CMS 3D CMS Logo

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