CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
ecaldqm::EcalDQMonitor Class Reference

#include <EcalDQMonitor.h>

Inheritance diagram for ecaldqm::EcalDQMonitor:
EcalDQMonitorClient EcalDQMonitorTask

Public Member Functions

 EcalDQMonitor (edm::ParameterSet const &)
 
virtual ~EcalDQMonitor () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &)
 

Protected Member Functions

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

std::string const moduleName_
 
const int verbosity_
 
std::vector< DQWorker * > workers_
 

Detailed Description

Definition at line 25 of file EcalDQMonitor.h.

Constructor & Destructor Documentation

◆ EcalDQMonitor()

ecaldqm::EcalDQMonitor::EcalDQMonitor ( edm::ParameterSet const &  _ps)

Definition at line 23 of file EcalDQMonitor.cc.

References cppFunctionSkipper::exception, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), edm::getWorker(), moduleName_, Skims_PA_cff::name, ecaldqm::DQWorker::onlineMode(), ecaldqm::DQWorker::setTime(), ecaldqm::WorkerFactoryStore::singleton(), AlCaHLTBitMon_QueryRunRegistry::string, protons_cff::time, verbosity_, EcalCondDBWriter_cfi::workerParams, and workers_.

24  : workers_(),
25  moduleName_(_ps.getUntrackedParameter<std::string>("moduleName")),
26  verbosity_(_ps.getUntrackedParameter<int>("verbosity")) {
27  std::vector<std::string> workerNames(_ps.getUntrackedParameter<std::vector<std::string>>("workers"));
28  edm::ParameterSet const &workerParams(_ps.getUntrackedParameterSet("workerParameters"));
29  edm::ParameterSet const &commonParams(_ps.getUntrackedParameterSet("commonParameters"));
30 
31  std::for_each(workerNames.begin(), workerNames.end(), [&](std::string const &name) {
32  if (verbosity_ > 0)
33  edm::LogInfo("EcalDQM") << moduleName_ << ": Setting up " << name << std::endl;
34  try {
35  DQWorker *worker(WorkerFactoryStore::singleton()->getWorker(
36  name, verbosity_, commonParams, workerParams.getUntrackedParameterSet(name)));
37  if (worker->onlineMode())
38  worker->setTime(time(nullptr));
39  workers_.push_back(worker);
40  } catch (std::exception &) {
41  edm::LogError("EcalDQM") << "Worker " << name << " not defined";
42  throw;
43  }
44  });
45  }
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:175
Log< level::Error, false > LogError
std::string const moduleName_
Definition: EcalDQMonitor.h:45
static Worker * getWorker(std::string const &moduleLabel, ParameterSet &proc_pset, WorkerManager &workerManager, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration)
Log< level::Info, false > LogInfo
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:44

◆ ~EcalDQMonitor()

ecaldqm::EcalDQMonitor::~EcalDQMonitor ( )
virtualnoexcept

Definition at line 47 of file EcalDQMonitor.cc.

References executeOnWorkers_(), moduleName_, and verbosity_.

47  {
48  if (verbosity_ > 2)
49  edm::LogInfo("EcalDQM") << moduleName_ << ": Deleting workers";
50 
51  executeOnWorkers_([](DQWorker *worker) { delete worker; }, "Dtor");
52  }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo

Member Function Documentation

◆ ecaldqmBeginLuminosityBlock()

void ecaldqm::EcalDQMonitor::ecaldqmBeginLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
) const
protected

Definition at line 94 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::beginLuminosityBlock(), executeOnWorkers_(), edm::LuminosityBlockBase::luminosityBlock(), moduleName_, ecaldqm::DQWorker::onlineMode(), ecaldqm::DQWorker::setLumiNumber(), ecaldqm::DQWorker::setTime(), protons_cff::time, and verbosity_.

Referenced by EcalDQMonitorTask::globalBeginLuminosityBlock().

94  {
96  [&_lumi, &_es](DQWorker *worker) {
97  if (worker->onlineMode())
98  worker->setTime(time(nullptr));
99  worker->setLumiNumber(_lumi.luminosityBlock());
100  worker->beginLuminosityBlock(_lumi, _es);
101  },
102  "beginLumi");
103 
104  if (verbosity_ > 1)
105  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginLuminosityBlock";
106  }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo

◆ ecaldqmBeginRun()

void ecaldqm::EcalDQMonitor::ecaldqmBeginRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 66 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::beginRun(), executeOnWorkers_(), moduleName_, ecaldqm::DQWorker::onlineMode(), edm::RunBase::run(), ecaldqm::DQWorker::setRunNumber(), ecaldqm::DQWorker::setTime(), protons_cff::time, and verbosity_.

Referenced by EcalDQMonitorClient::beginRun(), and EcalDQMonitorTask::dqmBeginRun().

66  {
68  [&_run, &_es](DQWorker *worker) {
69  if (worker->onlineMode())
70  worker->setTime(time(nullptr));
71  worker->setRunNumber(_run.run());
72  worker->beginRun(_run, _es);
73  },
74  "beginRun");
75 
76  if (verbosity_ > 0)
77  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginRun";
78  }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo

◆ ecaldqmEndLuminosityBlock()

void ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
protected

Definition at line 108 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::endLuminosityBlock(), executeOnWorkers_(), edm::LuminosityBlockBase::luminosityBlock(), moduleName_, ecaldqm::DQWorker::onlineMode(), ecaldqm::DQWorker::setLumiNumber(), ecaldqm::DQWorker::setTime(), protons_cff::time, and verbosity_.

Referenced by EcalDQMonitorClient::dqmEndLuminosityBlock(), and EcalDQMonitorTask::globalEndLuminosityBlock().

108  {
110  [&_lumi, &_es](DQWorker *worker) {
111  if (worker->onlineMode())
112  worker->setTime(time(nullptr));
113  worker->setLumiNumber(_lumi.luminosityBlock());
114  worker->endLuminosityBlock(_lumi, _es);
115  },
116  "endLumi");
117 
118  if (verbosity_ > 2)
119  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndLuminosityBlock";
120  }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo

◆ ecaldqmEndRun()

void ecaldqm::EcalDQMonitor::ecaldqmEndRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 80 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::endRun(), executeOnWorkers_(), moduleName_, ecaldqm::DQWorker::onlineMode(), edm::RunBase::run(), ecaldqm::DQWorker::setRunNumber(), ecaldqm::DQWorker::setTime(), protons_cff::time, and verbosity_.

Referenced by EcalDQMonitorTask::dqmEndRun(), and EcalDQMonitorClient::endRun().

80  {
82  [&_run, &_es](DQWorker *worker) {
83  if (worker->onlineMode())
84  worker->setTime(time(nullptr));
85  worker->setRunNumber(_run.run());
86  worker->endRun(_run, _es);
87  },
88  "endRun");
89 
90  if (verbosity_ > 0)
91  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndRun";
92  }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo

◆ executeOnWorkers_()

template<typename FuncOnWorker >
void ecaldqm::EcalDQMonitor::executeOnWorkers_ ( FuncOnWorker  _func,
std::string const &  _context,
std::string const &  _message = "",
int  _verbThreshold = 1 
) const
protected

Definition at line 50 of file EcalDQMonitor.h.

References cppFunctionSkipper::exception, moduleName_, verbosity_, and workers_.

Referenced by EcalDQMonitorTask::analyze(), EcalDQMonitorClient::beginRun(), EcalDQMonitorTask::bookHistograms(), EcalDQMonitorClient::dqmEndJob(), EcalDQMonitorClient::dqmEndLuminosityBlock(), EcalDQMonitorTask::dqmEndRun(), ecaldqmBeginLuminosityBlock(), ecaldqmBeginRun(), ecaldqmEndLuminosityBlock(), ecaldqmEndRun(), EcalDQMonitorClient::EcalDQMonitorClient(), EcalDQMonitorTask::EcalDQMonitorTask(), EcalDQMonitorTask::globalBeginLuminosityBlock(), EcalDQMonitorTask::runOnCollection(), EcalDQMonitorClient::runWorkers(), and ~EcalDQMonitor().

53  {
54  std::for_each(workers_.begin(), workers_.end(), [&](DQWorker *worker) {
55  if (verbosity_ > _verbThreshold && !_message.empty())
56  edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
57  try {
58  _func(worker);
59  } catch (std::exception &) {
60  edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
61  throw;
62  }
63  });
64  }
Log< level::Error, false > LogError
std::string const moduleName_
Definition: EcalDQMonitor.h:45
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:44

◆ fillDescriptions()

void ecaldqm::EcalDQMonitor::fillDescriptions ( edm::ParameterSetDescription _desc)
static

Definition at line 55 of file EcalDQMonitor.cc.

References edm::ParameterSetDescription::addUntracked(), EcalCalibMonitorClient_cfi::commonParameters, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EcalDQMonitorClient::fillDescriptions(), and EcalDQMonitorTask::fillDescriptions().

55  {
56  _desc.addUntracked<std::string>("moduleName", "Ecal Monitor Module");
57  _desc.addUntracked<std::vector<std::string>>("workers");
58  _desc.addUntracked<int>("verbosity", 0);
59 
61  commonParameters.addUntracked<bool>("onlineMode", false);
62  commonParameters.addUntracked<bool>("willConvertToEDM", true);
63  _desc.addUntracked("commonParameters", commonParameters);
64  }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)

Member Data Documentation

◆ moduleName_

std::string const ecaldqm::EcalDQMonitor::moduleName_
protected

◆ verbosity_

const int ecaldqm::EcalDQMonitor::verbosity_
protected

◆ workers_

std::vector<DQWorker *> ecaldqm::EcalDQMonitor::workers_
protected

Definition at line 44 of file EcalDQMonitor.h.

Referenced by EcalDQMonitor(), and executeOnWorkers_().