CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Protected Attributes
DCCTBEventBlock Class Reference

#include <DCCEventBlock.h>

Inheritance diagram for DCCTBEventBlock:
DCCTBBlockPrototype

Public Member Functions

virtual std::pair< bool, std::string > compare (DCCTBBlockPrototype *block)
 
std::pair< bool, std::string > compare (DCCTBEventBlock *)
 
void dataCheck ()
 
 DCCTBEventBlock (DCCTBDataParser *parser, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordBufferOffset=0, uint32_t wordEventOffset=0)
 
void displayEvent (std::ostream &os=std::cout)
 
std::string eventErrorString ()
 
bool eventHasErrors ()
 
DCCTBSRPBlocksrpBlock ()
 
std::vector< DCCTBTCCBlock * > & tccBlocks ()
 
std::vector< DCCTBTowerBlock * > & towerBlocks ()
 
std::vector< DCCTBTowerBlock * > towerBlocksById (uint32_t towerId)
 
DCCTBTrailerBlocktrailerBlock ()
 
 ~DCCTBEventBlock () override
 
- Public Member Functions inherited from DCCTBBlockPrototype
bool blockError ()
 
virtual std::pair< bool, std::string > checkDataField (std::string name, uint32_t data)
 
virtual std::pair< bool, std::string > compare (DCCTBBlockPrototype *block)
 
 DCCTBBlockPrototype (DCCTBDataParser *parser, std::string name, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEndOfEvent, uint32_t wordEventOffset=0)
 
virtual void displayData (std::ostream &os=std::cout)
 
std::map< std::string, uint32_t > & errorCounters ()
 
std::string & errorString ()
 
virtual uint32_t getDataField (std::string name)
 
virtual uint32_t getDataWord (uint32_t wordPosition, uint32_t bitPosition, uint32_t mask)
 
DCCTBDataParsergetParser ()
 
virtual void increment (uint32_t numb, std::string msg="")
 
std::string name ()
 
virtual void parseData ()
 
virtual void seeIfIsPossibleToIncrement (uint32_t numb, std::string msg="")
 
virtual void setDataField (std::string name, uint32_t data)
 
uint32_t size ()
 
uint32_t wOffset ()
 
virtual ~DCCTBBlockPrototype ()
 

Protected Types

enum  dccFields {
  PHYSICTRIGGER = 1, CALIBRATIONTRIGGER = 2, TESTTRIGGER = 3, TECHNICALTRIGGER = 4,
  CH_ENABLED = 0, CH_DISABLED = 1, CH_TIMEOUT = 2, CH_SUPPRESS = 7,
  SR_NREAD = 0, BOE = 0x5, DCCERROR_EMPTYEVENT = 0x1, TOWERHEADER_SIZE = 8,
  TRAILER_SIZE = 8
}
 

Protected Attributes

DCCTBTrailerBlockdccTrailerBlock_
 
bool emptyEvent
 
DCCTBSRPBlocksrpBlock_
 
std::vector< DCCTBTCCBlock * > tccBlocks_
 
std::vector< DCCTBTowerBlock * > towerBlocks_
 
uint32_t wordBufferOffset_
 
- Protected Attributes inherited from DCCTBBlockPrototype
const uint32_t * beginOfBuffer_
 
bool blockError_
 
uint32_t blockSize_
 
std::string blockString_
 
std::map< std::string, uint32_t > dataFields_
 
const uint32_t * dataP_
 
std::map< std::string, uint32_t > errors_
 
std::string errorString_
 
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
 
std::string name_
 
DCCTBDataParserparser_
 
std::string processingString_
 
uint32_t wordCounter_
 
uint32_t wordEventOffset_
 
uint32_t wordsToEndOfEvent_
 

Additional Inherited Members

- Protected Member Functions inherited from DCCTBBlockPrototype
std::string formatString (std::string myString, uint32_t minPositions)
 

Detailed Description

Definition at line 16 of file DCCEventBlock.h.

Member Enumeration Documentation

◆ dccFields

Enumerator
PHYSICTRIGGER 
CALIBRATIONTRIGGER 
TESTTRIGGER 
TECHNICALTRIGGER 
CH_ENABLED 
CH_DISABLED 
CH_TIMEOUT 
CH_SUPPRESS 
SR_NREAD 
BOE 
DCCERROR_EMPTYEVENT 
TOWERHEADER_SIZE 
TRAILER_SIZE 

Definition at line 42 of file DCCEventBlock.h.

Constructor & Destructor Documentation

◆ DCCTBEventBlock()

DCCTBEventBlock::DCCTBEventBlock ( DCCTBDataParser parser,
const uint32_t *  buffer,
uint32_t  numbBytes,
uint32_t  wordsToEnd,
uint32_t  wordBufferOffset = 0,
uint32_t  wordEventOffset = 0 
)

Definition at line 15 of file DCCEventBlock.cc.

References a, DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::blockSize_, CALIBRATIONTRIGGER, CH_DISABLED, CH_SUPPRESS, CH_TIMEOUT, dataCheck(), DCCTBBlockPrototype::dataP_, DCCERROR_EMPTYEVENT, DCCTBDataMapper::dccFields(), dccTrailerBlock_, DCCTBDataParser::debug(), MillePedeFileConverter_cfg::e, emptyEvent, DCCTBDataMapper::emptyEventFields(), DCCTBDataParser::EMPTYEVENTSIZE, relativeConstraints::error, DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), mps_fire::i, DCCTBBlockPrototype::increment(), DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, DCCTBTowerBlock::parseXtalData(), PHYSICTRIGGER, SR_NREAD, srpBlock_, DCCTBDataParser::srpBlockSize(), AlCaHLTBitMon_QueryRunRegistry::string, suppress, DCCTBDataParser::tcc1Id(), DCCTBDataParser::tcc2Id(), DCCTBDataParser::tcc3Id(), DCCTBDataParser::tcc4Id(), tccBlocks_, DCCTBDataParser::tccBlockSize(), ecaldqm::tccId(), towerBlocks_, TOWERHEADER_SIZE, TRAILER_SIZE, HLT_2023v12_cff::triggerType, and DCCTBBlockPrototype::wordCounter_.

21  : DCCTBBlockPrototype(parser, "DCCHEADER", buffer, numbBytes, wordsToEnd),
22  dccTrailerBlock_(nullptr),
23  srpBlock_(nullptr),
24  wordBufferOffset_(wordBufferOffset) {
25  //Reset error counters ////
26  errors_["DCC::HEADER"] = 0;
27  errors_["DCC::EVENT LENGTH"] = 0;
29 
30  uint32_t wToEnd(0);
31 
32  try {
33  // Get data fields from the mapper and retrieve data ///
34  if (numbBytes == DCCTBDataParser::EMPTYEVENTSIZE) {
36  emptyEvent = true;
37  } else {
39  emptyEvent = false;
40  }
41 
42  try {
43  parseData();
44  } catch (ECALTBParserBlockException &e) { /*ignore*/
45  }
47 
48  // Check internal data //////////////
49  if (parser_->debug()) {
50  dataCheck();
51  }
53 
54  // Check if empty event was produced /////////////////////////////////////////////////////////////////
55 
56  if (!emptyEvent && getDataField("DCC ERRORS") != DCCERROR_EMPTYEVENT) {
57  // Build the SRP block ////////////////////////////////////////////////////////////////////////////////////
58 
59  bool srp(false);
60  uint32_t sr_ch = getDataField("SR_CHSTATUS");
61  if (sr_ch != CH_TIMEOUT && sr_ch != CH_DISABLED) {
62  //Go to the begining of the block
63  increment(1, " (while trying to create a SR Block !)");
64  wToEnd = numbBytes / 4 - wordCounter_ - 1;
65 
66  // Build SRP Block //////////////////////////////////////////////////////////////////////
69 
70  increment((parser_->srpBlockSize()) / 4 - 1);
71  if (getDataField("SR")) {
72  srp = true;
73  }
74  }
75 
77 
78  // Build TCC blocks ////////////////////////////////////////////////////////////////////////////////////////
79  for (uint32_t i = 1; i <= 4; i++) {
80  uint32_t tcc_ch = 0;
81  uint32_t tccId = 0;
82  if (i == 1) {
83  tccId = parser_->tcc1Id();
84  }
85  if (i == 2) {
86  tccId = parser_->tcc2Id();
87  }
88  if (i == 3) {
89  tccId = parser_->tcc3Id();
90  }
91  if (i == 4) {
92  tccId = parser_->tcc4Id();
93  }
94 
95  std::string tcc = std::string("TCC_CHSTATUS#") + parser_->getDecString(i);
96  tcc_ch = getDataField(tcc);
97 
98  if (tcc_ch != CH_TIMEOUT && tcc_ch != CH_DISABLED) {
99  //std::cout<<"\n debug:Building TCC Block, channel enabled without errors"<<std::endl;
100 
101  // Go to the begining of the block
102  increment(1, " (while trying to create a" + tcc + " Block !)");
103 
104  wToEnd = numbBytes / 4 - wordCounter_ - 1;
105  //wToEnd or wordsToEnd ????????????????????????????????????????
106 
107  // Build TCC Block /////////////////////////////////////////////////////////////////////////////////
108  tccBlocks_.push_back(
111 
112  increment((parser_->tccBlockSize()) / 4 - 1);
113  }
114  }
116 
117  // Build channel data //////////////////////////////////////////////////////////////////////////////////////////////////////
118  // See number of channels that we need according to the trigger type //
119  // TODO : WHEN IN LOCAL MODE WE SHOULD CHECK RUN TYPE
120  uint32_t triggerType = getDataField("TRIGGER TYPE");
121  uint32_t numbChannels;
122  if (triggerType == PHYSICTRIGGER) {
123  numbChannels = 68;
124  } else if (triggerType == CALIBRATIONTRIGGER) {
125  numbChannels = 70;
126  }
127  // TODO :: implement other triggers
128  else {
129  std::string error = std::string("\n DCC::HEADER TRIGGER TYPE = ") + parser_->getDecString(triggerType) +
130  std::string(" is not a valid type !");
132  throw a;
133  }
135 
136  // uint32_t chStatus;
137  uint32_t srFlag;
138  bool suppress(false);
139 
140  for (uint32_t i = 1; i <= numbChannels; i++) {
141  std::string chStatusId = std::string("FE_CHSTATUS#") + parser_->getDecString(i);
142  uint32_t chStatus = getDataField(chStatusId);
143 
144  // If srp is on, we need to check if channel was suppressed ////////////////////
145  if (srp) {
146  srFlag = srpBlock_->getDataField(std::string("SR#") + parser_->getDecString(i));
147  if (srFlag == SR_NREAD) {
148  suppress = true;
149  } else {
150  suppress = false;
151  }
152  }
154 
155  if (chStatus != CH_TIMEOUT && chStatus != CH_DISABLED && !suppress && chStatus != CH_SUPPRESS) {
156  //Go to the begining of the block ///////////////////////////////////////////////////////////////////////
157  increment(1, " (while trying to create a TOWERHEADER Block for channel " + parser_->getDecString(i) + " !)");
159 
160  // Instantiate a new tower block//////////////////////////////////////////////////////////////////////////
161  wToEnd = numbBytes / 4 - wordCounter_ - 1;
162  DCCTBTowerBlock *towerBlock =
164  towerBlocks_.push_back(towerBlock);
165  towerBlock->parseXtalData();
167 
168  //go to the end of the block ///////////////////////////////
169  increment((towerBlock->getDataField("BLOCK LENGTH")) * 2 - 1);
171  }
172  }
174 
175  // go to the begining of the block ////////////////////////////////////////////////////////////////////
176  increment(1, " (while trying to create a DCC TRAILER Block !)");
177  wToEnd = numbBytes / 4 - wordCounter_ - 1;
180  }
181 
182  } catch (ECALTBParserException &e) {
183  } catch (ECALTBParserBlockException &e) {
184  // uint32_t nEv = (parser_->dccEvents()).size() +1;
185  errorString_ += std::string(e.what());
186  blockError_ = true;
187  //std::cout<<"cout"<<e.what();
188  }
189 }
uint32_t tcc3Id()
virtual uint32_t getDataField(std::string name)
std::vector< DCCTBTCCBlock * > tccBlocks_
Definition: DCCEventBlock.h:66
uint32_t tccBlockSize()
virtual void increment(uint32_t numb, std::string msg="")
const uint32_t * dataP_
virtual void parseData()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
std::map< std::string, uint32_t > errors_
uint32_t srpBlockSize()
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65
uint32_t tcc2Id()
DCCTBDataMapper * mapper()
uint32_t tcc1Id()
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
double a
Definition: hdecay.h:121
DCCTBBlockPrototype(DCCTBDataParser *parser, std::string name, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEndOfEvent, uint32_t wordEventOffset=0)
DCCTBTrailerBlock * dccTrailerBlock_
Definition: DCCEventBlock.h:67
DCCTBSRPBlock * srpBlock_
Definition: DCCEventBlock.h:68
uint32_t tcc4Id()
uint32_t wordBufferOffset_
Definition: DCCEventBlock.h:69
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * emptyEventFields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * dccFields()

◆ ~DCCTBEventBlock()

DCCTBEventBlock::~DCCTBEventBlock ( )
override

Definition at line 191 of file DCCEventBlock.cc.

References dccTrailerBlock_, srpBlock_, tccBlocks_, and towerBlocks_.

191  {
192  std::vector<DCCTBTCCBlock *>::iterator it1;
193  for (it1 = tccBlocks_.begin(); it1 != tccBlocks_.end(); it1++) {
194  delete (*it1);
195  }
196  tccBlocks_.clear();
197 
198  std::vector<DCCTBTowerBlock *>::iterator it2;
199  for (it2 = towerBlocks_.begin(); it2 != towerBlocks_.end(); it2++) {
200  delete (*it2);
201  }
202  towerBlocks_.clear();
203 
204  if (srpBlock_ != nullptr) {
205  delete srpBlock_;
206  }
207  if (dccTrailerBlock_ != nullptr) {
208  delete dccTrailerBlock_;
209  }
210 }
std::vector< DCCTBTCCBlock * > tccBlocks_
Definition: DCCEventBlock.h:66
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65
DCCTBTrailerBlock * dccTrailerBlock_
Definition: DCCEventBlock.h:67
DCCTBSRPBlock * srpBlock_
Definition: DCCEventBlock.h:68

Member Function Documentation

◆ compare() [1/2]

std::pair< bool, std::string > DCCTBBlockPrototype::compare

Definition at line 233 of file DCCBlockPrototype.cc.

233  {
234  std::pair<bool, std::string> ret(true, "");
235 
236  std::set<DCCTBDataField *, DCCTBDataFieldComparator>::iterator it;
237  std::stringstream out;
238 
239  out << "\n ======================================================================";
240  out << "\n ORIGINAL BLOCK : ";
241  out << "\n Block name : " << name_ << ", size : " << std::dec << blockSize_
242  << " bytes, event WOffset : " << wordEventOffset_;
243  out << "\n COMPARISION BLOCK : ";
244  out << "\n Block name : " << (block->name()) << ", size : " << std::dec << (block->size())
245  << " bytes, event WOffset : " << (block->wOffset());
246  out << "\n =====================================================================";
247 
248  if (block->name() != name_) {
249  ret.first = false;
250  out << "\n ERROR >> It is not possible to compare blocks with different names ! ";
251  ret.second += out.str();
252  return ret;
253  }
254 
255  if (block->size() != blockSize_) {
256  ret.first = false;
257  out << "\n WARNING >> Blocks have different sizes "
258  << "\n WARNING >> Comparision will be carried on untill possible";
259  }
260 
261  if (block->wOffset() != wordEventOffset_) {
262  ret.first = false;
263  out << "\n WARNING >> Blocks have different word offset within the event ";
264  }
265 
266  std::string dataFieldName;
267 
268  for (it = mapperFields_->begin(); it != mapperFields_->end(); it++) {
269  dataFieldName = (*it)->name();
270 
271  uint32_t aValue, bValue;
272 
273  //Access original block data fields /////////////////////////////////////////////////////
274  try {
275  aValue = getDataField(dataFieldName);
276  }
277 
278  catch (ECALTBParserBlockException &e) {
279  ret.first = false;
280  out << "\n ERROR ON ORIGINAL BLOCK unable to get data field :" << dataFieldName;
281  out << "\n Comparision was stoped ! ";
282  ret.second += out.str();
283  return ret;
284  }
286 
287  //Access comparision block data fields ///////////////////////////////////////////////////////
288  try {
289  bValue = block->getDataField(dataFieldName);
290  } catch (ECALTBParserBlockException &e) {
291  ret.first = false;
292  out << "\n ERROR ON COMPARISION BLOCK unable to get data field :" << dataFieldName
293  << "\n Comparision was stoped ! ";
294  ret.second += out.str();
295  return ret;
296  }
298 
299  //std::cout<<"\n data Field name "<<dataFieldName<<std::endl;
300  //std::cout<<"\n aValue "<<std::dec<<aValue<<std::endl;
301  //std::cout<<"\n bValue "<<std::dec<<bValue<<std::endl;
302 
303  // Compare values
304  if (aValue != bValue) {
305  ret.first = false;
306  out << "\n Data Field : " << dataFieldName << "\n ORIGINAL BLOCK value : " << std::dec << std::setw(5) << aValue
307  << " , COMPARISION BLOCK value : " << std::dec << std::setw(5) << bValue;
308  //std::cout<<"\n debug... "<<out<<std::endl;
309  }
310  }
311  out << "\n ======================================================================\n";
312  ret.second = out.str();
313 
314  return ret;
315 }
virtual uint32_t getDataField(std::string name)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
ret
prodAgent to be discontinued

◆ compare() [2/2]

std::pair< bool, std::string > DCCTBEventBlock::compare ( DCCTBEventBlock block)

Definition at line 307 of file DCCEventBlock.cc.

References groupFilesInBlocks::block, DCCTBBlockPrototype::compare(), mps_fire::end, MillePedeFileConverter_cfg::out, runTheMatrix::ret, srpBlock_, tccBlocks_, groupFilesInBlocks::temp, towerBlocks_, and trailerBlock().

307  {
308  // DCC Header comparision ///////////////////////////////
309  std::pair<bool, std::string> ret(DCCTBBlockPrototype::compare(block));
311 
312  std::stringstream out;
313 
314  // Selective readout processor block comparision ////////////////////////////////////////////
315  if (srpBlock_ && block->srpBlock()) {
316  std::pair<bool, std::string> temp(srpBlock_->compare(block->srpBlock()));
317  ret.first = ret.first & temp.first;
318  out << temp.second;
319  } else if (!srpBlock_ && block->srpBlock()) {
320  ret.first = false;
321  out << "\n ====================================================================="
322  << "\n ERROR SR block identified in the ORIGINAL BLOCK ... "
323  << "\n ... but the block is not present in the COMPARISION BLOCK !"
324  << "\n =====================================================================";
325  } else if (srpBlock_ && !(block->srpBlock())) {
326  ret.first = false;
327  out << "\n ====================================================================="
328  << "\n ERROR SR block identified in the COMPARISION BLOCK ... "
329  << "\n ... but the block is not present in the ORIGINAL BLOCK !"
330  << "\n =====================================================================";
331  }
333 
334  // TCC Blocks comparision ////////////////////////////////////////////////////////
335  // check number of TCC blocks
336  int numbTccBlocks_a = tccBlocks_.size();
337  int numbTccBlocks_b = block->tccBlocks().size();
338 
339  if (numbTccBlocks_a != numbTccBlocks_b) {
340  ret.first = false;
341  out << "\n ====================================================================="
342  << "\n ERROR number of TCC blocks in the ORIGINAL BLOCK( =" << numbTccBlocks_a << " )"
343  << "\n and in the COMPARISION BLOCK( = " << numbTccBlocks_b << " is different !"
344  << "\n =====================================================================";
345  }
346 
347  std::vector<DCCTBTCCBlock *>::iterator it1Tcc = tccBlocks_.begin();
348  std::vector<DCCTBTCCBlock *>::iterator it1TccEnd = tccBlocks_.end();
349  std::vector<DCCTBTCCBlock *>::iterator it2Tcc = block->tccBlocks().begin();
350  std::vector<DCCTBTCCBlock *>::iterator it2TccEnd = block->tccBlocks().end();
351 
352  for (; it1Tcc != it1TccEnd && it2Tcc != it2TccEnd; it1Tcc++, it2Tcc++) {
353  std::pair<bool, std::string> temp((*it1Tcc)->compare(*it2Tcc));
354  ret.first = ret.first & temp.first;
355  out << temp.second;
356  }
358 
359  // FE Blocks comparision ////////////////////////////////////////////////////////
360  // check number of FE blocks
361  int numbTowerBlocks_a = towerBlocks_.size();
362  int numbTowerBlocks_b = block->towerBlocks().size();
363 
364  if (numbTowerBlocks_a != numbTowerBlocks_b) {
365  ret.first = false;
366  out << "\n ====================================================================="
367  << "\n ERROR number of Tower blocks in the ORIGINAL BLOCK( =" << numbTowerBlocks_a << " )"
368  << "\n and in the COMPARISION BLOCK( = " << numbTowerBlocks_b << " is different !"
369  << "\n =====================================================================";
370  }
371 
372  std::vector<DCCTBTowerBlock *>::iterator it1Tower = towerBlocks_.begin();
373  std::vector<DCCTBTowerBlock *>::iterator it1TowerEnd = towerBlocks_.end();
374  std::vector<DCCTBTowerBlock *>::iterator it2Tower = (block->towerBlocks()).begin();
375  std::vector<DCCTBTowerBlock *>::iterator it2TowerEnd = (block->towerBlocks()).end();
376 
377  for (; it1Tower != it1TowerEnd && it2Tower != it2TowerEnd; it1Tower++, it2Tower++) {
378  std::pair<bool, std::string> temp((*it1Tower)->compare(*it2Tower));
379  ret.first = ret.first & temp.first;
380  out << temp.second;
381 
382  // Xtal Block comparision ////////////////////////////
383  std::vector<DCCTBXtalBlock *> xtalBlocks1((*it1Tower)->xtalBlocks());
384  std::vector<DCCTBXtalBlock *> xtalBlocks2((*it2Tower)->xtalBlocks());
385  // check number of xtal blocks
386  int numbXtalBlocks_a = xtalBlocks1.size();
387  int numbXtalBlocks_b = xtalBlocks2.size();
388 
389  if (numbXtalBlocks_a != numbXtalBlocks_b) {
390  ret.first = false;
391  out << "\n ====================================================================="
392  << "\n ERROR number of Xtal blocks in this TOWER ORIGINAL BLOCK( =" << numbXtalBlocks_a << " )"
393  << "\n and in the TOWER COMPARISION BLOCK( = " << numbXtalBlocks_b << " is different !"
394  << "\n =====================================================================";
395  }
396 
397  std::vector<DCCTBXtalBlock *>::iterator it1Xtal = xtalBlocks1.begin();
398  std::vector<DCCTBXtalBlock *>::iterator it1XtalEnd = xtalBlocks1.end();
399  std::vector<DCCTBXtalBlock *>::iterator it2Xtal = xtalBlocks1.begin();
400  std::vector<DCCTBXtalBlock *>::iterator it2XtalEnd = xtalBlocks2.end();
401 
402  for (; it1Xtal != it1XtalEnd && it2Xtal != it2XtalEnd; it1Xtal++, it2Xtal++) {
403  std::pair<bool, std::string> temp((*it1Xtal)->compare(*it2Xtal));
404  ret.first = ret.first & temp.first;
405  out << temp.second;
406  }
407  }
408 
409  // Trailer block comparision ////////////////////////////////////////////
410  if (block->trailerBlock() && trailerBlock()) {
411  std::pair<bool, std::string> temp(trailerBlock()->compare(block->trailerBlock()));
412  ret.first = ret.first & temp.first;
413  out << temp.second;
414  }
415 
416  ret.second += out.str();
417 
418  return ret;
419 }
std::vector< DCCTBTCCBlock * > tccBlocks_
Definition: DCCEventBlock.h:66
ret
prodAgent to be discontinued
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65
DCCTBTrailerBlock * trailerBlock()
Definition: DCCEventBlock.h:76
std::pair< bool, std::string > compare(DCCTBEventBlock *)
DCCTBSRPBlock * srpBlock_
Definition: DCCEventBlock.h:68
virtual std::pair< bool, std::string > compare(DCCTBBlockPrototype *block)

◆ dataCheck()

void DCCTBEventBlock::dataCheck ( )

Definition at line 212 of file DCCEventBlock.cc.

References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::blockSize_, BOE, DCCTBBlockPrototype::checkDataField(), emptyEvent, DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, DCCTBDataParser::getDecString(), RecoTauValidation_cfi::header, mps_fire::i, DCCTBBlockPrototype::name_, DCCTBBlockPrototype::parser_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DCCTBEventBlock().

212  {
213  std::string checkErrors("");
214 
215  // Check BOE field/////////////////////////////////////////////////////
216  std::pair<bool, std::string> res = checkDataField("BOE", BOE);
217  if (!res.first) {
218  checkErrors += res.second;
219  (errors_["DCC::HEADER"])++;
220  }
222 
223  // Check H Field //////////////////////////////////////////////////////
224  std::string hField = std::string("H");
225  res = checkDataField(hField, 1);
226  if (!res.first) {
227  checkErrors += res.second;
228  (errors_["DCC::HEADER"])++;
229  }
231 
232  // Check Headers //////////////////////////////////////////////////////////
233  uint32_t dccHeaderWords = 0;
234 
235  if (emptyEvent) {
236  dccHeaderWords = 2;
237  } else if (!emptyEvent) {
238  dccHeaderWords = 7;
239  }
240 
241  for (uint32_t i = 1; i <= dccHeaderWords; i++) {
244  if (!res.first) {
245  checkErrors += res.second;
246  (errors_["DCC::HEADER"])++;
247  }
248  }
250 
251  // Check event length ///////////////////////////////////////////////////////
252  res = checkDataField("EVENT LENGTH", blockSize_ / 8);
253  if (!res.first) {
254  checkErrors += res.second;
255  (errors_["DCC::EVENT LENGTH"])++;
256  }
258 
259  if (!checkErrors.empty()) {
260  errorString_ += "\n ======================================================================\n";
261  errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ");
262  errorString_ += checkErrors;
263  errorString_ += "\n ======================================================================";
264  blockError_ = true;
265  }
266 }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
std::map< std::string, uint32_t > errors_
Definition: Electron.h:6

◆ displayEvent()

void DCCTBEventBlock::displayEvent ( std::ostream &  os = std::cout)

Definition at line 268 of file DCCEventBlock.cc.

References dccTrailerBlock_, TauDecayModes::dec, DCCTBBlockPrototype::displayData(), srpBlock_, tccBlocks_, towerBlocks_, and wordBufferOffset_.

268  {
269  os << "\n\n\n\n\n >>>>>>>>>>>>>>>>>>>> Event started at word position " << std::dec << wordBufferOffset_
270  << " <<<<<<<<<<<<<<<<<<<<" << std::endl;
271 
272  // Display DCC Header ///
273  displayData(os);
275 
276  // Display SRP Block Contents //////////////
277  if (srpBlock_) {
278  srpBlock_->displayData(os);
279  }
281 
282  // Display TCC Block Contents ///////////////////////////////
283  std::vector<DCCTBTCCBlock *>::iterator it1;
284  for (it1 = tccBlocks_.begin(); it1 != tccBlocks_.end(); it1++) {
285  (*it1)->displayData(os);
286  }
287 
288  // Display Towers Blocks /////////////////////////////////////
289  std::vector<DCCTBTowerBlock *>::iterator it2;
290  for (it2 = towerBlocks_.begin(); it2 != towerBlocks_.end(); it2++) {
291  (*it2)->displayData(os);
292 
293  // Display Xtal Data /////////////////////////////////////
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);
298  }
299  }
300 
301  // Display Trailer Block Contents /////////////////////////
302  if (dccTrailerBlock_) {
304  }
305 }
std::vector< DCCTBTCCBlock * > tccBlocks_
Definition: DCCEventBlock.h:66
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65
virtual void displayData(std::ostream &os=std::cout)
DCCTBTrailerBlock * dccTrailerBlock_
Definition: DCCEventBlock.h:67
DCCTBSRPBlock * srpBlock_
Definition: DCCEventBlock.h:68
uint32_t wordBufferOffset_
Definition: DCCEventBlock.h:69

◆ eventErrorString()

std::string DCCTBEventBlock::eventErrorString ( )

Definition at line 462 of file DCCEventBlock.cc.

References dccTrailerBlock_, DCCTBBlockPrototype::errorString(), eventHasErrors(), DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), DCCTBBlockPrototype::parser_, runTheMatrix::ret, srpBlock_, AlCaHLTBitMon_QueryRunRegistry::string, tccBlocks_, groupFilesInBlocks::temp, and towerBlocks_.

462  {
463  std::string ret("");
464 
465  if (eventHasErrors()) {
466  ret += "\n ======================================================================\n";
467  ret += std::string(" Event Erros occurred for L1A ( decoded value ) = ");
468  ret += parser_->getDecString(getDataField("LV1"));
469  ret += "\n ======================================================================";
470 
471  ret += errorString();
472 
473  // TODO ::
474  // See if we have errors in the TCC Block Contents /////////////
475  std::vector<DCCTBTCCBlock *>::iterator it1;
476  for (it1 = tccBlocks_.begin(); it1 != tccBlocks_.end(); it1++) {
477  ret += (*it1)->errorString();
478  }
480  // See if we have errors in the SRP Block ////
481  if (srpBlock_) {
482  ret += srpBlock_->errorString();
483  }
485 
486  // See if we have errors in the Tower Blocks ///////////////////////////////////////////////////
487  std::vector<DCCTBTowerBlock *>::iterator it2;
488 
489  for (it2 = towerBlocks_.begin(); it2 != towerBlocks_.end(); it2++) {
490  ret += (*it2)->errorString();
491 
492  // See if we have errors in the Xtal Data /////////////////
493  std::vector<DCCTBXtalBlock *> &xtalBlocks = (*it2)->xtalBlocks();
494  std::vector<DCCTBXtalBlock *>::iterator it3;
495 
497  for (it3 = xtalBlocks.begin(); it3 != xtalBlocks.end(); it3++) {
498  temp += (*it3)->errorString();
499  }
500 
501  if (!temp.empty()) {
502  ret += "\n Fine grain data Errors found ...";
503  ret += "\n( Tower ID = " + parser_->getDecString((*it2)->getDataField("TT/SC ID"));
504  ret += ", LV1 = " + parser_->getDecString((*it2)->getDataField("LV1"));
505  ret += ", BX = " + parser_->getDecString((*it2)->getDataField("BX")) + " )";
506  ret += temp;
507  }
509  }
510 
511  // See if we have errors in the trailler ////////////////////
512  if (dccTrailerBlock_) {
514  }
516  }
517 
518  return ret;
519 }
virtual uint32_t getDataField(std::string name)
std::vector< DCCTBTCCBlock * > tccBlocks_
Definition: DCCEventBlock.h:66
ret
prodAgent to be discontinued
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65
DCCTBTrailerBlock * dccTrailerBlock_
Definition: DCCEventBlock.h:67
DCCTBSRPBlock * srpBlock_
Definition: DCCEventBlock.h:68
std::string & errorString()

◆ eventHasErrors()

bool DCCTBEventBlock::eventHasErrors ( )

Definition at line 421 of file DCCEventBlock.cc.

References DCCTBBlockPrototype::blockError(), dccTrailerBlock_, runTheMatrix::ret, srpBlock_, tccBlocks_, and towerBlocks_.

Referenced by eventErrorString().

421  {
422  bool ret(false);
423  ret = blockError();
424 
425  // See if we have errors in the TCC Block Contents ///////////////////////////////
426  std::vector<DCCTBTCCBlock *>::iterator it1;
427  for (it1 = tccBlocks_.begin(); it1 != tccBlocks_.end(); it1++) {
428  ret |= (*it1)->blockError();
429  }
431 
432  // See if we have errors in the SRP Block /////////
433  if (srpBlock_) {
434  ret |= srpBlock_->blockError();
435  }
437 
438  // See if we have errors in the Trigger Blocks ///////////////
439  std::vector<DCCTBTowerBlock *>::iterator it2;
440  for (it2 = towerBlocks_.begin(); it2 != towerBlocks_.end(); it2++) {
441  ret |= (*it2)->blockError();
442 
443  // See if we have errors in the Xtal Data /////////////////
444  std::vector<DCCTBXtalBlock *> &xtalBlocks = (*it2)->xtalBlocks();
445  std::vector<DCCTBXtalBlock *>::iterator it3;
446  for (it3 = xtalBlocks.begin(); it3 != xtalBlocks.end(); it3++) {
447  ret |= (*it3)->blockError();
448  }
450  }
452 
453  // See if we have errors in the trailler ///////////////////
454  if (dccTrailerBlock_) {
456  }
458 
459  return ret;
460 }
std::vector< DCCTBTCCBlock * > tccBlocks_
Definition: DCCEventBlock.h:66
ret
prodAgent to be discontinued
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65
DCCTBTrailerBlock * dccTrailerBlock_
Definition: DCCEventBlock.h:67
DCCTBSRPBlock * srpBlock_
Definition: DCCEventBlock.h:68

◆ srpBlock()

DCCTBSRPBlock * DCCTBEventBlock::srpBlock ( )
inline

Definition at line 75 of file DCCEventBlock.h.

References srpBlock_.

75 { return srpBlock_; }
DCCTBSRPBlock * srpBlock_
Definition: DCCEventBlock.h:68

◆ tccBlocks()

std::vector< DCCTBTCCBlock * > & DCCTBEventBlock::tccBlocks ( )
inline

Definition at line 74 of file DCCEventBlock.h.

References tccBlocks_.

74 { return tccBlocks_; }
std::vector< DCCTBTCCBlock * > tccBlocks_
Definition: DCCEventBlock.h:66

◆ towerBlocks()

std::vector< DCCTBTowerBlock * > & DCCTBEventBlock::towerBlocks ( )
inline

Definition at line 73 of file DCCEventBlock.h.

References towerBlocks_.

73 { return towerBlocks_; }
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65

◆ towerBlocksById()

std::vector< DCCTBTowerBlock * > DCCTBEventBlock::towerBlocksById ( uint32_t  towerId)

Definition at line 521 of file DCCEventBlock.cc.

References MillePedeFileConverter_cfg::e, towerBlocks_, and ecaldqm::towerId().

521  {
522  std::vector<DCCTBTowerBlock *> myVector;
523  std::vector<DCCTBTowerBlock *>::iterator it;
524 
525  for (it = towerBlocks_.begin(); it != towerBlocks_.end(); it++) {
526  try {
527  std::pair<bool, std::string> idCheck = (*it)->checkDataField("TT/SC ID", towerId);
528 
529  if (idCheck.first) {
530  myVector.push_back((*it));
531  }
532  } catch (ECALTBParserBlockException &e) { /*ignore*/
533  }
534  }
535 
536  return myVector;
537 }
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
std::vector< DCCTBTowerBlock * > towerBlocks_
Definition: DCCEventBlock.h:65

◆ trailerBlock()

DCCTBTrailerBlock * DCCTBEventBlock::trailerBlock ( )
inline

Definition at line 76 of file DCCEventBlock.h.

References dccTrailerBlock_.

Referenced by compare().

76 { return dccTrailerBlock_; }
DCCTBTrailerBlock * dccTrailerBlock_
Definition: DCCEventBlock.h:67

Member Data Documentation

◆ dccTrailerBlock_

DCCTBTrailerBlock* DCCTBEventBlock::dccTrailerBlock_
protected

◆ emptyEvent

bool DCCTBEventBlock::emptyEvent
protected

Definition at line 70 of file DCCEventBlock.h.

Referenced by dataCheck(), and DCCTBEventBlock().

◆ srpBlock_

DCCTBSRPBlock* DCCTBEventBlock::srpBlock_
protected

◆ tccBlocks_

std::vector<DCCTBTCCBlock*> DCCTBEventBlock::tccBlocks_
protected

◆ towerBlocks_

std::vector<DCCTBTowerBlock*> DCCTBEventBlock::towerBlocks_
protected

◆ wordBufferOffset_

uint32_t DCCTBEventBlock::wordBufferOffset_
protected

Definition at line 69 of file DCCEventBlock.h.

Referenced by displayEvent().