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 ()(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &)
 

Protected Member Functions

void ecaldqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup 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 &)
 
void ecaldqmGetSetupObjects (edm::EventSetup const &)
 
template<typename FuncOnWorker >
void executeOnWorkers_ (FuncOnWorker, std::string const &, std::string const &="", int=1)
 

Protected Attributes

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

Detailed Description

Definition at line 20 of file EcalDQMonitor.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file EcalDQMonitor.cc.

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

22  : workers_(),
23  moduleName_(_ps.getUntrackedParameter<std::string>("moduleName")),
24  verbosity_(_ps.getUntrackedParameter<int>("verbosity")) {
25  std::vector<std::string> workerNames(_ps.getUntrackedParameter<std::vector<std::string>>("workers"));
26  edm::ParameterSet const &workerParams(_ps.getUntrackedParameterSet("workerParameters"));
27  edm::ParameterSet const &commonParams(_ps.getUntrackedParameterSet("commonParameters"));
28 
29  std::for_each(workerNames.begin(), workerNames.end(), [&](std::string const &name) {
30  if (verbosity_ > 0)
31  edm::LogInfo("EcalDQM") << moduleName_ << ": Setting up " << name << std::endl;
32  try {
33  DQWorker *worker(WorkerFactoryStore::singleton()->getWorker(
34  name, verbosity_, commonParams, workerParams.getUntrackedParameterSet(name)));
35  if (worker->onlineMode())
36  worker->setTime(time(nullptr));
37  workers_.push_back(worker);
38  } catch (std::exception &) {
39  edm::LogError("EcalDQM") << "Worker " << name << " not defined";
40  throw;
41  }
42  });
43  }
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:95
std::string const moduleName_
Definition: EcalDQMonitor.h:41
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:40
ecaldqm::EcalDQMonitor::~EcalDQMonitor ( )
virtual

Definition at line 45 of file EcalDQMonitor.cc.

References executeOnWorkers_(), moduleName_, and verbosity_.

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

Member Function Documentation

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

Definition at line 115 of file EcalDQMonitor.cc.

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

Referenced by EcalDQMonitorTask::dqmBeginLuminosityBlock().

115  {
117  [&_lumi, &_es](DQWorker *worker) {
118  if (worker->onlineMode())
119  worker->setTime(time(nullptr));
120  worker->setLumiNumber(_lumi.luminosityBlock());
121  worker->beginLuminosityBlock(_lumi, _es);
122  },
123  "beginLumi");
124 
125  if (verbosity_ > 1)
126  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginLuminosityBlock";
127  }
std::string const moduleName_
Definition: EcalDQMonitor.h:41
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:46
void ecaldqm::EcalDQMonitor::ecaldqmBeginRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 87 of file EcalDQMonitor.cc.

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

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

87  {
89  [&_run, &_es](DQWorker *worker) {
90  if (worker->onlineMode())
91  worker->setTime(time(nullptr));
92  worker->setRunNumber(_run.run());
93  worker->beginRun(_run, _es);
94  },
95  "beginRun");
96 
97  if (verbosity_ > 0)
98  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginRun";
99  }
std::string const moduleName_
Definition: EcalDQMonitor.h:41
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:46
void ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
protected

Definition at line 129 of file EcalDQMonitor.cc.

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

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

129  {
131  [&_lumi, &_es](DQWorker *worker) {
132  if (worker->onlineMode())
133  worker->setTime(time(nullptr));
134  worker->setLumiNumber(_lumi.luminosityBlock());
135  worker->endLuminosityBlock(_lumi, _es);
136  },
137  "endLumi");
138 
139  if (verbosity_ > 2)
140  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndLuminosityBlock";
141  }
std::string const moduleName_
Definition: EcalDQMonitor.h:41
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:46
void ecaldqm::EcalDQMonitor::ecaldqmEndRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 101 of file EcalDQMonitor.cc.

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

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

101  {
103  [&_run, &_es](DQWorker *worker) {
104  if (worker->onlineMode())
105  worker->setTime(time(nullptr));
106  worker->setRunNumber(_run.run());
107  worker->endRun(_run, _es);
108  },
109  "endRun");
110 
111  if (verbosity_ > 0)
112  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndRun";
113  }
std::string const moduleName_
Definition: EcalDQMonitor.h:41
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:46
void ecaldqm::EcalDQMonitor::ecaldqmGetSetupObjects ( edm::EventSetup const &  _es)
protected

Definition at line 64 of file EcalDQMonitor.cc.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), ecaldqm::setElectronicsMap(), ecaldqm::setGeometry(), ecaldqm::setTopology(), and ecaldqm::setTrigTowerMap().

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

64  {
65  // NB: a more minimal solution may rely on ESWatchers
66  // but then here the cost is rather minimal
67  // set up electronicsMap in EcalDQMCommonUtils
69  _es.get<EcalMappingRcd>().get(elecMapHandle);
70  setElectronicsMap(elecMapHandle.product());
71 
72  // set up trigTowerMap in EcalDQMCommonUtils
74  _es.get<IdealGeometryRecord>().get(ttMapHandle);
75  setTrigTowerMap(ttMapHandle.product());
76 
77  edm::ESHandle<CaloGeometry> geomHandle;
78  _es.get<CaloGeometryRecord>().get(geomHandle);
79  setGeometry(geomHandle.product());
80 
81  // set up trigTowerMap in EcalDQMCommonUtils
82  edm::ESHandle<CaloTopology> topoHandle;
83  _es.get<CaloTopologyRecord>().get(topoHandle);
84  setTopology(topoHandle.product());
85  }
void setGeometry(CaloGeometry const *)
void setTopology(CaloTopology const *)
void setElectronicsMap(EcalElectronicsMapping const *)
void setTrigTowerMap(EcalTrigTowerConstituentsMap const *)
T const * product() const
Definition: ESHandle.h:86
template<typename FuncOnWorker >
void ecaldqm::EcalDQMonitor::executeOnWorkers_ ( FuncOnWorker  _func,
std::string const &  _context,
std::string const &  _message = "",
int  _verbThreshold = 1 
)
protected

Definition at line 46 of file EcalDQMonitor.h.

References cppFunctionSkipper::exception.

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

49  {
50  std::for_each(workers_.begin(), workers_.end(), [&](DQWorker *worker) {
51  if (verbosity_ > _verbThreshold && !_message.empty())
52  edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
53  try {
54  _func(worker);
55  } catch (std::exception &) {
56  edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
57  throw;
58  }
59  });
60  }
std::string const moduleName_
Definition: EcalDQMonitor.h:41
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:40
void ecaldqm::EcalDQMonitor::fillDescriptions ( edm::ParameterSetDescription _desc)
static

Definition at line 53 of file EcalDQMonitor.cc.

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

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

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

Member Data Documentation

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

Definition at line 40 of file EcalDQMonitor.h.

Referenced by EcalDQMonitor().