CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CSCChamberDataItr Class Reference

#include <CSCChamberDataItr.h>

List of all members.

Public Member Functions

 CSCChamberDataItr (const char *buf)
bool next ()
const CSCEventDataoperator* ()
 ~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 CSCDCCEventDatatheDCCData
 make a new vector of DDUs (length 1).
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.

                                                     :
  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;
}

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

Definition at line 54 of file CSCChamberDataItr.cc.

References theDDUItr.

{
  return **theDDUItr;
}

Member Data Documentation

Definition at line 41 of file CSCChamberDataItr.h.

Referenced by CSCChamberDataItr(), and next().

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

Definition at line 40 of file CSCChamberDataItr.h.

Referenced by CSCChamberDataItr(), next(), and operator*().

Definition at line 42 of file CSCChamberDataItr.h.

Referenced by CSCChamberDataItr(), and next().