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