CMS 3D CMS Logo

CSCChamberDataItr Class Reference

#include <EventFilter/CSCRawToDigi/interface/CSCChamberDataItr.h>

List of all members.

Public Member Functions

 CSCChamberDataItr (const char *buf)
 construct from data buffer.
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
 a little confusing here.
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.

00004                                                      :
00005   theDCCData(0),
00006   theCurrentDDU(0)
00007 {
00008   // first try if it's DCC data.
00009   const CSCDCCHeader * dccHeader 
00010     = reinterpret_cast<const CSCDCCHeader *>(buf);
00011   if(dccHeader->check())
00012     {
00013       theDCCData = new CSCDCCEventData((unsigned short *)buf);
00014       theNumberOfDDUs = theDCCData->dduData().size();
00015       theDDUItr = new CSCDDUDataItr( &(theDCCData->dduData()[theCurrentDDU]) );
00016     }
00017   else 
00018     {
00019       // it's DDU data, with only one DDU
00020       theDDUItr = new CSCDDUDataItr(buf);
00021       theNumberOfDDUs = 1;
00022     }
00023 }
  

CSCChamberDataItr::~CSCChamberDataItr (  ) 

Definition at line 26 of file CSCChamberDataItr.cc.

References theDCCData.

00027 {
00028    // safe, even if it's zero
00029    delete theDCCData;
00030 }


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

Definition at line 33 of file CSCChamberDataItr.cc.

References CSCDCCEventData::dduData(), CSCDDUDataItr::next(), HLT_VtxMuL3::result, theCurrentDDU, theDCCData, theDDUItr, and theNumberOfDDUs.

00034 {
00035   bool result = true;
00036   if(!theDDUItr->next()) 
00037     {
00038       if(++theCurrentDDU >= theNumberOfDDUs)
00039         {
00040           result = false;
00041         }
00042       else
00043         {
00044           // the next DDU exists, so initialize an itr
00045           assert(theDCCData != 0);
00046           delete theDDUItr;
00047           theDDUItr = new CSCDDUDataItr( &(theDCCData->dduData()[theCurrentDDU]) );
00048         }
00049     }
00050   return result;
00051 }

const CSCEventData & CSCChamberDataItr::operator * ( void   ) 

Definition at line 54 of file CSCChamberDataItr.cc.

References theDDUItr.

00055 {
00056   return **theDDUItr;
00057 }


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]

a little confusing here.

This class will either own theDCCData, in which case the DDUs points inside it, make a new vector of DDUs (length 1).

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:08 2009 for CMSSW by  doxygen 1.5.4