Main Page
Namespaces
Classes
Package Documentation
EventFilter
CSCRawToDigi
src
CSCDDUDataItr.cc
Go to the documentation of this file.
1
#include "
EventFilter/CSCRawToDigi/interface/CSCDDUDataItr.h
"
2
#include "
EventFilter/CSCRawToDigi/interface/CSCDDUEventData.h
"
3
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
4
5
6
// theCurrentCSC starts at -1, since user is expected to next() before he dereferences
7
// for the first time
8
CSCDDUDataItr::CSCDDUDataItr
() :
9
theDDUData(
nullptr
),
10
theCurrentCSC(-1),
11
theNumberOfCSCs(0),
12
theDataIsOwnedByMe(
true
)
13
{}
14
15
16
CSCDDUDataItr::CSCDDUDataItr
(
const
char
* buf) :
17
theDDUData
(
nullptr
),
18
theCurrentCSC
(-1),
19
theNumberOfCSCs
(0),
20
theDataIsOwnedByMe
(
true
)
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
((
const
uint16_t *)buf);
27
theNumberOfCSCs
=
theDDUData
->
cscData
().size();
28
}
else
{
29
LogTrace
(
"CSCDDUDataItr|CSCRawToDigi"
) <<
"Failed DDU header check."
;
30
}
31
}
32
33
34
CSCDDUDataItr::CSCDDUDataItr
(
const
CSCDDUEventData
* dduData) :
35
theDDUData
(dduData),
36
theCurrentCSC
(-1),
37
theNumberOfCSCs
(
theDDUData
->cscData().
size
()),
38
theDataIsOwnedByMe
(
false
)
39
{
40
}
41
42
43
CSCDDUDataItr::~CSCDDUDataItr
()
44
{
45
if
(
theDataIsOwnedByMe
)
delete
theDDUData
;
46
}
47
48
49
CSCDDUDataItr::CSCDDUDataItr
(
const
CSCDDUDataItr
&
i
) :
50
theCurrentCSC
(i.
theCurrentCSC
),
51
theNumberOfCSCs
(i.
theNumberOfCSCs
),
52
theDataIsOwnedByMe
(i.
theDataIsOwnedByMe
)
53
{
54
if
(
theDataIsOwnedByMe
)
55
{
56
if
(i.
theDDUData
!=
nullptr
)
57
{
58
theDDUData
=
new
CSCDDUEventData
(*(i.
theDDUData
));
59
}
60
}
61
else
62
{
63
theDDUData
= i.
theDDUData
;
64
}
65
}
66
67
68
void
CSCDDUDataItr::operator=
(
const
CSCDDUDataItr
&
i
)
69
{
70
if
(
theDataIsOwnedByMe
&&
theDDUData
!= i.
theDDUData
)
71
{
72
delete
theDDUData
;
73
if
(i.
theDDUData
!=
nullptr
)
74
{
75
theDDUData
=
new
CSCDDUEventData
(*(i.
theDDUData
));
76
}
77
}
78
else
79
{
80
theDDUData
= i.
theDDUData
;
81
}
82
83
theDDUData
= i.
theDDUData
;
84
theCurrentCSC
= i.
theCurrentCSC
;
85
theNumberOfCSCs
= i.
theNumberOfCSCs
;
86
theDataIsOwnedByMe
= i.
theDataIsOwnedByMe
;
87
}
88
89
90
bool
CSCDDUDataItr::next
()
91
{
92
return
(++
theCurrentCSC
<
theNumberOfCSCs
);
93
}
94
95
96
const
CSCEventData
&
CSCDDUDataItr::operator*
()
97
{
98
assert(
theCurrentCSC
>= 0 &&
theCurrentCSC
<
theNumberOfCSCs
);
99
return
theDDUData
->
cscData
()[
theCurrentCSC
];
100
}
101
102
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
MessageLogger.h
mps_fire.i
i
Definition:
mps_fire.py:330
CSCDDUHeader::check
bool check() const
Definition:
CSCDDUHeader.cc:54
CSCDDUDataItr::~CSCDDUDataItr
~CSCDDUDataItr()
Definition:
CSCDDUDataItr.cc:43
CSCDDUDataItr::operator=
void operator=(const CSCDDUDataItr &)
Definition:
CSCDDUDataItr.cc:68
funct::false
false
Definition:
Factorize.h:36
nullptr
#define nullptr
Definition:
GCC11Compatibility.h:37
CSCDDUDataItr
Definition:
CSCDDUDataItr.h:13
CSCDDUDataItr::theDDUData
const CSCDDUEventData * theDDUData
Definition:
CSCDDUDataItr.h:36
funct::true
true
Definition:
Factorize.h:185
CSCDDUDataItr::CSCDDUDataItr
CSCDDUDataItr()
default constructor
Definition:
CSCDDUDataItr.cc:8
CSCDDUDataItr.h
CSCDDUDataItr::theCurrentCSC
int theCurrentCSC
Definition:
CSCDDUDataItr.h:37
CSCDDUEventData::cscData
const std::vector< CSCEventData > & cscData() const
accessor to data
Definition:
CSCDDUEventData.h:34
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:671
CSCDDUDataItr::theDataIsOwnedByMe
bool theDataIsOwnedByMe
Definition:
CSCDDUDataItr.h:39
CSCDDUEventData.h
CSCDDUHeader
Definition:
CSCDDUHeader.h:11
CSCDDUDataItr::next
bool next()
Definition:
CSCDDUDataItr.cc:90
CSCDDUEventData
Definition:
CSCDDUEventData.h:19
CSCDDUDataItr::operator*
const CSCEventData & operator*()
Definition:
CSCDDUDataItr.cc:96
CSCEventData
Definition:
CSCEventData.h:28
CSCDDUDataItr::theNumberOfCSCs
int theNumberOfCSCs
Definition:
CSCDDUDataItr.h:38
Generated for CMSSW Reference Manual by
1.8.11