Chapter 2. Setting up the software
nWords -= nPacketWords;
}
return kfTRUE; // (15)
}
void
MyEventProcessor::unpackPacket(TranslatorPointer<UShort_t> pEvent)
{
pEvent += 2; // (16)
ULong_t header = getLong(pEvent);
if ((header & CAEN_DATUM_TYPE) != CAEN_HEADER) { // (17)
throw string("Did not find V785 header when expected");
}
if (((header & CAEN_GEOMASK) >> CAEN_GEOSHIFT) != m_nSlot) {
throw string("Mismatch on slot");
}
Long_t nChannelCount = (header & CAEN_COUNTMASK) >> CAEN_COUNTSHIFT;
pEvent += 2; // (18)
for (ULong_t i =0; i < nChannelCount; i++) { // (19)
ULong_t channelData = getLong(pEvent);
int channel = (channelData & CAEN_CHANNELMASK) >> CAEN_CHANNELSHIFT;
int data = (channelData & CAEN_DATAMASK);
m_rawData[channel] = data;
pEvent += 2;
}
Long_t trailer = getLong(pEvent);
trailer &= CAEN_DATUM_TYPE;
if ((trailer != CAEN_TRAILER) ) { // (20)
throw string("Did not find V785 trailer when expected");
}
}
The numbers in the annotations below refer to the numbered elements of the listing above.
Ê Since this compilation unit implements the MyEventProcessor class, it is necessary for the file to
have access to the header for that class.
Ë The header for MyEventProcessor declared several classes to be forward defined. Since these
classes will be manipulated in the implementation module, the headers for these classes must now
be #include-ed.
22
Comentários a estes Manuais