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

virtual void increment (uint32_t numb, std::string msg="")
 
void increment (uint32_t numb)
 
- 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.

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.

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

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 }
virtual void parseData()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
DCCTBDataParser * parser_
uint32_t expectedStripID_
Definition: DCCXtalBlock.h:32
std::map< std::string, uint32_t > errors_
DCCTBDataMapper * mapper()
uint32_t expectedXtalID_
Definition: DCCXtalBlock.h:31
DCCTBBlockPrototype(DCCTBDataParser *parser, std::string name, const uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEndOfEvent, uint32_t wordEventOffset=0)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields()

Member Function Documentation

◆ dataCheck()

void DCCTBXtalBlock::dataCheck ( )

Definition at line 32 of file DCCXtalBlock.cc.

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

Referenced by DCCTBXtalBlock().

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 }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
uint32_t expectedStripID_
Definition: DCCXtalBlock.h:32
std::map< std::string, uint32_t > errors_
Definition: Electron.h:6
uint32_t expectedXtalID_
Definition: DCCXtalBlock.h:31

◆ increment() [1/2]

void DCCTBBlockPrototype::increment
protected

Definition at line 113 of file DCCBlockPrototype.cc.

113  {
115  dataP_ += numb;
116  wordCounter_ += numb;
117 }
const uint32_t * dataP_
tuple msg
Definition: mps_check.py:285
virtual void seeIfIsPossibleToIncrement(uint32_t numb, std::string msg="")

◆ increment() [2/2]

void DCCTBXtalBlock::increment ( uint32_t  numb)
protected

Definition at line 60 of file DCCXtalBlock.cc.

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

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 }
virtual void increment(uint32_t numb, std::string msg="")
const uint32_t * dataP_
DCCTBDataParser * parser_
std::map< std::string, uint32_t > errors_

◆ stripID()

int DCCTBXtalBlock::stripID ( )

Definition at line 88 of file DCCXtalBlock.cc.

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

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 }
virtual uint32_t getDataField(std::string name)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_

◆ xtalDataSamples()

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

Definition at line 101 of file DCCXtalBlock.cc.

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

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 }
virtual uint32_t getDataField(std::string name)
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
uint32_t numbXtalSamples()
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ xtalID()

int DCCTBXtalBlock::xtalID ( )

Definition at line 75 of file DCCXtalBlock.cc.

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

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 }
virtual uint32_t getDataField(std::string name)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_

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().