CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
28  edm::EDAnalyzer(),
29  ecaldqm::EcalDQMonitor(_ps),
30  eventCycleLength_(_ps.getUntrackedParameter<unsigned>("analyzeEvery")),
31  iEvt_(0),
32  statusManager_()
33 {
34  executeOnWorkers_([this](ecaldqm::DQWorker* worker){
35  ecaldqm::DQWorkerClient* client(dynamic_cast<ecaldqm::DQWorkerClient*>(worker));
36  if(!client)
37  throw cms::Exception("InvalidConfiguration") << "Non-client DQWorker " << worker->getName() << " passed";
38  client->setStatusManager(this->statusManager_);
39  }, "initialization");
40 
41  if(_ps.existsAs<edm::FileInPath>("PNMaskFile", false)){
42  std::ifstream maskFile(_ps.getUntrackedParameter<edm::FileInPath>("PNMaskFile").fullPath());
43  if(maskFile.is_open())
45  }
46 }
47 
48 /*static*/
49 void
51 {
54 
55  edm::ParameterSetDescription clientParameters;
59  desc.addUntracked("workerParameters", allWorkers);
60 
61  desc.addUntracked<unsigned>("analyzeEvery", 0);
62  desc.addOptionalUntracked<edm::FileInPath>("PNMaskFile");
63 
64  _descs.addDefault(desc);
65 }
66 
67 void
69 {
71 
72  if(_es.find(edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMChannelStatusRcd>()) && _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 
83 
84  ecaldqmBeginRun(_run, _es);
85 }
86 
87 void
89 {
90  ecaldqmEndRun(_run, _es);
91 
93 
95 }
96 
97 void
99 {
100  ecaldqmEndLuminosityBlock(_lumi, _es);
101 
103 }
104 
105 void
107 {
109 }
110 
111 void
113 {
114  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << ": Starting worker modules..";
115 
116  DQMStore const& dqmStore(*edm::Service<DQMStore>());
117 
118  executeOnWorkers_([&dqmStore, &_type](ecaldqm::DQWorker* worker){
119  ecaldqm::DQWorkerClient* client(static_cast<ecaldqm::DQWorkerClient*>(worker));
120  client->releaseSource();
121  client->resetMEs();
122  if(!client->retrieveSource(dqmStore, _type)) return;
123  if(client->onlineMode()) client->setTime(time(0));
124  client->producePlots(_type);
125  }, "retrieveAndRun", "producing plots");
126 
127  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << " done." << std::endl;
128 }
129 
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:184
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void analyze(edm::Event const &, edm::EventSetup const &) override
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 &)
bool retrieveSource(DQMStore const &, ProcessType)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
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:90
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 &)
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
bool onlineMode() const
Definition: DQWorker.h:70
void beginRun(edm::Run const &, edm::EventSetup const &) override
const T & get() const
Definition: EventSetup.h:55
std::string const & getName() const
Definition: DQWorker.h:69
void runWorkers(ecaldqm::DQWorkerClient::ProcessType)
void ecaldqmBookHistograms(Booker &)
Definition: EcalDQMonitor.h:46
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
std::string fullPath() const
Definition: FileInPath.cc:165
void setTime(time_t _t)
Definition: DQWorker.h:64
void readFromObj(EcalDQMChannelStatus const &, EcalDQMTowerStatus const &)
Definition: Run.h:41