#include <CastorDataIntegrityMonitor.h>
Public Member Functions | |
CastorDataIntegrityMonitor () | |
void | cleanup () |
void | processEvent (const FEDRawDataCollection &RawData, const HcalUnpackerReport &report, const CastorElectronicsMap &emap) |
void | reset () |
void | setup (const edm::ParameterSet &ps, DQMStore *dbe) |
void | unpack (const FEDRawData &raw, const CastorElectronicsMap &emap) |
~CastorDataIntegrityMonitor () | |
Public Attributes | |
std::map< uint32_t, std::vector< HcalCastorDetId > > | DCCtoCell |
std::map< uint32_t, std::vector< HcalCastorDetId > >::iterator | thisDCC |
Private Member Functions | |
void | fillzoos (int bin, int dccid) |
void | mapDCCproblem (int dcc) |
void | mapHTRproblem (int dcc, int spigot) |
void | UpdateMap () |
Private Attributes | |
std::map< int, short > | CDFEventType_list |
std::map< int, short >::iterator | CDFEvT_it |
bool | CDFProbThisDCC |
std::map< int, short >::iterator | CDFReservedBits_it |
std::map< int, short > | CDFReservedBits_list |
std::map< int, short >::iterator | CDFvers_it |
std::map< int, short > | CDFversionNumber_list |
std::map< int, short >::iterator | DCCEvtFormat_it |
std::map< int, short > | DCCEvtFormat_list |
int | dccid |
std::map< int, short >::iterator | DCCRsvdBits_it |
std::map< int, short > | DCCRsvdBits_list |
MonitorElement * | fedEntries |
MonitorElement * | fedFatal |
MonitorElement * | fedNonFatal |
std::vector< int > | fedUnpackList_ |
int | ievt_ |
MonitorElement * | meDCCVersion |
MonitorElement * | meEVT_ |
std::vector< std::vector< bool > > | problemCASTOR |
int | problemsSpigot [15][3] |
int | spigotStatus |
MonitorElement * | spigotStatusMap |
double | statusSpigotDCC |
Definition at line 10 of file CastorDataIntegrityMonitor.h.
CastorDataIntegrityMonitor::CastorDataIntegrityMonitor | ( | ) |
Definition at line 25 of file CastorDataIntegrityMonitor.cc.
{ }
CastorDataIntegrityMonitor::~CastorDataIntegrityMonitor | ( | ) |
Definition at line 32 of file CastorDataIntegrityMonitor.cc.
{ }
void CastorDataIntegrityMonitor::cleanup | ( | ) |
Definition at line 47 of file CastorDataIntegrityMonitor.cc.
{ }
void CastorDataIntegrityMonitor::fillzoos | ( | int | bin, |
int | dccid | ||
) | [private] |
void CastorDataIntegrityMonitor::mapDCCproblem | ( | int | dcc | ) | [private] |
void CastorDataIntegrityMonitor::mapHTRproblem | ( | int | dcc, |
int | spigot | ||
) | [private] |
void CastorDataIntegrityMonitor::processEvent | ( | const FEDRawDataCollection & | RawData, |
const HcalUnpackerReport & | report, | ||
const CastorElectronicsMap & | emap | ||
) |
--- check the spigot arrays
Definition at line 103 of file CastorDataIntegrityMonitor.cc.
References gather_cfg::cout, FEDRawDataCollection::FEDData(), fedUnpackList_, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, MonitorElement::getTH2F(), i, ievt_, meEVT_, problemsSpigot, FEDRawData::size(), spigotStatusMap, statusSpigotDCC, and unpack().
{ if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor::processEvent" << std::endl; meEVT_->Fill(ievt_); ievt_++; for (std::vector<int>::const_iterator i=fedUnpackList_.begin();i!=fedUnpackList_.end(); i++) { const FEDRawData& fed = RawData.FEDData(*i); if (fed.size()<12) continue; unpack(fed,emap); } for (int spigot=0; spigot<15; spigot++){ for (int dcc=0; dcc<3; dcc++){ if( problemsSpigot[spigot][dcc] == 0) statusSpigotDCC=1.0; else if( double(problemsSpigot[spigot][dcc])/double(ievt_) < 0.05) statusSpigotDCC=0.; else statusSpigotDCC=-1.0; spigotStatusMap->getTH2F()->SetBinContent(spigot+1,dcc+1,statusSpigotDCC); if(fVerbosity>0) std::cout<< "==> SpigotNr:"<< spigot+1 <<" DCC_ID:"<< dcc+690 << " # problems=" << problemsSpigot[spigot][dcc] << "==> ievt_:"<< ievt_ << " ratio=" << double(problemsSpigot[spigot][dcc])/double(ievt_) << " STATUS=" << statusSpigotDCC << std::endl; } } return; }
void CastorDataIntegrityMonitor::reset | ( | void | ) |
Definition at line 39 of file CastorDataIntegrityMonitor.cc.
{ }
void CastorDataIntegrityMonitor::setup | ( | const edm::ParameterSet & | ps, |
DQMStore * | dbe | ||
) | [virtual] |
Reimplemented from CastorBaseMonitor.
Definition at line 55 of file CastorDataIntegrityMonitor.cc.
References CastorBaseMonitor::baseFolder_, DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookInt(), CDFProbThisDCC, gather_cfg::cout, fedEntries, fedFatal, fedUnpackList_, CastorBaseMonitor::fVerbosity, i, ievt_, CastorBaseMonitor::m_dbe, FEDNumbering::MAXCASTORFEDID, meEVT_, FEDNumbering::MINCASTORFEDID, NULL, problemsSpigot, CastorBaseMonitor::rootFolder_, DQMStore::setCurrentFolder(), spigotStatus, spigotStatusMap, and statusSpigotDCC.
{ if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor::setup (start)" << std::endl; CastorBaseMonitor::setup(ps,dbe); baseFolder_ = rootFolder_+"CastorDataIntegrityMonitor"; ievt_=0; spigotStatus=-99; statusSpigotDCC=-99; CDFProbThisDCC = false; for (int row=0; row<15; row++) for (int col=0; col<3; col++) problemsSpigot[row][col] = 0; for (int i=FEDNumbering::MINCASTORFEDID; i<=FEDNumbering:: MAXCASTORFEDID; ++i) fedUnpackList_.push_back(i); if ( m_dbe !=NULL ) { m_dbe->setCurrentFolder(baseFolder_); meEVT_ = m_dbe->bookInt("Digi Task Event Number"); fedEntries = m_dbe->book1D("FEDEntries_CASTOR" ,"Number of Entries per CASTOR FED",3,690,693); //-- FED 693 take out for the time being fedFatal = m_dbe->book1D("CASTOR FEDFatal errors" ,"Number of Fatal Errors per CASTOR FED",3,690,693); //-- FED 693 take out for the time being //fedNonFatal = m_dbe->book1D("FEDNonFatal_CASTOR","Number of non-fatal errors CASTOR FED",3,690,693); //-- take it out for the time being //meDCCVersion = m_dbe->bookProfile("DCC Firmware Version","DCC Firmware Version", 3, 690, 693, 256, -0.5, 255.5); //meDCCVersion->setAxisTitle("FED ID", 1); spigotStatusMap = m_dbe->book2D("CASTOR spigot status","CASTOR spigot status",15,0,15,4,690,694); //-- get some space for the legend } else{ if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup - NO DQMStore service" << std::endl; } if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup (end)" << std::endl; return; }
void CastorDataIntegrityMonitor::unpack | ( | const FEDRawData & | raw, |
const CastorElectronicsMap & | emap | ||
) |
Definition at line 147 of file CastorDataIntegrityMonitor.cc.
References HcalDCCHeader::BOEshouldBe5Always(), HcalDCCHeader::BOEshouldBeZeroAlways(), CDFEventType_list, CDFEvT_it, CDFProbThisDCC, CDFReservedBits_it, CDFReservedBits_list, CDFvers_it, CDFversionNumber_list, FEDTrailer::check(), HcalHTRData::check(), gather_cfg::cout, FEDRawData::data(), dccid, fedEntries, fedFatal, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, HcalDCCHeader::getCDFEventType(), HcalDCCHeader::getCDFversionNumber(), HcalDCCHeader::getLRBErrorBits(), HcalDCCHeader::getSlink64ReservedBits(), HcalDCCHeader::getSourceId(), HcalDCCHeader::getSpigotCRCError(), HcalDCCHeader::getSpigotData(), HcalDCCHeader::getSpigotDataLength(), HcalDCCHeader::getSpigotDataTruncated(), HcalDCCHeader::getSpigotEnabled(), HcalDCCHeader::getSpigotPresent(), HcalHTRData::isHistogramEvent(), FEDTrailer::lenght(), FEDTrailer::moreTrailers(), problemsSpigot, FEDRawData::size(), HcalDCCHeader::SPIGOT_COUNT, spigotStatus, HcalDCCHeader::thereIsASecondCDFHeaderWord(), and HcalDCCHeader::thereIsAThirdCDFHeaderWord().
Referenced by processEvent().
{ const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data()); if(!dccHeader) return; unsigned char* trailer_ptr = (unsigned char*) (raw.data()+raw.size()-sizeof(uint64_t)); FEDTrailer trailer = FEDTrailer(trailer_ptr); dccid=dccHeader->getSourceId(); HcalHTRData htr; CDFProbThisDCC = false; //================ BASIC CHECKS OF DATA INTEGRITY ====================// /* 1 */ //There should always be a second CDF header word indicated. if (!dccHeader->thereIsASecondCDFHeaderWord()) { CDFProbThisDCC = true; } /* 2 */ //Make sure a reference CDF Version value has been recorded for this dccid CDFvers_it = CDFversionNumber_list.find(dccid); if (CDFvers_it == CDFversionNumber_list.end()) { CDFversionNumber_list.insert(std::pair<int,short> (dccid,dccHeader->getCDFversionNumber() ) ); CDFvers_it = CDFversionNumber_list.find(dccid); } // then check against it. if (dccHeader->getCDFversionNumber()!= CDFvers_it->second) { CDFProbThisDCC = true; } /* 3 */ //Make sure a reference CDF EventType value has been recorded for this dccid CDFEvT_it = CDFEventType_list.find(dccid); if (CDFEvT_it == CDFEventType_list.end()) { CDFEventType_list.insert(std::pair<int,short> (dccid,dccHeader->getCDFEventType() ) ); CDFEvT_it = CDFEventType_list.find(dccid); } // then check against it. if (dccHeader->getCDFEventType()!= CDFEvT_it->second) { // On probation until safe against Orbit Gap Calibration Triggers... CDFProbThisDCC = true; } /* 4 */ //There should always be a '5' in CDF Header word 0, bits [63:60] if (dccHeader->BOEshouldBe5Always()!=5) { CDFProbThisDCC = true; } /* 5 */ //There should never be a third CDF Header word indicated. if (dccHeader->thereIsAThirdCDFHeaderWord()) { CDFProbThisDCC = true; } /* 6 */ //Make sure a reference value of Reserved Bits has been recorded for this dccid CDFReservedBits_it = CDFReservedBits_list.find(dccid); if (CDFReservedBits_it == CDFReservedBits_list.end()) { CDFReservedBits_list.insert(std::pair<int,short> (dccid,dccHeader->getSlink64ReservedBits() ) ); CDFReservedBits_it = CDFReservedBits_list.find(dccid); } // then check against it. if ((int) dccHeader->getSlink64ReservedBits()!= CDFReservedBits_it->second) { // On probation until safe against Orbit Gap Calibration Triggers... // CDFProbThisDCC = true; } /* 7 */ //There should always be 0x0 in CDF Header word 1, bits [63:60] if (dccHeader->BOEshouldBeZeroAlways() !=0) { CDFProbThisDCC = true; } /* 8 */ //There should only be one trailer if (trailer.moreTrailers()) { CDFProbThisDCC = true; } // if trailer. /* 9 */ //CDF Trailer [55:30] should be the # 64-bit words in the EvFragment if ((uint64_t) raw.size() != ( (uint64_t) trailer.lenght()*sizeof(uint64_t)) ) //The function name is a typo! Awesome. { CDFProbThisDCC = true; } /*10 */ //There is a rudimentary sanity check built into the FEDTrailer class if (!trailer.check()) { CDFProbThisDCC = true; } if (CDFProbThisDCC) fedFatal->Fill(dccid); fedEntries->Fill(dccid); //================== do similar what HCALRawDataMonitor does //uint64_t* dccfw= (uint64_t*) (raw.data()+(sizeof(uint64_t)*2)); //64-bit DAQ word number 2 (from 0) //int dcc_fw = ( ((*dccfw)>>(6*8))&0x00000000000000FF ); //Shift right 6 bytes, get that low byte. //meDCCVersion->Fill(dccid,dcc_fw); //char TTS_state = (char)trailer.ttsBits(); //errors per-Spigot bits from the DCC Header int WholeErrorList=0; for(int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) { if (!( dccHeader->getSpigotEnabled((unsigned int) spigot)) ) continue; //-- skip when not enabled //-- set OK here spigotStatus=1; //-- get DCC id dccid=dccHeader->getSourceId(); if (dccid==693) continue; //-- skip this one WholeErrorList=dccHeader->getLRBErrorBits((unsigned int) spigot); if (WholeErrorList!=0) { if ((WholeErrorList>>0)&0x01) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: error==> " << std::endl; spigotStatus=-1; ++problemsSpigot[spigot][dccid-690]; } if (((WholeErrorList>>1)&0x01)!=0) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: error ==> Uncorrected Error" << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (((WholeErrorList>>2)&0x01)!=0) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: error ==> Truncated data coming into LRB" << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (((WholeErrorList>>3)&0x01)!=0) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor: error ==>: FIFO Overflow" << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (((WholeErrorList>>4)&0x01)!=0) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: error ==> (EvN Mismatch), htr payload metadeta" << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (((WholeErrorList>>5)&0x01)!=0) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: error ==> STatus: hdr/data/trlr error" << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (((WholeErrorList>>6)&0x01)!=0) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: error ==> ODD 16-bit word count from HT error" << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } } if (!dccHeader->getSpigotPresent((unsigned int) spigot)){ if(fVerbosity>0) std::cout <<"CastorDataIntegrityMonitor:: HTR Problem: Spigot Not Present"<<std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } else { if ( dccHeader->getSpigotDataTruncated((unsigned int) spigot)) { if(fVerbosity>0) std::cout <<"CastorDataIntegrityMonitor:: HTR Problem: Spigot Data Truncated"<<std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if ( dccHeader->getSpigotCRCError((unsigned int) spigot)) { if(fVerbosity>0) std::cout <<"CastorDataIntegrityMonitor:: HTR Problem: Spigot CRC Error"<<std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (dccHeader->getSpigotDataLength(spigot) <(unsigned long)4) { if(fVerbosity>0) std::cout <<"CastorDataIntegrityMonitor:: HTR Problem: Spigot Data Length too small"<<std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (dccHeader->getSpigotData(spigot,htr,raw.size())==-1) { if(fVerbosity>0) std::cout<< "CastorDataIntegrityMonitor:: Invalid HTR data (data beyond payload size) observed on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId()<< std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (!htr.check()) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: Invalid HTR data observed on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId() << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } if (htr.isHistogramEvent()) { if(fVerbosity>0) std::cout << "CastorDataIntegrityMonitor:: Histogram data passed to non-histogram unpacker on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId() << std::endl; if(spigotStatus>0) ++problemsSpigot[spigot][dccid-690]; spigotStatus=-1; } } } //-- end of loop over spigots return; }
void CastorDataIntegrityMonitor::UpdateMap | ( | ) | [private] |
std::map<int, short> CastorDataIntegrityMonitor::CDFEventType_list [private] |
Definition at line 65 of file CastorDataIntegrityMonitor.h.
Referenced by unpack().
std::map<int, short>::iterator CastorDataIntegrityMonitor::CDFEvT_it [private] |
Definition at line 66 of file CastorDataIntegrityMonitor.h.
Referenced by unpack().
bool CastorDataIntegrityMonitor::CDFProbThisDCC [private] |
Definition at line 44 of file CastorDataIntegrityMonitor.h.
std::map<int, short>::iterator CastorDataIntegrityMonitor::CDFReservedBits_it [private] |
Definition at line 68 of file CastorDataIntegrityMonitor.h.
Referenced by unpack().
std::map<int, short> CastorDataIntegrityMonitor::CDFReservedBits_list [private] |
Definition at line 67 of file CastorDataIntegrityMonitor.h.
Referenced by unpack().
std::map<int, short>::iterator CastorDataIntegrityMonitor::CDFvers_it [private] |
Definition at line 64 of file CastorDataIntegrityMonitor.h.
Referenced by unpack().
std::map<int, short> CastorDataIntegrityMonitor::CDFversionNumber_list [private] |
Definition at line 63 of file CastorDataIntegrityMonitor.h.
Referenced by unpack().
std::map<int, short>::iterator CastorDataIntegrityMonitor::DCCEvtFormat_it [private] |
Definition at line 70 of file CastorDataIntegrityMonitor.h.
std::map<int, short> CastorDataIntegrityMonitor::DCCEvtFormat_list [private] |
Definition at line 69 of file CastorDataIntegrityMonitor.h.
int CastorDataIntegrityMonitor::dccid [private] |
Definition at line 42 of file CastorDataIntegrityMonitor.h.
Referenced by unpack().
std::map<int, short>::iterator CastorDataIntegrityMonitor::DCCRsvdBits_it [private] |
Definition at line 72 of file CastorDataIntegrityMonitor.h.
std::map<int, short> CastorDataIntegrityMonitor::DCCRsvdBits_list [private] |
Definition at line 71 of file CastorDataIntegrityMonitor.h.
std::map<uint32_t, std::vector<HcalCastorDetId> > CastorDataIntegrityMonitor::DCCtoCell |
Definition at line 28 of file CastorDataIntegrityMonitor.h.
Definition at line 55 of file CastorDataIntegrityMonitor.h.
Definition at line 56 of file CastorDataIntegrityMonitor.h.
Definition at line 57 of file CastorDataIntegrityMonitor.h.
std::vector<int> CastorDataIntegrityMonitor::fedUnpackList_ [private] |
Definition at line 41 of file CastorDataIntegrityMonitor.h.
Referenced by processEvent(), and setup().
int CastorDataIntegrityMonitor::ievt_ [private] |
Definition at line 43 of file CastorDataIntegrityMonitor.h.
Referenced by processEvent(), and setup().
Definition at line 59 of file CastorDataIntegrityMonitor.h.
MonitorElement* CastorDataIntegrityMonitor::meEVT_ [private] |
Definition at line 54 of file CastorDataIntegrityMonitor.h.
Referenced by processEvent(), and setup().
std::vector<std::vector<bool> > CastorDataIntegrityMonitor::problemCASTOR [private] |
Definition at line 33 of file CastorDataIntegrityMonitor.h.
int CastorDataIntegrityMonitor::problemsSpigot[15][3] [private] |
Definition at line 50 of file CastorDataIntegrityMonitor.h.
Referenced by processEvent(), setup(), and unpack().
int CastorDataIntegrityMonitor::spigotStatus [private] |
Definition at line 45 of file CastorDataIntegrityMonitor.h.
Definition at line 60 of file CastorDataIntegrityMonitor.h.
Referenced by processEvent(), and setup().
double CastorDataIntegrityMonitor::statusSpigotDCC [private] |
Definition at line 46 of file CastorDataIntegrityMonitor.h.
Referenced by processEvent(), and setup().
std::map<uint32_t, std::vector<HcalCastorDetId> >::iterator CastorDataIntegrityMonitor::thisDCC |
Definition at line 29 of file CastorDataIntegrityMonitor.h.