CMS 3D CMS Logo

EcalDQMonitorClient.cc
Go to the documentation of this file.
1 #include "../interface/EcalDQMonitorClient.h"
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 }
106 
107 void
109 {
110  executeOnWorkers_([&_ibooker](ecaldqm::DQWorker* worker){
111  worker->bookMEs(_ibooker); // worker returns if already booked
112  }, "bookMEs", "Booking MEs");
113 
115 
117  worker->releaseMEs();
118  }, "releaseMEs", "releasing histograms");
119 }
120 
121 void
123 {
124  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << ": Starting worker modules..";
125 
126  executeOnWorkers_([&_igetter, &_type](ecaldqm::DQWorker* worker){
127  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
128  if(!client->onlineMode() && !client->runsOn(_type)) return;
129  client->releaseSource();
130  client->resetMEs();
131  if(!client->retrieveSource(_igetter, _type)) return;
132  if(client->onlineMode()) client->setTime(time(nullptr));
133  client->producePlots(_type);
134  }, "retrieveAndRun", "producing plots");
135 
136  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << " done." << std::endl;
137 }
138 
ecaldqm::StatusManager statusManager_
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:186
void runWorkers(DQMStore::IGetter &, ecaldqm::DQWorkerClient::ProcessType)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void readFromStream(std::istream &)
void setStatusManager(StatusManager const &_manager)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
bool retrieveSource(DQMStore::IGetter &, ProcessType)
virtual void releaseMEs()
Definition: DQWorker.cc:77
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 &)
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:85
void endRun(edm::Run const &, edm::EventSetup const &) override
virtual void producePlots(ProcessType)=0
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:85
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:45
bool onlineMode() const
Definition: DQWorker.h:69
void beginRun(edm::Run const &, edm::EventSetup const &) override
const T & get() const
Definition: EventSetup.h:58
std::string const & getName() const
Definition: DQWorker.h:68
bool runsOn(ProcessType _type) const
void bookMEs(DQMStore::IBooker &) override
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
std::string fullPath() const
Definition: FileInPath.cc:197
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:43