Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DCCSRPBlock.h"
0002 #include "DCCDataParser.h"
0003 #include "DCCDataMapper.h"
0004 #include "DCCEventBlock.h"
0005 
0006 DCCTBSRPBlock::DCCTBSRPBlock(DCCTBEventBlock* dccBlock,
0007                              DCCTBDataParser* parser,
0008                              const uint32_t* buffer,
0009                              uint32_t numbBytes,
0010                              uint32_t wordsToEnd,
0011                              uint32_t wordEventOffset)
0012     : DCCTBBlockPrototype(parser, "SRP", buffer, numbBytes, wordsToEnd, wordEventOffset), dccBlock_(dccBlock) {
0013   //Reset error counters ///////
0014   errors_["SRP::HEADER"] = 0;
0015   errors_["SRP::BLOCKID"] = 0;
0016   //////////////////////////////
0017 
0018   // Get data fields from the mapper and retrieve data /////////////////////////////////////
0019   if (parser_->numbSRF() == 68) {
0020     mapperFields_ = parser_->mapper()->srp68Fields();
0021   } else if (parser_->numbSRF() == 32) {
0022     mapperFields_ = parser_->mapper()->srp32Fields();
0023   } else if (parser_->numbSRF() == 16) {
0024     mapperFields_ = parser_->mapper()->srp16Fields();
0025   }
0026   parseData();
0027   //////////////////////////////////////////////////////////////////////////////////////////
0028 
0029   // check internal data ////////////
0030   if (parser_->debug()) {
0031     dataCheck();
0032   }
0033   ///////////////////////////////////
0034 }
0035 
0036 void DCCTBSRPBlock::dataCheck() {
0037   std::string checkErrors("");
0038 
0039   std::pair<bool, std::string> res;
0040 
0041   res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX")));
0042   if (!res.first) {
0043     checkErrors += res.second;
0044     (errors_["SRP::HEADER"])++;
0045   }
0046   res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1")));
0047   if (!res.first) {
0048     checkErrors += res.second;
0049     (errors_["SRP::HEADER"])++;
0050   }
0051 
0052   res = checkDataField("SRP ID", parser_->srpId());
0053   if (!res.first) {
0054     checkErrors += res.second;
0055     (errors_["SRP::HEADER"])++;
0056   }
0057 
0058   if (!checkErrors.empty()) {
0059     errorString_ += "\n ======================================================================\n";
0060     errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ");
0061     errorString_ += checkErrors;
0062     errorString_ += "\n ======================================================================";
0063     blockError_ = true;
0064   }
0065 }
0066 
0067 void DCCTBSRPBlock::increment(uint32_t numb) {
0068   if (!parser_->debug()) {
0069     DCCTBBlockPrototype::increment(numb);
0070   } else {
0071     for (uint32_t counter = 0; counter < numb; counter++, dataP_++, wordCounter_++) {
0072       uint32_t blockID = (*dataP_) >> BPOSITION_BLOCKID;
0073       if (blockID != BLOCKID) {
0074         (errors_["SRP::BLOCKID"])++;
0075         //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID);
0076         //errorString  += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected");
0077       }
0078     }
0079   }
0080 }