CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/EventFilter/EcalTBRawToDigi/src/DCCSRPBlock.cc

Go to the documentation of this file.
00001 #include "DCCSRPBlock.h"
00002 #include "DCCDataParser.h"
00003 #include "DCCDataMapper.h"
00004 #include "DCCEventBlock.h"
00005 
00006 DCCTBSRPBlock::DCCTBSRPBlock(
00007         DCCTBEventBlock * dccBlock,
00008         DCCTBDataParser * parser, 
00009         uint32_t * buffer, 
00010         uint32_t numbBytes,
00011         uint32_t wordsToEnd,
00012         uint32_t wordEventOffset
00013 ) : DCCTBBlockPrototype(parser,"SRP", buffer, numbBytes,wordsToEnd,wordEventOffset), dccBlock_(dccBlock){
00014         
00015         //Reset error counters ///////
00016         errors_["SRP::HEADER"]  = 0;
00017         errors_["SRP::BLOCKID"] = 0;
00019         
00020         // Get data fields from the mapper and retrieve data /////////////////////////////////////
00021              if( parser_->numbSRF() == 68){ mapperFields_ = parser_->mapper()->srp68Fields();}
00022         else if( parser_->numbSRF() == 32){ mapperFields_ = parser_->mapper()->srp32Fields();}  
00023         else if( parser_->numbSRF() == 16){ mapperFields_ = parser_->mapper()->srp16Fields();}
00024         parseData();
00026         
00027         // check internal data ////////////
00028         if(parser_->debug()){ dataCheck();}
00030 
00031 }
00032 
00033 
00034 
00035 void DCCTBSRPBlock::dataCheck(){ 
00036         
00037         std::string checkErrors("");
00038 
00039         std::pair <bool,std::string> res;
00040         
00041         res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX")));
00042         if(!res.first){ checkErrors += res.second; (errors_["SRP::HEADER"])++; }
00043         res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1"))); 
00044         if(!res.first){ checkErrors += res.second; (errors_["SRP::HEADER"])++; }
00045         
00046          
00047         res = checkDataField("SRP ID",parser_->srpId()); 
00048         if(!res.first){ checkErrors += res.second; (errors_["SRP::HEADER"])++; } 
00049         
00050         
00051         if(checkErrors!=""){
00052                 errorString_ +="\n ======================================================================\n";           
00053                 errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ") ;
00054                 errorString_ += checkErrors ;
00055                 errorString_ += "\n ======================================================================";
00056                 blockError_ = true;     
00057         }
00058         
00059         
00060 }
00061 
00062 
00063 void  DCCTBSRPBlock::increment(uint32_t numb){
00064         if(!parser_->debug()){ DCCTBBlockPrototype::increment(numb); }
00065         else {
00066                 for(uint32_t counter=0; counter<numb; counter++, dataP_++,wordCounter_++){
00067                         uint32_t blockID = (*dataP_)>>BPOSITION_BLOCKID;
00068                         if( blockID != BLOCKID ){
00069                                 (errors_["SRP::BLOCKID"])++;
00070                                 //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID);
00071                                 //errorString  += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected");
00072                         }
00073                 }
00074         }
00075         
00076         
00077 }
00078 
00079