Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:37

0001 #include "DCCTrailerBlock.h"
0002 #include "DCCDataParser.h"
0003 #include "DCCDataMapper.h"
0004 DCCTBTrailerBlock::DCCTBTrailerBlock(DCCTBDataParser* parser,
0005                                      const uint32_t* buffer,
0006                                      uint32_t numbBytes,
0007                                      uint32_t wToEnd,
0008                                      uint32_t wordEventOffset,
0009                                      uint32_t expectedLength,
0010                                      uint32_t expectedCRC)
0011     : DCCTBBlockPrototype(parser, "DCCTRAILER", buffer, numbBytes, wToEnd, wordEventOffset),
0012       expectedLength_(expectedLength) {
0013   errors_["TRAILER::EVENT LENGTH"] = 0;
0014   errors_["TRAILER::EOE"] = 0;
0015   errors_["TRAILER::CRC"] = 0;
0016   errors_["TRAILER::T"] = 0;
0017 
0018   // Get data fields from the mapper and retrieve data ///////////////////////////////////////////
0019   mapperFields_ = parser_->mapper()->trailerFields();
0020   parseData();
0021   ////////////////////////////////////////////////////////////////////////////////////////////////
0022 
0023   // check internal data ////
0024   dataCheck();
0025   ///////////////////////////
0026 }
0027 
0028 void DCCTBTrailerBlock::dataCheck() {
0029   std::string checkErrors("");
0030 
0031   std::pair<bool, std::string> res;
0032 
0033   res = checkDataField("EVENT LENGTH", expectedLength_);
0034   if (!res.first) {
0035     checkErrors += res.second;
0036     (errors_["TRAILER::EVENT LENGTH"])++;
0037   }
0038 
0039   res = checkDataField("EOE", EOE);
0040   if (!res.first) {
0041     checkErrors += res.second;
0042     (errors_["TRAILER::EOE"])++;
0043   }
0044 
0045   res = checkDataField("T", 0);
0046   if (!res.first) {
0047     checkErrors += res.second;
0048     (errors_["TRAILER::T"])++;
0049   }
0050 
0051   //checkErrors += checkDataField("CRC",expectedCRC_);
0052 
0053   if (!checkErrors.empty()) {
0054     errorString_ += "\n ======================================================================\n";
0055     errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ");
0056     errorString_ += checkErrors;
0057     errorString_ += "\n ======================================================================";
0058     blockError_ = true;
0059   }
0060 }