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

Protected Attributes

const std::string 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 21 of file EcalDQMonitor.cc.

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  }

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_.

◆ ~EcalDQMonitor()

ecaldqm::EcalDQMonitor::~EcalDQMonitor ( )
virtualnoexcept

Definition at line 45 of file EcalDQMonitor.cc.

45  {
46  if (verbosity_ > 2)
47  edm::LogInfo("EcalDQM") << moduleName_ << ": Deleting workers";
48 
49  executeOnWorkers_([](DQWorker *worker) { delete worker; }, "Dtor");
50  }

References executeOnWorkers_(), moduleName_, and verbosity_.

Member Function Documentation

◆ ecaldqmBeginLuminosityBlock()

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

Definition at line 115 of file EcalDQMonitor.cc.

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  }

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::globalBeginLuminosityBlock().

◆ ecaldqmBeginRun()

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

Definition at line 87 of file EcalDQMonitor.cc.

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  }

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

◆ ecaldqmEndLuminosityBlock()

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

Definition at line 129 of file EcalDQMonitor.cc.

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  }

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::globalEndLuminosityBlock().

◆ ecaldqmEndRun()

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

Definition at line 101 of file EcalDQMonitor.cc.

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  }

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

◆ ecaldqmGetSetupObjects()

void ecaldqm::EcalDQMonitor::ecaldqmGetSetupObjects ( edm::EventSetup const &  _es)
protected

Definition at line 64 of file EcalDQMonitor.cc.

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  }

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

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

◆ 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 51 of file EcalDQMonitor.h.

54  {
55  std::for_each(workers_.begin(), workers_.end(), [&](DQWorker *worker) {
56  if (verbosity_ > _verbThreshold && !_message.empty())
57  edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
58  try {
59  _func(worker);
60  } catch (std::exception &) {
61  edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
62  throw;
63  }
64  });
65  }

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

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

◆ fillDescriptions()

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

Definition at line 53 of file EcalDQMonitor.cc.

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  }

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

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

Member Data Documentation

◆ moduleName_

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

◆ verbosity_

const int ecaldqm::EcalDQMonitor::verbosity_
protected

◆ workers_

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

Definition at line 45 of file EcalDQMonitor.h.

Referenced by EcalDQMonitor(), and executeOnWorkers_().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
ecaldqm::EcalDQMonitor::moduleName_
const std::string moduleName_
Definition: EcalDQMonitor.h:46
ecaldqm::EcalDQMonitor::executeOnWorkers_
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:51
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
ecaldqm::EcalDQMonitor::verbosity_
const int verbosity_
Definition: EcalDQMonitor.h:47
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ecaldqm::EcalDQMonitor::workers_
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:45
EcalCalibMonitorClient_cfi.commonParameters
commonParameters
Definition: EcalCalibMonitorClient_cfi.py:39
edm::ESHandle< EcalElectronicsMapping >
ecaldqm::setTopology
void setTopology(CaloTopology const *)
Definition: EcalDQMCommonUtils.cc:504
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
EcalCondDBWriter_cfi.workerParams
workerParams
Definition: EcalCondDBWriter_cfi.py:68
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::setGeometry
void setGeometry(CaloGeometry const *)
Definition: EcalDQMCommonUtils.cc:484
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
EcalMappingRcd
Definition: EcalMappingRcd.h:15
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ecaldqm::WorkerFactoryStore::singleton
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:95
ntuplemaker.time
time
Definition: ntuplemaker.py:310
edm::Log
Definition: MessageLogger.h:70
ecaldqm::setTrigTowerMap
void setTrigTowerMap(EcalTrigTowerConstituentsMap const *)
Definition: EcalDQMCommonUtils.cc:464
ecaldqm::setElectronicsMap
void setElectronicsMap(EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:444
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25