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
DCCTBTCCBlock Class Reference

#include <DCCTCCBlock.h>

Inheritance diagram for DCCTBTCCBlock:
DCCTBBlockPrototype

Public Member Functions

 DCCTBTCCBlock (DCCTBEventBlock *dccBlock, DCCTBDataParser *parser, uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordEventOffset, uint32_t expectedId)
 
std::vector< int > triggerFlags ()
 
std::vector< std::pair< int,
bool > > 
triggerSamples ()
 
- 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  tccFields {
  BXMASK = 0xFFF, L1MASK = 0xFFF, BPOSITION_BLOCKID = 29, BLOCKID = 3,
  BPOSITION_FGVB = 8, ETMASK = 0xFF
}
 

Protected Member Functions

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

Protected Attributes

DCCTBEventBlockdccBlock_
 
uint32_t expectedId_
 
- 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 24 of file DCCTCCBlock.h.

Member Enumeration Documentation

enum DCCTBTCCBlock::tccFields
protected

Define TCC block fields BXMASK (mask for BX, 12bit) L1MASK (mask for LV1, 12 bit) BPOSITION_BLOCKID (bit position for TCC block id, bit=61/29 for 64/32bit words BLOCKID (TCC block id B'011' = 3)

Enumerator
BXMASK 
L1MASK 
BPOSITION_BLOCKID 
BLOCKID 
BPOSITION_FGVB 
ETMASK 

Definition at line 62 of file DCCTCCBlock.h.

Constructor & Destructor Documentation

DCCTBTCCBlock::DCCTBTCCBlock ( DCCTBEventBlock dccBlock,
DCCTBDataParser parser,
uint32_t *  buffer,
uint32_t  numbBytes,
uint32_t  wordsToEnd,
uint32_t  wordEventOffset,
uint32_t  expectedId 
)

Class constructor

Definition at line 13 of file DCCTCCBlock.cc.

References dataCheck(), DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBDataParser::numbTTs(), DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, DCCTBDataMapper::tcc16Fields(), DCCTBDataMapper::tcc32Fields(), and DCCTBDataMapper::tcc68Fields().

20  :
21  DCCTBBlockPrototype(parser,"TCC", buffer, numbBytes, wordsToEnd, wordEventOffset),dccBlock_(dccBlock), expectedId_(expectedId){
22 
23  //Reset error counters
24  errors_["TCC::HEADER"] = 0;
25  errors_["TCC::BLOCKID"] = 0;
26 
27  //Get data fields from the mapper and retrieve data
28  if( parser_->numbTTs() == 68){ mapperFields_ = parser_->mapper()->tcc68Fields();}
29  else if( parser_->numbTTs() == 32){ mapperFields_ = parser_->mapper()->tcc32Fields();}
30  else if( parser_->numbTTs() == 16){ mapperFields_ = parser_->mapper()->tcc16Fields();}
31 
32  parseData();
33 
34  // check internal data
35  if(parser_->debug())
36  dataCheck();
37 }
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
uint32_t expectedId_
Definition: DCCTCCBlock.h:72
virtual void parseData()
void dataCheck()
Definition: DCCTCCBlock.cc:43
DCCTBDataParser * parser_
DCCTBBlockPrototype(DCCTBDataParser *parser, std::string name, uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEndOfEvent, uint32_t wordEventOffset=0)
uint32_t numbTTs()
DCCTBDataMapper * mapper()
std::map< std::string, uint32_t > errors_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc32Fields()
DCCTBEventBlock * dccBlock_
Definition: DCCTCCBlock.h:71
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc16Fields()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * tcc68Fields()

Member Function Documentation

void DCCTBTCCBlock::dataCheck ( )
protected

Checks header's data

Definition at line 43 of file DCCTCCBlock.cc.

References DCCTBBlockPrototype::blockError_, BXMASK, DCCTBBlockPrototype::checkDataField(), dccBlock_, DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, expectedId_, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), L1MASK, DCCTBBlockPrototype::name_, and DCCTBBlockPrototype::parser_.

Referenced by DCCTBTCCBlock().

43  {
44  std::pair <bool,std::string> res; //check result
45  std::string checkErrors(""); //error string
46 
47  //check BX(LOCAL) field (1st word bit 16)
48  res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX")));
49  if(!res.first){
50  checkErrors += res.second;
51  (errors_["TCC::HEADER"])++;
52  }
53 
54  //check LV1(LOCAL) field (1st word bit 32)
55  res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1")));
56  if(!res.first){
57  checkErrors += res.second;
58  (errors_["TCC::HEADER"])++;
59  }
60 
61  //check TCC ID field (1st word bit 0)
62  res = checkDataField("TCC ID",expectedId_);
63  if(!res.first){
64  checkErrors += res.second;
65  (errors_["TCC::HEADER"])++;
66  }
67 
68 
69  if(checkErrors!=""){
70  blockError_=true;
71  errorString_ +="\n ======================================================================\n";
72  errorString_ += std::string(" ") + name_ + std::string("( ID = ")+parser_->getDecString((uint32_t)(expectedId_))+std::string(" ) errors : ") ;
73  errorString_ += checkErrors ;
74  errorString_ += "\n ======================================================================";
75  }
76 
77 
78 }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
virtual uint32_t getDataField(std::string name)
uint32_t expectedId_
Definition: DCCTCCBlock.h:72
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
std::map< std::string, uint32_t > errors_
DCCTBEventBlock * dccBlock_
Definition: DCCTCCBlock.h:71
void DCCTBTCCBlock::increment ( uint32_t  numb)
protected

Adds a new TCC block

Definition at line 86 of file DCCTCCBlock.cc.

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

86  {
87  //if no debug is required increments the number of blocks
88  //otherwise checks if block id is really B'011'=3
89  if(!parser_->debug()){
91  }
92  else {
93  for(uint32_t counter=0; counter<numb; counter++, dataP_++, wordCounter_++){
94  uint32_t blockID = (*dataP_) >> BPOSITION_BLOCKID;
95  if( blockID != BLOCKID ){
96  (errors_["TCC::BLOCKID"])++;
97  //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID);
98  //errorString += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected");
99  }
100  }
101  }
102 
103 }
virtual void increment(uint32_t numb, std::string msg="")
DCCTBDataParser * parser_
std::map< std::string, uint32_t > errors_
std::vector< int > DCCTBTCCBlock::triggerFlags ( )

Definition at line 124 of file DCCTCCBlock.cc.

References data, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), i, DCCTBBlockPrototype::name(), DCCTBDataParser::numbTTs(), and DCCTBBlockPrototype::parser_.

124  {
125  std::vector<int> data;
126 
127  for(unsigned int i=1; i<= parser_->numbTTs();i++){
128  std::string name = std::string("TTF#") + parser_->getDecString(i);
129 
130  data.push_back ( getDataField( name ) );
131 
132  }
133 
134  return data;
135 }
virtual uint32_t getDataField(std::string name)
int i
Definition: DBlmapReader.cc:9
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
uint32_t numbTTs()
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::vector< std::pair< int, bool > > DCCTBTCCBlock::triggerSamples ( )

Definition at line 107 of file DCCTCCBlock.cc.

References BPOSITION_FGVB, data, ETMASK, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), i, DCCTBBlockPrototype::name(), DCCTBDataParser::numbTTs(), and DCCTBBlockPrototype::parser_.

107  {
108  std::vector< std::pair<int,bool> > data;
109 
110  for(unsigned int i=1;i <= parser_->numbTTs();i++){
111  std::string name = std::string("TPG#") + parser_->getDecString(i);
112  int tpgValue = getDataField( name ) ;
113  std::pair<int,bool> tpg( tpgValue&ETMASK, bool(tpgValue>>BPOSITION_FGVB));
114  data.push_back (tpg);
115 
116  }
117 
118  return data;
119 }
virtual uint32_t getDataField(std::string name)
int i
Definition: DBlmapReader.cc:9
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
uint32_t numbTTs()
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82

Member Data Documentation

DCCTBEventBlock* DCCTBTCCBlock::dccBlock_
protected

Definition at line 71 of file DCCTCCBlock.h.

Referenced by dataCheck().

uint32_t DCCTBTCCBlock::expectedId_
protected

Definition at line 72 of file DCCTCCBlock.h.

Referenced by dataCheck().