20 uint32_t wordBufferOffset ,
21 uint32_t wordEventOffset
24 ,dccTrailerBlock_(0),srpBlock_(0),wordBufferOffset_(wordBufferOffset) {
29 errors_[
"DCC::EVENT LENGTH"] = 0;
67 increment(1,
" (while trying to create a SR Block !)");
82 for(uint32_t
i=1;
i<=4;
i++){
83 uint32_t tcc_ch=0; uint32_t
tccId=0;
97 increment(1,
" (while trying to create a"+tcc+
" Block !)");
119 uint32_t numbChannels;
136 for( uint32_t
i=1;
i<=numbChannels;
i++){
144 if(srFlag ==
SR_NREAD){ suppress =
true; }
145 else{ suppress =
false; }
176 increment(1,
" (while trying to create a DCC TRAILER Block !)");
199 std::vector<DCCTBTCCBlock *>::iterator it1;
203 std::vector<DCCTBTowerBlock *>::iterator it2;
222 if(!res.first){ checkErrors += res.second; (
errors_[
"DCC::HEADER"])++; }
229 if(!res.first){ checkErrors += res.second; (
errors_[
"DCC::HEADER"])++; }
234 uint32_t dccHeaderWords = 0;
239 for(uint32_t
i = 1;
i<=dccHeaderWords ;
i++){
243 if(!res.first){ checkErrors += res.second; (
errors_[
"DCC::HEADER"])++; }
250 if(!res.first){ checkErrors += res.second; (
errors_[
"DCC::EVENT LENGTH"])++; }
255 errorString_ +=
"\n ======================================================================\n";
258 errorString_ +=
"\n ======================================================================";
269 os <<
"\n\n\n\n\n >>>>>>>>>>>>>>>>>>>> Event started at word position " << std::dec <<
wordBufferOffset_ <<
" <<<<<<<<<<<<<<<<<<<<"<<std::endl;
282 std::vector<DCCTBTCCBlock *>::iterator it1;
284 (*it1)->displayData(os);
288 std::vector<DCCTBTowerBlock *>::iterator it2;
291 (*it2)->displayData(os);
294 std::vector<DCCTBXtalBlock * > &xtalBlocks = (*it2)->xtalBlocks();
295 std::vector<DCCTBXtalBlock * >::iterator it3;
296 for(it3 = xtalBlocks.begin();it3!=xtalBlocks.end();it3++){
297 (*it3)->displayData(os);
313 std::stringstream
out;
318 ret.first = ret.first & temp.first;
322 out<<
"\n ====================================================================="
323 <<
"\n ERROR SR block identified in the ORIGINAL BLOCK ... "
324 <<
"\n ... but the block is not present in the COMPARISION BLOCK !"
325 <<
"\n =====================================================================";
328 out<<
"\n ====================================================================="
329 <<
"\n ERROR SR block identified in the COMPARISION BLOCK ... "
330 <<
"\n ... but the block is not present in the ORIGINAL BLOCK !"
331 <<
"\n =====================================================================";
340 int numbTccBlocks_b = block->
tccBlocks().size();
342 if( numbTccBlocks_a != numbTccBlocks_b ){
344 out<<
"\n ====================================================================="
345 <<
"\n ERROR number of TCC blocks in the ORIGINAL BLOCK( ="<<numbTccBlocks_a<<
" )"
346 <<
"\n and in the COMPARISION BLOCK( = "<<numbTccBlocks_b<<
" is different !"
347 <<
"\n =====================================================================";
350 std::vector<DCCTBTCCBlock *>::iterator it1Tcc =
tccBlocks_.begin();
351 std::vector<DCCTBTCCBlock *>::iterator it1TccEnd =
tccBlocks_.end();
352 std::vector<DCCTBTCCBlock *>::iterator it2Tcc = block->
tccBlocks().begin();
353 std::vector<DCCTBTCCBlock *>::iterator it2TccEnd = block->
tccBlocks().end();
355 for( ; it1Tcc!=it1TccEnd && it2Tcc!=it2TccEnd; it1Tcc++, it2Tcc++){
356 std::pair<bool,std::string>
temp( (*it1Tcc)->compare( *it2Tcc ) );
357 ret.first = ret.first &
temp.first;
366 int numbTowerBlocks_b = block->
towerBlocks().size();
368 if( numbTowerBlocks_a != numbTowerBlocks_b ){
370 out<<
"\n ====================================================================="
371 <<
"\n ERROR number of Tower blocks in the ORIGINAL BLOCK( ="<<numbTowerBlocks_a<<
" )"
372 <<
"\n and in the COMPARISION BLOCK( = "<<numbTowerBlocks_b<<
" is different !"
373 <<
"\n =====================================================================";
376 std::vector<DCCTBTowerBlock *>::iterator it1Tower =
towerBlocks_.begin();
377 std::vector<DCCTBTowerBlock *>::iterator it1TowerEnd =
towerBlocks_.end();
378 std::vector<DCCTBTowerBlock *>::iterator it2Tower = (block->
towerBlocks()).
begin();
379 std::vector<DCCTBTowerBlock *>::iterator it2TowerEnd = (block->
towerBlocks()).
end();
381 for( ; it1Tower!=it1TowerEnd && it2Tower!=it2TowerEnd; it1Tower++, it2Tower++){
383 std::pair<bool,std::string>
temp( (*it1Tower)->compare( *it2Tower ) );
384 ret.first = ret.first &
temp.first;
388 std::vector<DCCTBXtalBlock *> xtalBlocks1( (*it1Tower)->xtalBlocks());
389 std::vector<DCCTBXtalBlock *> xtalBlocks2( (*it2Tower)->xtalBlocks());
391 int numbXtalBlocks_a = xtalBlocks1.size();
392 int numbXtalBlocks_b = xtalBlocks2.size();
394 if( numbXtalBlocks_a != numbXtalBlocks_b ){
396 out<<
"\n ====================================================================="
397 <<
"\n ERROR number of Xtal blocks in this TOWER ORIGINAL BLOCK( ="<<numbXtalBlocks_a<<
" )"
398 <<
"\n and in the TOWER COMPARISION BLOCK( = "<<numbXtalBlocks_b<<
" is different !"
399 <<
"\n =====================================================================";
402 std::vector<DCCTBXtalBlock *>::iterator it1Xtal = xtalBlocks1.begin();
403 std::vector<DCCTBXtalBlock *>::iterator it1XtalEnd = xtalBlocks1.end();
404 std::vector<DCCTBXtalBlock *>::iterator it2Xtal = xtalBlocks1.begin();
405 std::vector<DCCTBXtalBlock *>::iterator it2XtalEnd = xtalBlocks2.end();
407 for( ; it1Xtal!=it1XtalEnd && it2Xtal!=it2XtalEnd; it1Xtal++, it2Xtal++){
408 std::pair<bool,std::string>
temp( (*it1Xtal)->compare( *it2Xtal ) );
409 ret.first = ret.first &
temp.first;
419 ret.first = ret.first & temp.first;
423 ret.second += out.str();
443 std::vector<DCCTBTCCBlock *>::iterator it1;
445 ret |= (*it1)->blockError();
455 std::vector<DCCTBTowerBlock *>::iterator it2;
458 ret |= (*it2)->blockError();
461 std::vector<DCCTBXtalBlock * > & xtalBlocks = (*it2)->xtalBlocks();
462 std::vector<DCCTBXtalBlock * >::iterator it3;
463 for(it3 = xtalBlocks.begin();it3!=xtalBlocks.end();it3++){
464 ret |= (*it3)->blockError();
488 ret +=
"\n ======================================================================\n";
489 ret +=
std::string(
" Event Erros occurred for L1A ( decoded value ) = ") ;
491 ret +=
"\n ======================================================================";
498 std::vector<DCCTBTCCBlock *>::iterator it1;
500 ret += (*it1)->errorString();
509 std::vector<DCCTBTowerBlock *>::iterator it2;
513 ret += (*it2)->errorString();
516 std::vector<DCCTBXtalBlock * > & xtalBlocks = (*it2)->xtalBlocks();
517 std::vector<DCCTBXtalBlock * >::iterator it3;
521 for(it3 = xtalBlocks.begin();it3!=xtalBlocks.end();it3++){ temp += (*it3)->errorString();}
524 ret +=
"\n Fine grain data Errors found ...";
549 std::vector<DCCTBTowerBlock *> myVector;
550 std::vector<DCCTBTowerBlock *>::iterator it;
555 std::pair<bool,std::string> idCheck = (*it)->checkDataField(
"TT/SC ID",towerId);
557 if(idCheck.first ){ myVector.push_back( (*it) ); }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
virtual uint32_t getDataField(std::string name)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
virtual void increment(uint32_t numb, std::string msg="")
const char * what() const
std::vector< DCCTBTCCBlock * > tccBlocks_
DCCTBDataParser * parser_
unsigned tccId(DetId const &)
std::string getDecString(uint32_t data)
DCCTBSRPBlock * srpBlock()
void displayEvent(std::ostream &os=std::cout)
virtual void displayData(std::ostream &os=std::cout)
DCCTBTrailerBlock * trailerBlock()
std::vector< DCCTBTCCBlock * > & tccBlocks()
DCCTBEventBlock(DCCTBDataParser *parser, uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordBufferOffset=0, uint32_t wordEventOffset=0)
DCCTBDataMapper * mapper()
std::map< std::string, uint32_t > errors_
unsigned towerId(DetId const &)
std::vector< DCCTBTowerBlock * > & towerBlocks()
std::pair< bool, std::string > compare(DCCTBEventBlock *)
std::vector< DCCTBTowerBlock * > towerBlocksById(uint32_t towerId)
std::vector< DCCTBTowerBlock * > towerBlocks_
std::string eventErrorString()
DCCTBTrailerBlock * dccTrailerBlock_
DCCTBSRPBlock * srpBlock_
virtual std::pair< bool, std::string > compare(DCCTBBlockPrototype *block)
uint32_t wordBufferOffset_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * emptyEventFields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * dccFields()
std::string & errorString()