#include <CSCChamberDataItr.h>
Public Member Functions | |
CSCChamberDataItr (const char *buf) | |
bool | next () |
const CSCEventData & | operator* () |
~CSCChamberDataItr () | |
Private Member Functions | |
void | constructFromDCC (const CSCDCCEventData &) |
for DCC data. | |
void | constructFromDDU (const CSCDDUEventData &) |
for DDU-only data | |
void | initDDU () |
sets theDDU & theNumberOfCSCs | |
Private Attributes | |
unsigned | theCurrentDDU |
const CSCDCCEventData * | theDCCData |
make a new vector of DDUs (length 1). | |
CSCDDUDataItr * | theDDUItr |
unsigned | theNumberOfDDUs |
Definition at line 15 of file CSCChamberDataItr.h.
CSCChamberDataItr::CSCChamberDataItr | ( | const char * | buf | ) |
construct from data buffer. Will figure out whether it's DCC or DDU
Definition at line 4 of file CSCChamberDataItr.cc.
References CSCDCCHeader::check(), CSCDCCEventData::dduData(), theCurrentDDU, theDCCData, theDDUItr, and theNumberOfDDUs.
: theDCCData(0), theCurrentDDU(0) { // first try if it's DCC data. const CSCDCCHeader * dccHeader = reinterpret_cast<const CSCDCCHeader *>(buf); if(dccHeader->check()) { theDCCData = new CSCDCCEventData((unsigned short *)buf); theNumberOfDDUs = theDCCData->dduData().size(); theDDUItr = new CSCDDUDataItr( &(theDCCData->dduData()[theCurrentDDU]) ); } else { // it's DDU data, with only one DDU theDDUItr = new CSCDDUDataItr(buf); theNumberOfDDUs = 1; } }
CSCChamberDataItr::~CSCChamberDataItr | ( | ) |
Definition at line 26 of file CSCChamberDataItr.cc.
References theDCCData.
{ // safe, even if it's zero delete theDCCData; }
void CSCChamberDataItr::constructFromDCC | ( | const CSCDCCEventData & | ) | [private] |
for DCC data.
void CSCChamberDataItr::constructFromDDU | ( | const CSCDDUEventData & | ) | [private] |
for DDU-only data
void CSCChamberDataItr::initDDU | ( | ) | [private] |
sets theDDU & theNumberOfCSCs
bool CSCChamberDataItr::next | ( | void | ) |
Definition at line 33 of file CSCChamberDataItr.cc.
References CSCDCCEventData::dduData(), CSCDDUDataItr::next(), query::result, theCurrentDDU, theDCCData, theDDUItr, and theNumberOfDDUs.
{ bool result = true; if(!theDDUItr->next()) { if(++theCurrentDDU >= theNumberOfDDUs) { result = false; } else { // the next DDU exists, so initialize an itr assert(theDCCData != 0); delete theDDUItr; theDDUItr = new CSCDDUDataItr( &(theDCCData->dduData()[theCurrentDDU]) ); } } return result; }
const CSCEventData & CSCChamberDataItr::operator* | ( | void | ) |
unsigned CSCChamberDataItr::theCurrentDDU [private] |
Definition at line 41 of file CSCChamberDataItr.h.
Referenced by CSCChamberDataItr(), and next().
const CSCDCCEventData* CSCChamberDataItr::theDCCData [private] |
make a new vector of DDUs (length 1).
a little confusing here. This class will either own theDCCData, in which case the DDUs points inside it,
Definition at line 39 of file CSCChamberDataItr.h.
Referenced by CSCChamberDataItr(), next(), and ~CSCChamberDataItr().
CSCDDUDataItr* CSCChamberDataItr::theDDUItr [private] |
Definition at line 40 of file CSCChamberDataItr.h.
Referenced by CSCChamberDataItr(), next(), and operator*().
unsigned CSCChamberDataItr::theNumberOfDDUs [private] |
Definition at line 42 of file CSCChamberDataItr.h.
Referenced by CSCChamberDataItr(), and next().