
Chapter 2. Setting up the software
// Reads data into the Packet
rBuf= m_MyPacket.End(rBuf); // (12)
// Closes the open Packet
}
return rBuf; // (13)
}
Ê The lines beginning with the include of config.h aneending with the #endif near here are
boilerplate that is required for all implementation (.cpp) files for Readout skeletons at version 8.0
and later.
Ë In order to get access to the class definition, we must include the header that we wrote that defines
the class
Ì Recall that we will be putting our event segment into a packet. The packet will be managed by a
documented packet (CDocumentedPacket) object. This packet can document the revision level, or
version of the structure of its body. The string pPacketVersion will document the revision level of
the packet body for our packet.
Í This code in the constructor is called an initializer. Initializers are basically constructor calls that
are used to construct base classes and data members of an object under construction. The Id
constructor parameter is used as the id of the m_MyPacket CDocumentedPacket. The three strings
that follow are, respectively, a packet name, a packet description and the packet body revision level.
These items are put in the documentation entry for the packet that is created by the packet at the
beginning of the run.
Î The constructor body creates a new CAENcard object, assigning a pointer to it to the member
variable module. The constructor’s slot is used as the geographical address of the module.
Ï The destructor body destroys the CAENcard object created by the constructor. If this is not done
here, then everytime we destroy an MyEventSegment class, we will "lead" some memory.
Ð This code initializes the CAEN V785 module by resetting it to the default data taking settings, and
then invoking our Clear member function to clear any data that may be latched.
Ñ This code clears any data that is latched in the module
Ò The CAEN V785 requires about 6textmus to convert once it is given a gate. It is possible for the
software to start executing the Read member function before conversion is complete. This loop
repeatedly invokes dataPresent for the module. This function returns true when the module has
buffered conversions. At that time, control breaks out of the loop.
(10) This call to the Begin member of our documented packet indicates that we are starting to read data
into the body of the packet. The code reserves space for the word count, and writes the packet id.
The return value is a "pointer" to the body of the packet.
(11) Data are read from the ADC into the packet.
(12) The size of the packet is written to the space reserved for it. The packet is closed, and a "pointer" is
returned to the next free word in the buffer.
11
Kommentare zu diesen Handbüchern