CMS 3D CMS Logo

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

#include <DCCXtalBlock.h>

Inheritance diagram for DCCTBXtalBlock:
DCCTBBlockPrototype

Public Member Functions

void dataCheck ()
 
 DCCTBXtalBlock (DCCTBDataParser *parser, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordEventOffset, uint32_t expectedXtalID, uint32_t expectedStripID)
 
int stripID ()
 
std::vector< int > xtalDataSamples ()
 
int xtalID ()
 
- 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  xtalBlockFields { BPOSITION_BLOCKID = 30, BLOCKID = 3 }
 

Protected Member Functions

void increment (uint32_t numb)
 
virtual void increment (uint32_t numb, std::string msg="")
 
- Protected Member Functions inherited from DCCTBBlockPrototype
std::string formatString (std::string myString, uint32_t minPositions)
 

Protected Attributes

uint32_t expectedStripID_
 
uint32_t expectedXtalID_
 
- 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_
 

Detailed Description

Definition at line 10 of file DCCXtalBlock.h.

Member Enumeration Documentation

◆ xtalBlockFields

Enumerator
BPOSITION_BLOCKID 
BLOCKID 

Definition at line 29 of file DCCXtalBlock.h.

29 { BPOSITION_BLOCKID = 30, BLOCKID = 3 };

Constructor & Destructor Documentation

◆ 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 at line 5 of file DCCXtalBlock.cc.

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 }

References dataCheck(), DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, and DCCTBDataMapper::xtalFields().

Member Function Documentation

◆ dataCheck()

void DCCTBXtalBlock::dataCheck ( )

Definition at line 32 of file DCCXtalBlock.cc.

32  {
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 }

References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::checkDataField(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, expectedStripID_, expectedXtalID_, DCCTBBlockPrototype::name_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DCCTBXtalBlock().

◆ increment() [1/2]

void DCCTBXtalBlock::increment ( uint32_t  numb)
protected

Definition at line 60 of file DCCXtalBlock.cc.

60  {
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 }

References BLOCKID, BPOSITION_BLOCKID, DCCTBBlockPrototype::dataP_, DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::increment(), DCCTBBlockPrototype::parser_, and DCCTBBlockPrototype::wordCounter_.

◆ increment() [2/2]

void DCCTBBlockPrototype::increment
protected

Definition at line 113 of file DCCBlockPrototype.cc.

113  {
115  dataP_ += numb;
116  wordCounter_ += numb;
117 }

◆ stripID()

int DCCTBXtalBlock::stripID ( )

Definition at line 88 of file DCCXtalBlock.cc.

88  {
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 }

References DCCTBBlockPrototype::getDataField(), DCCTBBlockPrototype::mapperFields_, and mps_fire::result.

◆ xtalDataSamples()

std::vector< int > DCCTBXtalBlock::xtalDataSamples ( )

Definition at line 101 of file DCCXtalBlock.cc.

101  {
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 }

References data, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), mps_fire::i, DCCTBBlockPrototype::name(), DCCTBDataParser::numbXtalSamples(), DCCTBBlockPrototype::parser_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ xtalID()

int DCCTBXtalBlock::xtalID ( )

Definition at line 75 of file DCCXtalBlock.cc.

75  {
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 }

References DCCTBBlockPrototype::getDataField(), DCCTBBlockPrototype::mapperFields_, and mps_fire::result.

Member Data Documentation

◆ expectedStripID_

uint32_t DCCTBXtalBlock::expectedStripID_
protected

Definition at line 32 of file DCCXtalBlock.h.

Referenced by dataCheck().

◆ expectedXtalID_

uint32_t DCCTBXtalBlock::expectedXtalID_
protected

Definition at line 31 of file DCCXtalBlock.h.

Referenced by dataCheck().

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:355
DCCTBXtalBlock::dataCheck
void dataCheck()
Definition: DCCXtalBlock.cc:32
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
mps_check.msg
tuple msg
Definition: mps_check.py:285
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
DCCTBDataParser::debug
bool debug()
Definition: DCCDataParser.h:194
DCCTBDataParser::getDecString
std::string getDecString(uint32_t data)
Definition: DCCDataParser.cc:290
DCCTBBlockPrototype::DCCTBBlockPrototype
DCCTBBlockPrototype(DCCTBDataParser *parser, std::string name, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEndOfEvent, uint32_t wordEventOffset=0)
Definition: DCCBlockPrototype.cc:9
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
DCCTBDataMapper::xtalFields
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields()
Definition: DCCDataMapper.h:113
DCCTBBlockPrototype::errors_
std::map< std::string, uint32_t > errors_
Definition: DCCBlockPrototype.h:84
DCCTBBlockPrototype::parser_
DCCTBDataParser * parser_
Definition: DCCBlockPrototype.h:81
DCCTBBlockPrototype::increment
virtual void increment(uint32_t numb, std::string msg="")
Definition: DCCBlockPrototype.cc:113
DCCTBBlockPrototype::name
std::string name()
Definition: DCCBlockPrototype.h:46
DCCTBDataParser::numbXtalSamples
uint32_t numbXtalSamples()
Definition: DCCDataParser.h:175
DCCTBBlockPrototype::getDataField
virtual uint32_t getDataField(std::string name)
Definition: DCCBlockPrototype.cc:194
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DCCTBXtalBlock::expectedXtalID_
uint32_t expectedXtalID_
Definition: DCCXtalBlock.h:31
DCCTBBlockPrototype::parseData
virtual void parseData()
Definition: DCCBlockPrototype.cc:38
DCCTBBlockPrototype::seeIfIsPossibleToIncrement
virtual void seeIfIsPossibleToIncrement(uint32_t numb, std::string msg="")
Definition: DCCBlockPrototype.cc:119
DCCTBBlockPrototype::blockError_
bool blockError_
Definition: DCCBlockPrototype.h:74
DCCTBXtalBlock::BLOCKID
Definition: DCCXtalBlock.h:29
res
Definition: Electron.h:6
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
DCCTBDataParser::mapper
DCCTBDataMapper * mapper()
Definition: DCCDataParser.h:172
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:303