Public Member Functions | |
SiStripFEDCheckPlugin (const edm::ParameterSet &) | |
~SiStripFEDCheckPlugin () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
void | doUpdateIfNeeded () |
virtual void | endJob () |
virtual void | endRun () |
void | fillFatalError (unsigned int fedId, bool fatalError) |
void | fillNonFatalError (unsigned int fedId, float nonFatalError) |
void | fillPresent (unsigned int fedId, bool present) |
bool | hasFatalError (const FEDRawData &fedData, unsigned int fedId) const |
bool | hasNonFatalError (const FEDRawData &fedData, unsigned int fedId) const |
void | updateCabling (const edm::EventSetup &eventSetup) |
void | updateHistograms () |
Private Attributes | |
const SiStripFedCabling * | cabling_ |
uint32_t | cablingCacheId_ |
bool | checkChannelLengths_ |
bool | checkChannelStatusBits_ |
bool | checkFELengths_ |
bool | checkPacketCodes_ |
std::string | dirName_ |
bool | doPayloadChecks_ |
DQMStore * | dqm_ |
unsigned int | eventCount_ |
std::vector< unsigned int > | fedFatalErrorBinContents_ |
MonitorElement * | fedFatalErrors_ |
std::vector< unsigned int > | fedNonFatalErrorBinContents_ |
MonitorElement * | fedNonFatalErrors_ |
MonitorElement * | fedsPresent_ |
std::vector< unsigned int > | fedsPresentBinContents_ |
bool | printDebug_ |
edm::InputTag | rawDataTag_ |
unsigned int | updateFrequency_ |
bool | writeDQMStore_ |
Description: DQM source application to produce data integrety histograms for SiStrip data for use in HLT and Prompt reco
Definition at line 48 of file SiStripFEDDataCheck.cc.
SiStripFEDCheckPlugin::SiStripFEDCheckPlugin | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 103 of file SiStripFEDDataCheck.cc.
References checkChannelLengths_, checkChannelStatusBits_, checkFELengths_, checkPacketCodes_, doPayloadChecks_, and printDebug_.
: rawDataTag_(iConfig.getParameter<edm::InputTag>("RawDataTag")), dirName_(iConfig.getUntrackedParameter<std::string>("DirName","SiStrip/FEDIntegrity/")), printDebug_(iConfig.getUntrackedParameter<bool>("PrintDebugMessages",false)), writeDQMStore_(iConfig.getUntrackedParameter<bool>("WriteDQMStore",false)), updateFrequency_(iConfig.getUntrackedParameter<unsigned int>("HistogramUpdateFrequency",0)), fedsPresentBinContents_(FEDNumbering::MAXSiStripFEDID+1,0), fedFatalErrorBinContents_(FEDNumbering::MAXSiStripFEDID+1,0), fedNonFatalErrorBinContents_(FEDNumbering::MAXSiStripFEDID+1,0), eventCount_(0), doPayloadChecks_(iConfig.getUntrackedParameter<bool>("DoPayloadChecks",true)), checkChannelLengths_(iConfig.getUntrackedParameter<bool>("CheckChannelLengths",true)), checkPacketCodes_(iConfig.getUntrackedParameter<bool>("CheckChannelPacketCodes",true)), checkFELengths_(iConfig.getUntrackedParameter<bool>("CheckFELengths",true)), checkChannelStatusBits_(iConfig.getUntrackedParameter<bool>("CheckChannelStatus",true)), cablingCacheId_(0) { if (printDebug_ && !doPayloadChecks_ && (checkChannelLengths_ || checkPacketCodes_ || checkFELengths_)) { std::stringstream ss; ss << "Payload checks are disabled but individual payload checks have been enabled. The following payload checks will be skipped: "; if (checkChannelLengths_) ss << "Channel length check, "; if (checkPacketCodes_) ss << "Channel packet code check, "; if (checkChannelStatusBits_) ss << "Cabled channel status bits checks, "; if (checkFELengths_) ss << "FE Unit legnth check"; edm::LogWarning("SiStripFEDCheck") << ss.str(); } }
SiStripFEDCheckPlugin::~SiStripFEDCheckPlugin | ( | ) |
Definition at line 131 of file SiStripFEDDataCheck.cc.
{ }
void SiStripFEDCheckPlugin::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 142 of file SiStripFEDDataCheck.cc.
References cabling_, checkChannelLengths_, checkChannelStatusBits_, checkFELengths_, checkPacketCodes_, FEDRawData::data(), doPayloadChecks_, doUpdateIfNeeded(), FEDRawDataCollection::FEDData(), fillFatalError(), fillNonFatalError(), fillPresent(), edm::Event::getByLabel(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, printDebug_, rawDataTag_, FEDRawData::size(), and updateCabling().
{ //update cabling updateCabling(iSetup); //get raw data edm::Handle<FEDRawDataCollection> rawDataCollectionHandle; const bool gotData = iEvent.getByLabel(rawDataTag_,rawDataCollectionHandle); if (!gotData) { //module is required to silently do nothing when data is not present return; } const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle; //get FED IDs const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; //FED errors FEDErrors lFedErrors; //loop over siStrip FED IDs for (unsigned int fedId = siStripFedIdMin; fedId <= siStripFedIdMax; fedId++) { const FEDRawData& fedData = rawDataCollection.FEDData(fedId); //create an object to fill all errors //third param to false:save time by not initialising anything not used here lFedErrors.initialiseFED(fedId,cabling_,false); //check data exists if (!fedData.size() || !fedData.data()) { fillPresent(fedId,0); continue; } //fill buffer present histogram fillPresent(fedId,1); //check for fatal errors //no need for debug output bool hasFatalErrors = false; float rateNonFatal = 0; std::auto_ptr<const sistrip::FEDBuffer> buffer; if (!lFedErrors.fillFatalFEDErrors(fedData,0)) { hasFatalErrors = true; } else { //need to construct full object to go any further if (doPayloadChecks_ || checkChannelStatusBits_) { buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); if (doPayloadChecks_) { bool channelLengthsOK = checkChannelLengths_ ? buffer->checkChannelLengthsMatchBufferLength() : true; bool channelPacketCodesOK = checkPacketCodes_ ? buffer->checkChannelPacketCodes() : true; bool feLengthsOK = checkFELengths_ ? buffer->checkFEUnitLengths() : true; if ( !channelLengthsOK || !channelPacketCodesOK || !feLengthsOK ) { hasFatalErrors = true; } } if (checkChannelStatusBits_) rateNonFatal = lFedErrors.fillNonFatalFEDErrors(buffer.get(),cabling_); } } if (hasFatalErrors) { fillFatalError(fedId,1); if (printDebug_) { if (!buffer.get()) buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); edm::LogInfo("SiStripFEDCheck") << "Fatal error with FED ID " << fedId << ". Check summary: " << std::endl << buffer->checkSummary() << std::endl; std::stringstream ss; buffer->dump(ss); edm::LogInfo("SiStripFEDCheck") << ss.str(); } } else { fillFatalError(fedId,0); //fill non-fatal errors histogram if there were no fatal errors fillNonFatalError(fedId,rateNonFatal); if (printDebug_ && rateNonFatal > 0) { if (!buffer.get()) buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); edm::LogInfo("SiStripFEDCheck") << "Non-fatal error with FED ID " << fedId << " for " << rateNonFatal << " of the channels. Check summary: " << std::endl << buffer->checkSummary() << std::endl; std::stringstream ss; buffer->dump(ss); edm::LogInfo("SiStripFEDCheck") << ss.str(); } } }//loop over FED IDs //update histograms if needed doUpdateIfNeeded(); }
void SiStripFEDCheckPlugin::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 244 of file SiStripFEDDataCheck.cc.
References DQMStore::book1D(), dirName_, dqm_, fedFatalErrors_, fedNonFatalErrors_, fedsPresent_, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().
{ //get FED IDs const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; //get DQM store dqm_ = &(*edm::Service<DQMStore>()); dqm_->setCurrentFolder(dirName_); //book histograms fedsPresent_ = dqm_->book1D("FEDEntries", "Number of times FED buffer is present in data", siStripFedIdMax-siStripFedIdMin+1, siStripFedIdMin-0.5,siStripFedIdMax+0.5); fedsPresent_->setAxisTitle("FED-ID",1); fedFatalErrors_ = dqm_->book1D("FEDFatal", "Number of fatal errors in FED buffer", siStripFedIdMax-siStripFedIdMin+1, siStripFedIdMin-0.5,siStripFedIdMax+0.5); fedFatalErrors_->setAxisTitle("FED-ID",1); fedNonFatalErrors_ = dqm_->book1D("FEDNonFatal", "Number of non fatal errors in FED buffer", siStripFedIdMax-siStripFedIdMin+1, siStripFedIdMin-0.5,siStripFedIdMax+0.5); fedNonFatalErrors_->setAxisTitle("FED-ID",1); }
void SiStripFEDCheckPlugin::doUpdateIfNeeded | ( | ) | [private] |
Definition at line 323 of file SiStripFEDDataCheck.cc.
References eventCount_, updateFrequency_, and updateHistograms().
Referenced by analyze().
{ eventCount_++; if (updateFrequency_ && (eventCount_%updateFrequency_ == 0)) { updateHistograms(); } }
void SiStripFEDCheckPlugin::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 279 of file SiStripFEDDataCheck.cc.
References dqm_, DQMStore::save(), and writeDQMStore_.
{ if (writeDQMStore_) dqm_->save("DQMStore.root"); }
void SiStripFEDCheckPlugin::endRun | ( | void | ) | [private, virtual] |
Definition at line 272 of file SiStripFEDDataCheck.cc.
References updateHistograms().
{ updateHistograms(); }
void SiStripFEDCheckPlugin::fillFatalError | ( | unsigned int | fedId, |
bool | fatalError | ||
) | [inline, private] |
Definition at line 304 of file SiStripFEDDataCheck.cc.
References fedFatalErrorBinContents_, fedFatalErrors_, MonitorElement::Fill(), and updateFrequency_.
Referenced by analyze().
{ if (updateFrequency_) { if (fatalError) fedFatalErrorBinContents_[fedId]++; } else { //fedFatalErrors_->Fill( fatalError ? 1 : 0 ); if (fatalError) fedFatalErrors_->Fill(fedId); } }
void SiStripFEDCheckPlugin::fillNonFatalError | ( | unsigned int | fedId, |
float | nonFatalError | ||
) | [inline, private] |
Definition at line 314 of file SiStripFEDDataCheck.cc.
References fedNonFatalErrorBinContents_, fedNonFatalErrors_, MonitorElement::Fill(), and updateFrequency_.
Referenced by analyze().
{ if (updateFrequency_) { if (nonFatalError>0) fedNonFatalErrorBinContents_[fedId]++;//nonFatalError; } else { if (nonFatalError>0) fedNonFatalErrors_->Fill(fedId); } }
void SiStripFEDCheckPlugin::fillPresent | ( | unsigned int | fedId, |
bool | present | ||
) | [inline, private] |
Definition at line 296 of file SiStripFEDDataCheck.cc.
References fedsPresent_, fedsPresentBinContents_, MonitorElement::Fill(), and updateFrequency_.
Referenced by analyze().
{ if (present) { if (updateFrequency_) fedsPresentBinContents_[fedId]++; else fedsPresent_->Fill(fedId); } }
bool SiStripFEDCheckPlugin::hasFatalError | ( | const FEDRawData & | fedData, |
unsigned int | fedId | ||
) | const [private] |
bool SiStripFEDCheckPlugin::hasNonFatalError | ( | const FEDRawData & | fedData, |
unsigned int | fedId | ||
) | const [private] |
void SiStripFEDCheckPlugin::updateCabling | ( | const edm::EventSetup & | eventSetup | ) | [private] |
Definition at line 285 of file SiStripFEDDataCheck.cc.
References cabling_, cablingCacheId_, edm::EventSetup::get(), and edm::ESHandle< T >::product().
Referenced by analyze().
{ uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier(); if (cablingCacheId_ != currentCacheId) { edm::ESHandle<SiStripFedCabling> cablingHandle; eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle); cabling_ = cablingHandle.product(); cablingCacheId_ = currentCacheId; } }
void SiStripFEDCheckPlugin::updateHistograms | ( | ) | [private] |
Definition at line 331 of file SiStripFEDDataCheck.cc.
References newFWLiteAna::bin, fedFatalErrorBinContents_, fedFatalErrors_, fedNonFatalErrorBinContents_, fedNonFatalErrors_, fedsPresent_, fedsPresentBinContents_, MonitorElement::getTH1(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, and updateFrequency_.
Referenced by doUpdateIfNeeded(), and endRun().
{ //if the cache is not being used then do nothing if (!updateFrequency_) return; const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; unsigned int entriesFedsPresent = 0; unsigned int entriesFatalErrors = 0; unsigned int entriesNonFatalErrors = 0; for (unsigned int fedId = siStripFedIdMin, bin = 1; fedId < siStripFedIdMax+1; fedId++, bin++) { unsigned int fedsPresentBin = fedsPresentBinContents_[fedId]; fedsPresent_->getTH1()->SetBinContent(bin,fedsPresentBin); entriesFedsPresent += fedsPresentBin; unsigned int fedFatalErrorsBin = fedFatalErrorBinContents_[fedId]; fedFatalErrors_->getTH1()->SetBinContent(bin,fedFatalErrorsBin); entriesFatalErrors += fedFatalErrorsBin; unsigned int fedNonFatalErrorsBin = fedNonFatalErrorBinContents_[fedId]; fedNonFatalErrors_->getTH1()->SetBinContent(bin,fedNonFatalErrorsBin); entriesNonFatalErrors += fedNonFatalErrorsBin; } fedsPresent_->getTH1()->SetEntries(entriesFedsPresent); fedFatalErrors_->getTH1()->SetEntries(entriesFatalErrors); fedNonFatalErrors_->getTH1()->SetEntries(entriesNonFatalErrors); }
const SiStripFedCabling* SiStripFEDCheckPlugin::cabling_ [private] |
Definition at line 95 of file SiStripFEDDataCheck.cc.
Referenced by analyze(), and updateCabling().
uint32_t SiStripFEDCheckPlugin::cablingCacheId_ [private] |
Definition at line 94 of file SiStripFEDDataCheck.cc.
Referenced by updateCabling().
bool SiStripFEDCheckPlugin::checkChannelLengths_ [private] |
Definition at line 91 of file SiStripFEDDataCheck.cc.
Referenced by analyze(), and SiStripFEDCheckPlugin().
bool SiStripFEDCheckPlugin::checkChannelStatusBits_ [private] |
Definition at line 91 of file SiStripFEDDataCheck.cc.
Referenced by analyze(), and SiStripFEDCheckPlugin().
bool SiStripFEDCheckPlugin::checkFELengths_ [private] |
Definition at line 91 of file SiStripFEDDataCheck.cc.
Referenced by analyze(), and SiStripFEDCheckPlugin().
bool SiStripFEDCheckPlugin::checkPacketCodes_ [private] |
Definition at line 91 of file SiStripFEDDataCheck.cc.
Referenced by analyze(), and SiStripFEDCheckPlugin().
std::string SiStripFEDCheckPlugin::dirName_ [private] |
Definition at line 72 of file SiStripFEDDataCheck.cc.
Referenced by beginJob().
bool SiStripFEDCheckPlugin::doPayloadChecks_ [private] |
Definition at line 91 of file SiStripFEDDataCheck.cc.
Referenced by analyze(), and SiStripFEDCheckPlugin().
DQMStore* SiStripFEDCheckPlugin::dqm_ [private] |
Definition at line 77 of file SiStripFEDDataCheck.cc.
Referenced by beginJob(), and endJob().
unsigned int SiStripFEDCheckPlugin::eventCount_ [private] |
Definition at line 88 of file SiStripFEDDataCheck.cc.
Referenced by doUpdateIfNeeded().
std::vector<unsigned int> SiStripFEDCheckPlugin::fedFatalErrorBinContents_ [private] |
Definition at line 86 of file SiStripFEDDataCheck.cc.
Referenced by fillFatalError(), and updateHistograms().
Definition at line 79 of file SiStripFEDDataCheck.cc.
Referenced by beginJob(), fillFatalError(), and updateHistograms().
std::vector<unsigned int> SiStripFEDCheckPlugin::fedNonFatalErrorBinContents_ [private] |
Definition at line 87 of file SiStripFEDDataCheck.cc.
Referenced by fillNonFatalError(), and updateHistograms().
Definition at line 80 of file SiStripFEDDataCheck.cc.
Referenced by beginJob(), fillNonFatalError(), and updateHistograms().
Definition at line 78 of file SiStripFEDDataCheck.cc.
Referenced by beginJob(), fillPresent(), and updateHistograms().
std::vector<unsigned int> SiStripFEDCheckPlugin::fedsPresentBinContents_ [private] |
Definition at line 85 of file SiStripFEDDataCheck.cc.
Referenced by fillPresent(), and updateHistograms().
bool SiStripFEDCheckPlugin::printDebug_ [private] |
Definition at line 73 of file SiStripFEDDataCheck.cc.
Referenced by analyze(), and SiStripFEDCheckPlugin().
Definition at line 71 of file SiStripFEDDataCheck.cc.
Referenced by analyze().
unsigned int SiStripFEDCheckPlugin::updateFrequency_ [private] |
Definition at line 83 of file SiStripFEDDataCheck.cc.
Referenced by doUpdateIfNeeded(), fillFatalError(), fillNonFatalError(), fillPresent(), and updateHistograms().
bool SiStripFEDCheckPlugin::writeDQMStore_ [private] |
Definition at line 74 of file SiStripFEDDataCheck.cc.
Referenced by endJob().