test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TableDataFormatter.cc
Go to the documentation of this file.
1 #include "TableDataFormatter.h"
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("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)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
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:120
void setTableIsMovingAtBegSpill(const bool &tableIsMoving)
void setThetaTableIndex(const unsigned int &thetaTableIndex)
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
static const int SMCRYSTALMODE
Definition: EBDetId.h:167