CMS 3D CMS Logo

Public Member Functions | Static Private Attributes

TableDataFormatter Class Reference

#include <TableDataFormatter.h>

List of all members.

Public Member Functions

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

Static Private Attributes

static const int nWordsPerEvent = 10

Detailed Description

Id:
TableDataFormatter.h,v 1.5 2007/04/12 08:36:47 franzoni Exp

Definition at line 16 of file TableDataFormatter.h.


Constructor & Destructor Documentation

TableDataFormatter::TableDataFormatter ( )

Definition at line 6 of file TableDataFormatter.cc.

                                        {
}
virtual TableDataFormatter::~TableDataFormatter ( ) [inline, virtual]

Definition at line 21 of file TableDataFormatter.h.

References LogDebug.

{LogDebug("EcalTBRawToDigi") << "@SUB=TableDataFormatter" << "\n"; };

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 EcalDCCTB07UnpackingModule::produce(), and EcalDCCTBUnpackingModule::produce().

{
  const unsigned long * buffer = ( reinterpret_cast<unsigned long*>(const_cast<unsigned char*> ( fedData.data())));
  int fedLenght                        = fedData.size(); // in Bytes
  
  // check ultimate fed size and strip off fed-header and -trailer
  if (fedLenght != (nWordsPerEvent *4) )
    {
      edm::LogError("TableDataFormatter") << "TableData has size "  <<  fedLenght
                                       <<" Bytes as opposed to expected " 
                                       << (nWordsPerEvent *4)
                                     << ". Returning.";
      return;
    }

  unsigned long a=1; // used to extract an 8 Bytes word from fed 
  unsigned long b=1; // used to manipulate the 8 Bytes word and get what needed

  int wordCounter =0;
  wordCounter +=4;

  a = buffer[wordCounter];wordCounter++;
  b = (a& 0xffffffff);
  tbEventHeader.setThetaTableIndex(b);
  LogDebug("TableDataFormatter") << "Table theta position:\t" << b;
  a = buffer[wordCounter];wordCounter++;
  b = (a& 0xffffffff);
  tbEventHeader.setPhiTableIndex(b);
  LogDebug("TableDataFormatter") << "Table phi position:\t" << b;
  a = buffer[wordCounter];wordCounter++;
  b = (a& 0xffff);
  tbEventHeader.setCrystalInBeam(EBDetId(1,b,EBDetId::SMCRYSTALMODE));
  LogDebug("TableDataFormatter") << "Actual Current crystal in beam:\t" << b;
  b = (a& 0xffff0000);
  b = b >> 16;
  tbEventHeader.setNominalCrystalInBeam(EBDetId(1,b,EBDetId::SMCRYSTALMODE));
  LogDebug("TableDataFormatter") << "Nominal Current crystal in beam:\t" << b;
  a = buffer[wordCounter];wordCounter++;
  b = (a& 0xffff);
  tbEventHeader.setNextCrystalInBeam(EBDetId(1,b,EBDetId::SMCRYSTALMODE));
  LogDebug("TableDataFormatter") << "Next crystal in beam:\t" << b;
  b = (a& 0x00010000); //Table is moving at the begin of the spill
  b = b >> 16;
  tbEventHeader.setTableIsMovingAtBegSpill(b & 0x1);
  LogDebug("TableDataFormatter") << "Table is moving at begin of the spill:\t" << b;
}

Member Data Documentation

const int TableDataFormatter::nWordsPerEvent = 10 [static, private]

Definition at line 27 of file TableDataFormatter.h.

Referenced by interpretRawData().