test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, 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, 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)
 
- 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
uint32_t * beginOfBuffer_
 
bool blockError_
 
uint32_t blockSize_
 
std::string blockString_
 
std::map< std::string, uint32_t > dataFields_
 
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

Enumerator
BPOSITION_BLOCKID 
BLOCKID 

Definition at line 33 of file DCCXtalBlock.h.

Constructor & Destructor Documentation

DCCTBXtalBlock::DCCTBXtalBlock ( DCCTBDataParser parser,
uint32_t *  buffer,
uint32_t  numbBytes,
uint32_t  wordsToEnd,
uint32_t  wordEventOffset,
uint32_t  expectedXtalID,
uint32_t  expectedStripID 
)

Definition at line 6 of file DCCXtalBlock.cc.

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

14  : DCCTBBlockPrototype(parser,"XTAL", buffer, numbBytes, wordsToEnd, wordEventOffset),
15 expectedXtalID_(expectedXtalID), expectedStripID_(expectedStripID){
16 
17 
18  //Reset error counters ////
19  errors_["XTAL::HEADER"] = 0;
20  errors_["XTAL::BLOCKID"] = 0;
22 
23  // Get data fields from the mapper and retrieve data /////////////////////////////////////
25  parseData();
27 
28  // check internal data ////////////
29  if(parser_->debug()){ dataCheck();}
31 
32 }
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
virtual void parseData()
DCCTBDataParser * parser_
DCCTBBlockPrototype(DCCTBDataParser *parser, std::string name, uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEndOfEvent, uint32_t wordEventOffset=0)
uint32_t expectedStripID_
Definition: DCCXtalBlock.h:36
DCCTBDataMapper * mapper()
std::map< std::string, uint32_t > errors_
uint32_t expectedXtalID_
Definition: DCCXtalBlock.h:35
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * xtalFields()

Member Function Documentation

void DCCTBXtalBlock::dataCheck ( )

Definition at line 36 of file DCCXtalBlock.cc.

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

Referenced by DCCTBXtalBlock().

36  {
37 
38  std::string checkErrors("");
39 
40  std::pair <bool,std::string> res;
41 
42 
43  if(expectedXtalID_ !=0){
44  res = checkDataField("XTAL ID",expectedXtalID_);
45  if(!res.first){ checkErrors += res.second; (errors_["XTAL::HEADER"])++; }
46  }
47  if(expectedStripID_!=0){
48  res = checkDataField("STRIP ID",expectedStripID_);
49  if(!res.first){ checkErrors += res.second; (errors_["XTAL::HEADER"])++; }
50  }
51  if(checkErrors!=""){
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 }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
uint32_t expectedStripID_
Definition: DCCXtalBlock.h:36
std::map< std::string, uint32_t > errors_
uint32_t expectedXtalID_
Definition: DCCXtalBlock.h:35
void DCCTBXtalBlock::increment ( uint32_t  numb)
protected

Definition at line 62 of file DCCXtalBlock.cc.

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

62  {
64  else {
65  for(uint32_t counter=0; counter<numb; counter++, dataP_++,wordCounter_++){
66  uint32_t blockID = (*dataP_)>>BPOSITION_BLOCKID;
67  if( blockID != BLOCKID ){
68  (errors_["XTAL::BLOCKID"])++;
69  //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID);
70  //errorString += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected");
71  }
72  }
73  }
74 }
virtual void increment(uint32_t numb, std::string msg="")
DCCTBDataParser * parser_
std::map< std::string, uint32_t > errors_
static std::atomic< unsigned int > counter
int DCCTBXtalBlock::stripID ( )

Definition at line 94 of file DCCXtalBlock.cc.

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

94  {
95  int result=-1;
96 
97  for(std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator it = mapperFields_->begin(); it!= mapperFields_->end(); it++){
98  if ( (*it)->name() == "STRIP ID" )
99  result=getDataField( (*it)->name() ) ;
100 
101  }
102 
103  return result;
104 
105 }
virtual uint32_t getDataField(std::string name)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
tuple result
Definition: mps_fire.py:83
std::vector< int > DCCTBXtalBlock::xtalDataSamples ( )

Definition at line 109 of file DCCXtalBlock.cc.

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

109  {
110  std::vector<int> data;
111 
112 
113  for(unsigned int i=1;i <= parser_->numbXtalSamples();i++){
115 
116  data.push_back ( getDataField( name ) );
117 
118  }
119 
120  return data;
121 }
virtual uint32_t getDataField(std::string name)
int i
Definition: DBlmapReader.cc:9
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
uint32_t numbXtalSamples()
int DCCTBXtalBlock::xtalID ( )

Definition at line 76 of file DCCXtalBlock.cc.

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

76  {
77 
78  int result=-1;
79 
80  for( std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator
81  it = mapperFields_->begin(); it!= mapperFields_->end(); it++){
82 
83  if ( (*it)->name() == "XTAL ID" )
84  result=getDataField( (*it)->name() ) ;
85 
86  }
87 
88 
89 
90  return result;
91 
92 }
virtual uint32_t getDataField(std::string name)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
tuple result
Definition: mps_fire.py:83

Member Data Documentation

uint32_t DCCTBXtalBlock::expectedStripID_
protected

Definition at line 36 of file DCCXtalBlock.h.

Referenced by dataCheck().

uint32_t DCCTBXtalBlock::expectedXtalID_
protected

Definition at line 35 of file DCCXtalBlock.h.

Referenced by dataCheck().