CMS 3D CMS Logo

EcalDQMonitor.cc
Go to the documentation of this file.
2 
4 
11 
16 
17 #include <ctime>
18 #include <sstream>
19 
20 namespace ecaldqm {
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  }
44 
46  if (verbosity_ > 2)
47  edm::LogInfo("EcalDQM") << moduleName_ << ": Deleting workers";
48 
49  executeOnWorkers_([](DQWorker *worker) { delete worker; }, "Dtor");
50  }
51 
52  /*static*/
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  }
63 
66  [&_run, &_es](DQWorker *worker) {
67  if (worker->onlineMode())
68  worker->setTime(time(nullptr));
69  worker->setRunNumber(_run.run());
70  worker->beginRun(_run, _es);
71  },
72  "beginRun");
73 
74  if (verbosity_ > 0)
75  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginRun";
76  }
77 
78  void EcalDQMonitor::ecaldqmEndRun(edm::Run const &_run, edm::EventSetup const &_es) {
80  [&_run, &_es](DQWorker *worker) {
81  if (worker->onlineMode())
82  worker->setTime(time(nullptr));
83  worker->setRunNumber(_run.run());
84  worker->endRun(_run, _es);
85  },
86  "endRun");
87 
88  if (verbosity_ > 0)
89  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndRun";
90  }
91 
94  [&_lumi, &_es](DQWorker *worker) {
95  if (worker->onlineMode())
96  worker->setTime(time(nullptr));
97  worker->setLumiNumber(_lumi.luminosityBlock());
98  worker->beginLuminosityBlock(_lumi, _es);
99  },
100  "beginLumi");
101 
102  if (verbosity_ > 1)
103  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginLuminosityBlock";
104  }
105 
108  [&_lumi, &_es](DQWorker *worker) {
109  if (worker->onlineMode())
110  worker->setTime(time(nullptr));
111  worker->setLumiNumber(_lumi.luminosityBlock());
112  worker->endLuminosityBlock(_lumi, _es);
113  },
114  "endLumi");
115 
116  if (verbosity_ > 2)
117  edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndLuminosityBlock";
118  }
119 } // namespace ecaldqm
ecaldqm::EcalDQMonitor::moduleName_
const std::string moduleName_
Definition: EcalDQMonitor.h:45
funct::false
false
Definition: Factorize.h:29
ecaldqm
Definition: DQWorker.h:29
ESHandle.h
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2136
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
ecaldqm::DQWorker::setLumiNumber
void setLumiNumber(edm::LuminosityBlockNumber_t _l)
Definition: DQWorker.h:94
edm::Run
Definition: Run.h:45
ecaldqm::EcalDQMonitor::executeOnWorkers_
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
LuminosityBlock.h
ecaldqm::EcalDQMonitor::verbosity_
const int verbosity_
Definition: EcalDQMonitor.h:46
ecaldqm::EcalDQMonitor::ecaldqmBeginRun
void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:64
ecaldqm::EcalDQMonitor::EcalDQMonitor
EcalDQMonitor(edm::ParameterSet const &)
Definition: EcalDQMonitor.cc:21
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
protons_cff.time
time
Definition: protons_cff.py:39
ecaldqm::EcalDQMonitor::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: EcalDQMonitor.cc:53
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
ecaldqm::EcalDQMonitor::workers_
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:44
ecaldqm::DQWorker
Definition: DQWorker.h:33
EcalCalibMonitorClient_cfi.commonParameters
commonParameters
Definition: EcalCalibMonitorClient_cfi.py:39
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
EcalMappingRcd.h
Run.h
ecaldqm::DQWorker::onlineMode
bool onlineMode() const
Definition: DQWorker.h:98
ecaldqm::DQWorker::beginLuminosityBlock
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQWorker.h:65
ParameterSetDescription.h
CaloGeometryRecord.h
ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:106
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
ecaldqm::DQWorker::setRunNumber
void setRunNumber(edm::RunNumber_t _r)
Definition: DQWorker.h:93
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::EcalDQMonitor::ecaldqmBeginLuminosityBlock
void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const
Definition: EcalDQMonitor.cc:92
createfilelist.int
int
Definition: createfilelist.py:10
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
ecaldqm::DQWorker::beginRun
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQWorker.h:62
EcalDQMonitor.h
CaloTopologyRecord.h
std
Definition: JetResolutionObject.h:76
ecaldqm::EcalDQMonitor::ecaldqmEndRun
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:78
ecaldqm::DQWorker::endLuminosityBlock
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQWorker.h:66
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
ecaldqm::WorkerFactoryStore::singleton
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:161
ParameterSet.h
ecaldqm::DQWorker::setTime
void setTime(time_t _t)
Definition: DQWorker.h:92
ecaldqm::EcalDQMonitor::~EcalDQMonitor
virtual ~EcalDQMonitor() noexcept(false)
Definition: EcalDQMonitor.cc:45
ecaldqm::DQWorker::endRun
virtual void endRun(edm::Run const &, edm::EventSetup const &)
Definition: DQWorker.h:63
EcalDQMCommonUtils.h