#include <DCCFEBlock.h>
Public Member Functions | |
DCCFEBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack, bool forceToKeepFRdata) | |
void | display (std::ostream &o) |
void | enableFeIdChecks () |
unsigned int | getLength () |
int | unpack (uint64_t **data, unsigned int *dwToEnd, bool zs, unsigned int expectedTowerID) |
virtual void | updateCollectors () |
void | zsFlag (bool zs) |
virtual | ~DCCFEBlock () |
Protected Member Functions | |
virtual void | fillEcalElectronicsError (std::auto_ptr< EcalElectronicsIdCollection > *) |
virtual int | unpackXtalData (unsigned int stripID, unsigned int xtalID) |
Protected Attributes | |
unsigned int | blockSize_ |
unsigned int | bx_ |
bool | checkFeId_ |
unsigned int | expTowerID_ |
unsigned int | expXtalTSamples_ |
bool | forceToKeepFRdata_ |
std::auto_ptr < EcalElectronicsIdCollection > * | invalidBlockLengths_ |
std::auto_ptr < EcalElectronicsIdCollection > * | invalidTTIds_ |
std::auto_ptr < EcalElectronicsIdCollection > * | invalidZSXtalIds_ |
unsigned int | l1_ |
unsigned int | lastStripId_ |
unsigned int | lastXtalId_ |
unsigned int | nTSamples_ |
unsigned int | numbDWInXtalBlock_ |
unsigned int | towerId_ |
unsigned int | unfilteredDataBlockLength_ |
unsigned int | xtalBlockSize_ |
short * | xtalGains_ |
bool | zs_ |
Definition at line 22 of file DCCFEBlock.h.
DCCFEBlock::DCCFEBlock | ( | DCCDataUnpacker * | u, |
EcalElectronicsMapper * | m, | ||
DCCEventBlock * | e, | ||
bool | unpack, | ||
bool | forceToKeepFRdata | ||
) |
Definition at line 9 of file DCCFEBlock.cc.
References expXtalTSamples_, EcalElectronicsMapper::getUnfilteredTowerBlockLength(), DCCDataBlockPrototype::mapper_, numbDWInXtalBlock_, EcalElectronicsMapper::numbXtalTSamples(), unfilteredDataBlockLength_, and xtalGains_.
: DCCDataBlockPrototype(u,m,e,unpack), checkFeId_(false), forceToKeepFRdata_(forceToKeepFRdata) { expXtalTSamples_ = mapper_->numbXtalTSamples(); numbDWInXtalBlock_ = (expXtalTSamples_-2)/4+1; unfilteredDataBlockLength_ = mapper_->getUnfilteredTowerBlockLength(); xtalGains_ = new short[expXtalTSamples_]; }
virtual DCCFEBlock::~DCCFEBlock | ( | ) | [inline, virtual] |
void DCCFEBlock::display | ( | std::ostream & | o | ) | [virtual] |
Reimplemented from DCCDataBlockPrototype.
Definition at line 254 of file DCCFEBlock.cc.
References DCCDataBlockPrototype::blockLength_, bx_, l1_, nTSamples_, and towerId_.
{ o<<"\n Unpacked Info for DCC Tower Block" <<"\n DW1 =============================" <<"\n Tower Id "<<towerId_ <<"\n Numb Samp "<<nTSamples_ <<"\n Bx "<<bx_ <<"\n L1 "<<l1_ <<"\n blockLength "<<blockLength_; }
void DCCFEBlock::enableFeIdChecks | ( | ) | [inline] |
Definition at line 32 of file DCCFEBlock.h.
References checkFeId_.
Referenced by DCCEventBlock::enableFeIdChecks().
{checkFeId_= true;}
virtual void DCCFEBlock::fillEcalElectronicsError | ( | std::auto_ptr< EcalElectronicsIdCollection > * | ) | [inline, protected, virtual] |
Reimplemented in DCCSCBlock, and DCCTowerBlock.
Definition at line 45 of file DCCFEBlock.h.
Referenced by unpack().
{};
unsigned int DCCFEBlock::getLength | ( | ) | [inline, virtual] |
Reimplemented from DCCDataBlockPrototype.
Definition at line 40 of file DCCFEBlock.h.
References DCCDataBlockPrototype::blockLength_.
{return blockLength_; }
int DCCFEBlock::unpack | ( | uint64_t ** | data, |
unsigned int * | dwToEnd, | ||
bool | zs, | ||
unsigned int | expectedTowerID | ||
) |
Definition at line 29 of file DCCFEBlock.cc.
References BLOCK_UNPACKED, DCCDataBlockPrototype::blockLength_, blockSize_, DCCEventBlock::bx(), bx_, checkFeId_, AlCaHLTBitMon_QueryRunRegistry::data, DCCDataBlockPrototype::data_, DCCDataBlockPrototype::datap_, DCCDataBlockPrototype::dwToEnd_, DCCDataBlockPrototype::event_, expTowerID_, expXtalTSamples_, FE_MEM, fillEcalElectronicsError(), forceToKeepFRdata_, DCCEventBlock::fov(), EcalElectronicsMapper::getActiveDCC(), EcalElectronicsMapper::getActiveSM(), DCCEventBlock::getHLTChannel(), EcalElectronicsMapper::getNumChannelsInDcc(), H_FOV_MASK, invalidBlockLengths_, invalidTTIds_, isSynced(), l1_, DCCEventBlock::l1A(), lastStripId_, lastXtalId_, DCCDataBlockPrototype::mapper_, nTSamples_, numbDWInXtalBlock_, DCCEventBlock::setFESyncNumbers(), DCCDataUnpacker::silentMode_, SKIP_BLOCK_UNPACKING, STOP_EVENT_UNPACKING, DCCDataBlockPrototype::sync_, TCC_BX_MASK, TCC_L1_MASK, TOWER_BX_B, TOWER_BX_MASK, TOWER_ID_MASK, TOWER_L1_B, TOWER_L1_MASK, TOWER_LENGTH_B, TOWER_LENGTH_MASK, TOWER_NSAMP_B, TOWER_NSAMP_MASK, towerId_, unfilteredDataBlockLength_, unpackXtalData(), DCCDataBlockPrototype::updateEventPointers(), xtalBlockSize_, and zs_.
Referenced by DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().
{ zs_ = zs; datap_ = data; data_ = *data; dwToEnd_ = dwToEnd; const unsigned int activeDCC = mapper_->getActiveSM(); if( (*dwToEnd_)<1){ if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectEvent") <<"\n Unable to unpack Tower block for event "<<event_->l1A()<<" in fed "<<activeDCC <<"\n The end of event was reached " <<"\n(or, previously, pointers intended to navigate outside of FedBlock (based on block sizes), and were stopped by setting dwToEnd_ to zero)" ; //TODO : add this to a dcc event size collection error? } return STOP_EVENT_UNPACKING; } lastStripId_ = 0; lastXtalId_ = 0; expTowerID_ = expectedTowerID; //Point to begin of block data_++; towerId_ = ( *data_ ) & TOWER_ID_MASK; nTSamples_ = ( *data_>>TOWER_NSAMP_B ) & TOWER_NSAMP_MASK; bx_ = ( *data_>>TOWER_BX_B ) & TOWER_BX_MASK; l1_ = ( *data_>>TOWER_L1_B ) & TOWER_L1_MASK; blockLength_ = ( *data_>>TOWER_LENGTH_B ) & TOWER_LENGTH_MASK; event_->setFESyncNumbers(l1_,bx_, (short)(expTowerID_-1)); //debugging //display(cout); // check that expected fe_id==fe_expected is on if (checkFeId_ && expTowerID_ != towerId_ && expTowerID_ <= mapper_->getNumChannelsInDcc(activeDCC) ){ // fe_id must be within range foreseen in the FED if (! DCCDataUnpacker::silentMode_) { edm::LogWarning("IncorrectBlock") << "Expected tower ID is " << expTowerID_ << " while " << towerId_ << " was found" << " (L1A " << event_->l1A() << " fed " << mapper_->getActiveDCC() << ")\n" << " => Skipping to next FE block..."; } fillEcalElectronicsError(invalidTTIds_); updateEventPointers(); return SKIP_BLOCK_UNPACKING; } // check that expected fe_id==fe_expected is off else if( (!checkFeId_) && towerId_ > mapper_->getNumChannelsInDcc(activeDCC) ){ // fe_id must still be within range foreseen in the FED if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectBlock") <<"For event "<<event_->l1A()<<" and fed "<<mapper_->getActiveDCC()<<" (there's no check fe_id==dcc_channel)" <<"\n the FE_id found: "<<towerId_<<" exceeds max number of FE foreseen in fed" <<"\n => Skipping to next FE block..."; } updateEventPointers(); return SKIP_BLOCK_UNPACKING; } // Check synchronization if (sync_) { const unsigned int dccBx = (event_->bx()) & TCC_BX_MASK; const unsigned int dccL1 = (event_->l1A()) & TCC_L1_MASK; const unsigned int fov = (event_->fov()) & H_FOV_MASK; if (! isSynced(dccBx, bx_, dccL1, l1_, FE_MEM, fov)) { if (! DCCDataUnpacker::silentMode_) { // TODO: add check for status from Channel Status DB edm::LogWarning("IncorrectBlock") << "Synchronization error for Tower Block" << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << " tower " << towerId_ << ")\n" << " dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n" << " => Skipping to next tower block"; } //Note : add to error collection ? updateEventPointers(); return SKIP_BLOCK_UNPACKING; } } // check number of samples if( nTSamples_ != expXtalTSamples_ ){ if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectBlock") <<"Unable to unpack Tower Block "<<towerId_<<" for event L1A "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC() <<"\n Number of time samples "<<nTSamples_<<" is not the same as expected ("<<expXtalTSamples_<<")" <<"\n => Skipping to next tower block..."; } //Note : add to error collection ? updateEventPointers(); return SKIP_BLOCK_UNPACKING; } xtalBlockSize_ = numbDWInXtalBlock_*8; blockSize_ = blockLength_*8; if((*dwToEnd_)<blockLength_){ if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectEvent") <<"\n Unable to unpack Tower Block "<<towerId_<<" for event L1A "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC() <<"\n Only "<<((*dwToEnd_)*8)<<" bytes are available while "<<blockSize_<<" are needed!" <<"\n => Skipping to next fed block..."; } //TODO : add to error collections return STOP_EVENT_UNPACKING; } if(!zs_ && !forceToKeepFRdata_){ if ( unfilteredDataBlockLength_ != blockLength_ ){ if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectEvent") <<"\n For event L1A "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_ <<"\n Expected block size is "<<(unfilteredDataBlockLength_*8)<<" bytes while "<<(blockLength_*8)<<" was found" <<"\n => Skipping to next fed block..."; } fillEcalElectronicsError(invalidBlockLengths_) ; //Safer approach... - why pointers do not navigate in this case? return STOP_EVENT_UNPACKING; } } else if (!zs && forceToKeepFRdata_){ if ( unfilteredDataBlockLength_ != blockLength_ ){ if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectBlock") <<"For event L1A "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_ <<"\n Expected block size is "<<(unfilteredDataBlockLength_*8)<<" bytes while "<<(blockLength_*8)<<" was found" <<"\n => Keeps unpacking as the unpacker was forced to keep FR data (by configuration) ..."; } fillEcalElectronicsError(invalidBlockLengths_) ; } } else if( blockLength_ > unfilteredDataBlockLength_ || (blockLength_-1) < numbDWInXtalBlock_ ){ if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectEvent") <<"\n For event L1A "<<event_->l1A()<<" and fed "<<mapper_->getActiveDCC() <<"\n The tower "<<towerId_<<" has a wrong number of bytes : "<<(blockLength_*8) <<"\n => Skipping to next fed block..."; } fillEcalElectronicsError(invalidBlockLengths_) ; //Safer approach... - why pointers do not navigate in this case? return STOP_EVENT_UNPACKING; } // If the HLT says to skip this tower we skip it... if( ! event_->getHLTChannel(towerId_) ){ updateEventPointers(); return SKIP_BLOCK_UNPACKING; } unsigned int numbOfXtalBlocks = (blockLength_-1)/numbDWInXtalBlock_; // get XTAL Data unsigned int expStripID(0), expXtalID(0); //point to xtal data data_++; int statusUnpackXtal =0; for(unsigned int numbXtal=1; numbXtal <= numbOfXtalBlocks && statusUnpackXtal!= SKIP_BLOCK_UNPACKING; numbXtal++){ if(!zs_ && ! forceToKeepFRdata_){ expStripID = ( numbXtal-1)/5 + 1; expXtalID = numbXtal - (expStripID-1)*5; } statusUnpackXtal = unpackXtalData(expStripID,expXtalID); if (statusUnpackXtal== SKIP_BLOCK_UNPACKING) { if( ! DCCDataUnpacker::silentMode_ ){ edm::LogWarning("IncorrectBlock") <<"For event L1A "<<event_->l1A()<<" and fed "<<mapper_->getActiveDCC() <<"\n The tower "<<towerId_<<" won't be unpacked further"; } } }// end loop over xtals of given FE updateEventPointers(); return BLOCK_UNPACKED; }
virtual int DCCFEBlock::unpackXtalData | ( | unsigned int | stripID, |
unsigned int | xtalID | ||
) | [inline, protected, virtual] |
Reimplemented in DCCSCBlock, and DCCTowerBlock.
Definition at line 44 of file DCCFEBlock.h.
References BLOCK_UNPACKED.
Referenced by unpack().
{ return BLOCK_UNPACKED;};
void DCCFEBlock::updateCollectors | ( | ) | [virtual] |
Reimplemented from DCCDataBlockPrototype.
Reimplemented in DCCSCBlock, and DCCTowerBlock.
Definition at line 20 of file DCCFEBlock.cc.
References invalidBlockLengths_, DCCDataUnpacker::invalidBlockLengthsCollection(), invalidTTIds_, DCCDataUnpacker::invalidTTIdsCollection(), invalidZSXtalIds_, DCCDataUnpacker::invalidZSXtalIdsCollection(), and DCCDataBlockPrototype::unpacker_.
Referenced by DCCEventBlock::updateCollectors().
void DCCFEBlock::zsFlag | ( | bool | zs | ) | [inline] |
unsigned int DCCFEBlock::blockSize_ [protected] |
Definition at line 62 of file DCCFEBlock.h.
Referenced by unpack().
unsigned int DCCFEBlock::bx_ [protected] |
Definition at line 63 of file DCCFEBlock.h.
bool DCCFEBlock::checkFeId_ [protected] |
Definition at line 49 of file DCCFEBlock.h.
Referenced by enableFeIdChecks(), and unpack().
unsigned int DCCFEBlock::expTowerID_ [protected] |
Definition at line 50 of file DCCFEBlock.h.
Referenced by DCCSCBlock::fillEcalElectronicsError(), DCCTowerBlock::fillEcalElectronicsError(), and unpack().
unsigned int DCCFEBlock::expXtalTSamples_ [protected] |
Definition at line 52 of file DCCFEBlock.h.
Referenced by DCCFEBlock(), and unpack().
bool DCCFEBlock::forceToKeepFRdata_ [protected] |
Definition at line 51 of file DCCFEBlock.h.
Referenced by unpack().
std::auto_ptr<EcalElectronicsIdCollection>* DCCFEBlock::invalidBlockLengths_ [protected] |
Definition at line 69 of file DCCFEBlock.h.
Referenced by unpack(), and updateCollectors().
std::auto_ptr<EcalElectronicsIdCollection>* DCCFEBlock::invalidTTIds_ [protected] |
Definition at line 67 of file DCCFEBlock.h.
Referenced by unpack(), and updateCollectors().
std::auto_ptr<EcalElectronicsIdCollection>* DCCFEBlock::invalidZSXtalIds_ [protected] |
Definition at line 68 of file DCCFEBlock.h.
Referenced by DCCTowerBlock::unpackXtalData(), DCCSCBlock::unpackXtalData(), and updateCollectors().
unsigned int DCCFEBlock::l1_ [protected] |
Definition at line 64 of file DCCFEBlock.h.
unsigned int DCCFEBlock::lastStripId_ [protected] |
Definition at line 54 of file DCCFEBlock.h.
Referenced by unpack(), DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().
unsigned int DCCFEBlock::lastXtalId_ [protected] |
Definition at line 55 of file DCCFEBlock.h.
Referenced by unpack(), DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().
unsigned int DCCFEBlock::nTSamples_ [protected] |
Definition at line 60 of file DCCFEBlock.h.
Referenced by display(), unpack(), DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().
unsigned int DCCFEBlock::numbDWInXtalBlock_ [protected] |
Definition at line 58 of file DCCFEBlock.h.
Referenced by DCCFEBlock(), unpack(), DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().
unsigned int DCCFEBlock::towerId_ [protected] |
Definition at line 57 of file DCCFEBlock.h.
Referenced by display(), unpack(), DCCTowerBlock::unpackXtalData(), and DCCSCBlock::unpackXtalData().
unsigned int DCCFEBlock::unfilteredDataBlockLength_ [protected] |
Definition at line 53 of file DCCFEBlock.h.
Referenced by DCCFEBlock(), and unpack().
unsigned int DCCFEBlock::xtalBlockSize_ [protected] |
Definition at line 59 of file DCCFEBlock.h.
Referenced by unpack().
short* DCCFEBlock::xtalGains_ [protected] |
Definition at line 66 of file DCCFEBlock.h.
Referenced by DCCFEBlock(), DCCTowerBlock::unpackXtalData(), DCCSCBlock::unpackXtalData(), and ~DCCFEBlock().
bool DCCFEBlock::zs_ [protected] |
Definition at line 45 of file DCCFEBlock.h.
Referenced by unpack(), DCCTowerBlock::unpackXtalData(), DCCSCBlock::unpackXtalData(), and zsFlag().