CMS 3D CMS Logo

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

#include <DCCTowerBlock.h>

Inheritance diagram for DCCTBTowerBlock:
DCCTBBlockPrototype

Public Member Functions

 DCCTBTowerBlock (DCCTBEventBlock *dccBlock, DCCTBDataParser *parser, uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordEventOffset, uint32_t expectedTowerID)
 
void parseXtalData ()
 
int towerID ()
 
std::vector< DCCTBXtalBlock * > & xtalBlocks ()
 
std::vector< DCCTBXtalBlock * > xtalBlocksById (uint32_t stripId, uint32_t xtalId)
 
 ~DCCTBTowerBlock ()
 
- 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  towerFields { BXMASK = 0xFFF, L1MASK = 0xFFF }
 

Protected Member Functions

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

Protected Attributes

DCCTBEventBlockdccBlock_
 
uint32_t expectedTowerID_
 
std::vector< DCCTBXtalBlock * > xtalBlocks_
 
- 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 21 of file DCCTowerBlock.h.

Member Enumeration Documentation

Enumerator
BXMASK 
L1MASK 

Definition at line 48 of file DCCTowerBlock.h.

Constructor & Destructor Documentation

DCCTBTowerBlock::DCCTBTowerBlock ( DCCTBEventBlock dccBlock,
DCCTBDataParser parser,
uint32_t *  buffer,
uint32_t  numbBytes,
uint32_t  wordsToEnd,
uint32_t  wordEventOffset,
uint32_t  expectedTowerID 
)

Definition at line 11 of file DCCTowerBlock.cc.

References DCCTBBlockPrototype::errors_, DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, and DCCTBDataMapper::towerFields().

20 : DCCTBBlockPrototype(parser,"TOWERHEADER", buffer, numbBytes,wordsToEnd, wordEventOffset )
21  , dccBlock_(dccBlock), expectedTowerID_(expectedTowerID)
22 {
23 
24  //Reset error counters ///////////
25  errors_["FE::HEADER"] = 0;
26  errors_["FE::TT/SC ID"] = 0;
27  errors_["FE::BLOCK LENGTH"] = 0;
29 
30 
31 
32  // Get data fields from the mapper and retrieve data /////////////////////////////////////
34  parseData();
36  }
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)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * towerFields()
DCCTBDataMapper * mapper()
std::map< std::string, uint32_t > errors_
uint32_t expectedTowerID_
Definition: DCCTowerBlock.h:52
DCCTBEventBlock * dccBlock_
Definition: DCCTowerBlock.h:51
DCCTBTowerBlock::~DCCTBTowerBlock ( )

Definition at line 118 of file DCCTowerBlock.cc.

References xtalBlocks_.

118  {
119  std::vector<DCCTBXtalBlock *>::iterator it;
120  for(it=xtalBlocks_.begin();it!=xtalBlocks_.end();it++){ delete (*it);}
121  xtalBlocks_.clear();
122 }
std::vector< DCCTBXtalBlock * > xtalBlocks_
Definition: DCCTowerBlock.h:50

Member Function Documentation

void DCCTBTowerBlock::dataCheck ( )
protected

Definition at line 126 of file DCCTowerBlock.cc.

References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::checkDataField(), dccBlock_, DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, expectedTowerID_, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), L1MASK, DCCTBBlockPrototype::name_, DCCTBBlockPrototype::parser_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by parseXtalData().

126  {
127  std::string checkErrors("");
128 
129 
130  std::pair <bool,std::string> res;
131 
133  // For TB we don-t check Bx
134  //res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX")));
135  //if(!res.first){ checkErrors += res.second; (errors_["FE::HEADER"])++; }
137 
138  // mod to account for ECAL counters starting from 0 in the front end N. Almeida
139  res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1") -1) );
140  if(!res.first){ checkErrors += res.second; (errors_["FE::HEADER"])++; }
141 
142 
143  if(expectedTowerID_ != 0){
144  res = checkDataField("TT/SC ID",expectedTowerID_);
145  if(!res.first){ checkErrors += res.second; (errors_["FE::HEADER"])++; }
146  }
147 
148  if( checkErrors !="" ){
149  std::string myTowerId;
150 
151  errorString_ +="\n ======================================================================\n";
152  errorString_ += std::string(" ") + name_ + std::string("( ID = ")+parser_->getDecString((uint32_t)(expectedTowerID_))+std::string(" ) errors : ") ;
153  errorString_ += checkErrors ;
154  errorString_ += "\n ======================================================================";
155  blockError_ = true;
156  }
157 }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
virtual uint32_t getDataField(std::string name)
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
Definition: Electron.h:4
std::map< std::string, uint32_t > errors_
uint32_t expectedTowerID_
Definition: DCCTowerBlock.h:52
DCCTBEventBlock * dccBlock_
Definition: DCCTowerBlock.h:51
void DCCTBTowerBlock::parseXtalData ( )

Definition at line 39 of file DCCTowerBlock.cc.

References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::blockSize_, dataCheck(), DCCTBBlockPrototype::dataP_, dccBlock_, DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), DCCTBBlockPrototype::increment(), DCCTBBlockPrototype::name_, DCCTBDataParser::numbXtalSamples(), DCCTBBlockPrototype::parser_, AlCaHLTBitMon_QueryRunRegistry::string, DCCTBBlockPrototype::wordCounter_, DCCTBBlockPrototype::wordEventOffset_, DCCTBBlockPrototype::wordsToEndOfEvent_, and xtalBlocks_.

Referenced by DCCTBEventBlock::DCCTBEventBlock().

39  {
40 
41  uint32_t numbBytes = blockSize_;
42  uint32_t wordsToEnd =wordsToEndOfEvent_;
43 
44  // See if we can construct the correct number of XTAL Blocks////////////////////////////////////////////////////////////////////////////////
45  uint32_t numbDWInXtalBlock = ( parser_->numbXtalSamples() )/4 + 1;
46  uint32_t length = getDataField("BLOCK LENGTH");
47  uint32_t numbOfXtalBlocks = 0 ;
48 
49  if( length > 0 ){ numbOfXtalBlocks = (length-1)/numbDWInXtalBlock; }
50  uint32_t xtalBlockSize = numbDWInXtalBlock*8;
51  //uint32_t pIncrease = numbDWInXtalBlock*2;
52 
53  //std::cout<<"\n DEBUG::numbDWInXtal Block "<<dec<<numbDWInXtalBlock<<std::endl;
54  //std::cout<<"\n DEBUG::length "<<length<<std::endl;
55  //std::cout<<"\n DEBUG::xtalBlockSize "<<xtalBlockSize<<std::endl;
56  //std::cout<<"\n DEBUG::pIncreade "<<pIncrease<<std::endl;
57 
58 
59 
60  bool zs = dccBlock_->getDataField("ZS");
61  if( !zs && numbOfXtalBlocks != 25 ){
62 
63 
64  (errors_["FE::BLOCK LENGTH"])++;
65  errorString_ += "\n ======================================================================\n";
66  errorString_ += std::string(" ") + name_ + std::string(" ZS is not active, error in the Tower Length !") ;
67  errorString_ += "\n Tower Length is : " + (parser_->getDecString(numbBytes/8))+std::string(" , while it should be : ");
68  std::string myString = parser_->getDecString((uint32_t)(25*numbDWInXtalBlock+1));
69  errorString_ += "\n It was only possible to build : " + parser_->getDecString( numbOfXtalBlocks)+ std::string(" XTAL blocks");
70  errorString_ += "\n ======================================================================";
71  blockError_ = true;
72  };
73  if( numbOfXtalBlocks > 25 ){
74  if (errors_["FE::BLOCK LENGTH"]==0)(errors_["FE::BLOCK LENGTH"])++;
75  errorString_ += "\n ======================================================================\n";
76  errorString_ += std::string(" ") + name_ + std::string(" Tower Length is larger then expected...!") ;
77  errorString_ += "\n Tower Length is : " + parser_->getDecString(numbBytes/8)+std::string(" , while it should be at maximum : ");
78  std::string myString = parser_->getDecString((uint32_t)(25*numbDWInXtalBlock+1));
79  errorString_ += "\n Action -> data after the xtal 25 is ignored... ";
80  errorString_ += "\n ======================================================================";
81  blockError_ = true;
82 
83  }
85 
86  blockSize_ += length*8; //??????????????????????
87 
88  // Get XTAL Data //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
89  uint32_t stripID, xtalID;
90 
91 
92  for(uint32_t numbXtal=1; numbXtal <= numbOfXtalBlocks && numbXtal <=25 ; numbXtal++){
93 
94  increment(1);
95 
96  stripID =( numbXtal-1)/5 + 1;
97  xtalID = numbXtal - (stripID-1)*5;
98 
99 
100  if(!zs){
101  xtalBlocks_.push_back( new DCCTBXtalBlock( parser_, dataP_, xtalBlockSize, wordsToEnd-wordCounter_,wordCounter_+wordEventOffset_,xtalID, stripID) );
102  }else{
103  xtalBlocks_.push_back( new DCCTBXtalBlock( parser_, dataP_, xtalBlockSize, wordsToEnd-wordCounter_,wordCounter_+wordEventOffset_,0,0));
104  }
105 
106  increment(xtalBlockSize/4-1);
107  }
109 
110 
111  // Check internal data ////////////
112  if(parser_->debug()){ dataCheck();};
114 }
virtual uint32_t getDataField(std::string name)
virtual void increment(uint32_t numb, std::string msg="")
DCCTBDataParser * parser_
std::string getDecString(uint32_t data)
uint32_t numbXtalSamples()
std::map< std::string, uint32_t > errors_
std::vector< DCCTBXtalBlock * > xtalBlocks_
Definition: DCCTowerBlock.h:50
DCCTBEventBlock * dccBlock_
Definition: DCCTowerBlock.h:51
int DCCTBTowerBlock::towerID ( )

Definition at line 178 of file DCCTowerBlock.cc.

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

Referenced by EcalTBDaqFormatter::DecodeMEM(), and EcalTB07DaqFormatter::DecodeMEM().

178  {
179  int result=-1;
180 
181  for(std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator it = mapperFields_->begin(); it!= mapperFields_->end(); it++){
182  if ( (*it)->name() == "TT/SC ID" )
183  result=getDataField( (*it)->name() ) ;
184 
185  }
186 
187  return result;
188 
189 }
virtual uint32_t getDataField(std::string name)
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
std::vector< DCCTBXtalBlock * > & DCCTBTowerBlock::xtalBlocks ( )
inline

Definition at line 57 of file DCCTowerBlock.h.

References xtalBlocks_.

Referenced by EcalTBDaqFormatter::DecodeMEM(), and EcalTB07DaqFormatter::DecodeMEM().

57 { return xtalBlocks_; }
std::vector< DCCTBXtalBlock * > xtalBlocks_
Definition: DCCTowerBlock.h:50
std::vector< DCCTBXtalBlock * > DCCTBTowerBlock::xtalBlocksById ( uint32_t  stripId,
uint32_t  xtalId 
)

Definition at line 160 of file DCCTowerBlock.cc.

References MillePedeFileConverter_cfg::e, and xtalBlocks_.

160  {
161  std::vector<DCCTBXtalBlock *> myVector;
162  std::vector<DCCTBXtalBlock *>::iterator it;
163 
164  for( it = xtalBlocks_.begin(); it!= xtalBlocks_.end(); it++ ){
165  try{
166 
167  std::pair<bool,std::string> stripIdCheck = (*it)->checkDataField("STRIP ID",stripId);
168  std::pair<bool,std::string> xtalIdCheck = (*it)->checkDataField("XTAL ID",xtalId);
169 
170  if(xtalIdCheck.first && stripIdCheck.first ){ myVector.push_back( (*it) ); }
171 
172  }catch (ECALTBParserBlockException &e){/*ignore*/ }
173  }
174 
175  return myVector;
176 }
std::vector< DCCTBXtalBlock * > xtalBlocks_
Definition: DCCTowerBlock.h:50

Member Data Documentation

DCCTBEventBlock* DCCTBTowerBlock::dccBlock_
protected

Definition at line 51 of file DCCTowerBlock.h.

Referenced by dataCheck(), and parseXtalData().

uint32_t DCCTBTowerBlock::expectedTowerID_
protected

Definition at line 52 of file DCCTowerBlock.h.

Referenced by dataCheck().

std::vector<DCCTBXtalBlock * > DCCTBTowerBlock::xtalBlocks_
protected

Definition at line 50 of file DCCTowerBlock.h.

Referenced by parseXtalData(), xtalBlocks(), xtalBlocksById(), and ~DCCTBTowerBlock().