test
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 
11 
12 namespace edm
13 {
14  class ParameterSet;
15  class Run;
16  class LuminosityBlock;
17  class EventSetup;
18 }
19 
20 namespace ecaldqm
21 {
22  class EcalDQMonitor {
23  public:
25  virtual ~EcalDQMonitor();
26 
28 
29  protected:
31  void ecaldqmBeginRun(edm::Run const&, edm::EventSetup const&);
32  void ecaldqmEndRun(edm::Run const&, edm::EventSetup const&);
35 
36  template<typename FuncOnWorker> void executeOnWorkers_(FuncOnWorker, std::string const&, std::string const& = "", int = 1); // loop over workers and capture exceptions
37 
38  std::vector<DQWorker*> workers_;
40  int const verbosity_;
41  };
42 
43  template<typename FuncOnWorker>
44  void
45  EcalDQMonitor::executeOnWorkers_(FuncOnWorker _func, std::string const& _context, std::string const& _message/* = ""*/, int _verbThreshold/* = 1*/)
46  {
47  std::for_each(workers_.begin(), workers_.end(), [&](DQWorker* worker){
48  if(verbosity_ > _verbThreshold && _message != "") edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
49  try{
50  _func(worker);
51  }
52  catch(std::exception&){
53  edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
54  throw;
55  }
56  });
57  }
58 }
59 
60 #endif
EcalDQMonitor(edm::ParameterSet const &)
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:38
void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &)
void ecaldqmGetSetupObjects(edm::EventSetup const &)
static void fillDescriptions(edm::ParameterSetDescription &)
void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &)
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:45
void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: Run.h:43