#include <EcalDQMonitorTask.h>
Definition at line 24 of file EcalDQMonitorTask.h.
typedef void(EcalDQMonitorTask::* EcalDQMonitorTask::Processor)(const edm::Event &, ecaldqm::Collections) [private] |
Definition at line 40 of file EcalDQMonitorTask.h.
EcalDQMonitorTask::EcalDQMonitorTask | ( | const edm::ParameterSet & | _ps | ) |
Definition at line 29 of file EcalDQMonitorTask.cc.
References ecaldqm::collectionName, collectionTags_, gather_cfg::cout, formSchedule_(), ecaldqm::DQWorkerTask::getDependencies(), ecaldqm::DQWorker::getName(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEcalRawData, EcalDQMonitor::moduleName_, ecaldqm::nCollections, schedule_, edm::second(), ecaldqm::DQWorker::setVerbosity(), taskLists_, EcalDQMonitor::verbosity_, and workers_.
: EcalDQMonitor(_ps), ievt_(0), workers_(0), schedule_(), enabled_(), taskTimes_(), evaluateTime_(_ps.getUntrackedParameter<bool>("evaluateTime")), allowMissingCollections_(_ps.getUntrackedParameter<bool>("allowMissingCollections")) { using namespace std; vector<string> taskNames(_ps.getUntrackedParameter<vector<string> >("tasks")); const edm::ParameterSet& taskParams(_ps.getUntrackedParameterSet("taskParameters")); const edm::ParameterSet& mePaths(_ps.getUntrackedParameterSet("mePaths")); WorkerFactory factory(0); std::multimap<Collections, Collections> dependencies; for(vector<string>::iterator tItr(taskNames.begin()); tItr != taskNames.end(); ++tItr){ if (!(factory = SetWorker::findFactory(*tItr))) continue; if(verbosity_ > 0) cout << moduleName_ << ": Setting up " << *tItr << endl; DQWorker* worker(factory(taskParams, mePaths.getUntrackedParameterSet(*tItr))); if(worker->getName() != *tItr){ delete worker; if(verbosity_ > 0) cout << moduleName_ << ": " << *tItr << " could not be configured" << endl; continue; } DQWorkerTask* task(static_cast<DQWorkerTask*>(worker)); task->setVerbosity(verbosity_); workers_.push_back(task); const std::vector<std::pair<Collections, Collections> >& dep(task->getDependencies()); for(std::vector<std::pair<Collections, Collections> >::const_iterator depItr(dep.begin()); depItr != dep.end(); ++depItr) dependencies.insert(*depItr); } const edm::ParameterSet& collectionTags(_ps.getUntrackedParameterSet("collectionTags")); std::vector<Collections> usedCollections; for(unsigned iCol(0); iCol < nCollections; iCol++){ collectionTags_[iCol] = edm::InputTag(); taskLists_[iCol] = vector<DQWorkerTask*>(); bool use(iCol == kEcalRawData); for(vector<DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ if((*wItr)->runsOn(iCol)){ taskLists_[iCol].push_back(*wItr); use = true; } } if(use){ collectionTags_[iCol] = collectionTags.getUntrackedParameter<edm::InputTag>(collectionName[iCol]); usedCollections.push_back(Collections(iCol)); } } formSchedule_(usedCollections, dependencies); if(verbosity_ > 0){ cout << moduleName_ << ": Using collections" << endl; for(unsigned iCol(0); iCol < schedule_.size(); iCol++) cout << collectionName[schedule_[iCol].second] << endl; cout << endl; } }
EcalDQMonitorTask::~EcalDQMonitorTask | ( | ) |
Definition at line 104 of file EcalDQMonitorTask.cc.
References workers_.
void EcalDQMonitorTask::analyze | ( | const edm::Event & | _evt, |
const edm::EventSetup & | _es | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 188 of file EcalDQMonitorTask.cc.
References ecaldqm::DQWorkerTask::beginEvent(), ecaldqm::DQWorker::bookMEs(), collectionTags_, gather_cfg::cout, enabled_, ecaldqm::DQWorkerTask::endEvent(), ecaldqm::DQWorkerTask::filterRunType(), first, edm::Event::getByLabel(), ecaldqm::DQWorker::getName(), ievt_, ecaldqm::DQWorker::isInitialized(), ecaldqm::kEcalRawData, EcalDQMonitor::moduleName_, environment_file_cff::runType, schedule_, edm::second(), ecaldqm::DQWorker::setInitialized(), EcalDQMonitor::verbosity_, and workers_.
{ using namespace std; using namespace ecaldqm; ievt_++; edm::Handle<EcalRawDataCollection> dcchsHndl; if(!_evt.getByLabel(collectionTags_[kEcalRawData], dcchsHndl)) throw cms::Exception("ObjectNotFound") << "EcalRawDataCollection with InputTag " << collectionTags_[kEcalRawData] << " does not exist"; // determine event type (called run type in DCCHeader for some reason) for each FED std::vector<short> runType(54, -1); for(EcalRawDataCollection::const_iterator dcchItr = dcchsHndl->begin(); dcchItr != dcchsHndl->end(); ++dcchItr){ runType[dcchItr->id() - 1] = dcchItr->getRunType(); } bool atLeastOne(false); DQWorkerTask *task(0); // set up task modules for(vector<DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ task = *wItr; if(task->filterRunType(runType)){ enabled_[task] = true; if(!task->isInitialized()){ if(verbosity_ > 1) cout << moduleName_ << ": Booking MEs for " << task->getName() << endl; task->bookMEs(); task->setInitialized(true); } task->beginEvent(_evt, _es); atLeastOne = true; }else{ enabled_[task] = false; } } if(!atLeastOne) return; // run on collections for(unsigned iSch(0); iSch < schedule_.size(); iSch++){ Processor processor(schedule_[iSch].first); (this->*processor)(_evt, schedule_[iSch].second); } // close event for(vector<DQWorkerTask *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ task = *wItr; if(enabled_[task]) task->endEvent(_evt, _es); } }
void EcalDQMonitorTask::beginLuminosityBlock | ( | const edm::LuminosityBlock & | _lumi, |
const edm::EventSetup & | _es | ||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 170 of file EcalDQMonitorTask.cc.
References ecaldqm::DQWorker::beginLuminosityBlock(), ecaldqm::DQWorker::isInitialized(), ecaldqm::kLumiSection, ecaldqm::DQWorkerTask::runsOn(), and workers_.
{ for(std::vector<DQWorkerTask *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ DQWorkerTask* task(*wItr); if(task->isInitialized() && task->runsOn(kLumiSection)) task->beginLuminosityBlock(_lumi, _es); } }
void EcalDQMonitorTask::beginRun | ( | const edm::Run & | _run, |
const edm::EventSetup & | _es | ||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 120 of file EcalDQMonitorTask.cc.
References ecaldqm::DQWorker::beginRun(), gather_cfg::cout, edm::EventSetup::get(), ievt_, ecaldqm::kRun, EcalDQMonitor::moduleName_, edm::ESHandle< T >::product(), ecaldqm::DQWorker::reset(), edm::RunBase::run(), ecaldqm::DQWorkerTask::runsOn(), ecaldqm::setElectronicsMap(), ecaldqm::setTrigTowerMap(), taskTimes_, EcalDQMonitor::verbosity_, and workers_.
{ // set up ecaldqm::electronicsMap in EcalDQMCommonUtils edm::ESHandle<EcalElectronicsMapping> elecMapHandle; _es.get<EcalMappingRcd>().get(elecMapHandle); setElectronicsMap(elecMapHandle.product()); // set up ecaldqm::electronicsMap in EcalDQMCommonUtils edm::ESHandle<EcalTrigTowerConstituentsMap> ttMapHandle; _es.get<IdealGeometryRecord>().get(ttMapHandle); setTrigTowerMap(ttMapHandle.product()); for(std::vector<DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ DQWorkerTask* task(*wItr); task->reset(); if(task->runsOn(kRun)) task->beginRun(_run, _es); } if(verbosity_ > 0) std::cout << moduleName_ << ": Starting run " << _run.run() << std::endl; ievt_ = 0; taskTimes_.clear(); }
void EcalDQMonitorTask::endLuminosityBlock | ( | const edm::LuminosityBlock & | _lumi, |
const edm::EventSetup & | _es | ||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 179 of file EcalDQMonitorTask.cc.
References ecaldqm::DQWorker::endLuminosityBlock(), ecaldqm::DQWorker::isInitialized(), ecaldqm::kLumiSection, ecaldqm::DQWorkerTask::runsOn(), and workers_.
{ for(std::vector<DQWorkerTask *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ DQWorkerTask* task(*wItr); if(task->isInitialized() && task->runsOn(kLumiSection)) task->endLuminosityBlock(_lumi, _es); } }
void EcalDQMonitorTask::endRun | ( | const edm::Run & | _run, |
const edm::EventSetup & | _es | ||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 146 of file EcalDQMonitorTask.cc.
References ecaldqm::DQWorker::endRun(), evaluateTime_, ecaldqm::DQWorker::getName(), ievt_, ecaldqm::kRun, EcalDQMonitor::moduleName_, ecaldqm::DQWorkerTask::runsOn(), taskTimes_, and workers_.
{ using namespace std; for(vector<DQWorkerTask *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ DQWorkerTask* task(*wItr); if(task->runsOn(kRun)) task->endRun(_run, _es); } if(evaluateTime_){ stringstream ss; ss << "************** " << moduleName_ << " **************" << endl; ss << " Mean time consumption of the modules" << endl; ss << "____________________________________" << endl; for(std::vector<DQWorkerTask *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){ DQWorkerTask* task(*wItr); ss << setw(20) << setfill(' ') << task->getName() << "| " << (taskTimes_[task] / ievt_) << endl; } edm::LogInfo("EcalDQM") << ss.str(); } }
void EcalDQMonitorTask::fillDescriptions | ( | edm::ConfigurationDescriptions & | _descs | ) | [static] |
Reimplemented from edm::EDAnalyzer.
Definition at line 112 of file EcalDQMonitorTask.cc.
References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().
{ edm::ParameterSetDescription desc; desc.setUnknown(); _descs.addDefault(desc); }
void EcalDQMonitorTask::formSchedule_ | ( | const std::vector< ecaldqm::Collections > & | _usedCollections, |
const std::multimap< ecaldqm::Collections, ecaldqm::Collections > & | _dependencies | ||
) | [private] |
Definition at line 93 of file EcalDQMonitorTask2.cc.
References Exception, spr::find(), ecaldqm::kBlockSizeErrors, ecaldqm::kChIdErrors, ecaldqm::kEBBasicCluster, ecaldqm::kEBDigi, ecaldqm::kEBRecHit, ecaldqm::kEBSrFlag, ecaldqm::kEBSuperCluster, ecaldqm::kEBUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEBasicCluster, ecaldqm::kEEDigi, ecaldqm::kEERecHit, ecaldqm::kEESrFlag, ecaldqm::kEESuperCluster, ecaldqm::kEEUncalibRecHit, ecaldqm::kGainErrors, ecaldqm::kGainSwitchErrors, ecaldqm::kMEMBlockSizeErrors, ecaldqm::kMEMChIdErrors, ecaldqm::kMEMGainErrors, ecaldqm::kMEMTowerIdErrors, ecaldqm::kPnDiodeDigi, ecaldqm::kSource, ecaldqm::kTowerIdErrors, ecaldqm::kTrigPrimDigi, and ecaldqm::kTrigPrimEmulDigi.
Referenced by EcalDQMonitorTask().
{ using namespace std; typedef multimap<Collections, Collections>::const_iterator mmiter; vector<Collections> preSchedule; vector<Collections>::iterator insertPoint, findPoint; for(vector<Collections>::const_iterator colItr(_usedCollections.begin()); colItr != _usedCollections.end(); ++colItr){ bool inserted(true); if((insertPoint = find(preSchedule.begin(), preSchedule.end(), *colItr)) == preSchedule.end()) inserted = false; pair<mmiter, mmiter> range(_dependencies.equal_range(*colItr)); for(mmiter depItr(range.first); depItr != range.second; ++depItr){ if(depItr->second == depItr->first) throw cms::Exception("Fatal") << "Collection " << depItr->second << " depends on itself"; if(find(_usedCollections.begin(), _usedCollections.end(), depItr->second) == _usedCollections.end()) throw cms::Exception("Fatal") << "Collection " << depItr->first << " depends on Collection " << depItr->second; if((findPoint = find(preSchedule.begin(), preSchedule.end(), depItr->second)) == preSchedule.end()) preSchedule.insert(insertPoint, depItr->second); else if(findPoint > insertPoint) throw cms::Exception("InvalidConfiguration") << "Circular dependencies in Collections"; } if(!inserted) preSchedule.push_back(*colItr); } for(vector<Collections>::const_iterator colItr(preSchedule.begin()); colItr != preSchedule.end(); ++colItr){ std::pair<Processor, Collections> sch; switch(*colItr){ case kSource: sch.first = &EcalDQMonitorTask::runOnCollection<FEDRawDataCollection>; break; case kEcalRawData: sch.first = &EcalDQMonitorTask::runOnCollection<EcalRawDataCollection>; break; case kGainErrors: sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>; break; case kChIdErrors: sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>; break; case kGainSwitchErrors: sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>; break; case kTowerIdErrors: sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break; case kBlockSizeErrors: sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break; case kMEMTowerIdErrors: sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break; case kMEMBlockSizeErrors: sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break; case kMEMChIdErrors: sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break; case kMEMGainErrors: sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break; case kEBSrFlag: sch.first = &EcalDQMonitorTask::runOnCollection<EBSrFlagCollection>; break; case kEESrFlag: sch.first = &EcalDQMonitorTask::runOnCollection<EESrFlagCollection>; break; case kEBDigi: sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>; break; case kEEDigi: sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>; break; case kPnDiodeDigi: sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>; break; case kTrigPrimDigi: sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>; break; case kTrigPrimEmulDigi: sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>; break; case kEBUncalibRecHit: sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>; break; case kEEUncalibRecHit: sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>; break; case kEBRecHit: sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>; break; case kEERecHit: sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>; break; case kEBBasicCluster: sch.first = &EcalDQMonitorTask::runOnCollection<reco::BasicClusterCollection>; break; case kEEBasicCluster: sch.first = &EcalDQMonitorTask::runOnCollection<reco::BasicClusterCollection>; break; case kEBSuperCluster: sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>; break; case kEESuperCluster: sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>; break; default: throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr; } sch.second = *colItr; schedule_.push_back(sch); } }
void EcalDQMonitorTask::runOnCollection< DetIdCollection > | ( | const edm::Event & | _evt, |
ecaldqm::Collections | _colName | ||
) | [private] |
Definition at line 23 of file EcalDQMonitorTask2.cc.
References ecaldqm::DQWorkerTask::analyze(), begin, Exception, edm::Event::getByLabel(), and edm::Handle< T >::product().
{ edm::Handle<C> hndl; if(_evt.getByLabel(collectionTags_[_colName], hndl)){ TStopwatch* sw(0); if(evaluateTime_){ sw = new TStopwatch; sw->Stop(); } DQWorkerTask* task(0); for(std::vector<DQWorkerTask *>::iterator wItr(taskLists_[_colName].begin()); wItr != taskLists_[_colName].end(); ++wItr){ task = *wItr; if(evaluateTime_) sw->Start(); if(enabled_[task]) task->analyze(hndl.product(), _colName); if(evaluateTime_){ sw->Stop(); taskTimes_[task] += sw->RealTime(); } } delete sw; } else if(!allowMissingCollections_) throw cms::Exception("ObjectNotFound") << "Collection with InputTag " << collectionTags_[_colName] << " does not exist"; }
bool EcalDQMonitorTask::allowMissingCollections_ [private] |
Definition at line 61 of file EcalDQMonitorTask.h.
edm::InputTag EcalDQMonitorTask::collectionTags_[ecaldqm::nCollections] [private] |
Definition at line 50 of file EcalDQMonitorTask.h.
Referenced by analyze(), and EcalDQMonitorTask().
std::map<ecaldqm::DQWorkerTask*, bool> EcalDQMonitorTask::enabled_ [private] |
Definition at line 56 of file EcalDQMonitorTask.h.
Referenced by analyze().
bool EcalDQMonitorTask::evaluateTime_ [private] |
Definition at line 59 of file EcalDQMonitorTask.h.
Referenced by endRun().
int EcalDQMonitorTask::ievt_ [private] |
Definition at line 46 of file EcalDQMonitorTask.h.
Referenced by analyze(), beginRun(), and endRun().
std::vector<std::pair<Processor, ecaldqm::Collections> > EcalDQMonitorTask::schedule_ [private] |
Definition at line 52 of file EcalDQMonitorTask.h.
Referenced by analyze(), and EcalDQMonitorTask().
std::vector<ecaldqm::DQWorkerTask*> EcalDQMonitorTask::taskLists_[ecaldqm::nCollections] [private] |
Definition at line 54 of file EcalDQMonitorTask.h.
Referenced by EcalDQMonitorTask().
std::map<ecaldqm::DQWorkerTask*, double> EcalDQMonitorTask::taskTimes_ [private] |
Definition at line 58 of file EcalDQMonitorTask.h.
Referenced by beginRun(), and endRun().
std::vector<ecaldqm::DQWorkerTask*> EcalDQMonitorTask::workers_ [private] |
Definition at line 48 of file EcalDQMonitorTask.h.
Referenced by analyze(), beginLuminosityBlock(), beginRun(), EcalDQMonitorTask(), endLuminosityBlock(), endRun(), and ~EcalDQMonitorTask().