CMS 3D CMS Logo

EcalDQMonitorClient.cc
Go to the documentation of this file.
2 
4 
9 
14 
16 
18 
23 
24 #include <ctime>
25 #include <fstream>
26 
29  ecaldqm::EcalDQMonitor(_ps),
30  iEvt_(0),
31  statusManager_()
32 {
33  executeOnWorkers_([this](ecaldqm::DQWorker* worker){
34  ecaldqm::DQWorkerClient* client(dynamic_cast<ecaldqm::DQWorkerClient*>(worker));
35  if(!client)
36  throw cms::Exception("InvalidConfiguration") << "Non-client DQWorker " << worker->getName() << " passed";
37  client->setStatusManager(this->statusManager_);
38  }, "initialization");
39 
40  if(_ps.existsAs<edm::FileInPath>("PNMaskFile", false)){
41  std::ifstream maskFile(_ps.getUntrackedParameter<edm::FileInPath>("PNMaskFile").fullPath());
42  if(maskFile.is_open())
44  }
45 }
46 
48 {
49 }
50 
51 /*static*/
52 void
54 {
57 
58  edm::ParameterSetDescription clientParameters;
62  desc.addUntracked("workerParameters", allWorkers);
63 
64  desc.addOptionalUntracked<edm::FileInPath>("PNMaskFile");
65 
66  _descs.addDefault(desc);
67 }
68 
69 void
71 {
73 
74  if(_es.find(edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMChannelStatusRcd>()) && _es.find(edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMTowerStatusRcd>())){
76  _es.get<EcalDQMChannelStatusRcd>().get(cStHndl);
77 
79  _es.get<EcalDQMTowerStatusRcd>().get(tStHndl);
80 
81  statusManager_.readFromObj(*cStHndl, *tStHndl);
82  }
83 
84  ecaldqmBeginRun(_run, _es);
85 }
86 
87 void
89 {
90  ecaldqmEndRun(_run, _es);
91 }
92 
93 void
95 {
96  executeOnWorkers_([&_ibooker](ecaldqm::DQWorker* worker){
97  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
98  if(!client->onlineMode() && !client->runsOn(ecaldqm::DQWorkerClient::kLumi)) return;
99  client->bookMEs(_ibooker);
100  }, "bookMEs", "Booking MEs");
101 
102  ecaldqmEndLuminosityBlock(_lumi, _es);
103 
105 
107  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
108  client->resetPerLumi();
109  }, "dqmEndLuminosityBlock", "Reset per-lumi MEs");
110 }
111 
112 void
114 {
115  executeOnWorkers_([&_ibooker](ecaldqm::DQWorker* worker){
116  worker->bookMEs(_ibooker); // worker returns if already booked
117  }, "bookMEs", "Booking MEs");
118 
120 
122  worker->releaseMEs();
123  }, "releaseMEs", "releasing histograms");
124 }
125 
126 void
128 {
129  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << ": Starting worker modules..";
130 
131  executeOnWorkers_([&_igetter, &_type](ecaldqm::DQWorker* worker){
132  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
133  if(!client->onlineMode() && !client->runsOn(_type)) return;
134  client->releaseSource();
135  client->resetMEs();
136  if(!client->retrieveSource(_igetter, _type)) return;
137  if(client->onlineMode()) client->setTime(time(nullptr));
138  client->producePlots(_type);
139  }, "retrieveAndRun", "producing plots");
140 
141  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << " done." << std::endl;
142 }
143 
ecaldqm::StatusManager statusManager_
std::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &iKey) const
Definition: EventSetup.h:160
T getUntrackedParameter(std::string const &, T const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &)
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
void runWorkers(DQMStore::IGetter &, ecaldqm::DQWorkerClient::ProcessType)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void readFromStream(std::istream &)
void setStatusManager(StatusManager const &_manager)
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
bool retrieveSource(DQMStore::IGetter &, ProcessType)
virtual void releaseMEs()
Definition: DQWorker.cc:60
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
void ecaldqmGetSetupObjects(edm::EventSetup const &)
static void fillDescriptions(edm::ParameterSetDescription &)
EcalDQMonitorClient(edm::ParameterSet const &)
void endRun(edm::Run const &, edm::EventSetup const &) override
virtual void producePlots(ProcessType)=0
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ParameterSetDescription &)
void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &)
virtual void bookMEs(DQMStore::IBooker &)
Definition: DQWorker.cc:66
std::string const moduleName_
Definition: EcalDQMonitor.h:41
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:46
bool onlineMode() const
Definition: DQWorker.h:69
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::string const & getName() const
Definition: DQWorker.h:68
bool runsOn(ProcessType _type) const
void bookMEs(DQMStore::IBooker &) override
T get() const
Definition: EventSetup.h:71
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
std::string fullPath() const
Definition: FileInPath.cc:163
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
void setTime(time_t _t)
Definition: DQWorker.h:63
void readFromObj(EcalDQMChannelStatus const &, EcalDQMTowerStatus const &)
Definition: Run.h:45