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