CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DCCTrailerBlock.cc
Go to the documentation of this file.
1 #include "DCCTrailerBlock.h"
2 #include "DCCDataParser.h"
3 #include "DCCDataMapper.h"
5  const uint32_t* buffer,
6  uint32_t numbBytes,
7  uint32_t wToEnd,
8  uint32_t wordEventOffset,
9  uint32_t expectedLength,
10  uint32_t expectedCRC)
11  : DCCTBBlockPrototype(parser, "DCCTRAILER", buffer, numbBytes, wToEnd, wordEventOffset),
12  expectedLength_(expectedLength) {
13  errors_["TRAILER::EVENT LENGTH"] = 0;
14  errors_["TRAILER::EOE"] = 0;
15  errors_["TRAILER::CRC"] = 0;
16  errors_["TRAILER::T"] = 0;
17 
18  // Get data fields from the mapper and retrieve data ///////////////////////////////////////////
20  parseData();
22 
23  // check internal data ////
24  dataCheck();
26 }
27 
29  std::string checkErrors("");
30 
31  std::pair<bool, std::string> res;
32 
33  res = checkDataField("EVENT LENGTH", expectedLength_);
34  if (!res.first) {
35  checkErrors += res.second;
36  (errors_["TRAILER::EVENT LENGTH"])++;
37  }
38 
39  res = checkDataField("EOE", EOE);
40  if (!res.first) {
41  checkErrors += res.second;
42  (errors_["TRAILER::EOE"])++;
43  }
44 
45  res = checkDataField("T", 0);
46  if (!res.first) {
47  checkErrors += res.second;
48  (errors_["TRAILER::T"])++;
49  }
50 
51  //checkErrors += checkDataField("CRC",expectedCRC_);
52 
53  if (!checkErrors.empty()) {
54  errorString_ += "\n ======================================================================\n";
55  errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ");
56  errorString_ += checkErrors;
57  errorString_ += "\n ======================================================================";
58  blockError_ = true;
59  }
60 }
virtual std::pair< bool, std::string > checkDataField(std::string name, uint32_t data)
virtual void parseData()
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * mapperFields_
DCCTBDataParser * parser_
std::map< std::string, uint32_t > errors_
DCCTBTrailerBlock(DCCTBDataParser *parser, const uint32_t *buffer, uint32_t numbBytes, uint32_t wToEnd, uint32_t wordEventOffset, uint32_t expectedLength, uint32_t expectedCRC)
DCCTBDataMapper * mapper()
uint32_t expectedLength_
std::set< DCCTBDataField *, DCCTBDataFieldComparator > * trailerFields()