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.
2 
6 
12 
16 
19 
24 
25 using namespace ecaldqm;
26 
28  EcalDQMonitor(_ps),
29  workers_(0),
30  runAtEndLumi_(_ps.getUntrackedParameter<bool>("runAtEndLumi", false)),
31  lumiStatus_(-1)
32 {
33  using namespace std;
34 
35  const edm::ParameterSet& clientParams(_ps.getUntrackedParameterSet("clientParameters"));
36  const edm::ParameterSet& mePaths(_ps.getUntrackedParameterSet("mePaths"));
37 
38  vector<string> clientNames(_ps.getUntrackedParameter<vector<string> >("clients"));
39 
40  WorkerFactory factory(0);
41 
42  for(vector<string>::iterator cItr(clientNames.begin()); cItr != clientNames.end(); ++cItr){
43  if (!(factory = SetWorker::findFactory(*cItr))) continue;
44 
45  if(verbosity_ > 0) cout << moduleName_ << ": Setting up " << *cItr << endl;
46 
47  DQWorker* worker(factory(clientParams, mePaths.getUntrackedParameterSet(*cItr)));
48  if(worker->getName() != *cItr){
49  delete worker;
50  continue;
51  }
52  DQWorkerClient* client(static_cast<DQWorkerClient*>(worker));
53  client->setVerbosity(verbosity_);
54 
55  workers_.push_back(client);
56  }
57 }
58 
60 {
61  for(std::vector<DQWorkerClient*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr)
62  delete *wItr;
63 }
64 
65 /* static */
66 void
68 {
70  desc.setUnknown();
71  _descs.addDefault(desc);
72 }
73 
74 void
76 {
77  // set up ecaldqm::electronicsMap in EcalDQMCommonUtils
79  _es.get<EcalMappingRcd>().get(elecMapHandle);
80  ecaldqm::setElectronicsMap(elecMapHandle.product());
81 
82  // set up ecaldqm::electronicsMap in EcalDQMCommonUtils
84  _es.get<IdealGeometryRecord>().get(ttMapHandle);
85  ecaldqm::setTrigTowerMap(ttMapHandle.product());
86 
87  if(_es.find(edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMChannelStatusRcd>())){
89  _es.get<EcalDQMChannelStatusRcd>().get(cStHndl);
90  DQWorkerClient::channelStatus = cStHndl.product();
91  }
92 
93  if(_es.find(edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMTowerStatusRcd>())){
95  _es.get<EcalDQMTowerStatusRcd>().get(tStHndl);
96  DQWorkerClient::towerStatus = tStHndl.product();
97  }
98 
99  for(std::vector<DQWorkerClient*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
100  DQWorkerClient* client(*wItr);
101  if(verbosity_ > 1) std::cout << moduleName_ << ": Booking MEs for " << client->getName() << std::endl;
102  client->bookMEs();
103  client->beginRun(_run, _es);
104  }
105 
106  lumiStatus_ = -1;
107 
108  if(verbosity_ > 0)
109  std::cout << moduleName_ << ": Starting run " << _run.run() << std::endl;
110 }
111 
112 void
114 {
115  if(lumiStatus_ == 0)
116  runWorkers();
117 
118  for(std::vector<DQWorkerClient *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
119  (*wItr)->endRun(_run, _es);
120  }
121 }
122 
123 void
125 {
126  for(std::vector<DQWorkerClient *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr)
127  (*wItr)->beginLuminosityBlock(_lumi, _es);
128 
129  lumiStatus_ = 0;
130 }
131 
132 void
134 {
135  for(std::vector<DQWorkerClient *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr)
136  (*wItr)->endLuminosityBlock(_lumi, _es);
137 
138  if(runAtEndLumi_){
139  runWorkers();
140  lumiStatus_ = 1;
141  }
142 }
143 
144 void
146 {
147  if(verbosity_ > 0)
148  std::cout << "EcalDQMonitorClient: Starting worker modules.." << std::endl;
149 
150  for(std::vector<DQWorkerClient *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
151  DQWorkerClient* client(*wItr);
152  if(!client->isInitialized())
153  client->initialize();
154 
155  if(client->isInitialized())
156  client->producePlots();
157  }
158 
159  if(verbosity_ > 0)
160  std::cout << " done." << std::endl;
161 }
T getUntrackedParameter(std::string const &, T const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &)
void setTrigTowerMap(const EcalTrigTowerConstituentsMap *)
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
RunNumber_t run() const
Definition: RunBase.h:42
std::string moduleName_
Definition: EcalDQMonitor.h:22
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
Definition: DQWorker.h:27
virtual void setVerbosity(int _verbosity)
Definition: DQWorker.h:39
virtual void initialize()
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:90
void setElectronicsMap(const EcalElectronicsMapping *)
void addDefault(ParameterSetDescription const &psetDescription)
virtual std::string const & getName()
Definition: DQWorker.h:36
virtual bool isInitialized()
Definition: DQWorker.h:37
ParameterSet const & getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
DQWorker *(* WorkerFactory)(const edm::ParameterSet &, const edm::ParameterSet &)
Definition: DQWorker.h:64
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
std::vector< ecaldqm::DQWorkerClient * > workers_
virtual void bookMEs()
Definition: DQWorker.cc:48
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void beginRun(const edm::Run &, const edm::EventSetup &)
void endRun(const edm::Run &, const edm::EventSetup &)
virtual void producePlots()=0
tuple cout
Definition: gather_cfg.py:121
EcalDQMonitorClient(const edm::ParameterSet &)
const int verbosity_
Definition: EcalDQMonitor.h:24
Definition: Run.h:33