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 
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  }
86 
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  }
100 
101  void EcalDQMonitor::ecaldqmEndRun(edm::Run const &_run, edm::EventSetup const &_es) {
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  }
114 
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  }
128 
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  }
142 } // namespace ecaldqm
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
ecaldqm::EcalDQMonitor::moduleName_
const std::string moduleName_
Definition: EcalDQMonitor.h:46
funct::false
false
Definition: Factorize.h:29
ecaldqm
Definition: DQWorker.h:24
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:68
edm::Run
Definition: Run.h:45
ecaldqm::EcalDQMonitor::executeOnWorkers_
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:51
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
LuminosityBlock.h
ecaldqm::EcalDQMonitor::verbosity_
const int verbosity_
Definition: EcalDQMonitor.h:47
ecaldqm::EcalDQMonitor::ecaldqmBeginRun
void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:87
ecaldqm::EcalDQMonitor::EcalDQMonitor
EcalDQMonitor(edm::ParameterSet const &)
Definition: EcalDQMonitor.cc:21
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ecaldqm::EcalDQMonitor::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: EcalDQMonitor.cc:53
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
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:45
ecaldqm::DQWorker
Definition: DQWorker.h:28
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
EcalCalibMonitorClient_cfi.commonParameters
commonParameters
Definition: EcalCalibMonitorClient_cfi.py:39
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
EcalMappingRcd.h
Run.h
edm::ESHandle< EcalElectronicsMapping >
ecaldqm::DQWorker::onlineMode
bool onlineMode() const
Definition: DQWorker.h:72
ecaldqm::DQWorker::beginLuminosityBlock
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQWorker.h:60
ParameterSetDescription.h
ecaldqm::setTopology
void setTopology(CaloTopology const *)
Definition: EcalDQMCommonUtils.cc:504
CaloGeometryRecord.h
ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:129
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:67
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::EcalDQMonitor::ecaldqmBeginLuminosityBlock
void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const
Definition: EcalDQMonitor.cc:115
ecaldqm::setGeometry
void setGeometry(CaloGeometry const *)
Definition: EcalDQMCommonUtils.cc:484
createfilelist.int
int
Definition: createfilelist.py:10
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
ecaldqm::DQWorker::beginRun
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQWorker.h:57
EcalDQMonitor.h
CaloTopologyRecord.h
std
Definition: JetResolutionObject.h:76
EcalMappingRcd
Definition: EcalMappingRcd.h:15
ecaldqm::EcalDQMonitor::ecaldqmEndRun
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:101
ecaldqm::DQWorker::endLuminosityBlock
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQWorker.h:61
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
ecaldqm::WorkerFactoryStore::singleton
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:95
ParameterSet.h
ecaldqm::DQWorker::setTime
void setTime(time_t _t)
Definition: DQWorker.h:66
ntuplemaker.time
time
Definition: ntuplemaker.py:310
ecaldqm::EcalDQMonitor::~EcalDQMonitor
virtual ~EcalDQMonitor() noexcept(false)
Definition: EcalDQMonitor.cc:45
ecaldqm::setTrigTowerMap
void setTrigTowerMap(EcalTrigTowerConstituentsMap const *)
Definition: EcalDQMCommonUtils.cc:464
ecaldqm::EcalDQMonitor::ecaldqmGetSetupObjects
void ecaldqmGetSetupObjects(edm::EventSetup const &)
Definition: EcalDQMonitor.cc:64
ecaldqm::DQWorker::endRun
virtual void endRun(edm::Run const &, edm::EventSetup const &)
Definition: DQWorker.h:58
ecaldqm::setElectronicsMap
void setElectronicsMap(EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:444
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
EcalDQMCommonUtils.h