CMS 3D CMS Logo

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