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, const 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 () override
 
- 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  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
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 19 of file DCCTowerBlock.h.

Member Enumeration Documentation

◆ towerFields

Enumerator
BXMASK 
L1MASK 

Definition at line 41 of file DCCTowerBlock.h.

41 { BXMASK = 0xFFF, L1MASK = 0xFFF };

Constructor & Destructor Documentation

◆ DCCTBTowerBlock()

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

Definition at line 9 of file DCCTowerBlock.cc.

16  : DCCTBBlockPrototype(parser, "TOWERHEADER", buffer, numbBytes, wordsToEnd, wordEventOffset),
17  dccBlock_(dccBlock),
18  expectedTowerID_(expectedTowerID) {
19  //Reset error counters ///////////
20  errors_["FE::HEADER"] = 0;
21  errors_["FE::TT/SC ID"] = 0;
22  errors_["FE::BLOCK LENGTH"] = 0;
24 
25  // Get data fields from the mapper and retrieve data /////////////////////////////////////
27  parseData();
29 }

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

◆ ~DCCTBTowerBlock()

DCCTBTowerBlock::~DCCTBTowerBlock ( )
override

Definition at line 108 of file DCCTowerBlock.cc.

108  {
109  std::vector<DCCTBXtalBlock *>::iterator it;
110  for (it = xtalBlocks_.begin(); it != xtalBlocks_.end(); it++) {
111  delete (*it);
112  }
113  xtalBlocks_.clear();
114 }

References xtalBlocks_.

Member Function Documentation

◆ dataCheck()

void DCCTBTowerBlock::dataCheck ( )
protected

Definition at line 116 of file DCCTowerBlock.cc.

116  {
117  std::string checkErrors("");
118 
119  std::pair<bool, std::string> res;
120 
122  // For TB we don-t check Bx
123  //res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX")));
124  //if(!res.first){ checkErrors += res.second; (errors_["FE::HEADER"])++; }
126 
127  // mod to account for ECAL counters starting from 0 in the front end N. Almeida
128  res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1") - 1));
129  if (!res.first) {
130  checkErrors += res.second;
131  (errors_["FE::HEADER"])++;
132  }
133 
134  if (expectedTowerID_ != 0) {
135  res = checkDataField("TT/SC ID", expectedTowerID_);
136  if (!res.first) {
137  checkErrors += res.second;
138  (errors_["FE::HEADER"])++;
139  }
140  }
141 
142  if (!checkErrors.empty()) {
143  std::string myTowerId;
144 
145  errorString_ += "\n ======================================================================\n";
146  errorString_ += std::string(" ") + name_ + std::string("( ID = ") +
147  parser_->getDecString((uint32_t)(expectedTowerID_)) + std::string(" ) errors : ");
148  errorString_ += checkErrors;
149  errorString_ += "\n ======================================================================";
150  blockError_ = true;
151  }
152 }

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

◆ parseXtalData()

void DCCTBTowerBlock::parseXtalData ( )

Definition at line 31 of file DCCTowerBlock.cc.

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

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

◆ towerID()

int DCCTBTowerBlock::towerID ( )

Definition at line 174 of file DCCTowerBlock.cc.

174  {
175  int result = -1;
176 
177  for (std::set<DCCTBDataField *, DCCTBDataFieldComparator>::iterator it = mapperFields_->begin();
178  it != mapperFields_->end();
179  it++) {
180  if ((*it)->name() == "TT/SC ID")
181  result = getDataField((*it)->name());
182  }
183 
184  return result;
185 }

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

◆ xtalBlocks()

std::vector< DCCTBXtalBlock * > & DCCTBTowerBlock::xtalBlocks ( )
inline

Definition at line 48 of file DCCTowerBlock.h.

48 { return xtalBlocks_; }

References xtalBlocks_.

◆ xtalBlocksById()

std::vector< DCCTBXtalBlock * > DCCTBTowerBlock::xtalBlocksById ( uint32_t  stripId,
uint32_t  xtalId 
)

Definition at line 154 of file DCCTowerBlock.cc.

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

References MillePedeFileConverter_cfg::e, and xtalBlocks_.

Member Data Documentation

◆ dccBlock_

DCCTBEventBlock* DCCTBTowerBlock::dccBlock_
protected

Definition at line 44 of file DCCTowerBlock.h.

Referenced by dataCheck(), and parseXtalData().

◆ expectedTowerID_

uint32_t DCCTBTowerBlock::expectedTowerID_
protected

Definition at line 45 of file DCCTowerBlock.h.

Referenced by dataCheck().

◆ xtalBlocks_

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

Definition at line 43 of file DCCTowerBlock.h.

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

DCCTBBlockPrototype::mapperFields_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
Definition: DCCBlockPrototype.h:86
DCCTBTowerBlock::L1MASK
Definition: DCCTowerBlock.h:41
DCCTBTowerBlock::expectedTowerID_
uint32_t expectedTowerID_
Definition: DCCTowerBlock.h:45
DCCTBTowerBlock::xtalBlocks_
std::vector< DCCTBXtalBlock * > xtalBlocks_
Definition: DCCTowerBlock.h:43
DCCTBXtalBlock
Definition: DCCXtalBlock.h:10
DCCTBBlockPrototype::blockSize_
uint32_t blockSize_
Definition: DCCBlockPrototype.h:69
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
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
DCCTBTowerBlock::dataCheck
void dataCheck()
Definition: DCCTowerBlock.cc:116
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
DCCTBBlockPrototype::errors_
std::map< std::string, uint32_t > errors_
Definition: DCCBlockPrototype.h:84
DCCTBTowerBlock::BXMASK
Definition: DCCTowerBlock.h:41
DCCTBBlockPrototype::parser_
DCCTBDataParser * parser_
Definition: DCCBlockPrototype.h:81
DCCTBBlockPrototype::increment
virtual void increment(uint32_t numb, std::string msg="")
Definition: DCCBlockPrototype.cc:113
DCCTBDataParser::numbXtalSamples
uint32_t numbXtalSamples()
Definition: DCCDataParser.h:175
DCCTBBlockPrototype::getDataField
virtual uint32_t getDataField(std::string name)
Definition: DCCBlockPrototype.cc:194
DCCTBBlockPrototype::wordsToEndOfEvent_
uint32_t wordsToEndOfEvent_
Definition: DCCBlockPrototype.h:72
DCCTBBlockPrototype::parseData
virtual void parseData()
Definition: DCCBlockPrototype.cc:38
DCCTBBlockPrototype::blockError_
bool blockError_
Definition: DCCBlockPrototype.h:74
DCCTBTowerBlock::dccBlock_
DCCTBEventBlock * dccBlock_
Definition: DCCTowerBlock.h:44
res
Definition: Electron.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DCCTBBlockPrototype::errorString_
std::string errorString_
Definition: DCCBlockPrototype.h:77
DCCTBDataMapper::towerFields
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * towerFields()
Definition: DCCDataMapper.h:112
DCCTBBlockPrototype::dataP_
const uint32_t * dataP_
Definition: DCCBlockPrototype.h:66
DCCTBDataParser::mapper
DCCTBDataMapper * mapper()
Definition: DCCDataParser.h:172
DCCTBBlockPrototype::name_
std::string name_
Definition: DCCBlockPrototype.h:76
mps_fire.result
result
Definition: mps_fire.py:311
DCCTBBlockPrototype::wordEventOffset_
uint32_t wordEventOffset_
Definition: DCCBlockPrototype.h:71
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ECALTBParserBlockException
Definition: ECALParserBlockException.h:10