CMS 3D CMS Logo

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() noexcept(false);
26 
27  static void fillDescriptions(edm::ParameterSetDescription&);
28 
29  protected:
30  void ecaldqmGetSetupObjects(edm::EventSetup const&);
31  void ecaldqmBeginRun(edm::Run const&, edm::EventSetup const&);
32  void ecaldqmEndRun(edm::Run const&, edm::EventSetup const&);
33  void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
34  void ecaldqmEndLuminosityBlock(edm::LuminosityBlock 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
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:38
#define noexcept
std::string const moduleName_
Definition: EcalDQMonitor.h:39
HLT enums.
Definition: Run.h:43