CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TableDataFormatter.cc
Go to the documentation of this file.
1 #include "TableDataFormatter.h"
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("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;
42  LogDebug("TableDataFormatter") << "Nominal Current crystal in beam:\t" << b;
43  a = buffer[wordCounter];
44  wordCounter++;
45  b = (a & 0xffff);
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 & 0x1);
51  LogDebug("TableDataFormatter") << "Table is moving at begin of the spill:\t" << b;
52 }
void setNextCrystalInBeam(const DetId &crystalInBeam)
void setNominalCrystalInBeam(const DetId &crystalInBeam)
Log< level::Error, false > LogError
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
void setPhiTableIndex(const unsigned int &phiTableIndex)
void interpretRawData(const FEDRawData &data, EcalTBEventHeader &tbEventHeader)
void setCrystalInBeam(const DetId &crystalInBeam)
static const int nWordsPerEvent
double b
Definition: hdecay.h:118
void setTableIsMovingAtBegSpill(const bool &tableIsMoving)
void setThetaTableIndex(const unsigned int &thetaTableIndex)
double a
Definition: hdecay.h:119
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
#define LogDebug(id)