CMS 3D CMS Logo

DQMEDHarvester.h
Go to the documentation of this file.
1 #ifndef CORE_DQMED_HARVESTER_H
2 #define CORE_DQMED_HARVESTER_H
3 
5 
7 
17 
19 
20 namespace edm {
22  public:
23  VInputTagMatch(std::vector<edm::InputTag> const &inputTags) {
24  for (auto &tag : inputTags) {
25  matchers_.emplace_back(InputTagMatch(tag));
26  }
27  }
28 
29  bool operator()(edm::BranchDescription const &branchDescription) {
30  for (auto &m : matchers_) {
31  if (m(branchDescription)) {
32  return true;
33  }
34  }
35  return false;
36  }
37 
38  private:
39  std::vector<InputTagMatch> matchers_;
40  };
41 } // namespace edm
42 
44  : public edm::one::EDProducer<edm::EndLuminosityBlockProducer,
45  edm::EndRunProducer,
46  edm::one::WatchLuminosityBlocks,
47  edm::one::WatchRuns,
48  // for uncontrolled DQMStore access, and that EDM does not even attempt to
49  // run things in parallel (which would then be blocked by the booking lock).
50  edm::one::SharedResources,
51  edm::Accumulator> {
52 public:
55 
56 protected:
62 
63 public:
65  usesResource("DQMStore");
66  dqmstore_ = edm::Service<DQMStore>().operator->();
67 
68  auto inputgeneration = iConfig.getUntrackedParameter<std::string>("inputGeneration", "DQMGenerationReco");
69  auto outputgeneration = iConfig.getUntrackedParameter<std::string>("outputGeneration", "DQMGenerationHarvesting");
70 
71  // TODO: Run/Lumi suffix should not be needed, complain to CMSSW core in case.
72  lumiToken_ = produces<DQMToken, edm::Transition::EndLuminosityBlock>(outputgeneration + "Lumi");
73  runToken_ = produces<DQMToken, edm::Transition::EndRun>(outputgeneration + "Run");
74 
75  // Use explicitly specified inputs, but if there are none...
76  auto inputtags =
77  iConfig.getUntrackedParameter<std::vector<edm::InputTag>>("inputMEs", std::vector<edm::InputTag>());
78  if (inputtags.empty()) {
79  // ... use all RECO MEs.
80  inputtags.push_back(edm::InputTag("", inputgeneration + "Run"));
81  inputtags.push_back(edm::InputTag("", inputgeneration + "Lumi"));
82  }
88  });
89  };
90 
92 
93  void beginJob() override{};
94 
95  void beginRun(edm::Run const &run, edm::EventSetup const &) override {
96  // According to edm experts, it is never save to look at run products
97  // in beginRun, since they might be merged as new input files how up.
98  }
99 
101  // According to edm experts, it is never save to look at run products
102  // in beginRun, since they might be merged as new input files how up.
103  }
104 
105  void accumulate(edm::Event const &ev, edm::EventSetup const &es) final {
107  b.setScope(MonitorElementData::Scope::JOB);
108  this->dqmAnalyze(b, g, ev, es);
109  });
110  }
111 
113  // No need to actually get products for now
114  //auto refs = std::vector<edm::Handle<DQMToken>>();
115  //lumimegetter_.fillHandles(lumi, refs);
116 
118  b.setScope(MonitorElementData::Scope::JOB);
119  this->dqmEndLuminosityBlock(b, g, lumi, es);
120  });
121 
122  lumi.put(lumiToken_, std::make_unique<DQMToken>());
123  }
124 
126 
127  void endRunProduce(edm::Run &run, edm::EventSetup const &es) final {
129  b.setScope(MonitorElementData::Scope::JOB);
130  this->dqmEndRun(b, g, run, es);
131  });
132 
133  run.put(runToken_, std::make_unique<DQMToken>());
134  }
135 
136  void endRun(edm::Run const &, edm::EventSetup const &) override{};
137 
138  void endJob() final {
140  b.setScope(MonitorElementData::Scope::JOB);
141  this->dqmEndJob(b, g);
142  });
143  };
144 
145  ~DQMEDHarvester() override = default;
146 
147  // DQM_EXPERIMENTAL
148  // Could be used for niche workflows like commissioning.
149  // Real harvesting jobs have no events and will never call this.
153  edm::LuminosityBlock const &,
154  edm::EventSetup const &){};
155  // HARVESTING should happen in endJob (or endLumi, for online), but there can
156  // be applications for end-run harvesting. Better to have a callback than
157  // have unprotected DQMStore access.
158  virtual void dqmEndRun(DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &){};
159  virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) = 0;
160 };
161 
162 #endif // CORE_DQMED_HARVESTER_H
EDProducer.h
DQMEDHarvester::endRunProduce
void endRunProduce(edm::Run &run, edm::EventSetup const &es) final
Definition: DQMEDHarvester.h:127
DQMEDHarvester::accumulate
void accumulate(edm::Event const &ev, edm::EventSetup const &es) final
Definition: DQMEDHarvester.h:105
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm::VInputTagMatch::matchers_
std::vector< InputTagMatch > matchers_
Definition: DQMEDHarvester.h:39
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT< DQMToken >
DQMEDHarvester::beginJob
void beginJob() override
Definition: DQMEDHarvester.h:93
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
DQMEDHarvester::runToken_
edm::EDPutTokenT< DQMToken > runToken_
Definition: DQMEDHarvester.h:61
GetterOfProducts.h
DQMEDHarvester::lumiToken_
edm::EDPutTokenT< DQMToken > lumiToken_
Definition: DQMEDHarvester.h:60
DQMStore.h
dqm::implementation::DQMStore::meBookerGetter
void meBookerGetter(iFunc f)
Definition: DQMStore.h:632
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::one::EDProducer
Definition: EDProducer.h:30
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::InRun
Definition: BranchType.h:11
DQMEDHarvester::runmegetter_
edm::GetterOfProducts< DQMToken > runmegetter_
Definition: DQMEDHarvester.h:58
DQMEDHarvester::DQMStore
dqm::harvesting::DQMStore DQMStore
Definition: DQMEDHarvester.h:53
DQMEDHarvester::beginRun
void beginRun(edm::Run const &run, edm::EventSetup const &) override
Definition: DQMEDHarvester.h:95
DQMEDHarvester::endJob
void endJob() final
Definition: DQMEDHarvester.h:138
edm::ProducerBase::callWhenNewProductsRegistered
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:79
dqm::legacy::DQMStore::IBooker
dqm::implementation::IBooker IBooker
Definition: DQMStore.h:729
dqm::legacy::DQMStore
Definition: DQMStore.h:727
DQMEDHarvester::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
Definition: DQMEDHarvester.h:100
DQMToken.h
edm::VInputTagMatch::VInputTagMatch
VInputTagMatch(std::vector< edm::InputTag > const &inputTags)
Definition: DQMEDHarvester.h:23
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
Service.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::VInputTagMatch::operator()
bool operator()(edm::BranchDescription const &branchDescription)
Definition: DQMEDHarvester.h:29
Run.h
DQMEDHarvester::endLuminosityBlockProduce
void endLuminosityBlockProduce(edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
Definition: DQMEDHarvester.h:112
DQMEDHarvester::dqmstore_
DQMStore * dqmstore_
Definition: DQMEDHarvester.h:57
HLTMuonOfflineAnalyzer_cfi.inputTags
inputTags
All input tags are specified in this pset for convenience.
Definition: HLTMuonOfflineAnalyzer_cfi.py:82
b
double b
Definition: hdecay.h:118
DQMEDHarvester::dqmAnalyze
virtual void dqmAnalyze(DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
Definition: DQMEDHarvester.h:150
InputTagMatch.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DQMEDHarvester::lumimegetter_
edm::GetterOfProducts< DQMToken > lumimegetter_
Definition: DQMEDHarvester.h:59
edm::ParameterSet
Definition: ParameterSet.h:36
DQMEDHarvester::dqmEndJob
virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)=0
Event.h
ParameterSet
Definition: Functions.h:16
edm::InLumi
Definition: BranchType.h:11
EDPutToken.h
DQMEDHarvester::~DQMEDHarvester
~DQMEDHarvester() override=default
DQMEDHarvester::DQMEDHarvester
DQMEDHarvester()
Definition: DQMEDHarvester.h:91
edm::Service
Definition: Service.h:30
edm::GetterOfProducts< DQMToken >
DQMEDHarvester::MonitorElement
dqm::harvesting::MonitorElement MonitorElement
Definition: DQMEDHarvester.h:54
DQMEDHarvester::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: DQMEDHarvester.h:136
DQMEDHarvester::DQMEDHarvester
DQMEDHarvester(edm::ParameterSet const &iConfig)
Definition: DQMEDHarvester.h:64
edm::EventSetup
Definition: EventSetup.h:57
edm::VInputTagMatch
Definition: DQMEDHarvester.h:21
edm::InputTagMatch
Definition: InputTagMatch.h:20
DQMEDHarvester::dqmEndRun
virtual void dqmEndRun(DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
Definition: DQMEDHarvester.h:158
DQMEDHarvester
Definition: DQMEDHarvester.py:1
writedatasetfile.run
run
Definition: writedatasetfile.py:27
dqm::implementation::IGetter
Definition: DQMStore.h:484
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
edm::BranchDescription
Definition: BranchDescription.h:32
DQMEDHarvester::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) final
Definition: DQMEDHarvester.h:125
ParameterSet.h
dqm::legacy::DQMStore::IGetter
dqm::implementation::IGetter IGetter
Definition: DQMStore.h:730
edm::Event
Definition: Event.h:73
lumi
Definition: LumiSectionData.h:20
DQMEDHarvester::dqmEndLuminosityBlock
virtual void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQMEDHarvester.h:151
edm::InputTag
Definition: InputTag.h:15
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4