CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalDQMonitor.h
Go to the documentation of this file.
1 #ifndef EcalDQMonitor_H
2 #define EcalDQMonitor_H
3 
4 #include <string>
5 #include <vector>
6 
7 #include "DQWorker.h"
8 
10 
11 namespace edm
12 {
13  class ParameterSet;
14  class Run;
15  class LuminosityBlock;
16  class EventSetup;
17 }
18 
19 namespace ecaldqm
20 {
21  class EcalDQMonitor {
22  public:
24  virtual ~EcalDQMonitor();
25 
27 
28  protected:
30  template<typename Booker> void ecaldqmBookHistograms(Booker&);
32  void ecaldqmBeginRun(edm::Run const&, edm::EventSetup const&);
33  void ecaldqmEndRun(edm::Run const&, edm::EventSetup const&);
36 
37  template<typename FuncOnWorker> void executeOnWorkers_(FuncOnWorker, std::string const&, std::string const& = "", int = 1); // loop over workers and capture exceptions
38 
39  std::vector<DQWorker*> workers_;
41  int const verbosity_;
42  };
43 
44  template<typename Booker>
45  void
47  {
48  executeOnWorkers_([&_booker](ecaldqm::DQWorker* worker){
49  worker->releaseMEs();
50  worker->bookMEs(_booker);
51  }, "bookMEs", "Booking MEs");
52  }
53 
54  template<typename FuncOnWorker>
55  void
56  EcalDQMonitor::executeOnWorkers_(FuncOnWorker _func, std::string const& _context, std::string const& _message/* = ""*/, int _verbThreshold/* = 1*/)
57  {
58  std::for_each(workers_.begin(), workers_.end(), [&](DQWorker* worker){
59  if(verbosity_ > _verbThreshold && _message != "") edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
60  try{
61  _func(worker);
62  }
63  catch(std::exception&){
64  edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
65  throw;
66  }
67  });
68  }
69 }
70 
71 #endif
EcalDQMonitor(edm::ParameterSet const &)
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:39
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
virtual void releaseMEs()
Definition: DQWorker.cc:76
void ecaldqmGetSetupObjects(edm::EventSetup const &)
static void fillDescriptions(edm::ParameterSetDescription &)
void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &)
virtual void bookMEs(DQMStore &)
Definition: DQWorker.cc:83
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void ecaldqmBookHistograms(Booker &)
Definition: EcalDQMonitor.h:46
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: Run.h:41