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
// theCurrentCSC starts at -1, since user is expected to next() before he dereferences
6
// for the first time
7
CSCDDUDataItr::CSCDDUDataItr
() : theDDUData(nullptr), theCurrentCSC(-1), theNumberOfCSCs(0), theDataIsOwnedByMe(
true
) {}
8
9
CSCDDUDataItr::CSCDDUDataItr
(
const
char
*
buf
)
10
: theDDUData(nullptr), theCurrentCSC(-1), theNumberOfCSCs(0), theDataIsOwnedByMe(
true
) {
11
// check if it's OK first
12
const
CSCDDUHeader
*dduHeader = reinterpret_cast<const CSCDDUHeader *>(
buf
);
13
if
(dduHeader->
check
()) {
14
theDDUData
=
new
CSCDDUEventData
((
const
uint16_t *)
buf
);
15
theNumberOfCSCs
=
theDDUData
->
cscData
().size();
16
}
else
{
17
LogTrace
(
"CSCDDUDataItr|CSCRawToDigi"
) <<
"Failed DDU header check."
;
18
}
19
}
20
21
CSCDDUDataItr::CSCDDUDataItr
(
const
CSCDDUEventData
*dduData)
22
: theDDUData(dduData),
23
theCurrentCSC(-1),
24
theNumberOfCSCs(theDDUData->cscData().
size
()),
25
theDataIsOwnedByMe(
false
) {}
26
27
CSCDDUDataItr::~CSCDDUDataItr
() {
28
if
(
theDataIsOwnedByMe
)
29
delete
theDDUData
;
30
}
31
32
CSCDDUDataItr::CSCDDUDataItr
(
const
CSCDDUDataItr
&
i
)
33
: theCurrentCSC(
i
.theCurrentCSC), theNumberOfCSCs(
i
.theNumberOfCSCs), theDataIsOwnedByMe(
i
.theDataIsOwnedByMe) {
34
if
(
theDataIsOwnedByMe
) {
35
if
(
i
.theDDUData !=
nullptr
) {
36
theDDUData
=
new
CSCDDUEventData
(*(
i
.theDDUData));
37
}
38
}
else
{
39
theDDUData
=
i
.theDDUData;
40
}
41
}
42
43
void
CSCDDUDataItr::operator=
(
const
CSCDDUDataItr
&
i
) {
44
if
(
theDataIsOwnedByMe
&&
theDDUData
!=
i
.theDDUData) {
45
delete
theDDUData
;
46
if
(
i
.theDDUData !=
nullptr
) {
47
theDDUData
=
new
CSCDDUEventData
(*(
i
.theDDUData));
48
}
49
}
else
{
50
theDDUData
=
i
.theDDUData;
51
}
52
53
theDDUData
=
i
.theDDUData;
54
theCurrentCSC
=
i
.theCurrentCSC;
55
theNumberOfCSCs
=
i
.theNumberOfCSCs;
56
theDataIsOwnedByMe
=
i
.theDataIsOwnedByMe;
57
}
58
59
bool
CSCDDUDataItr::next
() {
return
(++
theCurrentCSC
<
theNumberOfCSCs
); }
60
61
const
CSCEventData
&
CSCDDUDataItr::operator*
() {
62
assert
(
theCurrentCSC
>= 0 &&
theCurrentCSC
<
theNumberOfCSCs
);
63
return
theDDUData
->
cscData
()[
theCurrentCSC
];
64
}
mps_fire.i
i
Definition:
mps_fire.py:428
CSCEventData
Definition:
CSCEventData.h:26
MessageLogger.h
funct::false
false
Definition:
Factorize.h:29
CSCDDUEventData::cscData
const std::vector< CSCEventData > & cscData() const
accessor to data
Definition:
CSCDDUEventData.h:33
CSCDDUHeader::check
bool check() const
Definition:
CSCDDUHeader.cc:43
CSCDDUDataItr::theDDUData
const CSCDDUEventData * theDDUData
Definition:
CSCDDUDataItr.h:35
CSCDDUHeader
Definition:
CSCDDUHeader.h:11
cms::cuda::assert
assert(be >=bs)
CSCDDUEventData.h
CSCDDUDataItr::next
bool next()
Definition:
CSCDDUDataItr.cc:59
CSCDDUDataItr::theCurrentCSC
int theCurrentCSC
Definition:
CSCDDUDataItr.h:36
CSCDDUDataItr
Definition:
CSCDDUDataItr.h:13
CSCDDUDataItr::theDataIsOwnedByMe
bool theDataIsOwnedByMe
Definition:
CSCDDUDataItr.h:38
funct::true
true
Definition:
Factorize.h:173
CSCDDUDataItr::operator*
const CSCEventData & operator*()
Definition:
CSCDDUDataItr.cc:61
CSCDDUDataItr::CSCDDUDataItr
CSCDDUDataItr()
default constructor
Definition:
CSCDDUDataItr.cc:7
visDQMUpload.buf
buf
Definition:
visDQMUpload.py:160
CSCDDUEventData
Definition:
CSCDDUEventData.h:19
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:234
CSCDDUDataItr.h
CSCDDUDataItr::theNumberOfCSCs
int theNumberOfCSCs
Definition:
CSCDDUDataItr.h:37
CSCDDUDataItr::operator=
void operator=(const CSCDDUDataItr &)
Definition:
CSCDDUDataItr.cc:43
CSCDDUDataItr::~CSCDDUDataItr
~CSCDDUDataItr()
Definition:
CSCDDUDataItr.cc:27
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16