CMS 3D CMS Logo

List of all members | Public Member Functions | Static Private Attributes
TableDataFormatter Class Reference

#include <TableDataFormatter.h>

Public Member Functions

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

Static Private Attributes

static const int nWordsPerEvent = 10
 

Detailed Description

Definition at line 13 of file TableDataFormatter.h.

Constructor & Destructor Documentation

TableDataFormatter::TableDataFormatter ( )

Definition at line 5 of file TableDataFormatter.cc.

5 {}
virtual TableDataFormatter::~TableDataFormatter ( )
inlinevirtual

Definition at line 16 of file TableDataFormatter.h.

References data, interpretRawData(), and LogDebug.

16  {
17  LogDebug("EcalTBRawToDigi") << "@SUB=TableDataFormatter"
18  << "\n";
19  };
#define LogDebug(id)

Member Function Documentation

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

Definition at line 7 of file TableDataFormatter.cc.

References a, b, edmScanValgrind::buffer, FEDRawData::data(), LogDebug, nWordsPerEvent, EcalTBEventHeader::setCrystalInBeam(), EcalTBEventHeader::setNextCrystalInBeam(), EcalTBEventHeader::setNominalCrystalInBeam(), EcalTBEventHeader::setPhiTableIndex(), EcalTBEventHeader::setTableIsMovingAtBegSpill(), EcalTBEventHeader::setThetaTableIndex(), FEDRawData::size(), EBDetId::SMCRYSTALMODE, and testProducerWithPsetDescEmpty_cfi::x1.

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

7  {
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 }
#define LogDebug(id)
void setNextCrystalInBeam(const DetId &crystalInBeam)
void setNominalCrystalInBeam(const DetId &crystalInBeam)
void setPhiTableIndex(const unsigned int &phiTableIndex)
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
static const int SMCRYSTALMODE
Definition: EBDetId.h:159

Member Data Documentation

const int TableDataFormatter::nWordsPerEvent = 10
staticprivate

Definition at line 25 of file TableDataFormatter.h.

Referenced by interpretRawData().