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>
11 class DQMGlobalEDAnalyzer : public edm::global::EDAnalyzer<edm::RunCache<H>>
12 {
13 private:
14  std::shared_ptr<H>
15  globalBeginRun(edm::Run const&, edm::EventSetup const&) const final;
16 
17  void
18  globalEndRun(edm::Run const&, edm::EventSetup const&) const final;
19 
20  virtual void
21  dqmBeginRun(edm::Run const&, edm::EventSetup const&, H &) const { }
22 
23  // this will run while holding the DQMStore lock
24  virtual void
25  bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const&, edm::EventSetup const&, H &) const = 0;
26 
27  void
28  analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const final;
29 
30  virtual void
31  dqmAnalyze(edm::Event const&, edm::EventSetup const&, H const&) const = 0;
32 };
33 
34 template <typename H>
35 std::shared_ptr<H>
37 {
38  auto h = std::make_shared<H>();
39  dqmBeginRun(run, setup, *h);
40  edm::Service<DQMStore>()->bookConcurrentTransaction([&, this](DQMStore::ConcurrentBooker &b) {
41  // this runs while holding the DQMStore lock
42  b.cd();
43  bookHistograms(b, run, setup, *h);
44  },
45  run.run() );
46  return h;
47 }
48 
49 template <typename H>
50 void
52 {
53 }
54 
55 template <typename H>
56 void
58 {
59  //auto& h = const_cast<H&>(* this->runCache(event.getRun().index()));
60  auto const& h = * this->runCache(event.getRun().index());
61  dqmAnalyze(event, setup, h);
62 }
63 
64 #endif // DQMServices_Core_DQMGlobalEDAnalyzer_h
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const final
RunNumber_t run() const
Definition: RunBase.h:40
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &, H &) const
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
Run const & getRun() const
Definition: Event.cc:114
std::shared_ptr< H > globalBeginRun(edm::Run const &, edm::EventSetup const &) const final
RunIndex index() const
Definition: Run.cc:24
virtual void dqmAnalyze(edm::Event const &, edm::EventSetup const &, H const &) const =0
double b
Definition: hdecay.h:120
virtual void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, H &) const =0
void globalEndRun(edm::Run const &, edm::EventSetup const &) const final
Definition: event.py:1
Definition: Run.h:44