#include <EventFilter/EcalTBRawToDigi/src/DCCTowerBlock.h>
Public Member Functions | |
DCCTBTowerBlock (DCCTBEventBlock *dccBlock, DCCTBDataParser *parser, ulong *buffer, ulong numbBytes, ulong wordsToEnd, ulong wordEventOffset, ulong expectedTowerID) | |
void | parseXtalData () |
int | towerID () |
std::vector< DCCTBXtalBlock * > & | xtalBlocks () |
std::vector< DCCTBXtalBlock * > | xtalBlocksById (ulong stripId, ulong xtalId) |
~DCCTBTowerBlock () | |
Protected Types | |
enum | towerFields { BXMASK = 0xFFF, L1MASK = 0xFFF } |
Protected Member Functions | |
void | dataCheck () |
Protected Attributes | |
DCCTBEventBlock * | dccBlock_ |
ulong | expectedTowerID_ |
std::vector< DCCTBXtalBlock * > | xtalBlocks_ |
Definition at line 21 of file DCCTowerBlock.h.
enum DCCTBTowerBlock::towerFields [protected] |
DCCTBTowerBlock::DCCTBTowerBlock | ( | DCCTBEventBlock * | dccBlock, | |
DCCTBDataParser * | parser, | |||
ulong * | buffer, | |||
ulong | numbBytes, | |||
ulong | wordsToEnd, | |||
ulong | wordEventOffset, | |||
ulong | expectedTowerID | |||
) |
Definition at line 12 of file DCCTowerBlock.cc.
References DCCTBBlockPrototype::errors_, DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, and DCCTBDataMapper::towerFields().
00021 : DCCTBBlockPrototype(parser,"TOWERHEADER", buffer, numbBytes,wordsToEnd, wordEventOffset ) 00022 , dccBlock_(dccBlock), expectedTowerID_(expectedTowerID) 00023 { 00024 00025 //Reset error counters /////////// 00026 errors_["FE::HEADER"] = 0; 00027 errors_["FE::TT/SC ID"] = 0; 00028 errors_["FE::BLOCK LENGTH"] = 0; 00030 00031 00032 00033 // Get data fields from the mapper and retrieve data ///////////////////////////////////// 00034 mapperFields_ = parser_->mapper()->towerFields(); 00035 parseData(); 00037 }
DCCTBTowerBlock::~DCCTBTowerBlock | ( | ) |
Definition at line 119 of file DCCTowerBlock.cc.
References it, and xtalBlocks_.
00119 { 00120 std::vector<DCCTBXtalBlock *>::iterator it; 00121 for(it=xtalBlocks_.begin();it!=xtalBlocks_.end();it++){ delete (*it);} 00122 xtalBlocks_.clear(); 00123 }
void DCCTBTowerBlock::dataCheck | ( | ) | [protected] |
Definition at line 127 of file DCCTowerBlock.cc.
References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::checkDataField(), dccBlock_, DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, expectedTowerID_, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), L1MASK, DCCTBBlockPrototype::name_, DCCTBBlockPrototype::parser_, and res.
Referenced by parseXtalData().
00127 { 00128 std::string checkErrors(""); 00129 00130 00131 std::pair <bool,std::string> res; 00132 00134 // For TB we don-t check Bx 00135 //res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX"))); 00136 //if(!res.first){ checkErrors += res.second; (errors_["FE::HEADER"])++; } 00138 00139 // mod to account for ECAL counters starting from 0 in the front end N. Almeida 00140 res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1") -1) ); 00141 if(!res.first){ checkErrors += res.second; (errors_["FE::HEADER"])++; } 00142 00143 00144 if(expectedTowerID_ != 0){ 00145 res = checkDataField("TT/SC ID",expectedTowerID_); 00146 if(!res.first){ checkErrors += res.second; (errors_["FE::HEADER"])++; } 00147 } 00148 00149 if( checkErrors !="" ){ 00150 std::string myTowerId; 00151 00152 errorString_ +="\n ======================================================================\n"; 00153 errorString_ += std::string(" ") + name_ + std::string("( ID = ")+parser_->getDecString((ulong)(expectedTowerID_))+std::string(" ) errors : ") ; 00154 errorString_ += checkErrors ; 00155 errorString_ += "\n ======================================================================"; 00156 blockError_ = true; 00157 } 00158 }
void DCCTBTowerBlock::parseXtalData | ( | ) |
Definition at line 40 of file DCCTowerBlock.cc.
References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::blockSize_, dataCheck(), DCCTBBlockPrototype::dataP_, dccBlock_, DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), DCCTBBlockPrototype::increment(), DCCTBBlockPrototype::name_, DCCTBDataParser::numbXtalSamples(), DCCTBBlockPrototype::parser_, DCCTBBlockPrototype::wordCounter_, DCCTBBlockPrototype::wordEventOffset_, DCCTBBlockPrototype::wordsToEndOfEvent_, and xtalBlocks_.
Referenced by DCCTBEventBlock::DCCTBEventBlock().
00040 { 00041 00042 ulong numbBytes = blockSize_; 00043 ulong wordsToEnd =wordsToEndOfEvent_; 00044 00045 // See if we can construct the correct number of XTAL Blocks//////////////////////////////////////////////////////////////////////////////// 00046 ulong numbDWInXtalBlock = ( parser_->numbXtalSamples() )/4 + 1; 00047 ulong length = getDataField("BLOCK LENGTH"); 00048 ulong numbOfXtalBlocks = 0 ; 00049 00050 if( length > 0 ){ numbOfXtalBlocks = (length-1)/numbDWInXtalBlock; } 00051 ulong xtalBlockSize = numbDWInXtalBlock*8; 00052 //ulong pIncrease = numbDWInXtalBlock*2; 00053 00054 //std::cout<<"\n DEBUG::numbDWInXtal Block "<<dec<<numbDWInXtalBlock<<std::endl; 00055 //std::cout<<"\n DEBUG::length "<<length<<std::endl; 00056 //std::cout<<"\n DEBUG::xtalBlockSize "<<xtalBlockSize<<std::endl; 00057 //std::cout<<"\n DEBUG::pIncreade "<<pIncrease<<std::endl; 00058 00059 00060 00061 bool zs = dccBlock_->getDataField("ZS"); 00062 if( !zs && numbOfXtalBlocks != 25 ){ 00063 00064 00065 (errors_["FE::BLOCK LENGTH"])++; 00066 errorString_ += "\n ======================================================================\n"; 00067 errorString_ += std::string(" ") + name_ + std::string(" ZS is not active, error in the Tower Length !") ; 00068 errorString_ += "\n Tower Length is : " + (parser_->getDecString(numbBytes/8))+std::string(" , while it should be : "); 00069 std::string myString = parser_->getDecString((ulong)(25*numbDWInXtalBlock+1)); 00070 errorString_ += "\n It was only possible to build : " + parser_->getDecString( numbOfXtalBlocks)+ std::string(" XTAL blocks"); 00071 errorString_ += "\n ======================================================================"; 00072 blockError_ = true; 00073 }; 00074 if( numbOfXtalBlocks > 25 ){ 00075 if (errors_["FE::BLOCK LENGTH"]==0)(errors_["FE::BLOCK LENGTH"])++; 00076 errorString_ += "\n ======================================================================\n"; 00077 errorString_ += std::string(" ") + name_ + std::string(" Tower Length is larger then expected...!") ; 00078 errorString_ += "\n Tower Length is : " + parser_->getDecString(numbBytes/8)+std::string(" , while it should be at maximum : "); 00079 std::string myString = parser_->getDecString((ulong)(25*numbDWInXtalBlock+1)); 00080 errorString_ += "\n Action -> data after the xtal 25 is ignored... "; 00081 errorString_ += "\n ======================================================================"; 00082 blockError_ = true; 00083 00084 } 00086 00087 blockSize_ += length*8; //?????????????????????? 00088 00089 // Get XTAL Data ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00090 ulong stripID, xtalID; 00091 00092 00093 for(ulong numbXtal=1; numbXtal <= numbOfXtalBlocks && numbXtal <=25 ; numbXtal++){ 00094 00095 increment(1); 00096 00097 stripID =( numbXtal-1)/5 + 1; 00098 xtalID = numbXtal - (stripID-1)*5; 00099 00100 00101 if(!zs){ 00102 xtalBlocks_.push_back( new DCCTBXtalBlock( parser_, dataP_, xtalBlockSize, wordsToEnd-wordCounter_,wordCounter_+wordEventOffset_,xtalID, stripID) ); 00103 }else{ 00104 xtalBlocks_.push_back( new DCCTBXtalBlock( parser_, dataP_, xtalBlockSize, wordsToEnd-wordCounter_,wordCounter_+wordEventOffset_,0,0)); 00105 } 00106 00107 increment(xtalBlockSize/4-1); 00108 } 00110 00111 00112 // Check internal data //////////// 00113 if(parser_->debug()){ dataCheck();}; 00115 }
int DCCTBTowerBlock::towerID | ( | ) |
Definition at line 179 of file DCCTowerBlock.cc.
References DCCTBBlockPrototype::getDataField(), it, DCCTBBlockPrototype::mapperFields_, and HLT_VtxMuL3::result.
Referenced by EcalTBDaqFormatter::DecodeMEM(), and EcalTB07DaqFormatter::DecodeMEM().
00179 { 00180 int result=-1; 00181 00182 for(std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator it = mapperFields_->begin(); it!= mapperFields_->end(); it++){ 00183 if ( (*it)->name() == "TT/SC ID" ) 00184 result=getDataField( (*it)->name() ) ; 00185 00186 } 00187 00188 return result; 00189 00190 }
std::vector< DCCTBXtalBlock * > & DCCTBTowerBlock::xtalBlocks | ( | ) | [inline] |
Definition at line 57 of file DCCTowerBlock.h.
References xtalBlocks_.
Referenced by EcalTBDaqFormatter::DecodeMEM(), and EcalTB07DaqFormatter::DecodeMEM().
00057 { return xtalBlocks_; }
std::vector< DCCTBXtalBlock * > DCCTBTowerBlock::xtalBlocksById | ( | ulong | stripId, | |
ulong | xtalId | |||
) |
Definition at line 161 of file DCCTowerBlock.cc.
References e, it, and xtalBlocks_.
00161 { 00162 std::vector<DCCTBXtalBlock *> myVector; 00163 std::vector<DCCTBXtalBlock *>::iterator it; 00164 00165 for( it = xtalBlocks_.begin(); it!= xtalBlocks_.end(); it++ ){ 00166 try{ 00167 00168 std::pair<bool,std::string> stripIdCheck = (*it)->checkDataField("STRIP ID",stripId); 00169 std::pair<bool,std::string> xtalIdCheck = (*it)->checkDataField("XTAL ID",xtalId); 00170 00171 if(xtalIdCheck.first && stripIdCheck.first ){ myVector.push_back( (*it) ); } 00172 00173 }catch (ECALTBParserBlockException &e){/*ignore*/ } 00174 } 00175 00176 return myVector; 00177 }
DCCTBEventBlock* DCCTBTowerBlock::dccBlock_ [protected] |
ulong DCCTBTowerBlock::expectedTowerID_ [protected] |
std::vector<DCCTBXtalBlock * > DCCTBTowerBlock::xtalBlocks_ [protected] |
Definition at line 50 of file DCCTowerBlock.h.
Referenced by parseXtalData(), xtalBlocks(), xtalBlocksById(), and ~DCCTBTowerBlock().