EventFilter
EcalTBRawToDigi
src
TableDataFormatter.cc
Go to the documentation of this file.
1
#include "
TableDataFormatter.h
"
2
3
#include <iostream>
4
5
TableDataFormatter::TableDataFormatter
() {}
6
7
void
TableDataFormatter::interpretRawData
(
const
FEDRawData
& fedData,
EcalTBEventHeader
& tbEventHeader) {
8
const
unsigned
long
*
buffer
= reinterpret_cast<const unsigned long*>(fedData.
data
());
9
int
fedLenght = fedData.
size
();
// in Bytes
10
11
// check ultimate fed size and strip off fed-header and -trailer
12
if
(fedLenght != (
nWordsPerEvent
* 4)) {
13
edm::LogError
(
"TableDataFormatter"
) <<
"TableData has size "
<< fedLenght <<
" Bytes as opposed to expected "
14
<< (
nWordsPerEvent
* 4) <<
". Returning."
;
15
return
;
16
}
17
18
unsigned
long
a
= 1;
// used to extract an 8 Bytes word from fed
19
unsigned
long
b
= 1;
// used to manipulate the 8 Bytes word and get what needed
20
21
int
wordCounter = 0;
22
wordCounter += 4;
23
24
a
=
buffer
[wordCounter];
25
wordCounter++;
26
b
= (
a
& 0xffffffff);
27
tbEventHeader.
setThetaTableIndex
(
b
);
28
LogDebug
(
"TableDataFormatter"
) <<
"Table theta position:\t"
<<
b
;
29
a
=
buffer
[wordCounter];
30
wordCounter++;
31
b
= (
a
& 0xffffffff);
32
tbEventHeader.
setPhiTableIndex
(
b
);
33
LogDebug
(
"TableDataFormatter"
) <<
"Table phi position:\t"
<<
b
;
34
a
=
buffer
[wordCounter];
35
wordCounter++;
36
b
= (
a
& 0xffff);
37
tbEventHeader.
setCrystalInBeam
(
EBDetId
(1,
b
,
EBDetId::SMCRYSTALMODE
));
38
LogDebug
(
"TableDataFormatter"
) <<
"Actual Current crystal in beam:\t"
<<
b
;
39
b
= (
a
& 0xffff0000);
40
b
=
b
>> 16;
41
tbEventHeader.
setNominalCrystalInBeam
(
EBDetId
(1,
b
,
EBDetId::SMCRYSTALMODE
));
42
LogDebug
(
"TableDataFormatter"
) <<
"Nominal Current crystal in beam:\t"
<<
b
;
43
a
=
buffer
[wordCounter];
44
wordCounter++;
45
b
= (
a
& 0xffff);
46
tbEventHeader.
setNextCrystalInBeam
(
EBDetId
(1,
b
,
EBDetId::SMCRYSTALMODE
));
47
LogDebug
(
"TableDataFormatter"
) <<
"Next crystal in beam:\t"
<<
b
;
48
b
= (
a
& 0x00010000);
//Table is moving at the begin of the spill
49
b
=
b
>> 16;
50
tbEventHeader.
setTableIsMovingAtBegSpill
(
b
& 0
x1
);
51
LogDebug
(
"TableDataFormatter"
) <<
"Table is moving at begin of the spill:\t"
<<
b
;
52
}
TableDataFormatter.h
EcalTBEventHeader::setNominalCrystalInBeam
void setNominalCrystalInBeam(const DetId &crystalInBeam)
Definition:
EcalTBEventHeader.h:183
TableDataFormatter::nWordsPerEvent
static const int nWordsPerEvent
Definition:
TableDataFormatter.h:25
EcalTBEventHeader::setNextCrystalInBeam
void setNextCrystalInBeam(const DetId &crystalInBeam)
Definition:
EcalTBEventHeader.h:185
EBDetId
Definition:
EBDetId.h:17
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition:
FEDRawData.cc:24
EcalTBEventHeader
Definition:
EcalTBEventHeader.h:14
FEDRawData
Definition:
FEDRawData.h:19
edmScanValgrind.buffer
buffer
Definition:
edmScanValgrind.py:171
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition:
testProducerWithPsetDescEmpty_cfi.py:33
TableDataFormatter::interpretRawData
void interpretRawData(const FEDRawData &data, EcalTBEventHeader &tbEventHeader)
Definition:
TableDataFormatter.cc:7
b
double b
Definition:
hdecay.h:118
EcalTBEventHeader::setPhiTableIndex
void setPhiTableIndex(const unsigned int &phiTableIndex)
Definition:
EcalTBEventHeader.h:189
LogDebug
#define LogDebug(id)
Definition:
MessageLogger.h:670
edm::LogError
Definition:
MessageLogger.h:183
a
double a
Definition:
hdecay.h:119
EcalTBEventHeader::setTableIsMovingAtBegSpill
void setTableIsMovingAtBegSpill(const bool &tableIsMoving)
Definition:
EcalTBEventHeader.h:193
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition:
FEDRawData.h:45
EcalTBEventHeader::setCrystalInBeam
void setCrystalInBeam(const DetId &crystalInBeam)
Definition:
EcalTBEventHeader.h:181
EcalTBEventHeader::setThetaTableIndex
void setThetaTableIndex(const unsigned int &thetaTableIndex)
Definition:
EcalTBEventHeader.h:187
EBDetId::SMCRYSTALMODE
static const int SMCRYSTALMODE
Definition:
EBDetId.h:159
TableDataFormatter::TableDataFormatter
TableDataFormatter()
Definition:
TableDataFormatter.cc:5
Generated for CMSSW Reference Manual by
1.8.16