CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DCCSRPBlock.cc
Go to the documentation of this file.
1 #include "DCCSRPBlock.h"
2 #include "DCCDataParser.h"
3 #include "DCCDataMapper.h"
4 #include "DCCEventBlock.h"
5 
8  const uint32_t* buffer,
9  uint32_t numbBytes,
10  uint32_t wordsToEnd,
11  uint32_t wordEventOffset)
12  : DCCTBBlockPrototype(parser, "SRP", buffer, numbBytes, wordsToEnd, wordEventOffset), dccBlock_(dccBlock) {
13  //Reset error counters ///////
14  errors_["SRP::HEADER"] = 0;
15  errors_["SRP::BLOCKID"] = 0;
17 
18  // Get data fields from the mapper and retrieve data /////////////////////////////////////
19  if (parser_->numbSRF() == 68) {
21  } else if (parser_->numbSRF() == 32) {
23  } else if (parser_->numbSRF() == 16) {
25  }
26  parseData();
28 
29  // check internal data ////////////
30  if (parser_->debug()) {
31  dataCheck();
32  }
34 }
35 
37  std::string checkErrors("");
38 
39  std::pair<bool, std::string> res;
40 
41  res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX")));
42  if (!res.first) {
43  checkErrors += res.second;
44  (errors_["SRP::HEADER"])++;
45  }
46  res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1")));
47  if (!res.first) {
48  checkErrors += res.second;
49  (errors_["SRP::HEADER"])++;
50  }
51 
52  res = checkDataField("SRP ID", parser_->srpId());
53  if (!res.first) {
54  checkErrors += res.second;
55  (errors_["SRP::HEADER"])++;
56  }
57 
58  if (!checkErrors.empty()) {
59  errorString_ += "\n ======================================================================\n";
60  errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ");
61  errorString_ += checkErrors;
62  errorString_ += "\n ======================================================================";
63  blockError_ = true;
64  }
65 }
66 
67 void DCCTBSRPBlock::increment(uint32_t numb) {
68  if (!parser_->debug()) {
70  } else {
71  for (uint32_t counter = 0; counter < numb; counter++, dataP_++, wordCounter_++) {
72  uint32_t blockID = (*dataP_) >> BPOSITION_BLOCKID;
73  if (blockID != BLOCKID) {
74  (errors_["SRP::BLOCKID"])++;
75  //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID);
76  //errorString += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected");
77  }
78  }
79  }
80 }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
virtual uint32_t getDataField(std::string name)
virtual void increment(uint32_t numb, std::string msg="")
const uint32_t * dataP_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp32Fields()
virtual void parseData()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
DCCTBDataParser * parser_
void increment(uint32_t numb)
Definition: DCCSRPBlock.cc:67
std::map< std::string, uint32_t > errors_
DCCTBEventBlock * dccBlock_
Definition: DCCSRPBlock.h:35
void dataCheck()
Definition: DCCSRPBlock.cc:36
DCCTBDataMapper * mapper()
uint32_t numbSRF()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp16Fields()
uint32_t srpId()
static std::atomic< unsigned int > counter
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * srp68Fields()
DCCTBSRPBlock(DCCTBEventBlock *dccBlock, DCCTBDataParser *parser, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordEventOffset)
Definition: DCCSRPBlock.cc:6