CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalDQMonitorTask Class Reference

#include <EcalDQMonitorTask.h>

Inheritance diagram for EcalDQMonitorTask:
DQMEDAnalyzer ecaldqm::EcalDQMonitor edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
 EcalDQMonitorTask (edm::ParameterSet const &)
 
 ~EcalDQMonitorTask ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 
- Public Member Functions inherited from ecaldqm::EcalDQMonitor
 EcalDQMonitor (edm::ParameterSet const &)
 
virtual ~EcalDQMonitor ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from ecaldqm::EcalDQMonitor
static void fillDescriptions (edm::ParameterSetDescription &)
 

Private Types

typedef void(EcalDQMonitorTask::* Processor )(edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker * > const &)
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void formSchedule (std::vector< ecaldqm::Collections > const &, edm::ParameterSet const &)
 
template<typename CollectionClass >
void runOnCollection (edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker * > const &)
 

Private Attributes

bool allowMissingCollections_
 
edm::EDGetToken collectionTokens_ [ecaldqm::nCollections]
 
bool evaluateTime_
 
time_t lastResetTime_
 
int processedEvents_
 
float resetInterval_
 
std::vector< std::pair
< Processor,
ecaldqm::Collections > > 
schedule_
 
std::map< ecaldqm::DQWorker
*, double > 
taskTimes_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Member Functions inherited from ecaldqm::EcalDQMonitor
void ecaldqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void ecaldqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
template<typename Booker >
void ecaldqmBookHistograms (Booker &)
 
void ecaldqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void ecaldqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void ecaldqmGetSetupObjects (edm::EventSetup const &)
 
void ecaldqmReleaseHistograms ()
 
template<typename FuncOnWorker >
void executeOnWorkers_ (FuncOnWorker, std::string const &, std::string const &="", int=1)
 
- Protected Attributes inherited from ecaldqm::EcalDQMonitor
std::string const moduleName_
 
int const verbosity_
 
std::vector< DQWorker * > workers_
 

Detailed Description

Definition at line 19 of file EcalDQMonitorTask.h.

Member Typedef Documentation

typedef void(EcalDQMonitorTask::* EcalDQMonitorTask::Processor)(edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker * > const &)
private

Definition at line 35 of file EcalDQMonitorTask.h.

Constructor & Destructor Documentation

EcalDQMonitorTask::EcalDQMonitorTask ( edm::ParameterSet const &  _ps)

Definition at line 27 of file EcalDQMonitorTask.cc.

References ecaldqm::DQWorkerTask::addDependencies(), ecaldqm::DQWorkerTask::analyze(), ecaldqm::collectionName, edm::EDConsumerBase::consumesCollector(), edm::hlt::Exception, ecaldqm::EcalDQMonitor::executeOnWorkers_(), formSchedule(), ecaldqm::DependencySet::formSequence(), ecaldqm::DQWorker::getName(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEcalRawData, lastResetTime_, ecaldqm::EcalDQMonitor::moduleName_, ecaldqm::nCollections, ecaldqm::DependencySet::push_back(), schedule_, edm::second(), ecaldqm::DQWorkerTask::setTokens(), contentValuesCheck::ss, taskTimes_, cond::rpcobgas::time, and ecaldqm::EcalDQMonitor::verbosity_.

27  :
28  DQMEDAnalyzer(),
30  schedule_(),
31  allowMissingCollections_(_ps.getUntrackedParameter<bool>("allowMissingCollections")),
33  evaluateTime_(_ps.getUntrackedParameter<bool>("evaluateTime")),
34  taskTimes_(),
35  lastResetTime_(0),
36  resetInterval_(_ps.getUntrackedParameter<double>("resetInterval"))
37 {
38  ecaldqm::DependencySet dependencies;
39  std::bitset<ecaldqm::nCollections> hasTaskToRun;
41 
42  executeOnWorkers_([&dependencies, &hasTaskToRun, &collector, this](ecaldqm::DQWorker* worker){
43  ecaldqm::DQWorkerTask* task(dynamic_cast<ecaldqm::DQWorkerTask*>(worker));
44  if(!task)
45  throw cms::Exception("InvalidConfiguration") << "Non-task DQWorker " << worker->getName() << " passed";
46 
47  task->addDependencies(dependencies);
48  for(unsigned iCol(0); iCol < ecaldqm::nCollections; ++iCol){
49  if(task->analyze(0, ecaldqm::Collections(iCol))) // "dry run" mode
50  hasTaskToRun.set(iCol);
51  }
52 
53  task->setTokens(collector);
54 
55  taskTimes_[task] = 0.;
56  }, "initialization");
57 
58  edm::ParameterSet const& collectionTags(_ps.getUntrackedParameterSet("collectionTags"));
59 
60  for(unsigned iCol(0); iCol < ecaldqm::nCollections; iCol++){
61  if(hasTaskToRun[iCol])
63  }
64  if(collectionTags.existsAs<edm::InputTag>("EcalRawData", false))
66 
67  formSchedule(dependencies.formSequence(), collectionTags);
68 
69  if(verbosity_ > 0){
70  std::stringstream ss;
71  ss << moduleName_ << ": Using collections" << std::endl;
72  for(unsigned iCol(0); iCol < schedule_.size(); iCol++)
73  ss << ecaldqm::collectionName[schedule_[iCol].second] << std::endl;
74  edm::LogInfo("EcalDQM") << ss.str();
75  }
76 
77  edm::ParameterSet const& commonParams(_ps.getUntrackedParameterSet("commonParameters"));
78  if(commonParams.getUntrackedParameter<bool>("onlineMode"))
79  lastResetTime_ = time(0);
80 }
void formSchedule(std::vector< ecaldqm::Collections > const &, edm::ParameterSet const &)
U second(std::pair< T, U > const &p)
std::string const collectionName[nCollections]
Definition: Collections.h:45
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
std::vector< Collections > formSequence() const
Definition: DQWorkerTask.h:58
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
std::map< ecaldqm::DQWorker *, double > taskTimes_
std::string const & getName() const
Definition: DQWorker.h:69
void push_back(Dependency const &_d)
Definition: DQWorkerTask.h:50
EcalDQMonitorTask::~EcalDQMonitorTask ( )
inline

Definition at line 22 of file EcalDQMonitorTask.h.

22 {}

Member Function Documentation

void EcalDQMonitorTask::analyze ( edm::Event const &  _evt,
edm::EventSetup const &  _es 
)
overrideprivatevirtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 170 of file EcalDQMonitorTask.cc.

References collectionTokens_, edm::EventID::event(), ecaldqm::EcalDQMonitor::executeOnWorkers_(), first, edm::Event::getByToken(), ecaldqm::DQWorker::getName(), edm::EventBase::id(), ecaldqm::kEcalRawData, edm::EventID::luminosityBlock(), ecaldqm::EcalDQMonitor::moduleName_, ecaldqm::nDCC, ecaldqm::DQWorker::onlineMode(), processedEvents_, processEvent(), edm::EventID::run(), environment_file_cff::runType, schedule_, edm::second(), ecaldqm::DQWorker::setEventNumber(), ecaldqm::DQWorker::setTime(), contentValuesCheck::ss, cond::rpcobgas::time, and ecaldqm::EcalDQMonitor::verbosity_.

Referenced by runOnCollection().

171 {
172  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Run " << _evt.id().run() << " Lumisection " << _evt.id().luminosityBlock() << " Event " << _evt.id().event() << ": processed " << processedEvents_;
173 
174  if(schedule_.size() == 0) return;
175 
176  std::set<ecaldqm::DQWorker*> enabledTasks;
177 
179  if(_evt.getByToken(collectionTokens_[ecaldqm::kEcalRawData], dcchsHndl)){
180  // determine event type (called run type in DCCHeader for some reason) for each FED
181  std::stringstream ss;
182  if(verbosity_ > 2) ss << moduleName_ << ": Event type ";
183 
184  short runType[ecaldqm::nDCC];
185  std::fill_n(runType, ecaldqm::nDCC, -1);
186  for(EcalRawDataCollection::const_iterator dcchItr = dcchsHndl->begin(); dcchItr != dcchsHndl->end(); ++dcchItr){
187  if(verbosity_ > 2) ss << dcchItr->getRunType() << " ";
188  runType[dcchItr->id() - 1] = dcchItr->getRunType();
189  }
190  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << ss.str();
191 
192  bool processEvent(false);
193 
194  executeOnWorkers_([&enabledTasks, &runType, &processEvent, this](ecaldqm::DQWorker* worker){
195  if(static_cast<ecaldqm::DQWorkerTask*>(worker)->filterRunType(runType)){
196  if(this->verbosity_ > 2) edm::LogInfo("EcalDQM") << worker->getName() << " will run on this event";
197  enabledTasks.insert(worker);
198  processEvent = true;
199  }
200  }, "filterRunType");
201 
202  if(!processEvent) return;
203  }
204  else{
205  edm::LogWarning("EcalDQM") << "EcalRawDataCollection does not exist. No event-type filtering will be applied";
206  executeOnWorkers_([&enabledTasks](ecaldqm::DQWorker* worker){
207  enabledTasks.insert(worker);
208  }, "");
209  }
210 
212 
213  // start event processing
214  executeOnWorkers_([&_evt, &_es, &enabledTasks](ecaldqm::DQWorker* worker){
215  if(enabledTasks.find(worker) != enabledTasks.end()){
216  if(worker->onlineMode()) worker->setTime(time(0));
217  worker->setEventNumber(_evt.id().event());
218  static_cast<ecaldqm::DQWorkerTask*>(worker)->beginEvent(_evt, _es);
219  }
220  }, "beginEvent");
221 
222  // run on collections
223  for(unsigned iSch(0); iSch < schedule_.size(); iSch++){
224  Processor processor(schedule_[iSch].first);
225  (this->*processor)(_evt, schedule_[iSch].second, enabledTasks);
226  }
227 
228  // close event processing
229  executeOnWorkers_([&_evt, &_es, &enabledTasks](ecaldqm::DQWorker* worker){
230  if(enabledTasks.find(worker) != enabledTasks.end())
231  static_cast<ecaldqm::DQWorkerTask*>(worker)->endEvent(_evt, _es);
232  }, "endEvent");
233 
234  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Closing Event " << _evt.id().event();
235 }
dispatcher processEvent(e, inputTag, standby)
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
U second(std::pair< T, U > const &p)
void setEventNumber(edm::EventNumber_t _e)
Definition: DQWorker.h:67
void(EcalDQMonitorTask::* Processor)(edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker * > const &)
bool first
Definition: L1TdeRCT.cc:75
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
bool onlineMode() const
Definition: DQWorker.h:70
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
std::string const & getName() const
Definition: DQWorker.h:69
void setTime(time_t _t)
Definition: DQWorker.h:64
void EcalDQMonitorTask::beginLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 149 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmBeginLuminosityBlock().

150 {
151  ecaldqmBeginLuminosityBlock(_lumi, _es);
152 }
void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void EcalDQMonitorTask::bookHistograms ( DQMStore::IBooker _ibooker,
edm::Run const &  ,
edm::EventSetup const &  _es 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 107 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmBookHistograms(), and ecaldqm::EcalDQMonitor::ecaldqmGetSetupObjects().

108 {
110  ecaldqmBookHistograms(_ibooker);
111 }
void ecaldqmGetSetupObjects(edm::EventSetup const &)
void ecaldqmBookHistograms(Booker &)
Definition: EcalDQMonitor.h:46
void EcalDQMonitorTask::dqmBeginRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 114 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmBeginRun(), lastResetTime_, processedEvents_, and cond::rpcobgas::time.

115 {
116  ecaldqmBeginRun(_run, _es);
117 
118  processedEvents_ = 0;
119 
120  if(lastResetTime_ != 0) lastResetTime_ = time(0);
121 }
void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &)
void EcalDQMonitorTask::endLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 155 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock(), ecaldqm::EcalDQMonitor::executeOnWorkers_(), lastResetTime_, ecaldqm::EcalDQMonitor::moduleName_, resetInterval_, cond::rpcobgas::time, and ecaldqm::EcalDQMonitor::verbosity_.

156 {
157  ecaldqmEndLuminosityBlock(_lumi, _es);
158 
159  if(lastResetTime_ != 0 && (time(0) - lastResetTime_) / 3600. > resetInterval_){
160  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << ": Soft-resetting the histograms";
162  static_cast<ecaldqm::DQWorkerTask*>(worker)->softReset();
163  }, "softReset");
164 
165  lastResetTime_ = time(0);
166  }
167 }
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void EcalDQMonitorTask::endRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 124 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmEndRun(), ecaldqm::EcalDQMonitor::ecaldqmReleaseHistograms(), evaluateTime_, ecaldqm::EcalDQMonitor::executeOnWorkers_(), ecaldqm::DQWorker::getName(), lastResetTime_, ecaldqm::EcalDQMonitor::moduleName_, processedEvents_, contentValuesCheck::ss, and taskTimes_.

125 {
126  if(lastResetTime_ != 0)
128  static_cast<ecaldqm::DQWorkerTask*>(worker)->recoverStats();
129  }, "recoverStats");
130 
131  ecaldqmEndRun(_run, _es);
132 
134 
135  if(evaluateTime_){
136  std::stringstream ss;
137 
138  ss << "************** " << moduleName_ << " **************" << std::endl;
139  ss << " Mean time consumption of the modules" << std::endl;
140  ss << "____________________________________" << std::endl;
141  executeOnWorkers_([&ss, this](ecaldqm::DQWorker* worker){
142  ss << std::setw(20) << std::setfill(' ') << worker->getName() << "| " << (this->taskTimes_[worker] / this->processedEvents_) << std::endl;
143  }, "print time");
144  edm::LogInfo("EcalDQM") << ss.str();
145  }
146 }
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
std::map< ecaldqm::DQWorker *, double > taskTimes_
std::string const & getName() const
Definition: DQWorker.h:69
void EcalDQMonitorTask::fillDescriptions ( edm::ConfigurationDescriptions _descs)
static

Definition at line 84 of file EcalDQMonitorTask.cc.

References edm::ConfigurationDescriptions::addDefault(), edm::ParameterSetDescription::addNode(), edm::ParameterSetDescription::addUntracked(), edm::ParameterSetDescription::addWildcardUntracked(), ecaldqm::EcalDQMonitor::fillDescriptions(), ecaldqm::DQWorkerTask::fillDescriptions(), and edm::RequireZeroOrMore.

85 {
88 
89  edm::ParameterSetDescription taskParameters;
93  desc.addUntracked("workerParameters", allWorkers);
94 
95  edm::ParameterSetDescription collectionTags;
96  collectionTags.addWildcardUntracked<edm::InputTag>("*");
97  desc.addUntracked("collectionTags", collectionTags);
98 
99  desc.addUntracked<bool>("allowMissingCollections", true);
100  desc.addUntracked<bool>("evaluateTime", false);
101  desc.addUntracked<double>("resetInterval", 0.);
102 
103  _descs.addDefault(desc);
104 }
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: DQWorkerTask.cc:17
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
static void fillDescriptions(edm::ParameterSetDescription &)
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
void addDefault(ParameterSetDescription const &psetDescription)
void EcalDQMonitorTask::formSchedule ( std::vector< ecaldqm::Collections > const &  _preSchedule,
edm::ParameterSet const &  _tagPSet 
)
private

Definition at line 50 of file EcalDQMonitorTask2.cc.

References ecaldqm::collectionName, collectionTokens_, edm::EDConsumerBase::consumes(), edm::hlt::Exception, edm::ParameterSet::getUntrackedParameter(), ecaldqm::kBlockSizeErrors, ecaldqm::kEBBasicCluster, ecaldqm::kEBChIdErrors, ecaldqm::kEBDigi, ecaldqm::kEBGainErrors, ecaldqm::kEBGainSwitchErrors, ecaldqm::kEBLaserLedUncalibRecHit, ecaldqm::kEBRecHit, ecaldqm::kEBReducedRecHit, ecaldqm::kEBSrFlag, ecaldqm::kEBSuperCluster, ecaldqm::kEBTestPulseUncalibRecHit, ecaldqm::kEBUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEBasicCluster, ecaldqm::kEEChIdErrors, ecaldqm::kEEDigi, ecaldqm::kEEGainErrors, ecaldqm::kEEGainSwitchErrors, ecaldqm::kEELaserLedUncalibRecHit, ecaldqm::kEERecHit, ecaldqm::kEEReducedRecHit, ecaldqm::kEESrFlag, ecaldqm::kEESuperCluster, ecaldqm::kEETestPulseUncalibRecHit, ecaldqm::kEEUncalibRecHit, ecaldqm::kMEMBlockSizeErrors, ecaldqm::kMEMChIdErrors, ecaldqm::kMEMGainErrors, ecaldqm::kMEMTowerIdErrors, ecaldqm::kPnDiodeDigi, ecaldqm::kSource, ecaldqm::kTowerIdErrors, ecaldqm::kTrigPrimDigi, ecaldqm::kTrigPrimEmulDigi, schedule_, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by EcalDQMonitorTask().

51 {
52  for(std::vector<ecaldqm::Collections>::const_iterator colItr(_preSchedule.begin()); colItr != _preSchedule.end(); ++colItr){
53  std::pair<Processor, ecaldqm::Collections> sch;
54 
55  edm::InputTag tag(_tagPSet.getUntrackedParameter<edm::InputTag>(ecaldqm::collectionName[*colItr]));
56 
57  switch(*colItr){
58  case ecaldqm::kSource:
59  collectionTokens_[*colItr] = edm::EDGetToken(consumes<FEDRawDataCollection>(tag));
60  sch.first = &EcalDQMonitorTask::runOnCollection<FEDRawDataCollection>;
61  break;
63  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRawDataCollection>(tag));
64  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRawDataCollection>;
65  break;
69  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDetIdCollection>(tag));
70  sch.first = &EcalDQMonitorTask::runOnCollection<EBDetIdCollection>;
71  break;
75  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDetIdCollection>(tag));
76  sch.first = &EcalDQMonitorTask::runOnCollection<EEDetIdCollection>;
77  break;
84  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(tag));
85  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
86  break;
87  case ecaldqm::kEBSrFlag:
88  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBSrFlagCollection>(tag));
89  sch.first = &EcalDQMonitorTask::runOnCollection<EBSrFlagCollection>;
90  break;
91  case ecaldqm::kEESrFlag:
92  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EESrFlagCollection>(tag));
93  sch.first = &EcalDQMonitorTask::runOnCollection<EESrFlagCollection>;
94  break;
95  case ecaldqm::kEBDigi:
96  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDigiCollection>(tag));
97  sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>;
98  break;
99  case ecaldqm::kEEDigi:
100  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDigiCollection>(tag));
101  sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>;
102  break;
104  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalPnDiodeDigiCollection>(tag));
105  sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>;
106  break;
109  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalTrigPrimDigiCollection>(tag));
110  sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>;
111  break;
118  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalUncalibratedRecHitCollection>(tag));
119  sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>;
120  break;
121  case ecaldqm::kEBRecHit:
123  case ecaldqm::kEERecHit:
125  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRecHitCollection>(tag));
126  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>;
127  break;
131  sch.first = &EcalDQMonitorTask::runOnCollection<edm::View<reco::CaloCluster> >;
132  break;
135  collectionTokens_[*colItr] = edm::EDGetToken(consumes<reco::SuperClusterCollection>(tag));
136  sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>;
137  break;
138  default:
139  throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr;
140  }
141 
142  sch.second = *colItr;
143 
144  schedule_.push_back(sch);
145  }
146 }
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::string const collectionName[nCollections]
Definition: Collections.h:45
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
template<typename CollectionClass >
void EcalDQMonitorTask::runOnCollection ( edm::Event const &  _evt,
ecaldqm::Collections  _col,
std::set< ecaldqm::DQWorker * > const &  _enabledTasks 
)
private

Definition at line 23 of file EcalDQMonitorTask2.cc.

References allowMissingCollections_, analyze(), runEdmFileComparison::collection, ecaldqm::collectionName, collectionTokens_, evaluateTime_, edm::hlt::Exception, ecaldqm::EcalDQMonitor::executeOnWorkers_(), edm::Event::getByToken(), ecaldqm::EcalDQMonitor::moduleName_, edm::Handle< T >::product(), and taskTimes_.

24 {
26  if(!_evt.getByToken(collectionTokens_[_col], hndl)){
28  throw cms::Exception("ObjectNotFound") << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] << " does not exist";
29  edm::LogWarning("EcalDQM") << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] << " does not exist";
30  return;
31  }
32 
33  CollectionClass const* collection(hndl.product());
34 
35  TStopwatch sw;
36  sw.Reset();
37 
38  executeOnWorkers_([collection, _col, &_enabledTasks, &sw, this](ecaldqm::DQWorker* worker){
39  if(_enabledTasks.find(worker) != _enabledTasks.end()){
40  if(this->evaluateTime_) sw.Start();
41  static_cast<ecaldqm::DQWorkerTask*>(worker)->analyze(collection, _col);
42  if(this->evaluateTime_) this->taskTimes_[worker] += sw.RealTime();
43  }
44  }, "analyze");
45 
46  edm::LogInfo("EcalDQM") << moduleName_ << "::runOn" << ecaldqm::collectionName[_col] << " returning";
47 }
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
void analyze(edm::Event const &, edm::EventSetup const &) override
std::string const collectionName[nCollections]
Definition: Collections.h:45
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
std::map< ecaldqm::DQWorker *, double > taskTimes_
T const * product() const
Definition: Handle.h:81

Member Data Documentation

bool EcalDQMonitorTask::allowMissingCollections_
private

Definition at line 45 of file EcalDQMonitorTask.h.

Referenced by runOnCollection().

edm::EDGetToken EcalDQMonitorTask::collectionTokens_[ecaldqm::nCollections]
private

Definition at line 43 of file EcalDQMonitorTask.h.

Referenced by analyze(), formSchedule(), and runOnCollection().

bool EcalDQMonitorTask::evaluateTime_
private

Definition at line 49 of file EcalDQMonitorTask.h.

Referenced by endRun(), and runOnCollection().

time_t EcalDQMonitorTask::lastResetTime_
private

Definition at line 51 of file EcalDQMonitorTask.h.

Referenced by dqmBeginRun(), EcalDQMonitorTask(), endLuminosityBlock(), and endRun().

int EcalDQMonitorTask::processedEvents_
private

Definition at line 46 of file EcalDQMonitorTask.h.

Referenced by analyze(), dqmBeginRun(), and endRun().

float EcalDQMonitorTask::resetInterval_
private

Definition at line 52 of file EcalDQMonitorTask.h.

Referenced by endLuminosityBlock().

std::vector<std::pair<Processor, ecaldqm::Collections> > EcalDQMonitorTask::schedule_
private
std::map<ecaldqm::DQWorker*, double> EcalDQMonitorTask::taskTimes_
private

Definition at line 50 of file EcalDQMonitorTask.h.

Referenced by EcalDQMonitorTask(), endRun(), and runOnCollection().