CMS 3D CMS Logo

EcalSupervisorDataFormatter.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
6 
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("EcalSupervisorTBDataFormatter")
14  << "EcalSupervisorTBData has size " << fedLenght << " Bytes as opposed to expected " << (nWordsPerEvent * 4)
15  << ". Returning.";
16  return;
17  }
18 
19  unsigned long a = 1; // used to extract an 8 Bytes word from fed
20  unsigned long b = 1; // used to manipulate the 8 Bytes word and get what needed
21 
22  int wordCounter = 0;
23  a = buffer[wordCounter];
24  wordCounter++;
25  b = (a & 0xfff00000);
26  b = b >> 20;
27  tbEventHeader.setBurstNumber(b);
28  LogDebug("EcalSupervisorTBDataFormatter") << "Burst number:\t" << b;
29  //Skipping the second word
30  wordCounter += 1;
31  a = buffer[wordCounter];
32  wordCounter++;
33  b = (a & 0x80000000);
34  b = b >> 31;
35  tbEventHeader.setSyncError(b & 0x1);
36  LogDebug("EcalSupervisorTBDataFormatter") << "Sync Error:\t" << b;
37  a = buffer[wordCounter];
38  wordCounter++;
39  b = (a & 0xffffff);
40  tbEventHeader.setRunNumber(b);
41  LogDebug("EcalSupervisorTBDataFormatter") << "Run Number:\t" << b;
42  a = buffer[wordCounter];
43  wordCounter++;
44  b = (a & 0xff);
45  int version = b;
46  LogDebug("EcalSupervisorTBDataFormatter") << "Version Number:\t" << b;
47 
48  int numberOfMagnetMeasurements = -1;
49  if (version >= 11) {
50  b = (a & 0xff00);
51  b = b >> 8;
52  numberOfMagnetMeasurements = b;
53  tbEventHeader.setNumberOfMagnetMeasurements(b);
54  LogDebug("EcalSupervisorTBDataFormatter") << "Number Of Magnet Measurements:\t" << b;
55  }
56 
57  a = buffer[wordCounter];
58  wordCounter++;
59  b = (a & 0xffffffff);
60  tbEventHeader.setEventNumber(b);
61  LogDebug("EcalSupervisorTBDataFormatter") << "Event Number:\t" << b;
62  a = buffer[wordCounter];
63  wordCounter++;
64  b = (a & 0xffffffff);
65  tbEventHeader.setBegBurstTimeSec(b);
66  LogDebug("EcalSupervisorTBDataFormatter") << "BegBurstTimeSec:\t" << b;
67  a = buffer[wordCounter];
68  wordCounter++;
69  b = (a & 0xffffffff);
70  tbEventHeader.setBegBurstTimeMsec(b);
71  LogDebug("EcalSupervisorTBDataFormatter") << "BegBurstTimeMsec:\t" << b;
72  a = buffer[wordCounter];
73  wordCounter++;
74  b = (a & 0xffffffff);
75  tbEventHeader.setEndBurstTimeSec(b);
76  LogDebug("EcalSupervisorTBDataFormatter") << "EndBurstTimeSec:\t" << b;
77  a = buffer[wordCounter];
78  wordCounter++;
79  b = (a & 0xffffffff);
80  tbEventHeader.setEndBurstTimeMsec(b);
81  LogDebug("EcalSupervisorTBDataFormatter") << "EndBurstTimeMsec:\t" << b;
82  a = buffer[wordCounter];
83  wordCounter++;
84  b = (a & 0xffffffff);
85  tbEventHeader.setBegBurstLV1A(b);
86  LogDebug("EcalSupervisorTBDataFormatter") << "BegBurstLV1A:\t" << b;
87  a = buffer[wordCounter];
88  wordCounter++;
89  b = (a & 0xffffffff);
90  tbEventHeader.setEndBurstLV1A(b);
91  LogDebug("EcalSupervisorTBDataFormatter") << "EndBurstLV1A:\t" << b;
92 
93  if (version >= 11) {
94  std::vector<EcalTBEventHeader::magnetsMeasurement_t> magnetMeasurements;
95  for (int iMagMeas = 0; iMagMeas < numberOfMagnetMeasurements; iMagMeas++) {
96  LogDebug("EcalSupervisorTBDataFormatter") << "++++++ New Magnet Measurement++++++\t" << (iMagMeas + 1);
98  wordCounter += 4;
99  a = buffer[wordCounter];
100  wordCounter++;
101  b = (a & 0xffffffff);
102  aMeasurement.magnet6IRead_ampere = b;
103  LogDebug("EcalSupervisorTBDataFormatter") << "NominalMagnet6ReadAmpere:\t" << b;
104  a = buffer[wordCounter];
105  wordCounter++;
106  b = (a & 0xffffffff);
107  aMeasurement.magnet6ISet_ampere = b;
108  LogDebug("EcalSupervisorTBDataFormatter") << "NominalMagnet6SetAmpere:\t" << b;
109  a = buffer[wordCounter];
110  wordCounter++;
111  b = (a & 0xffffffff);
112  aMeasurement.magnet7IRead_ampere = b;
113  LogDebug("EcalSupervisorTBDataFormatter") << "NominalMagnet7ReadAmpere:\t" << b;
114  a = buffer[wordCounter];
115  wordCounter++;
116  b = (a & 0xffffffff);
117  aMeasurement.magnet7ISet_ampere = b;
118  LogDebug("EcalSupervisorTBDataFormatter") << "NominalMagnet7SetAmpere:\t" << b;
119  a = buffer[wordCounter];
120  wordCounter++;
121  b = (a & 0xffffffff);
122  aMeasurement.magnet7VMeas_uvolt = b;
123  LogDebug("EcalSupervisorTBDataFormatter") << "MeasuredMagnet7MicroVolt:\t" << b;
124  a = buffer[wordCounter];
125  wordCounter++;
126  b = (a & 0xffffffff);
127  aMeasurement.magnet7IMeas_uampere = b;
128  LogDebug("EcalSupervisorTBDataFormatter") << "MeasuredMagnet7Ampere:\t" << b;
129  a = buffer[wordCounter];
130  wordCounter++;
131  b = (a & 0xffffffff);
132  aMeasurement.magnet6VMeas_uvolt = b;
133  LogDebug("EcalSupervisorTBDataFormatter") << "MeasuredMagnet6MicroVolt:\t" << b;
134  a = buffer[wordCounter];
135  wordCounter++;
136  b = (a & 0xffffffff);
137  aMeasurement.magnet6IMeas_uampere = b;
138  LogDebug("EcalSupervisorTBDataFormatter") << "MeasuredMagnet6Ampere:\t" << b;
139  magnetMeasurements.push_back(aMeasurement);
140  }
141  tbEventHeader.setMagnetMeasurements(magnetMeasurements);
142  }
143 }
EcalSupervisorDataFormatter.h
EcalTBEventHeader::magnetsMeasurement
Definition: EcalTBEventHeader.h:20
EcalSupervisorTBDataFormatter::EcalSupervisorTBDataFormatter
EcalSupervisorTBDataFormatter()
Definition: EcalSupervisorDataFormatter.cc:5
EcalSupervisorTBDataFormatter::nWordsPerEvent
static const int nWordsPerEvent
Definition: EcalSupervisorDataFormatter.h:26
EcalTBEventHeader::setBegBurstLV1A
void setBegBurstLV1A(const int &begBurstLV1A)
Definition: EcalTBEventHeader.h:175
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
EcalTBEventHeader::setEventNumber
void setEventNumber(const int &eventNumber)
Definition: EcalTBEventHeader.h:157
FEDRawData
Definition: FEDRawData.h:19
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
EcalTBEventHeader::magnetsMeasurement::magnet7VMeas_uvolt
int magnet7VMeas_uvolt
Definition: EcalTBEventHeader.h:27
EcalTBEventHeader::magnetsMeasurement::magnet6ISet_ampere
int magnet6ISet_ampere
Definition: EcalTBEventHeader.h:22
b
double b
Definition: hdecay.h:118
EcalTBEventHeader::setBegBurstTimeMsec
void setBegBurstTimeMsec(const int &begBurstTimeMsec)
Definition: EcalTBEventHeader.h:169
EcalTBEventHeader::magnetsMeasurement::magnet7IMeas_uampere
int magnet7IMeas_uampere
Definition: EcalTBEventHeader.h:28
EcalTBEventHeader::setMagnetMeasurements
void setMagnetMeasurements(const std::vector< magnetsMeasurement_t > &magnetMeasurements)
Definition: EcalTBEventHeader.h:206
EcalTBEventHeader::magnetsMeasurement::magnet6IRead_ampere
int magnet6IRead_ampere
Definition: EcalTBEventHeader.h:21
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
EcalTBEventHeader::magnetsMeasurement::magnet6VMeas_uvolt
int magnet6VMeas_uvolt
Definition: EcalTBEventHeader.h:30
EcalTBEventHeader::magnetsMeasurement::magnet6IMeas_uampere
int magnet6IMeas_uampere
Definition: EcalTBEventHeader.h:31
EcalTBEventHeader::setNumberOfMagnetMeasurements
void setNumberOfMagnetMeasurements(const int &numberOfMagnetMeasurements)
Definition: EcalTBEventHeader.h:203
EcalTBEventHeader::magnetsMeasurement::magnet7ISet_ampere
int magnet7ISet_ampere
Definition: EcalTBEventHeader.h:25
EcalTBEventHeader::magnetsMeasurement::magnet7IRead_ampere
int magnet7IRead_ampere
Definition: EcalTBEventHeader.h:24
EcalTBEventHeader::setEndBurstTimeSec
void setEndBurstTimeSec(const int &endBurstTimeSec)
Definition: EcalTBEventHeader.h:171
EcalTBEventHeader::setRunNumber
void setRunNumber(const int &runNumber)
Definition: EcalTBEventHeader.h:159
EcalSupervisorTBDataFormatter::interpretRawData
void interpretRawData(const FEDRawData &data, EcalTBEventHeader &tbEventHeader)
Definition: EcalSupervisorDataFormatter.cc:7
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
EcalTBEventHeader::setBurstNumber
void setBurstNumber(const short &burstNumber)
Definition: EcalTBEventHeader.h:163
EcalTBEventHeader::setEndBurstLV1A
void setEndBurstLV1A(const int &endBurstLV1A)
Definition: EcalTBEventHeader.h:177
EcalTBEventHeader::setSyncError
void setSyncError(const bool &syncError)
Definition: EcalTBEventHeader.h:195
EcalTBEventHeader::setBegBurstTimeSec
void setBegBurstTimeSec(const int &begBurstTimeSec)
Definition: EcalTBEventHeader.h:167
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
EcalTBEventHeader::setEndBurstTimeMsec
void setEndBurstTimeMsec(const int &endBurstTimeMsec)
Definition: EcalTBEventHeader.h:173