CMS 3D CMS Logo

DQMGlobalEDAnalyzer.h
Go to the documentation of this file.
1 #ifndef DQMServices_Core_DQMGlobalEDAnalyzer_h
2 #define DQMServices_Core_DQMGlobalEDAnalyzer_h
3 
9 
10 template <typename H, typename... Args>
11 class DQMGlobalEDAnalyzer : public edm::global::EDAnalyzer<edm::RunCache<H>, Args...> {
12 public:
15 
16 private:
17  std::shared_ptr<H> globalBeginRun(edm::Run const&, edm::EventSetup const&) const final;
18 
19  void globalEndRun(edm::Run const&, edm::EventSetup const&) const final;
20 
21  virtual void dqmBeginRun(edm::Run const&, edm::EventSetup const&, H&) const {}
22 
23  // this will run while holding the DQMStore lock
24  virtual void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&, H&) const = 0;
25 
26  void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const final;
27 
28  virtual void dqmAnalyze(edm::Event const&, edm::EventSetup const&, H const&) const = 0;
29 };
30 
31 template <typename H, typename... Args>
33  edm::EventSetup const& setup) const {
34  auto h = std::make_shared<H>();
35  dqmBeginRun(run, setup, *h);
36  edm::Service<DQMStore>()->bookConcurrentTransaction(
37  [&, this](DQMStore::IBooker& b) {
38  // this runs while holding the DQMStore lock
39  b.cd();
40  bookHistograms(b, run, setup, *h);
41  },
42  run.run());
43  return h;
44 }
45 
46 template <typename H, typename... Args>
48 
49 template <typename H, typename... Args>
51  edm::Event const& event,
52  edm::EventSetup const& setup) const {
53  //auto& h = const_cast<H&>(* this->runCache(event.getRun().index()));
54  auto const& h = *this->runCache(event.getRun().index());
55  dqmAnalyze(event, setup, h);
56 }
57 
58 #endif // DQMServices_Core_DQMGlobalEDAnalyzer_h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void globalEndRun(edm::Run const &, edm::EventSetup const &) const final
dqm::reco::DQMStore DQMStore
std::shared_ptr< H > globalBeginRun(edm::Run const &, edm::EventSetup const &) const final
RunNumber_t run() const
Definition: RunBase.h:40
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const final
Run const & getRun() const
Definition: Event.cc:108
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, H &) const =0
RunIndex index() const
Definition: Run.cc:21
virtual void dqmAnalyze(edm::Event const &, edm::EventSetup const &, H const &) const =0
dqm::reco::MonitorElement MonitorElement
double b
Definition: hdecay.h:118
HLT enums.
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &, H &) const
Definition: event.py:1
Definition: Run.h:45