CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCChamberDataItr Class Reference

#include <CSCChamberDataItr.h>

Public Member Functions

 CSCChamberDataItr (const char *buf)
 
bool next ()
 
const CSCEventDataoperator* ()
 
 ~CSCChamberDataItr ()
 

Private Member Functions

void constructFromDCC (const CSCDCCEventData &)
 for DCC data. More...
 
void constructFromDDU (const CSCDDUEventData &)
 for DDU-only data More...
 
void initDDU ()
 sets theDDU & theNumberOfCSCs More...
 

Private Attributes

unsigned theCurrentDDU
 
const CSCDCCEventDatatheDCCData
 make a new vector of DDUs (length 1). More...
 
CSCDDUDataItrtheDDUItr
 
unsigned theNumberOfDDUs
 

Detailed Description

Definition at line 15 of file CSCChamberDataItr.h.

Constructor & Destructor Documentation

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.

4  :
5  theDCCData(nullptr),
7 {
8  // first try if it's DCC data.
9  const CSCDCCHeader * dccHeader
10  = reinterpret_cast<const CSCDCCHeader *>(buf);
11  if(dccHeader->check())
12  {
13  theDCCData = new CSCDCCEventData((const uint16_t *)buf);
16  }
17  else
18  {
19  // it's DDU data, with only one DDU
20  theDDUItr = new CSCDDUDataItr(buf);
21  theNumberOfDDUs = 1;
22  }
23 }
01/20/05 A.Tumanov
const CSCDCCEventData * theDCCData
make a new vector of DDUs (length 1).
const std::vector< CSCDDUEventData > & dduData() const
accessor to dduData
CSCDDUDataItr * theDDUItr
bool check() const
Definition: CSCDCCHeader.h:24
CSCChamberDataItr::~CSCChamberDataItr ( )

Definition at line 26 of file CSCChamberDataItr.cc.

References theDCCData.

27 {
28  // safe, even if it's zero
29  delete theDCCData;
30 }
const CSCDCCEventData * theDCCData
make a new vector of DDUs (length 1).

Member Function Documentation

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(), mps_fire::result, theCurrentDDU, theDCCData, theDDUItr, and theNumberOfDDUs.

34 {
35  bool result = true;
36  if(!theDDUItr->next())
37  {
39  {
40  result = false;
41  }
42  else
43  {
44  // the next DDU exists, so initialize an itr
45  assert(theDCCData != nullptr);
46  delete theDDUItr;
48  }
49  }
50  return result;
51 }
const CSCDCCEventData * theDCCData
make a new vector of DDUs (length 1).
const std::vector< CSCDDUEventData > & dduData() const
accessor to dduData
CSCDDUDataItr * theDDUItr
const CSCEventData & CSCChamberDataItr::operator* ( void  )

Definition at line 54 of file CSCChamberDataItr.cc.

References theDDUItr.

55 {
56  return **theDDUItr;
57 }
CSCDDUDataItr * theDDUItr

Member Data Documentation

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().