CMS 3D CMS Logo

EcalDQMonitor.cc
Go to the documentation of this file.
2 
4 
11 
16 
18 
19 #include <ctime>
20 #include <sstream>
21 
22 namespace ecaldqm {
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  }
46 
48  if (verbosity_ > 2)
49  edm::LogInfo("EcalDQM") << moduleName_ << ": Deleting workers";
50 
51  executeOnWorkers_([](DQWorker *worker) { delete worker; }, "Dtor");
52  }
53 
54  /*static*/
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  }
65 
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  }
79 
80  void EcalDQMonitor::ecaldqmEndRun(edm::Run const &_run, edm::EventSetup const &_es) {
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  }
93 
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  }
107 
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  }
121 } // namespace ecaldqm
ecaldqm::EcalDQMonitor::moduleName_
const std::string moduleName_
Definition: EcalDQMonitor.h:45
funct::false
false
Definition: Factorize.h:29
ecaldqm
Definition: DQWorker.h:37
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:115
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:66
ecaldqm::EcalDQMonitor::EcalDQMonitor
EcalDQMonitor(edm::ParameterSet const &)
Definition: EcalDQMonitor.cc:23
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
protons_cff.time
time
Definition: protons_cff.py:35
ecaldqm::EcalDQMonitor::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: EcalDQMonitor.cc:55
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:41
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:119
ecaldqm::DQWorker::beginLuminosityBlock
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQWorker.h:74
ParameterSetDescription.h
CaloGeometryRecord.h
ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:108
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:114
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::EcalDQMonitor::ecaldqmBeginLuminosityBlock
void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const
Definition: EcalDQMonitor.cc:94
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
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecaldqm::DQWorker::beginRun
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQWorker.h:71
EcalDQMonitor.h
CaloTopologyRecord.h
std
Definition: JetResolutionObject.h:76
ecaldqm::EcalDQMonitor::ecaldqmEndRun
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:80
ecaldqm::DQWorker::endLuminosityBlock
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQWorker.h:75
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
ecaldqm::WorkerFactoryStore::singleton
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:175
ConsumesCollector.h
ParameterSet.h
ecaldqm::DQWorker::setTime
void setTime(time_t _t)
Definition: DQWorker.h:113
ecaldqm::EcalDQMonitor::~EcalDQMonitor
virtual ~EcalDQMonitor() noexcept(false)
Definition: EcalDQMonitor.cc:47
ecaldqm::DQWorker::endRun
virtual void endRun(edm::Run const &, edm::EventSetup const &)
Definition: DQWorker.h:72
EcalDQMCommonUtils.h