Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:50

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0003 
0004 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0005 
0006 class DemoHarvester : public DQMEDHarvester {
0007 private:
0008   std::string target_;
0009   int ctr_ = 0;
0010 
0011 public:
0012   explicit DemoHarvester(const edm::ParameterSet &);
0013   ~DemoHarvester() override {}
0014 
0015   void beginRun(const edm::Run &run, const edm::EventSetup &c) override;
0016   void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override;
0017   void dqmEndLuminosityBlock(DQMStore::IBooker &ib,
0018                              DQMStore::IGetter &ig,
0019                              edm::LuminosityBlock const &lumi,
0020                              edm::EventSetup const &) override;
0021 };
0022 
0023 DemoHarvester::DemoHarvester(const edm::ParameterSet &iConfig)
0024     : DQMEDHarvester(iConfig), target_(iConfig.getParameter<std::string>("target")) {}
0025 
0026 void DemoHarvester::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) {}
0027 
0028 void DemoHarvester::dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) {
0029   ig.setCurrentFolder(target_);
0030   MonitorElement *me = ig.get(target_ + "/EXAMPLE");
0031   me->getTH1()->Fill(3);
0032 
0033   ib.setCurrentFolder(target_ + "_runsummary");
0034   MonitorElement *out = ib.book1D("EXAMPLE", "EXAMPLE", 100, 0., 100.);
0035   out->setBinContent(5, me->getBinContent(5));
0036 }
0037 
0038 void DemoHarvester::dqmEndLuminosityBlock(DQMStore::IBooker &ib,
0039                                           DQMStore::IGetter &ig,
0040                                           edm::LuminosityBlock const &lumi,
0041                                           edm::EventSetup const &) {
0042   ig.setCurrentFolder(target_);
0043   MonitorElement *me = ig.get(target_ + "/EXAMPLE");
0044   me->getTH1()->Fill(4);
0045 
0046   ctr_++;
0047 
0048   ib.setCurrentFolder(target_ + "_lumisummary");
0049   MonitorElement *out = ib.book1D("EXAMPLE", "EXAMPLE", 100, 0., 100.);
0050   out->setBinContent(ctr_, lumi.luminosityBlock());
0051 }
0052 
0053 #include "FWCore/Framework/interface/MakerMacros.h"
0054 
0055 DEFINE_FWK_MODULE(DemoHarvester);