CMS 3D CMS Logo

BlockFormatter Class Reference

#include <EventFilter/EcalDigiToRaw/interface/BlockFormatter.h>

Inheritance diagram for BlockFormatter:

SRBlockFormatter TCCBlockFormatter TowerBlockFormatter

List of all members.

Public Types

typedef uint16_t Word16
typedef uint64_t Word64

Public Member Functions

 BlockFormatter ()
void CleanUp (FEDRawDataCollection *productRawData, std::map< int, std::map< int, int > > *FEDorder)
void DigiToRaw (FEDRawDataCollection *productRawData)
void print (FEDRawData &rawdata)
void PrintSizes (FEDRawDataCollection *productRawData)
void SetParam (EcalDigiToRaw *base)
 ~BlockFormatter ()

Static Public Attributes

static const int kCardsPerTower = 5

Protected Attributes

bool debug_
bool doBarrel_
bool doEndCap_
bool doSR_
bool doTCC_
bool doTower_
std::pair< int, intEcalFEDIds
intpbx_
intpcounter_
std::vector< int32_t > * plistDCCId_
intplv1_
intporbit_number_
intprunnumber_


Detailed Description

Definition at line 18 of file BlockFormatter.h.


Member Typedef Documentation

typedef uint16_t BlockFormatter::Word16

Definition at line 21 of file BlockFormatter.h.

typedef uint64_t BlockFormatter::Word64

Definition at line 20 of file BlockFormatter.h.


Constructor & Destructor Documentation

BlockFormatter::BlockFormatter (  ) 

Definition at line 14 of file BlockFormatter.cc.

References EcalFEDIds, and FEDNumbering::getEcalFEDIds().

00014                                {
00015 
00016   EcalFEDIds=FEDNumbering::getEcalFEDIds();
00017 }

BlockFormatter::~BlockFormatter (  ) 

Definition at line 19 of file BlockFormatter.cc.

00019                                 {
00020 }


Member Function Documentation

void BlockFormatter::CleanUp ( FEDRawDataCollection productRawData,
std::map< int, std::map< int, int > > *  FEDorder 
)

void BlockFormatter::DigiToRaw ( FEDRawDataCollection productRawData  ) 

Definition at line 41 of file BlockFormatter.cc.

References GenMuonPlsPt100GeV_cfg::cout, FEDRawData::data(), debug_, doBarrel_, doEndCap_, EcalFEDIds, lat::endl(), L1Comparator_cfi::FEDid, i, j, lv1, EcalElectronicsId::MAX_DCCID_EBP, EcalElectronicsId::MIN_DCCID_EBM, EcalElectronicsId::MIN_DCCID_EEP, pbx_, plv1_, porbit_number_, prunnumber_, FEDRawData::resize(), and FEDRawData::size().

00041                                                                    {
00042 
00043  int run_number = *prunnumber_;
00044  int orbit_number_ = *porbit_number_;
00045  int bx = *pbx_;
00046  int lv1 = *plv1_;
00047 
00048  if (debug_) cout << "in BlockFormatter::DigiToRaw  run_number orbit_number bx lv1 " << dec << run_number << " " <<
00049          orbit_number_ << " " << bx << " " << lv1 << endl;
00050 
00051  for (int idcc=1; idcc <= 54; idcc++) {
00052         if ( (! doBarrel_) && 
00053              (idcc >= EcalElectronicsId::MIN_DCCID_EBM && idcc <= EcalElectronicsId::MAX_DCCID_EBP)) continue;
00054         if ( (! doEndCap_) && 
00055              (idcc <= EcalElectronicsId::MAX_DCCID_EEM || idcc >= EcalElectronicsId::MIN_DCCID_EEP)) continue;
00056  
00057         int FEDid = EcalFEDIds.first + idcc;
00058         FEDRawData& rawdata = productRawData -> FEDData(FEDid);
00059         unsigned char * pData;
00060         short int DCC_ERRORS = 0;
00061 
00062         if (rawdata.size() == 0) {
00063                 rawdata.resize(8);
00064                 pData = rawdata.data();
00065 
00066                 Word64 word = 0x18 + ((FEDid & 0xFFF)<<8)
00067                             + ((Word64)((Word64)bx & 0xFFF)<<20)
00068                             + ((Word64)((Word64)lv1 & 0xFFFFFF)<<32)
00069                             + (Word64)((Word64)0x51<<56);
00070                 Word64* pw = reinterpret_cast<Word64*>(const_cast<unsigned char*>(pData));
00071                 *pw = word;    // DAQ header
00072 
00073                 rawdata.resize(rawdata.size() + 8*8);   // DCC header
00074                 pData = rawdata.data();
00075                 pData[11] = DCC_ERRORS & 0xFF;
00076                 pData[12] = run_number & 0xFF;
00077                 pData[13] = (run_number >>8) & 0xFF;
00078                 pData[14] = (run_number >> 16) & 0xFF;
00079                 pData[15] = 0x01;
00080 
00081                 for (int i=16; i <= 22; i++) {
00082                  pData[i] = 0;    // to be filled for local data taking or calibration
00083                 }
00084                 pData[23] = 0x02;
00085                 pData[24] = orbit_number_ & 0xFF;
00086                 pData[25] = (orbit_number_ >>8) & 0xFF;
00087                 pData[26] = (orbit_number_ >>16) & 0xFF;
00088                 pData[27] = (orbit_number_ >>24) & 0xFF;
00089                 int SRenable_ = 1;
00090                 int SR = SRenable_;
00091                 int ZS = 0;
00092                 int TZS = 0;
00093                 // int SR_CHSTATUS = 0;
00094                 pData[28] = (SR&0x1) + ((ZS&0x1)<<1) + ((TZS&0x1)<<2);
00095                 pData[31] = 0x03;
00096 
00097                 for (int i=0; i<=4; i++) {
00098                   for (int j=0; j<7; j++) {
00099                    pData[32 +8*i + j] = 0;
00100                   }
00101                   pData[32 +8*i + 7] = 0x04;
00102                 }
00103 
00104         } // endif rawdatasize == 0
00105  } // loop on id
00106 
00107 }

void BlockFormatter::print ( FEDRawData rawdata  ) 

Definition at line 111 of file BlockFormatter.cc.

References GenMuonPlsPt100GeV_cfg::cout, FEDRawData::data(), lat::endl(), i, int, j, n, FEDRawData::size(), and size.

Referenced by TCCBlockFormatter::DigiToRaw(), TowerBlockFormatter::DigiToRaw(), and SRBlockFormatter::DigiToRaw().

00111                                               {
00112         int size = rawdata.size();
00113         cout << "Print RawData  size " << dec << size << endl;
00114         unsigned char* pData = rawdata.data();
00115 
00116         int n = size/8;
00117         for (int i=0; i < n; i++) {
00118                 for (int j=7; j>=0; j--) {
00119                   if (8*i+j <= size) cout << hex << (int)pData[8*i+j] << " ";
00120                 }
00121                 cout << endl;
00122         }
00123 }

void BlockFormatter::PrintSizes ( FEDRawDataCollection productRawData  ) 

Definition at line 204 of file BlockFormatter.cc.

References GenMuonPlsPt100GeV_cfg::cout, EcalFEDIds, lat::endl(), id, and FEDRawData::size().

00204                                                                     {
00205 
00206 
00207  for (int id=0; id < 36 + 18; id++) {
00208 
00209         // if ( (! doBarrel_) && (id >= 9 && id <= 44)) continue;
00210         // if ( (! doEndCap_) && (id <= 8 || id >= 45)) continue;
00211 
00212 
00213         int FEDid = EcalFEDIds.first + id;
00214         FEDRawData& rawdata = productRawData -> FEDData(FEDid);
00215         if (rawdata.size() > 0)
00216         cout << "Size of FED id " << dec << FEDid << " is : " << dec << rawdata.size() << endl;
00217 
00218  }
00219 }

void BlockFormatter::SetParam ( EcalDigiToRaw base  ) 

Definition at line 23 of file BlockFormatter.cc.

References debug_, doBarrel_, doEndCap_, doSR_, doTCC_, doTower_, pbx_, pcounter_, plistDCCId_, plv1_, porbit_number_, and prunnumber_.

00023                                                  {
00024 
00025  pcounter_ = (base -> GetCounter());
00026  debug_   = base -> GetDebug();
00027  porbit_number_ = (base -> GetOrbit());
00028  plv1_ = (base -> GetLV1());
00029  pbx_  = (base -> GetBX());
00030  prunnumber_ = (base -> GetRunNumber());
00031  doBarrel_ = base -> GetDoBarrel();
00032  doEndCap_ = base -> GetDoEndCap();
00033  plistDCCId_ = base -> GetListDCCId();
00034  doTCC_ = base -> GetDoTCC();
00035  doSR_ = base -> GetDoSR();
00036  doTower_ = base -> GetDoTower();
00037 
00038 }


Member Data Documentation

bool BlockFormatter::debug_ [protected]

Definition at line 36 of file BlockFormatter.h.

Referenced by TCCBlockFormatter::DigiToRaw(), TowerBlockFormatter::DigiToRaw(), SRBlockFormatter::DigiToRaw(), DigiToRaw(), TowerBlockFormatter::EndEvent(), SetParam(), and SRBlockFormatter::StartEvent().

bool BlockFormatter::doBarrel_ [protected]

Definition at line 38 of file BlockFormatter.h.

Referenced by TCCBlockFormatter::DigiToRaw(), DigiToRaw(), and SetParam().

bool BlockFormatter::doEndCap_ [protected]

Definition at line 39 of file BlockFormatter.h.

Referenced by TCCBlockFormatter::DigiToRaw(), DigiToRaw(), and SetParam().

bool BlockFormatter::doSR_ [protected]

Definition at line 41 of file BlockFormatter.h.

Referenced by SetParam().

bool BlockFormatter::doTCC_ [protected]

Definition at line 40 of file BlockFormatter.h.

Referenced by SetParam().

bool BlockFormatter::doTower_ [protected]

Definition at line 42 of file BlockFormatter.h.

Referenced by SetParam().

std::pair<int,int> BlockFormatter::EcalFEDIds [protected]

Definition at line 35 of file BlockFormatter.h.

Referenced by BlockFormatter(), TCCBlockFormatter::DigiToRaw(), TowerBlockFormatter::DigiToRaw(), DigiToRaw(), TowerBlockFormatter::EndEvent(), and PrintSizes().

const int BlockFormatter::kCardsPerTower = 5 [static]

Reimplemented in TCCBlockFormatter, and TowerBlockFormatter.

Definition at line 26 of file BlockFormatter.h.

int* BlockFormatter::pbx_ [protected]

Definition at line 48 of file BlockFormatter.h.

Referenced by TCCBlockFormatter::DigiToRaw(), TowerBlockFormatter::DigiToRaw(), SRBlockFormatter::DigiToRaw(), DigiToRaw(), and SetParam().

int* BlockFormatter::pcounter_ [protected]

Definition at line 46 of file BlockFormatter.h.

Referenced by SetParam().

std::vector<int32_t>* BlockFormatter::plistDCCId_ [protected]

Definition at line 44 of file BlockFormatter.h.

Referenced by SetParam().

int* BlockFormatter::plv1_ [protected]

Definition at line 49 of file BlockFormatter.h.

Referenced by TCCBlockFormatter::DigiToRaw(), TowerBlockFormatter::DigiToRaw(), SRBlockFormatter::DigiToRaw(), DigiToRaw(), and SetParam().

int* BlockFormatter::porbit_number_ [protected]

Definition at line 47 of file BlockFormatter.h.

Referenced by DigiToRaw(), and SetParam().

int* BlockFormatter::prunnumber_ [protected]

Definition at line 50 of file BlockFormatter.h.

Referenced by DigiToRaw(), and SetParam().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:15:02 2009 for CMSSW by  doxygen 1.5.4