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 
28  : DQMEDHarvester(), ecaldqm::EcalDQMonitor(_ps), iEvt_(0), statusManager_() {
30  [this](ecaldqm::DQWorker* worker) {
31  ecaldqm::DQWorkerClient* client(dynamic_cast<ecaldqm::DQWorkerClient*>(worker));
32  if (!client)
33  throw cms::Exception("InvalidConfiguration") << "Non-client DQWorker " << worker->getName() << " passed";
34  client->setStatusManager(this->statusManager_);
35  },
36  "initialization");
37 
38  // This is no longer used since run 2
39  //
40  //if (_ps.existsAs<edm::FileInPath>("PNMaskFile", false)) {
41  // std::ifstream maskFile(_ps.getUntrackedParameter<edm::FileInPath>("PNMaskFile").fullPath());
42  // if (maskFile.is_open())
43  // statusManager_.readFromStream(maskFile);
44  //}
45 }
46 
48 
49 /*static*/
53 
54  edm::ParameterSetDescription clientParameters;
57  allWorkers.addNode(
59  desc.addUntracked("workerParameters", allWorkers);
60 
61  desc.addOptionalUntracked<edm::FileInPath>("PNMaskFile");
62 
63  _descs.addDefault(desc);
64 }
65 
67  executeOnWorkers_([&_es](ecaldqm::DQWorker* worker) { worker->setSetupObjects(_es); },
68  "ecaldqmGetSetupObjects",
69  "Getting EventSetup Objects");
70 
71  if (_es.find(edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMChannelStatusRcd>()) &&
72  _es.find(edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMTowerStatusRcd>())) {
74  _es.get<EcalDQMChannelStatusRcd>().get(cStHndl);
75 
77  _es.get<EcalDQMTowerStatusRcd>().get(tStHndl);
78 
79  statusManager_.readFromObj(*cStHndl, *tStHndl);
80  }
81 
82  ecaldqmBeginRun(_run, _es);
83 }
84 
85 void EcalDQMonitorClient::endRun(edm::Run const& _run, edm::EventSetup const& _es) { ecaldqmEndRun(_run, _es); }
86 
88  DQMStore::IGetter& _igetter,
89  edm::LuminosityBlock const& _lumi,
90  edm::EventSetup const& _es) {
92  [&_ibooker](ecaldqm::DQWorker* worker) {
93  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
94  if (!client->onlineMode() && !client->runsOn(ecaldqm::DQWorkerClient::kLumi))
95  return;
96  client->bookMEs(_ibooker);
97  },
98  "bookMEs",
99  "Booking MEs");
100 
101  ecaldqmEndLuminosityBlock(_lumi, _es);
102 
104 
106  [](ecaldqm::DQWorker* worker) {
107  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
108  client->resetPerLumi();
109  },
110  "dqmEndLuminosityBlock",
111  "Reset per-lumi MEs");
112 }
113 
116  [&_ibooker](ecaldqm::DQWorker* worker) {
117  worker->bookMEs(_ibooker); // worker returns if already booked
118  },
119  "bookMEs",
120  "Booking MEs");
121 
123 
124  executeOnWorkers_([](ecaldqm::DQWorker* worker) { worker->releaseMEs(); }, "releaseMEs", "releasing histograms");
125 }
126 
128  if (verbosity_ > 0)
129  edm::LogInfo("EcalDQM") << moduleName_ << ": Starting worker modules..";
130 
132  [&_igetter, &_type](ecaldqm::DQWorker* worker) {
133  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
134  if (!client->onlineMode() && !client->runsOn(_type))
135  return;
136  client->releaseSource();
137  client->resetMEs();
138  if (!client->retrieveSource(_igetter, _type))
139  return;
140  if (client->onlineMode())
141  client->setTime(time(nullptr));
142  client->producePlots(_type);
143  },
144  "retrieveAndRun",
145  "producing plots");
146 
147  if (verbosity_ > 0)
148  edm::LogInfo("EcalDQM") << " done." << std::endl;
149 }
150 
ConfigurationDescriptions.h
MessageLogger.h
ecaldqm::EcalDQMonitor::moduleName_
const std::string moduleName_
Definition: EcalDQMonitor.h:45
ecaldqm
Definition: DQWorker.h:29
ecaldqm::DQWorkerClient::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: DQWorkerClient.cc:21
ESHandle.h
edm::ParameterWildcard
Definition: ParameterWildcard.h:23
EcalDQMonitorClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: EcalDQMonitorClient.cc:114
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
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
EcalDQMonitorClient::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: EcalDQMonitorClient.cc:87
EcalDQMonitorClient::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: EcalDQMonitorClient.cc:50
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
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EcalDQMonitorClient::runWorkers
void runWorkers(DQMStore::IGetter &, ecaldqm::DQWorkerClient::ProcessType)
Definition: EcalDQMonitorClient.cc:127
protons_cff.time
time
Definition: protons_cff.py:39
EcalDQMTowerStatus.h
ecaldqm::EcalDQMonitor::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: EcalDQMonitor.cc:53
ecaldqm::DQWorker::bookMEs
virtual void bookMEs(DQMStore::IBooker &)
Definition: DQWorker.cc:78
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
EcalDQMonitorClient::~EcalDQMonitorClient
~EcalDQMonitorClient() override
Definition: EcalDQMonitorClient.cc:47
EcalDQMChannelStatusRcd.h
ecaldqm::DQWorker::releaseMEs
virtual void releaseMEs()
Definition: DQWorker.cc:72
FileInPath.h
ecaldqm::StatusManager::readFromObj
void readFromObj(EcalDQMChannelStatus const &, EcalDQMTowerStatus const &)
Definition: StatusManager.cc:200
ecaldqm::DQWorker
Definition: DQWorker.h:33
edm::FileInPath
Definition: FileInPath.h:64
ecaldqm::DQWorker::setSetupObjects
void setSetupObjects(edm::EventSetup const &)
Definition: DQWorker.cc:86
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EcalDQMonitorClient::EcalDQMonitorClient
EcalDQMonitorClient(edm::ParameterSet const &)
Definition: EcalDQMonitorClient.cc:27
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLTObjectMonitor_Client_cff.client
client
Definition: HLTObjectMonitor_Client_cff.py:6
ecaldqm::DQWorkerClient::kJob
Definition: DQWorkerClient.h:15
Service.h
ecaldqm::DQWorkerClient::ProcessType
ProcessType
Definition: DQWorkerClient.h:15
edm::ESHandle
Definition: DTSurvey.h:22
ParameterSetDescription.h
ecaldqm::DQWorkerClient::kLumi
Definition: DQWorkerClient.h:15
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:106
EcalDQMTowerStatusRcd
Definition: EcalDQMTowerStatusRcd.h:5
EcalDQMTowerStatusRcd.h
edm::ParameterSet
Definition: ParameterSet.h:47
EcalDQMonitorClient::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: EcalDQMonitorClient.cc:66
EcalDQMonitorClient.h
EcalDQMChannelStatusRcd
Definition: EcalDQMChannelStatusRcd.h:5
edm::EventSetup
Definition: EventSetup.h:58
edm::ParameterSetDescription::addNode
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
Definition: ParameterSetDescription.cc:41
ecaldqm::DQWorkerClient
Definition: DQWorkerClient.h:13
edm::EventSetup::find
std::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &iKey) const
Definition: EventSetup.h:176
get
#define get
EcalDQMonitorClient::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: EcalDQMonitorClient.cc:85
DQMEDHarvester
Definition: DQMEDHarvester.py:1
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
ecaldqm::EcalDQMonitor::ecaldqmEndRun
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
Definition: EcalDQMonitor.cc:78
ecaldqm::DQWorker::getName
const std::string & getName() const
Definition: DQWorker.h:97
dqm::implementation::IGetter
Definition: DQMStore.h:484
Exception
Definition: hltDiff.cc:245
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
EcalDQMonitorClient
Definition: EcalDQMonitorClient.h:10
ParameterSet.h
EventSetupRecordKey.h
EcalDQMChannelStatus.h
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::RequireZeroOrMore
Definition: ParameterWildcardBase.h:17
EcalDQMonitorClient::statusManager_
ecaldqm::StatusManager statusManager_
Definition: EcalDQMonitorClient.h:31
EcalDQMCommonUtils.h