CMS 3D CMS Logo

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:
DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > > ecaldqm::EcalDQMonitor edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 
- Public Member Functions inherited from ecaldqm::EcalDQMonitor
 EcalDQMonitor (edm::ParameterSet const &)
 
virtual ~EcalDQMonitor () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
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 dqmEndRun (edm::Run const &, edm::EventSetup const &) override
 
void formSchedule (std::vector< ecaldqm::Collections > const &, edm::ParameterSet const &)
 
std::shared_ptr< ecaldqm::EcalLSCacheglobalBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) const override
 
void globalEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
template<typename CollectionClass >
void runOnCollection (edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker *> const &)
 

Private Attributes

bool allowMissingCollections_
 
edm::EDGetToken collectionTokens_ [ecaldqm::nCollections]
 
time_t lastResetTime_
 
int processedEvents_
 
float resetInterval_
 
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
 
std::vector< std::string > skipCollections_
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Member Functions inherited from ecaldqm::EcalDQMonitor
void ecaldqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) const
 
void ecaldqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
void ecaldqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void ecaldqmEndRun (edm::Run const &, edm::EventSetup const &)
 
template<typename FuncOnWorker >
void executeOnWorkers_ (FuncOnWorker, std::string const &, std::string const &="", int=1) const
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > >
edm::EDPutTokenT< DQMTokenrunToken_
 
- Protected Attributes inherited from ecaldqm::EcalDQMonitor
std::string const moduleName_
 
const int verbosity_
 
std::vector< DQWorker * > workers_
 

Detailed Description

Definition at line 18 of file EcalDQMonitorTask.h.

Member Typedef Documentation

◆ Processor

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

Definition at line 36 of file EcalDQMonitorTask.h.

Constructor & Destructor Documentation

◆ EcalDQMonitorTask()

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

Definition at line 27 of file EcalDQMonitorTask.cc.

References ecaldqm::collectionName, EcalCalibMonitorTasks_cfi::collectionTags, edm::EDConsumerBase::consumesCollector(), symbols::dependencies, Exception, ecaldqm::EcalDQMonitor::executeOnWorkers_(), formSchedule(), ecaldqm::DQWorker::getName(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEcalRawData, lastResetTime_, ecaldqm::EcalDQMonitor::moduleName_, ecaldqm::nCollections, schedule_, edm::second(), ecaldqm::DQWorker::setTokens(), contentValuesCheck::ss, TrackValidation_cff::task, hcalRecHitTable_cff::time, and ecaldqm::EcalDQMonitor::verbosity_.

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

◆ ~EcalDQMonitorTask()

EcalDQMonitorTask::~EcalDQMonitorTask ( )
inlineoverride

Definition at line 22 of file EcalDQMonitorTask.h.

22 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > >.

Definition at line 152 of file EcalDQMonitorTask.cc.

References edm::SortedCollection< T, SORT >::begin(), collectionTokens_, edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), ecaldqm::EcalDQMonitor::executeOnWorkers_(), spr::find(), dqmdumpme::first, edm::Event::getByToken(), edm::Event::getLuminosityBlock(), ecaldqm::DQWorker::getName(), edm::EventBase::id(), edm::LuminosityBlock::index(), ecaldqm::kEcalRawData, edm::EventID::luminosityBlock(), ecaldqm::EcalDQMonitor::moduleName_, ecaldqm::nDCC, ecaldqm::DQWorker::onlineMode(), processedEvents_, processEvent(), edm::EventID::run(), EcalCondDBWriter_cfi::runType, schedule_, edm::second(), ecaldqm::DQWorker::setEventNumber(), ecaldqm::DQWorker::setTime(), skipCollections_, contentValuesCheck::ss, hcalRecHitTable_cff::time, and ecaldqm::EcalDQMonitor::verbosity_.

152  {
153  if (verbosity_ > 2)
154  edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Run " << _evt.id().run() << " Lumisection "
155  << _evt.id().luminosityBlock() << " Event " << _evt.id().event() << ": processed "
156  << processedEvents_;
157 
158  if (schedule_.empty())
159  return;
160 
161  std::set<ecaldqm::DQWorker*> enabledTasks;
162 
163  bool eventTypeFiltering(false);
165 
166  if (std::find(skipCollections_.begin(), skipCollections_.end(), "EcalRawData") != skipCollections_.end()) {
167  if (verbosity_ > 2)
168  edm::LogInfo("EcalDQM") << "EcalRawDataCollection is being skipped. No event-type filtering will be applied";
169 
170  } else if (_evt.getByToken(collectionTokens_[ecaldqm::kEcalRawData], dcchsHndl)) {
171  eventTypeFiltering = true;
172  // determine event type (called run type in DCCHeader for some reason) for each FED
173  std::stringstream ss;
174  if (verbosity_ > 2)
175  ss << moduleName_ << ": Event type ";
176 
177  short runType[ecaldqm::nDCC];
178  std::fill_n(runType, ecaldqm::nDCC, -1);
179  for (EcalRawDataCollection::const_iterator dcchItr = dcchsHndl->begin(); dcchItr != dcchsHndl->end(); ++dcchItr) {
180  if (verbosity_ > 2)
181  ss << dcchItr->getRunType() << " ";
182  runType[dcchItr->id() - 1] = dcchItr->getRunType();
183  }
184  if (verbosity_ > 2)
185  edm::LogInfo("EcalDQM") << ss.str();
186 
187  bool processEvent(false);
188 
190  [&enabledTasks, &runType, &processEvent, this](ecaldqm::DQWorker* worker) {
191  if (static_cast<ecaldqm::DQWorkerTask*>(worker)->filterRunType(runType)) {
192  if (this->verbosity_ > 2)
193  edm::LogInfo("EcalDQM") << worker->getName() << " will run on this event";
194  enabledTasks.insert(worker);
195  processEvent = true;
196  }
197  },
198  "filterRunType");
199 
200  if (!processEvent)
201  return;
202  } else {
203  edm::LogWarning("EcalDQM") << "EcalRawDataCollection does not exist. No event-type filtering will be applied";
204  }
205 
206  if (!eventTypeFiltering)
207  executeOnWorkers_([&enabledTasks](ecaldqm::DQWorker* worker) { enabledTasks.insert(worker); }, "");
208 
210 
211  // start event processing
212  auto lumiCache = luminosityBlockCache(_evt.getLuminosityBlock().index());
214  [&_evt, &_es, &enabledTasks, &lumiCache](ecaldqm::DQWorker* worker) {
215  if (enabledTasks.find(worker) != enabledTasks.end()) {
216  if (worker->onlineMode())
217  worker->setTime(time(nullptr));
218  worker->setEventNumber(_evt.id().event());
219  bool ByLumiResetSwitch = (lumiCache->ByLumiPlotsResetSwitches).at(worker->getName());
220  bool lhcStatusSet = lumiCache->lhcStatusSet_;
221  static_cast<ecaldqm::DQWorkerTask*>(worker)->beginEvent(_evt, _es, ByLumiResetSwitch, lhcStatusSet);
222  (lumiCache->ByLumiPlotsResetSwitches)[worker->getName()] = false;
223  lumiCache->lhcStatusSet_ = lhcStatusSet;
224  }
225  },
226  "beginEvent");
227 
228  // run on collections
229  for (unsigned iSch(0); iSch < schedule_.size(); iSch++) {
230  Processor processor(schedule_[iSch].first);
231  (this->*processor)(_evt, schedule_[iSch].second, enabledTasks);
232  }
233 
234  // close event processing
236  [&_evt, &_es, &enabledTasks](ecaldqm::DQWorker* worker) {
237  if (enabledTasks.find(worker) != enabledTasks.end())
238  static_cast<ecaldqm::DQWorkerTask*>(worker)->endEvent(_evt, _es);
239  },
240  "endEvent");
241 
242  if (verbosity_ > 2)
243  edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Closing Event " << _evt.id().event();
244 }
bool onlineMode() const
Definition: DQWorker.h:125
dispatcher processEvent(e, inputTag, standby)
std::string const & getName() const
Definition: DQWorker.h:124
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
std::vector< T >::const_iterator const_iterator
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
U second(std::pair< T, U > const &p)
void setEventNumber(edm::EventNumber_t _e)
Definition: DQWorker.h:122
void(EcalDQMonitorTask::* Processor)(edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker *> const &)
const_iterator begin() const
std::string const moduleName_
Definition: EcalDQMonitor.h:45
const_iterator end() const
Log< level::Info, false > LogInfo
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
Log< level::Warning, false > LogWarning
void setTime(time_t _t)
Definition: DQWorker.h:119
std::vector< std::string > skipCollections_

◆ bookHistograms()

void EcalDQMonitorTask::bookHistograms ( DQMStore::IBooker _ibooker,
edm::Run const &  ,
edm::EventSetup const &  _es 
)
overridevirtual

Implements DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > >.

Definition at line 103 of file EcalDQMonitorTask.cc.

References ecaldqm::DQWorker::bookMEs(), ecaldqm::EcalDQMonitor::executeOnWorkers_(), and ecaldqm::DQWorker::setSetupObjects().

103  {
104  executeOnWorkers_([&_es](ecaldqm::DQWorker* worker) { worker->setSetupObjects(_es); },
105  "ecaldqmGetSetupObjects",
106  "Getting EventSetup Objects");
107 
108  executeOnWorkers_([&_ibooker](ecaldqm::DQWorker* worker) { worker->bookMEs(_ibooker); }, "bookMEs", "Booking MEs");
109 }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
virtual void bookMEs(DQMStore::IBooker &)
Definition: DQWorker.cc:96
void setSetupObjects(edm::EventSetup const &)
Definition: DQWorker.cc:104

◆ dqmBeginRun()

void EcalDQMonitorTask::dqmBeginRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
overridevirtual

Reimplemented from DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > >.

Definition at line 111 of file EcalDQMonitorTask.cc.

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

111  {
112  ecaldqmBeginRun(_run, _es);
113 
114  processedEvents_ = 0;
115 
116  if (lastResetTime_ != 0)
117  lastResetTime_ = time(nullptr);
118 }
void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &)

◆ dqmEndRun()

void EcalDQMonitorTask::dqmEndRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
overrideprivatevirtual

Reimplemented from DQMOneEDAnalyzer< edm::LuminosityBlockCache< ecaldqm::EcalLSCache > >.

Definition at line 120 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmEndRun(), ecaldqm::EcalDQMonitor::executeOnWorkers_(), and ecaldqm::DQWorker::releaseMEs().

120  {
121  ecaldqmEndRun(_run, _es);
122 
123  executeOnWorkers_([](ecaldqm::DQWorker* worker) { worker->releaseMEs(); }, "releaseMEs", "releasing histograms");
124 }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
virtual void releaseMEs()
Definition: DQWorker.cc:90

◆ fillDescriptions()

void EcalDQMonitorTask::fillDescriptions ( edm::ConfigurationDescriptions _descs)
static

Definition at line 81 of file EcalDQMonitorTask.cc.

References edm::ConfigurationDescriptions::addDefault(), edm::ParameterSetDescription::addNode(), EcalCalibMonitorTasks_cfi::collectionTags, submitPVResolutionJobs::desc, ecaldqm::EcalDQMonitor::fillDescriptions(), ecaldqm::DQWorkerTask::fillDescriptions(), and edm::RequireZeroOrMore.

81  {
84 
85  edm::ParameterSetDescription taskParameters;
88  allWorkers.addNode(
90  desc.addUntracked("workerParameters", allWorkers);
91 
93  collectionTags.addWildcardUntracked<edm::InputTag>("*");
94  desc.add("collectionTags", collectionTags);
95 
96  desc.addUntracked<std::vector<std::string>>("skipCollections", std::vector<std::string>());
97  desc.addUntracked<bool>("allowMissingCollections", true);
98  desc.addUntracked<double>("resetInterval", 0.);
99 
100  _descs.addDefault(desc);
101 }
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: DQWorkerTask.cc:11
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
static void fillDescriptions(edm::ParameterSetDescription &)
void addDefault(ParameterSetDescription const &psetDescription)

◆ formSchedule()

void EcalDQMonitorTask::formSchedule ( std::vector< ecaldqm::Collections > const &  _preSchedule,
edm::ParameterSet const &  _tagPSet 
)
private

Definition at line 46 of file EcalDQMonitorTask2.cc.

References ecaldqm::collectionName, collectionTokens_, edm::EDConsumerBase::consumes(), Exception, spr::find(), edm::ParameterSet::getUntrackedParameter(), ecaldqm::kBlockSizeErrors, ecaldqm::kEBBasicCluster, ecaldqm::kEBChIdErrors, ecaldqm::kEBCpuDigi, ecaldqm::kEBCpuRecHit, ecaldqm::kEBCpuUncalibRecHit, ecaldqm::kEBDigi, ecaldqm::kEBGainErrors, ecaldqm::kEBGainSwitchErrors, ecaldqm::kEBGpuDigi, ecaldqm::kEBGpuRecHit, ecaldqm::kEBGpuUncalibRecHit, ecaldqm::kEBLaserLedUncalibRecHit, ecaldqm::kEBRecHit, ecaldqm::kEBReducedRecHit, ecaldqm::kEBSrFlag, ecaldqm::kEBSuperCluster, ecaldqm::kEBTestPulseUncalibRecHit, ecaldqm::kEBUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEBasicCluster, ecaldqm::kEEChIdErrors, ecaldqm::kEECpuDigi, ecaldqm::kEECpuRecHit, ecaldqm::kEECpuUncalibRecHit, ecaldqm::kEEDigi, ecaldqm::kEEGainErrors, ecaldqm::kEEGainSwitchErrors, ecaldqm::kEEGpuDigi, ecaldqm::kEEGpuRecHit, ecaldqm::kEEGpuUncalibRecHit, 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, ecaldqm::EcalDQMonitor::moduleName_, ecaldqm::nCollections, schedule_, skipCollections_, makeGlobalPositionRcd_cfg::tag, and ecaldqm::EcalDQMonitor::verbosity_.

Referenced by EcalDQMonitorTask().

47  {
48  std::vector<ecaldqm::Collections> collectionsToSkip;
49  for (const auto& skipColName : skipCollections_) {
50  for (unsigned iCol = 0; iCol <= ecaldqm::nCollections; iCol++) {
51  if (iCol == ecaldqm::nCollections)
52  throw cms::Exception("InvalidConfiguration")
53  << moduleName_ << "::formSchedule: Collection name " << skipColName << " in skipCollections does not exist";
54  if (skipColName == ecaldqm::collectionName[iCol]) {
55  collectionsToSkip.push_back(ecaldqm::Collections(iCol));
56  break;
57  }
58  }
59  }
60 
61  for (std::vector<ecaldqm::Collections>::const_iterator colItr(_preSchedule.begin()); colItr != _preSchedule.end();
62  ++colItr) {
63  std::pair<Processor, ecaldqm::Collections> sch;
64 
65  edm::InputTag tag(_tagPSet.getUntrackedParameter<edm::InputTag>(ecaldqm::collectionName[*colItr]));
66 
67  auto skipItr = std::find(collectionsToSkip.begin(), collectionsToSkip.end(), *colItr);
68  if (skipItr != collectionsToSkip.end()) {
69  if (verbosity_ > 0)
70  edm::LogInfo("EcalDQM") << moduleName_ << ": Skipping collection " << ecaldqm::collectionName[*colItr]
71  << " and removing from schedule";
72  collectionsToSkip.erase(skipItr);
73  continue;
74  }
75 
76  switch (*colItr) {
77  case ecaldqm::kSource:
78  collectionTokens_[*colItr] = edm::EDGetToken(consumes<FEDRawDataCollection>(tag));
79  sch.first = &EcalDQMonitorTask::runOnCollection<FEDRawDataCollection>;
80  break;
82  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRawDataCollection>(tag));
83  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRawDataCollection>;
84  break;
88  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDetIdCollection>(tag));
89  sch.first = &EcalDQMonitorTask::runOnCollection<EBDetIdCollection>;
90  break;
94  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDetIdCollection>(tag));
95  sch.first = &EcalDQMonitorTask::runOnCollection<EEDetIdCollection>;
96  break;
103  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(tag));
104  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
105  break;
106  case ecaldqm::kEBSrFlag:
107  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBSrFlagCollection>(tag));
108  sch.first = &EcalDQMonitorTask::runOnCollection<EBSrFlagCollection>;
109  break;
110  case ecaldqm::kEESrFlag:
111  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EESrFlagCollection>(tag));
112  sch.first = &EcalDQMonitorTask::runOnCollection<EESrFlagCollection>;
113  break;
114  case ecaldqm::kEBDigi:
115  case ecaldqm::kEBCpuDigi:
116  case ecaldqm::kEBGpuDigi:
117  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDigiCollection>(tag));
118  sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>;
119  break;
120  case ecaldqm::kEEDigi:
121  case ecaldqm::kEECpuDigi:
122  case ecaldqm::kEEGpuDigi:
123  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDigiCollection>(tag));
124  sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>;
125  break;
127  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalPnDiodeDigiCollection>(tag));
128  sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>;
129  break;
132  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalTrigPrimDigiCollection>(tag));
133  sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>;
134  break;
145  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalUncalibratedRecHitCollection>(tag));
146  sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>;
147  break;
148  case ecaldqm::kEBRecHit:
150  case ecaldqm::kEERecHit:
156  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRecHitCollection>(tag));
157  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>;
158  break;
162  sch.first = &EcalDQMonitorTask::runOnCollection<edm::View<reco::CaloCluster> >;
163  break;
166  collectionTokens_[*colItr] = edm::EDGetToken(consumes<reco::SuperClusterCollection>(tag));
167  sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>;
168  break;
169  default:
170  throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr;
171  }
172 
173  sch.second = *colItr;
174 
175  schedule_.push_back(sch);
176  }
177  for (const auto& colNotSkipped : collectionsToSkip)
178  edm::LogWarning("EcalDQM") << moduleName_
179  << "::formSchedule: Collection: " << ecaldqm::collectionName[colNotSkipped]
180  << " is not in the schedule but was listed to be skipped";
181 }
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::string const collectionName[nCollections]
Definition: Collections.h:59
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
Log< level::Warning, false > LogWarning
std::vector< std::string > skipCollections_

◆ globalBeginLuminosityBlock()

std::shared_ptr< ecaldqm::EcalLSCache > EcalDQMonitorTask::globalBeginLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
) const
overrideprivate

Definition at line 126 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmBeginLuminosityBlock(), ecaldqm::EcalDQMonitor::executeOnWorkers_(), ecaldqm::DQWorker::getName(), and ecaldqm::EcalDQMonitor::verbosity_.

127  {
128  std::shared_ptr<ecaldqm::EcalLSCache> tmpCache = std::make_shared<ecaldqm::EcalLSCache>();
130  [&tmpCache](ecaldqm::DQWorker* worker) { (tmpCache->ByLumiPlotsResetSwitches)[worker->getName()] = true; },
131  "globalBeginLuminosityBlock");
132  if (this->verbosity_ > 2)
133  edm::LogInfo("EcalDQM") << "Set LS cache.";
134 
135  // Reset lhcStatusSet_ to false at the beginning of each LS; when LHC status is set in some event this variable will be set to tru
136  tmpCache->lhcStatusSet_ = false;
137  ecaldqmBeginLuminosityBlock(_lumi, _es);
138  return tmpCache;
139 }
std::string const & getName() const
Definition: DQWorker.h:124
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const
Log< level::Info, false > LogInfo

◆ globalEndLuminosityBlock()

void EcalDQMonitorTask::globalEndLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
overrideprivate

Definition at line 141 of file EcalDQMonitorTask.cc.

References ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock(), lastResetTime_, ecaldqm::EcalDQMonitor::moduleName_, resetInterval_, hcalRecHitTable_cff::time, and ecaldqm::EcalDQMonitor::verbosity_.

141  {
142  ecaldqmEndLuminosityBlock(_lumi, _es);
143 
144  if (lastResetTime_ != 0 && (time(nullptr) - lastResetTime_) / 3600. > resetInterval_) {
145  if (verbosity_ > 0)
146  edm::LogInfo("EcalDQM") << moduleName_ << ": Soft-resetting the histograms";
147  // TODO: soft-reset is no longer supported.
148  lastResetTime_ = time(nullptr);
149  }
150 }
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)

◆ runOnCollection()

template<typename CollectionClass >
void EcalDQMonitorTask::runOnCollection ( edm::Event const &  _evt,
ecaldqm::Collections  _col,
std::set< ecaldqm::DQWorker *> const &  _enabledTasks 
)
private

Definition at line 20 of file EcalDQMonitorTask2.cc.

References allowMissingCollections_, universalConfigTemplate::collection, ecaldqm::collectionName, collectionTokens_, Exception, ecaldqm::EcalDQMonitor::executeOnWorkers_(), edm::Event::getByToken(), ecaldqm::EcalDQMonitor::moduleName_, edm::Handle< T >::product(), and ecaldqm::EcalDQMonitor::verbosity_.

22  {
24  if (!_evt.getByToken(collectionTokens_[_col], hndl)) {
26  throw cms::Exception("ObjectNotFound")
27  << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] << " does not exist";
28  edm::LogWarning("EcalDQM") << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col]
29  << " does not exist";
30  return;
31  }
32 
33  CollectionClass const* collection(hndl.product());
34 
36  [collection, _col, &_enabledTasks](ecaldqm::DQWorker* worker) {
37  if (_enabledTasks.find(worker) != _enabledTasks.end())
38  static_cast<ecaldqm::DQWorkerTask*>(worker)->analyze(collection, _col);
39  },
40  "analyze");
41 
42  if (verbosity_ > 1)
43  edm::LogInfo("EcalDQM") << moduleName_ << "::runOn" << ecaldqm::collectionName[_col] << " returning";
44 }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
T const * product() const
Definition: Handle.h:70
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
std::string const collectionName[nCollections]
Definition: Collections.h:59
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ allowMissingCollections_

bool EcalDQMonitorTask::allowMissingCollections_
private

Definition at line 55 of file EcalDQMonitorTask.h.

Referenced by runOnCollection().

◆ collectionTokens_

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

Definition at line 47 of file EcalDQMonitorTask.h.

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

◆ lastResetTime_

time_t EcalDQMonitorTask::lastResetTime_
private

Definition at line 62 of file EcalDQMonitorTask.h.

Referenced by dqmBeginRun(), EcalDQMonitorTask(), and globalEndLuminosityBlock().

◆ processedEvents_

int EcalDQMonitorTask::processedEvents_
private

Definition at line 59 of file EcalDQMonitorTask.h.

Referenced by analyze(), and dqmBeginRun().

◆ resetInterval_

float EcalDQMonitorTask::resetInterval_
private

Definition at line 63 of file EcalDQMonitorTask.h.

Referenced by globalEndLuminosityBlock().

◆ schedule_

std::vector<std::pair<Processor, ecaldqm::Collections> > EcalDQMonitorTask::schedule_
private

◆ skipCollections_

std::vector<std::string> EcalDQMonitorTask::skipCollections_
private

Definition at line 50 of file EcalDQMonitorTask.h.

Referenced by analyze(), and formSchedule().