CMS 3D CMS Logo

DQMOneEDAnalyzer.h
Go to the documentation of this file.
1 #ifndef DQMServices_Core_DQMOneEDAnalyzer_h
2 #define DQMServices_Core_DQMOneEDAnalyzer_h
3 
11 
19 template <typename... Args>
21  : public edm::one::EDProducer<edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args...> {
22 public:
25 
26  virtual bool getCanSaveByLumi() { return false; }
27 
28  // framework calls in the order of invocation
30  // for whatever reason we need the explicit `template` keyword here.
31  runToken_ = this->template produces<DQMToken, edm::Transition::EndRun>("DQMGenerationRecoRun");
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 
46  void accumulate(edm::Event const& event, edm::EventSetup const& setup) final { analyze(event, setup); }
47 
50  edm::Service<DQMStore>()->cloneRunHistograms(run.run(), this->moduleDescription().id());
51  run.emplace<DQMToken>(runToken_);
52  }
53 
54  // Subsystems could safely override this, but any changes to MEs would not be
55  // noticeable since the product was made already.
56  void endRun(edm::Run const&, edm::EventSetup const&) final{};
57 
58 protected:
59  // methods to be implemented by the user, in order of invocation
60  virtual void dqmBeginRun(edm::Run const&, edm::EventSetup const&) {}
61  virtual void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) = 0;
62  virtual void analyze(edm::Event const&, edm::EventSetup const&) {}
63  virtual void dqmEndRun(edm::Run const&, edm::EventSetup const&) {}
64 
66 };
67 
79 template <typename... Args>
81  : public DQMOneEDAnalyzer<edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, Args...> {
82 public:
83  bool getCanSaveByLumi() override { return true; }
84 
85  // framework calls in the order of invocation
87  // for whatever reason we need the explicit `template` keyword here.
88  lumiToken_ = this->template produces<DQMToken, edm::Transition::EndLuminosityBlock>("DQMGenerationRecoLumi");
89  }
90 
92  dqmBeginLuminosityBlock(lumi, setup);
93  }
94 
95  //void accumulate(edm::StreamID id, edm::Event const& event, edm::EventSetup const& setup) final {
96  // // TODO: we could maybe switch lumis by event here, to allow concurrent
97  // // lumis. Not for now, though.
98  // analyze(event, setup);
99  //}
100 
102  dqmEndLuminosityBlock(lumi, setup);
103  // fully qualified name required for... reasons.
104  edm::Service<dqm::legacy::DQMStore>()->cloneLumiHistograms(
105  lumi.run(), lumi.luminosityBlock(), this->moduleDescription().id());
106  lumi.emplace(lumiToken_);
107  }
108 
109  // Subsystems could safely override this, but any changes to MEs would not be
110  // noticeable since the product was made already.
112 
113 protected:
114  // methods to be implemented by the user, in order of invocation
117 
119 };
120 
121 #endif // DQMServices_Core_DQMOneEDAnalyzer_h
void endRunProduce(edm::Run &run, edm::EventSetup const &setup) final
virtual void dqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
dqm::reco::DQMStore DQMStore
edm::EDPutTokenT< DQMToken > lumiToken_
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
dqm::reco::MonitorElement MonitorElement
ModuleDescription const & moduleDescription() const
virtual bool getCanSaveByLumi()
virtual void dqmEndRun(edm::Run const &, edm::EventSetup const &)
bool getCanSaveByLumi() override
void beginRun(edm::Run const &run, edm::EventSetup const &setup) final
void accumulate(edm::Event const &event, edm::EventSetup const &setup) final
void endRun(edm::Run const &, edm::EventSetup const &) final
virtual void dqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) final
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)=0
edm::EDPutTokenT< DQMToken > runToken_
void endLuminosityBlockProduce(edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &)
virtual void analyze(edm::Event const &, edm::EventSetup const &)
Definition: event.py:1
Definition: Run.h:45
unsigned int id() const