CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Attributes | Protected Attributes

BlockFormatter Class Reference

#include <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_
int * pbx_
int * pcounter_
std::vector< int32_t > * plistDCCId_
int * plv1_
int * porbit_number_
int * prunnumber_

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.

                               {
}
BlockFormatter::~BlockFormatter ( )

Definition at line 17 of file BlockFormatter.cc.

                                {
}

Member Function Documentation

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

Definition at line 39 of file BlockFormatter.cc.

References gather_cfg::cout, FEDRawData::data(), L1Comparator_cfi::FEDid, i, j, EcalElectronicsId::MAX_DCCID_EBP, EcalElectronicsId::MIN_DCCID_EBM, EcalElectronicsId::MIN_DCCID_EEP, FEDNumbering::MINECALFEDID, lumiPlot::rawdata, FEDRawData::resize(), and FEDRawData::size().

                                                                   {

 int run_number = *prunnumber_;
 int orbit_number_ = *porbit_number_;
 int bx = *pbx_;
 int lv1 = *plv1_;

 if (debug_) cout << "in BlockFormatter::DigiToRaw  run_number orbit_number bx lv1 " << dec << run_number << " " <<
         orbit_number_ << " " << bx << " " << lv1 << endl;

 for (int idcc=1; idcc <= 54; idcc++) {
        if ( (! doBarrel_) && 
             (idcc >= EcalElectronicsId::MIN_DCCID_EBM && idcc <= EcalElectronicsId::MAX_DCCID_EBP)) continue;
        if ( (! doEndCap_) && 
             (idcc <= EcalElectronicsId::MAX_DCCID_EEM || idcc >= EcalElectronicsId::MIN_DCCID_EEP)) continue;
 
        int FEDid = FEDNumbering::MINECALFEDID + idcc;
        FEDRawData& rawdata = productRawData -> FEDData(FEDid);
        unsigned char * pData;
        short int DCC_ERRORS = 0;

        if (rawdata.size() == 0) {
                rawdata.resize(8);
                pData = rawdata.data();

                Word64 word = 0x18 + ((FEDid & 0xFFF)<<8)
                            + ((Word64)((Word64)bx & 0xFFF)<<20)
                            + ((Word64)((Word64)lv1 & 0xFFFFFF)<<32)
                            + (Word64)((Word64)0x51<<56);
                Word64* pw = reinterpret_cast<Word64*>(const_cast<unsigned char*>(pData));
                *pw = word;    // DAQ header

                rawdata.resize(rawdata.size() + 8*8);   // DCC header
                pData = rawdata.data();
                pData[11] = DCC_ERRORS & 0xFF;
                pData[12] = run_number & 0xFF;
                pData[13] = (run_number >>8) & 0xFF;
                pData[14] = (run_number >> 16) & 0xFF;
                pData[15] = 0x01;

                for (int i=16; i <= 22; i++) {
                 pData[i] = 0;    // to be filled for local data taking or calibration
                }
                pData[23] = 0x02;
                pData[24] = orbit_number_ & 0xFF;
                pData[25] = (orbit_number_ >>8) & 0xFF;
                pData[26] = (orbit_number_ >>16) & 0xFF;
                pData[27] = (orbit_number_ >>24) & 0xFF;
                int SRenable_ = 1;
                int SR = SRenable_;
                int ZS = 0;
                int TZS = 0;
                // int SR_CHSTATUS = 0;
                pData[28] = (SR&0x1) + ((ZS&0x1)<<1) + ((TZS&0x1)<<2);
                pData[31] = 0x03;

                for (int i=0; i<=4; i++) {
                  for (int j=0; j<7; j++) {
                   pData[32 +8*i + j] = 0;
                  }
                  pData[32 +8*i + 7] = 0x04;
                }

        } // endif rawdatasize == 0
 } // loop on id

}
void BlockFormatter::print ( FEDRawData rawdata)

Definition at line 109 of file BlockFormatter.cc.

References gather_cfg::cout, FEDRawData::data(), i, j, n, findQualityFiles::size, and FEDRawData::size().

                                              {
        int size = rawdata.size();
        cout << "Print RawData  size " << dec << size << endl;
        unsigned char* pData = rawdata.data();

        int n = size/8;
        for (int i=0; i < n; i++) {
                for (int j=7; j>=0; j--) {
                  if (8*i+j <= size) cout << hex << (int)pData[8*i+j] << " ";
                }
                cout << endl;
        }
}
void BlockFormatter::PrintSizes ( FEDRawDataCollection productRawData)

Definition at line 202 of file BlockFormatter.cc.

References gather_cfg::cout, L1Comparator_cfi::FEDid, FEDNumbering::MINECALFEDID, lumiPlot::rawdata, and FEDRawData::size().

                                                                    {


 for (int id=0; id < 36 + 18; id++) {

        // if ( (! doBarrel_) && (id >= 9 && id <= 44)) continue;
        // if ( (! doEndCap_) && (id <= 8 || id >= 45)) continue;


        int FEDid = FEDNumbering::MINECALFEDID + id;
        FEDRawData& rawdata = productRawData -> FEDData(FEDid);
        if (rawdata.size() > 0)
        cout << "Size of FED id " << dec << FEDid << " is : " << dec << rawdata.size() << endl;

 }
}
void BlockFormatter::SetParam ( EcalDigiToRaw base)

Definition at line 21 of file BlockFormatter.cc.

                                                 {

 pcounter_ = (base -> GetCounter());
 debug_   = base -> GetDebug();
 porbit_number_ = (base -> GetOrbit());
 plv1_ = (base -> GetLV1());
 pbx_  = (base -> GetBX());
 prunnumber_ = (base -> GetRunNumber());
 doBarrel_ = base -> GetDoBarrel();
 doEndCap_ = base -> GetDoEndCap();
 plistDCCId_ = base -> GetListDCCId();
 doTCC_ = base -> GetDoTCC();
 doSR_ = base -> GetDoSR();
 doTower_ = base -> GetDoTower();

}

Member Data Documentation

bool BlockFormatter::debug_ [protected]

Definition at line 35 of file BlockFormatter.h.

bool BlockFormatter::doBarrel_ [protected]

Definition at line 37 of file BlockFormatter.h.

bool BlockFormatter::doEndCap_ [protected]

Definition at line 38 of file BlockFormatter.h.

bool BlockFormatter::doSR_ [protected]

Definition at line 40 of file BlockFormatter.h.

bool BlockFormatter::doTCC_ [protected]

Definition at line 39 of file BlockFormatter.h.

bool BlockFormatter::doTower_ [protected]

Definition at line 41 of file BlockFormatter.h.

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 47 of file BlockFormatter.h.

int* BlockFormatter::pcounter_ [protected]

Definition at line 45 of file BlockFormatter.h.

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

Definition at line 43 of file BlockFormatter.h.

int* BlockFormatter::plv1_ [protected]

Definition at line 48 of file BlockFormatter.h.

Definition at line 46 of file BlockFormatter.h.

int* BlockFormatter::prunnumber_ [protected]

Definition at line 49 of file BlockFormatter.h.