CMS 3D CMS Logo

DQMEDAnalyzer.h
Go to the documentation of this file.
1 #ifndef DQMServices_Core_DQMEDAnalyzer_h
2 #define DQMServices_Core_DQMEDAnalyzer_h
3 
11 
16 class DQMEDAnalyzer : public edm::one::EDProducer<edm::EndRunProducer,
17  edm::one::WatchRuns,
18  edm::EndLuminosityBlockProducer,
19  edm::one::WatchLuminosityBlocks,
20  edm::Accumulator> {
21 public:
24 
25  virtual bool getCanSaveByLumi() { return true; }
26 
27  // framework calls in the order of invocation
29  // for whatever reason we need the explicit `template` keyword here.
30  runToken_ = this->template produces<DQMToken, edm::Transition::EndRun>("DQMGenerationRecoRun");
31  lumiToken_ = this->template produces<DQMToken, edm::Transition::EndLuminosityBlock>("DQMGenerationRecoLumi");
32  }
33 
34  void beginRun(edm::Run const& run, edm::EventSetup const& setup) final {
36  edm::Service<DQMStore>()->bookTransaction(
37  [this, &run, &setup](DQMStore::IBooker& booker) {
38  booker.cd();
39  this->bookHistograms(booker, run, setup);
40  },
41  run.run(),
42  this->moduleDescription().id(),
43  this->getCanSaveByLumi());
44  }
45 
48  }
49 
50  void accumulate(edm::Event const& event, edm::EventSetup const& setup) final { analyze(event, setup); }
51 
54  edm::Service<DQMStore>()->cloneLumiHistograms(lumi.run(), lumi.luminosityBlock(), this->moduleDescription().id());
55  lumi.emplace(lumiToken_);
56  }
57 
58  // Subsystems could safely override this, but any changes to MEs would not be
59  // noticeable since the product was made already.
61 
64  edm::Service<DQMStore>()->cloneRunHistograms(run.run(), this->moduleDescription().id());
65  run.emplace<DQMToken>(runToken_);
66  }
67 
68  // Subsystems could safely override this, but any changes to MEs would not be
69  // noticeable since the product was made already.
70  void endRun(edm::Run const&, edm::EventSetup const&) final{};
71 
72  // methods to be implemented by the user, in order of invocation
73  virtual void dqmBeginRun(edm::Run const&, edm::EventSetup const&) {}
74  virtual void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) = 0;
76  virtual void analyze(edm::Event const&, edm::EventSetup const&) {}
78  virtual void dqmEndRun(edm::Run const&, edm::EventSetup const&) {}
79 
80 protected:
83 };
84 
85 #endif // DQMServices_Core_DQMEDAnalyzer_h
virtual void analyze(edm::Event const &, edm::EventSetup const &)
Definition: DQMEDAnalyzer.h:76
dqm::reco::MonitorElement MonitorElement
Definition: DQMEDAnalyzer.h:23
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)=0
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) final
Definition: DQMEDAnalyzer.h:60
void endLuminosityBlockProduce(edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
Definition: DQMEDAnalyzer.h:52
void endRunProduce(edm::Run &run, edm::EventSetup const &setup) final
Definition: DQMEDAnalyzer.h:62
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
Definition: DQMEDAnalyzer.h:46
ModuleDescription const & moduleDescription() const
dqm::reco::DQMStore DQMStore
Definition: DQMEDAnalyzer.h:22
void endRun(edm::Run const &, edm::EventSetup const &) final
Definition: DQMEDAnalyzer.h:70
void accumulate(edm::Event const &event, edm::EventSetup const &setup) final
Definition: DQMEDAnalyzer.h:50
void beginRun(edm::Run const &run, edm::EventSetup const &setup) final
Definition: DQMEDAnalyzer.h:34
virtual void dqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQMEDAnalyzer.h:75
edm::EDPutTokenT< DQMToken > runToken_
Definition: DQMEDAnalyzer.h:81
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQMEDAnalyzer.h:73
virtual bool getCanSaveByLumi()
Definition: DQMEDAnalyzer.h:25
virtual void dqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQMEDAnalyzer.h:77
virtual void dqmEndRun(edm::Run const &, edm::EventSetup const &)
Definition: DQMEDAnalyzer.h:78
Definition: event.py:1
Definition: Run.h:45
unsigned int id() const
edm::EDPutTokenT< DQMToken > lumiToken_
Definition: DQMEDAnalyzer.h:82