CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Private Attributes
EcalSupervisorTBDataFormatter Class Reference

#include <EcalSupervisorDataFormatter.h>

Public Member Functions

 EcalSupervisorTBDataFormatter ()
 
void interpretRawData (const FEDRawData &data, EcalTBEventHeader &tbEventHeader)
 
virtual ~EcalSupervisorTBDataFormatter ()
 

Static Private Attributes

static const int nWordsPerEvent = 14
 

Detailed Description

Definition at line 15 of file EcalSupervisorDataFormatter.h.

Constructor & Destructor Documentation

EcalSupervisorTBDataFormatter::EcalSupervisorTBDataFormatter ( )

Definition at line 6 of file EcalSupervisorDataFormatter.cc.

6  {
7 }
virtual EcalSupervisorTBDataFormatter::~EcalSupervisorTBDataFormatter ( )
inlinevirtual

Definition at line 20 of file EcalSupervisorDataFormatter.h.

References LogDebug.

20 {LogDebug("EcalTBRawToDigi") << "@SUB=EcalSupervisorTBDataFormatter" << "\n"; };
#define LogDebug(id)

Member Function Documentation

void EcalSupervisorTBDataFormatter::interpretRawData ( const FEDRawData data,
EcalTBEventHeader tbEventHeader 
)

Definition at line 9 of file EcalSupervisorDataFormatter.cc.

References a, b, FEDRawData::data(), LogDebug, EcalTBEventHeader::magnetsMeasurement::magnet6IMeas_uampere, EcalTBEventHeader::magnetsMeasurement::magnet6IRead_ampere, EcalTBEventHeader::magnetsMeasurement::magnet6ISet_ampere, EcalTBEventHeader::magnetsMeasurement::magnet6VMeas_uvolt, EcalTBEventHeader::magnetsMeasurement::magnet7IMeas_uampere, EcalTBEventHeader::magnetsMeasurement::magnet7IRead_ampere, EcalTBEventHeader::magnetsMeasurement::magnet7ISet_ampere, EcalTBEventHeader::magnetsMeasurement::magnet7VMeas_uvolt, nWordsPerEvent, EcalTBEventHeader::setBegBurstLV1A(), EcalTBEventHeader::setBegBurstTimeMsec(), EcalTBEventHeader::setBegBurstTimeSec(), EcalTBEventHeader::setBurstNumber(), EcalTBEventHeader::setEndBurstLV1A(), EcalTBEventHeader::setEndBurstTimeMsec(), EcalTBEventHeader::setEndBurstTimeSec(), EcalTBEventHeader::setEventNumber(), EcalTBEventHeader::setMagnetMeasurements(), EcalTBEventHeader::setNumberOfMagnetMeasurements(), EcalTBEventHeader::setRunNumber(), EcalTBEventHeader::setSyncError(), FEDRawData::size(), and relval_steps::version.

Referenced by EcalDCCTBUnpackingModule::produce(), and EcalDCCTB07UnpackingModule::produce().

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)
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)
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
void setBegBurstTimeSec(const int &begBurstTimeSec)
void setEndBurstTimeMsec(const int &endBurstTimeMsec)
void setSyncError(const bool &syncError)

Member Data Documentation

const int EcalSupervisorTBDataFormatter::nWordsPerEvent = 14
staticprivate

Definition at line 27 of file EcalSupervisorDataFormatter.h.

Referenced by interpretRawData().