CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DCCXtalBlock.cc
Go to the documentation of this file.
1 #include "DCCXtalBlock.h"
2 #include "DCCDataParser.h"
3 #include "DCCDataMapper.h"
4 
6  const uint32_t *buffer,
7  uint32_t numbBytes,
8  uint32_t wordsToEnd,
9  uint32_t wordEventOffset,
10  uint32_t expectedXtalID,
11  uint32_t expectedStripID)
12  : DCCTBBlockPrototype(parser, "XTAL", buffer, numbBytes, wordsToEnd, wordEventOffset),
13  expectedXtalID_(expectedXtalID),
14  expectedStripID_(expectedStripID) {
15  //Reset error counters ////
16  errors_["XTAL::HEADER"] = 0;
17  errors_["XTAL::BLOCKID"] = 0;
19 
20  // Get data fields from the mapper and retrieve data /////////////////////////////////////
22  parseData();
24 
25  // check internal data ////////////
26  if (parser_->debug()) {
27  dataCheck();
28  }
30 }
31 
33  std::string checkErrors("");
34 
35  std::pair<bool, std::string> res;
36 
37  if (expectedXtalID_ != 0) {
38  res = checkDataField("XTAL ID", expectedXtalID_);
39  if (!res.first) {
40  checkErrors += res.second;
41  (errors_["XTAL::HEADER"])++;
42  }
43  }
44  if (expectedStripID_ != 0) {
45  res = checkDataField("STRIP ID", expectedStripID_);
46  if (!res.first) {
47  checkErrors += res.second;
48  (errors_["XTAL::HEADER"])++;
49  }
50  }
51  if (!checkErrors.empty()) {
52  errorString_ += "\n ======================================================================\n";
53  errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ");
54  errorString_ += checkErrors;
55  errorString_ += "\n ======================================================================";
56  blockError_ = true;
57  }
58 }
59 
60 void DCCTBXtalBlock::increment(uint32_t numb) {
61  if (!parser_->debug()) {
63  } else {
64  for (uint32_t counter = 0; counter < numb; counter++, dataP_++, wordCounter_++) {
65  uint32_t blockID = (*dataP_) >> BPOSITION_BLOCKID;
66  if (blockID != BLOCKID) {
67  (errors_["XTAL::BLOCKID"])++;
68  //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID);
69  //errorString += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected");
70  }
71  }
72  }
73 }
74 
76  int result = -1;
77 
78  for (std::set<DCCTBDataField *, DCCTBDataFieldComparator>::iterator it = mapperFields_->begin();
79  it != mapperFields_->end();
80  it++) {
81  if ((*it)->name() == "XTAL ID")
82  result = getDataField((*it)->name());
83  }
84 
85  return result;
86 }
87 
89  int result = -1;
90 
91  for (std::set<DCCTBDataField *, DCCTBDataFieldComparator>::iterator it = mapperFields_->begin();
92  it != mapperFields_->end();
93  it++) {
94  if ((*it)->name() == "STRIP ID")
95  result = getDataField((*it)->name());
96  }
97 
98  return result;
99 }
100 
102  std::vector<int> data;
103 
104  for (unsigned int i = 1; i <= parser_->numbXtalSamples(); i++) {
106 
107  data.push_back(getDataField(name));
108  }
109 
110  return data;
111 }
DCCTBXtalBlock::expectedStripID_
uint32_t expectedStripID_
Definition: DCCXtalBlock.h:32
counter
Definition: counter.py:1
DCCTBBlockPrototype::mapperFields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
Definition: DCCBlockPrototype.h:86
mps_fire.i
i
Definition: mps_fire.py:428
DCCTBXtalBlock::stripID
int stripID()
Definition: DCCXtalBlock.cc:88
DCCTBXtalBlock::dataCheck
void dataCheck()
Definition: DCCXtalBlock.cc:32
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
DCCTBBlockPrototype::wordCounter_
uint32_t wordCounter_
Definition: DCCBlockPrototype.h:70
DCCTBBlockPrototype::checkDataField
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
Definition: DCCBlockPrototype.cc:173
DCCTBXtalBlock::DCCTBXtalBlock
DCCTBXtalBlock(DCCTBDataParser *parser, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordEventOffset, uint32_t expectedXtalID, uint32_t expectedStripID)
Definition: DCCXtalBlock.cc:5
DCCTBDataParser::debug
bool debug()
Definition: DCCDataParser.h:194
DCCTBDataParser::getDecString
std::string getDecString(uint32_t data)
Definition: DCCDataParser.cc:290
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
DCCTBDataMapper::xtalFields
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields()
Definition: DCCDataMapper.h:113
DCCDataParser.h
DCCTBBlockPrototype::errors_
std::map< std::string, uint32_t > errors_
Definition: DCCBlockPrototype.h:84
DCCTBBlockPrototype::parser_
DCCTBDataParser * parser_
Definition: DCCBlockPrototype.h:81
DCCDataMapper.h
DCCTBBlockPrototype::increment
virtual void increment(uint32_t numb, std::string msg="")
Definition: DCCBlockPrototype.cc:113
DCCTBBlockPrototype::name
std::string name()
Definition: DCCBlockPrototype.h:46
DCCXtalBlock.h
DCCTBDataParser::numbXtalSamples
uint32_t numbXtalSamples()
Definition: DCCDataParser.h:175
DCCTBBlockPrototype::getDataField
virtual uint32_t getDataField(std::string name)
Definition: DCCBlockPrototype.cc:194
DCCTBXtalBlock::increment
void increment(uint32_t numb)
Definition: DCCXtalBlock.cc:60
DCCTBXtalBlock::expectedXtalID_
uint32_t expectedXtalID_
Definition: DCCXtalBlock.h:31
DCCTBBlockPrototype::parseData
virtual void parseData()
Definition: DCCBlockPrototype.cc:38
DCCTBBlockPrototype::blockError_
bool blockError_
Definition: DCCBlockPrototype.h:74
DCCTBXtalBlock::xtalDataSamples
std::vector< int > xtalDataSamples()
Definition: DCCXtalBlock.cc:101
DCCTBXtalBlock::BLOCKID
Definition: DCCXtalBlock.h:29
res
Definition: Electron.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DCCTBBlockPrototype::errorString_
std::string errorString_
Definition: DCCBlockPrototype.h:77
DCCTBXtalBlock::BPOSITION_BLOCKID
Definition: DCCXtalBlock.h:29
DCCTBBlockPrototype::dataP_
const uint32_t * dataP_
Definition: DCCBlockPrototype.h:66
DCCTBXtalBlock::xtalID
int xtalID()
Definition: DCCXtalBlock.cc:75
DCCTBDataParser::mapper
DCCTBDataMapper * mapper()
Definition: DCCDataParser.h:172
DCCTBDataParser
Definition: DCCDataParser.h:25
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DCCTBBlockPrototype::name_
std::string name_
Definition: DCCBlockPrototype.h:76
mps_fire.result
result
Definition: mps_fire.py:311
DCCTBBlockPrototype
Definition: DCCBlockPrototype.h:21