CMS 3D CMS Logo

CSCDDUDataItr.cc
Go to the documentation of this file.
4 
5 
6 // theCurrentCSC starts at -1, since user is expected to next() before he dereferences
7 // for the first time
9  theDDUData(nullptr),
10  theCurrentCSC(-1),
11  theNumberOfCSCs(0),
12  theDataIsOwnedByMe(true)
13 {}
14 
15 
16 CSCDDUDataItr::CSCDDUDataItr(const char * buf) :
18  theCurrentCSC(-1),
19  theNumberOfCSCs(0),
21 {
22  // check if it's OK first
23  const CSCDDUHeader * dduHeader
24  = reinterpret_cast<const CSCDDUHeader *>(buf);
25  if(dduHeader->check()){
26  theDDUData = new CSCDDUEventData((unsigned short *)buf);
28  } else {
29  LogTrace ("CSCDDUDataItr|CSCRawToDigi") << "Failed DDU header check.";
30  }
31 }
32 
33 
35  theDDUData(dduData),
36  theCurrentCSC(-1),
37  theNumberOfCSCs(theDDUData->cscData().size()),
39 {
40 }
41 
42 
44 {
45  if(theDataIsOwnedByMe) delete theDDUData;
46 }
47 
48 
53 {
55  {
56  if(i.theDDUData != nullptr)
57  {
59  }
60  }
61  else
62  {
64  }
65 }
66 
67 
69 {
71  {
72  delete theDDUData;
73  if(i.theDDUData != nullptr)
74  {
76  }
77  }
78  else
79  {
81  }
82 
87 }
88 
89 
91 {
92  return (++theCurrentCSC < theNumberOfCSCs);
93 }
94 
95 
97 {
99  return theDDUData->cscData()[theCurrentCSC];
100 }
101 
102 
size
Write out results.
bool check() const
Definition: CSCDDUHeader.cc:54
void operator=(const CSCDDUDataItr &)
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
#define nullptr
CSCDDUDataItr()
default constructor
Definition: CSCDDUDataItr.cc:8
const std::vector< CSCEventData > & cscData() const
accessor to data
#define LogTrace(id)
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39
const CSCEventData & operator*()