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
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 15 of file TableDataFormatter.h.

Constructor & Destructor Documentation

TableDataFormatter::TableDataFormatter ( )

Definition at line 6 of file TableDataFormatter.cc.

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

Definition at line 20 of file TableDataFormatter.h.

References LogDebug.

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

Member Function Documentation

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

Definition at line 9 of file TableDataFormatter.cc.

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

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("TableDataFormatter") << "TableData 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  wordCounter +=4;
30 
31  a = buffer[wordCounter];wordCounter++;
32  b = (a& 0xffffffff);
33  tbEventHeader.setThetaTableIndex(b);
34  LogDebug("TableDataFormatter") << "Table theta position:\t" << b;
35  a = buffer[wordCounter];wordCounter++;
36  b = (a& 0xffffffff);
37  tbEventHeader.setPhiTableIndex(b);
38  LogDebug("TableDataFormatter") << "Table phi position:\t" << b;
39  a = buffer[wordCounter];wordCounter++;
40  b = (a& 0xffff);
42  LogDebug("TableDataFormatter") << "Actual Current crystal in beam:\t" << b;
43  b = (a& 0xffff0000);
44  b = b >> 16;
46  LogDebug("TableDataFormatter") << "Nominal Current crystal in beam:\t" << b;
47  a = buffer[wordCounter];wordCounter++;
48  b = (a& 0xffff);
50  LogDebug("TableDataFormatter") << "Next crystal in beam:\t" << b;
51  b = (a& 0x00010000); //Table is moving at the begin of the spill
52  b = b >> 16;
53  tbEventHeader.setTableIsMovingAtBegSpill(b & 0x1);
54  LogDebug("TableDataFormatter") << "Table is moving at begin of the spill:\t" << b;
55 }
#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:120
void setTableIsMovingAtBegSpill(const bool &tableIsMoving)
void setThetaTableIndex(const unsigned int &thetaTableIndex)
double a
Definition: hdecay.h:121
static const int SMCRYSTALMODE
Definition: EBDetId.h:167

Member Data Documentation

const int TableDataFormatter::nWordsPerEvent =10
staticprivate

Definition at line 26 of file TableDataFormatter.h.

Referenced by interpretRawData().