#include <DQM/SiStripMonitorHardware/plugins/SiStripFEDMonitor.cc>
Public Member Functions | |
SiStripFEDMonitorPlugin (const edm::ParameterSet &) | |
~SiStripFEDMonitorPlugin () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) |
virtual void | endJob () |
virtual void | endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) |
void | updateCabling (const edm::EventSetup &eventSetup) |
Private Attributes | |
const SiStripFedCabling * | cabling_ |
uint32_t | cablingCacheId_ |
bool | doMedHists_ |
bool | doTkHistoMap_ |
DQMStore * | dqm_ |
std::string | dqmStoreFileName_ |
FEDErrors | fedErrors_ |
FEDHistograms | fedHists_ |
bool | fillAllDetailedHistograms_ |
bool | fillWithEvtNum_ |
std::string | folderName_ |
unsigned int | nEvt_ |
unsigned int | printDebug_ |
edm::InputTag | rawDataTag_ |
bool | writeDQMStore_ |
Description: DQM source application to produce data integrety histograms for SiStrip data
Definition at line 57 of file SiStripFEDMonitor.cc.
SiStripFEDMonitorPlugin::SiStripFEDMonitorPlugin | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 114 of file SiStripFEDMonitor.cc.
References doMedHists_, doTkHistoMap_, dqmStoreFileName_, fedHists_, fillAllDetailedHistograms_, fillWithEvtNum_, folderName_, LogTrace, nEvt_, NULL, printDebug_, rawDataTag_, and writeDQMStore_.
: rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))), folderName_(iConfig.getUntrackedParameter<std::string>("HistogramFolderName","SiStrip/ReadoutView/FedMonitoringSummary")), fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms",false)), fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber",false)), printDebug_(iConfig.getUntrackedParameter<unsigned int>("PrintDebugMessages",1)), //printDebug_(iConfig.getUntrackedParameter<bool>("PrintDebugMessages",false)), writeDQMStore_(iConfig.getUntrackedParameter<bool>("WriteDQMStore",false)), dqmStoreFileName_(iConfig.getUntrackedParameter<std::string>("DQMStoreFileName","DQMStore.root")), dqm_(0), cablingCacheId_(0) { //print config to debug log std::ostringstream debugStream; if (printDebug_>1) { debugStream << "[SiStripFEDMonitorPlugin]Configuration for SiStripFEDMonitorPlugin: " << std::endl << "[SiStripFEDMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl << "[SiStripFEDMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl << "[SiStripFEDMonitorPlugin]\tFillAllDetailedHistograms? " << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl << "[SiStripFEDMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl << "[SiStripFEDMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl << "[SiStripFEDMonitorPlugin]\tWriteDQMStore? " << (writeDQMStore_ ? "yes" : "no") << std::endl; if (writeDQMStore_) debugStream << "[SiStripFEDMonitorPlugin]\tDQMStoreFileName: " << dqmStoreFileName_ << std::endl; } //don;t generate debug mesages if debug is disabled std::ostringstream* pDebugStream = (printDebug_>1 ? &debugStream : NULL); fedHists_.initialise(iConfig,pDebugStream); doTkHistoMap_ = fedHists_.tkHistoMapEnabled(); doMedHists_ = fedHists_.cmHistosEnabled(); if (printDebug_) { LogTrace("SiStripMonitorHardware") << debugStream.str(); //debugStream.str(""); //debugStream << " -- Quelle est la difference entre un canard ? " << std::endl // << " -- Reponse: c'est qu'il a les deux pattes de la meme longueur, surtout la gauche." << std::endl; //edm::LogError("SiStripMonitorHardware") << debugStream.str(); } nEvt_ = 0; }
SiStripFEDMonitorPlugin::~SiStripFEDMonitorPlugin | ( | ) |
Definition at line 163 of file SiStripFEDMonitor.cc.
{ }
void SiStripFEDMonitorPlugin::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 174 of file SiStripFEDMonitor.cc.
References cabling_, doMedHists_, doTkHistoMap_, edm::EventID::event(), FEDRawDataCollection::FEDData(), fedErrors_, fedHists_, fillWithEvtNum_, edm::Event::getByLabel(), edm::EventBase::id(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nEvt_, edm::EventBase::orbitNumber(), printDebug_, rawDataTag_, and updateCabling().
{ //update cabling updateCabling(iSetup); //get raw data edm::Handle<FEDRawDataCollection> rawDataCollectionHandle; iEvent.getByLabel(rawDataTag_,rawDataCollectionHandle); const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle; fedErrors_.initialiseEvent(); //initialise map of fedId/bad channel number std::map<unsigned int,std::pair<unsigned short,unsigned short> > badChannelFraction; unsigned int lNFEDMonitoring = 0; unsigned int lNFEDUnpacker = 0; unsigned int lNChannelMonitoring = 0; unsigned int lNChannelUnpacker = 0; unsigned int lNTotBadFeds = 0; unsigned int lNTotBadChannels = 0; unsigned int lNTotBadActiveChannels = 0; //loop over siStrip FED IDs for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; fedId <= FEDNumbering::MAXSiStripFEDID; fedId++) {//loop over FED IDs const FEDRawData& fedData = rawDataCollection.FEDData(fedId); //create an object to fill all errors fedErrors_.initialiseFED(fedId,cabling_); bool lFullDebug = false; //Do detailed check //first check if data exists bool lDataExist = fedErrors_.checkDataPresent(fedData); if (!lDataExist) { fedHists_.fillFEDHistograms(fedErrors_,lFullDebug); continue; } //check for problems and fill detailed histograms fedErrors_.fillFEDErrors(fedData, lFullDebug, printDebug_, lNChannelMonitoring, lNChannelUnpacker, doMedHists_, fedHists_.cmHistPointer(false), fedHists_.cmHistPointer(true) ); //check filled in previous method. bool lFailUnpackerFEDcheck = fedErrors_.failUnpackerFEDCheck(); fedErrors_.incrementFEDCounters(); fedHists_.fillFEDHistograms(fedErrors_,lFullDebug); bool lFailMonitoringFEDcheck = fedErrors_.failMonitoringFEDCheck(); if (lFailMonitoringFEDcheck) lNTotBadFeds++; //sanity check: if something changed in the unpacking code //but wasn't propagated here //print only the summary, and more info if printDebug>1 if (lFailMonitoringFEDcheck != lFailUnpackerFEDcheck) { if (printDebug_>1) { std::ostringstream debugStream; debugStream << " --- WARNING: FED " << fedId << std::endl << " ------ Monitoring FED check " ; if (lFailMonitoringFEDcheck) debugStream << "failed." << std::endl; else debugStream << "passed." << std::endl ; debugStream << " ------ Unpacker FED check " ; if (lFailUnpackerFEDcheck) debugStream << "failed." << std::endl; else debugStream << "passed." << std::endl ; edm::LogError("SiStripMonitorHardware") << debugStream.str(); } if (lFailMonitoringFEDcheck) lNFEDMonitoring++; else if (lFailUnpackerFEDcheck) lNFEDUnpacker++; } //Fill TkHistoMap: //add an entry for all channels (good = 0), //so that tkHistoMap knows which channels should be there. if (doTkHistoMap_ && !fedHists_.tkHistoMapPointer()) { edm::LogWarning("SiStripMonitorHardware") << " -- Fedid " << fedId << ", TkHistoMap enabled but pointer is null." << std::endl; } fedErrors_.fillBadChannelList(doTkHistoMap_, fedHists_.tkHistoMapPointer(), lNTotBadChannels, lNTotBadActiveChannels); }//loop over FED IDs if ((lNTotBadFeds> 0 || lNTotBadChannels>0) && printDebug_>1) { std::ostringstream debugStream; debugStream << "[SiStripFEDMonitorPlugin] --- Total number of bad feds = " << lNTotBadFeds << std::endl << "[SiStripFEDMonitorPlugin] --- Total number of bad channels = " << lNTotBadChannels << std::endl << "[SiStripFEDMonitorPlugin] --- Total number of bad active channels = " << lNTotBadActiveChannels << std::endl; edm::LogInfo("SiStripMonitorHardware") << debugStream.str(); } if ((lNFEDMonitoring > 0 || lNFEDUnpacker > 0 || lNChannelMonitoring > 0 || lNChannelUnpacker > 0) && printDebug_) { std::ostringstream debugStream; debugStream << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at FED level : " << std::endl << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNFEDMonitoring << std::endl << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNFEDUnpacker << std::endl << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at Channel level : " << std::endl << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNChannelMonitoring << std::endl << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNChannelUnpacker << std::endl << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl ; edm::LogError("SiStripMonitorHardware") << debugStream.str(); } FEDErrors::getFEDErrorsCounters().nTotalBadChannels = lNTotBadChannels; FEDErrors::getFEDErrorsCounters().nTotalBadActiveChannels = lNTotBadActiveChannels; //fedHists_.fillCountersHistograms(FEDErrors::getFEDErrorsCounters(), nEvt_); //time in seconds since beginning of the run or event number if (fillWithEvtNum_) fedHists_.fillCountersHistograms(FEDErrors::getFEDErrorsCounters(),FEDErrors::getChannelErrorsCounters(),iEvent.id().event()); else fedHists_.fillCountersHistograms(FEDErrors::getFEDErrorsCounters(),FEDErrors::getChannelErrorsCounters(),iEvent.orbitNumber()/11223.); nEvt_++; }//analyze method
void SiStripFEDMonitorPlugin::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 320 of file SiStripFEDMonitor.cc.
References dqm_, fedHists_, fillAllDetailedHistograms_, folderName_, nEvt_, and DQMStore::setCurrentFolder().
{ //get DQM store dqm_ = &(*edm::Service<DQMStore>()); dqm_->setCurrentFolder(folderName_); //this propagates dqm_ to the histoclass, must be called ! fedHists_.bookTopLevelHistograms(dqm_); if (fillAllDetailedHistograms_) fedHists_.bookAllFEDHistograms(); nEvt_ = 0; //const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; //const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; //mark all channels as inactive until they have been 'locked' at least once // activeChannels_.resize(siStripFedIdMax+1); // for (unsigned int fedId = siStripFedIdMin; // fedId <= siStripFedIdMax; // fedId++) { // activeChannels_[fedId].resize(sistrip::FEDCH_PER_FED,false); // } }
void SiStripFEDMonitorPlugin::beginLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | context | ||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 359 of file SiStripFEDMonitor.cc.
References fedErrors_.
{ fedErrors_.initialiseLumiBlock(); }
void SiStripFEDMonitorPlugin::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 351 of file SiStripFEDMonitor.cc.
References dqm_, dqmStoreFileName_, DQMStore::save(), and writeDQMStore_.
{ if (writeDQMStore_) dqm_->save(dqmStoreFileName_); }
void SiStripFEDMonitorPlugin::endLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | context | ||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 369 of file SiStripFEDMonitor.cc.
References fedErrors_, and fedHists_.
{ fedHists_.fillLumiHistograms(fedErrors_.getLumiErrors()); }
void SiStripFEDMonitorPlugin::updateCabling | ( | const edm::EventSetup & | eventSetup | ) | [private] |
Definition at line 378 of file SiStripFEDMonitor.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; } }
const SiStripFedCabling* SiStripFEDMonitorPlugin::cabling_ [private] |
Definition at line 95 of file SiStripFEDMonitor.cc.
Referenced by analyze(), and updateCabling().
uint32_t SiStripFEDMonitorPlugin::cablingCacheId_ [private] |
Definition at line 94 of file SiStripFEDMonitor.cc.
Referenced by updateCabling().
bool SiStripFEDMonitorPlugin::doMedHists_ [private] |
Definition at line 99 of file SiStripFEDMonitor.cc.
Referenced by analyze(), and SiStripFEDMonitorPlugin().
bool SiStripFEDMonitorPlugin::doTkHistoMap_ [private] |
Definition at line 98 of file SiStripFEDMonitor.cc.
Referenced by analyze(), and SiStripFEDMonitorPlugin().
DQMStore* SiStripFEDMonitorPlugin::dqm_ [private] |
Definition at line 92 of file SiStripFEDMonitor.cc.
Referenced by beginJob(), and endJob().
std::string SiStripFEDMonitorPlugin::dqmStoreFileName_ [private] |
Definition at line 90 of file SiStripFEDMonitor.cc.
Referenced by endJob(), and SiStripFEDMonitorPlugin().
FEDErrors SiStripFEDMonitorPlugin::fedErrors_ [private] |
Definition at line 105 of file SiStripFEDMonitor.cc.
Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().
FEDHistograms SiStripFEDMonitorPlugin::fedHists_ [private] |
Definition at line 78 of file SiStripFEDMonitor.cc.
Referenced by analyze(), beginJob(), endLuminosityBlock(), and SiStripFEDMonitorPlugin().
bool SiStripFEDMonitorPlugin::fillAllDetailedHistograms_ [private] |
Definition at line 82 of file SiStripFEDMonitor.cc.
Referenced by beginJob(), and SiStripFEDMonitorPlugin().
bool SiStripFEDMonitorPlugin::fillWithEvtNum_ [private] |
Definition at line 84 of file SiStripFEDMonitor.cc.
Referenced by analyze(), and SiStripFEDMonitorPlugin().
std::string SiStripFEDMonitorPlugin::folderName_ [private] |
Definition at line 80 of file SiStripFEDMonitor.cc.
Referenced by beginJob(), and SiStripFEDMonitorPlugin().
unsigned int SiStripFEDMonitorPlugin::nEvt_ [private] |
Definition at line 101 of file SiStripFEDMonitor.cc.
Referenced by analyze(), beginJob(), and SiStripFEDMonitorPlugin().
unsigned int SiStripFEDMonitorPlugin::printDebug_ [private] |
Definition at line 86 of file SiStripFEDMonitor.cc.
Referenced by analyze(), and SiStripFEDMonitorPlugin().
Definition at line 76 of file SiStripFEDMonitor.cc.
Referenced by analyze(), and SiStripFEDMonitorPlugin().
bool SiStripFEDMonitorPlugin::writeDQMStore_ [private] |
Definition at line 89 of file SiStripFEDMonitor.cc.
Referenced by endJob(), and SiStripFEDMonitorPlugin().