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::EndProcessBlockProducer,
47  edm::one::WatchLuminosityBlocks,
48  edm::one::WatchRuns,
49  // for uncontrolled DQMStore access, and that EDM does not even attempt to
50  // run things in parallel (which would then be blocked by the booking lock).
51  edm::one::SharedResources,
52  edm::Accumulator> {
53 public:
56 
57 protected:
65 
66 public:
68  usesResource("DQMStore");
69  dqmstore_ = edm::Service<DQMStore>().operator->();
70 
71  auto inputgeneration = iConfig.getUntrackedParameter<std::string>("inputGeneration", "DQMGenerationReco");
72  auto outputgeneration = iConfig.getUntrackedParameter<std::string>("outputGeneration", "DQMGenerationHarvesting");
73 
74  // TODO: Run/Lumi suffix should not be needed, complain to CMSSW core in case.
75  lumiToken_ = produces<DQMToken, edm::Transition::EndLuminosityBlock>(outputgeneration + "Lumi");
76  runToken_ = produces<DQMToken, edm::Transition::EndRun>(outputgeneration + "Run");
77  jobToken_ = produces<DQMToken, edm::Transition::EndProcessBlock>(outputgeneration + "Job");
78 
79  // Use explicitly specified inputs, but if there are none...
80  auto inputtags =
81  iConfig.getUntrackedParameter<std::vector<edm::InputTag>>("inputMEs", std::vector<edm::InputTag>());
82  if (inputtags.empty()) {
83  // ... use all RECO MEs.
84  inputtags.push_back(edm::InputTag("", inputgeneration + "Job"));
85  inputtags.push_back(edm::InputTag("", inputgeneration + "Run"));
86  inputtags.push_back(edm::InputTag("", inputgeneration + "Lumi"));
87  }
95  });
96  };
97 
99 
100  void beginJob() override{};
101 
102  void beginRun(edm::Run const &run, edm::EventSetup const &) override {
103  // According to edm experts, it is never save to look at run products
104  // in beginRun, since they might be merged as new input files how up.
105  }
106 
108  // According to edm experts, it is never save to look at run products
109  // in beginRun, since they might be merged as new input files how up.
110  }
111 
112  void accumulate(edm::Event const &ev, edm::EventSetup const &es) final {
114  b.setScope(MonitorElementData::Scope::JOB);
115  this->dqmAnalyze(b, g, ev, es);
116  });
117  }
118 
120  // No need to actually get products for now
121  //auto refs = std::vector<edm::Handle<DQMToken>>();
122  //lumimegetter_.fillHandles(lumi, refs);
123 
125  b.setScope(MonitorElementData::Scope::JOB);
126  this->dqmEndLuminosityBlock(b, g, lumi, es);
127  });
128 
129  lumi.put(lumiToken_, std::make_unique<DQMToken>());
130  }
131 
133 
134  void endRunProduce(edm::Run &run, edm::EventSetup const &es) final {
136  b.setScope(MonitorElementData::Scope::JOB);
137  this->dqmEndRun(b, g, run, es);
138  });
139 
140  run.put(runToken_, std::make_unique<DQMToken>());
141  }
142 
143  void endRun(edm::Run const &, edm::EventSetup const &) override{};
144 
147  b.setScope(MonitorElementData::Scope::JOB);
148  this->dqmEndJob(b, g);
149  });
150  };
151 
152  ~DQMEDHarvester() override = default;
153 
154  // DQM_EXPERIMENTAL
155  // Could be used for niche workflows like commissioning.
156  // Real harvesting jobs have no events and will never call this.
160  edm::LuminosityBlock const &,
161  edm::EventSetup const &){};
162  // HARVESTING should happen in endJob (or endLumi, for online), but there can
163  // be applications for end-run harvesting. Better to have a callback than
164  // have unprotected DQMStore access.
165  virtual void dqmEndRun(DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &){};
166  virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) = 0;
167 };
168 
169 #endif // CORE_DQMED_HARVESTER_H
EDProducer.h
DQMEDHarvester::endRunProduce
void endRunProduce(edm::Run &run, edm::EventSetup const &es) final
Definition: DQMEDHarvester.h:134
DQMEDHarvester::accumulate
void accumulate(edm::Event const &ev, edm::EventSetup const &es) final
Definition: DQMEDHarvester.h:112
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:100
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
DQMEDHarvester::runToken_
edm::EDPutTokenT< DQMToken > runToken_
Definition: DQMEDHarvester.h:63
GetterOfProducts.h
DQMEDHarvester::lumiToken_
edm::EDPutTokenT< DQMToken > lumiToken_
Definition: DQMEDHarvester.h:62
DQMEDHarvester::endProcessBlockProduce
void endProcessBlockProduce(edm::ProcessBlock &) final
Definition: DQMEDHarvester.h:145
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
DQMEDHarvester::jobToken_
edm::EDPutTokenT< DQMToken > jobToken_
Definition: DQMEDHarvester.h:64
edm::InRun
Definition: BranchType.h:11
DQMEDHarvester::runmegetter_
edm::GetterOfProducts< DQMToken > runmegetter_
Definition: DQMEDHarvester.h:60
DQMEDHarvester::DQMStore
dqm::harvesting::DQMStore DQMStore
Definition: DQMEDHarvester.h:54
DQMEDHarvester::beginRun
void beginRun(edm::Run const &run, edm::EventSetup const &) override
Definition: DQMEDHarvester.h:102
edm::ProducerBase::callWhenNewProductsRegistered
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:84
edm::InProcess
Definition: BranchType.h:11
dqm::legacy::DQMStore
Definition: DQMStore.h:727
DQMEDHarvester::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
Definition: DQMEDHarvester.h:107
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:119
DQMEDHarvester::dqmstore_
DQMStore * dqmstore_
Definition: DQMEDHarvester.h:58
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:157
InputTagMatch.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DQMEDHarvester::lumimegetter_
edm::GetterOfProducts< DQMToken > lumimegetter_
Definition: DQMEDHarvester.h:61
edm::ParameterSet
Definition: ParameterSet.h:47
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:98
edm::Service
Definition: Service.h:30
edm::GetterOfProducts< DQMToken >
DQMEDHarvester::MonitorElement
dqm::harvesting::MonitorElement MonitorElement
Definition: DQMEDHarvester.h:55
DQMEDHarvester::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: DQMEDHarvester.h:143
DQMEDHarvester::DQMEDHarvester
DQMEDHarvester(edm::ParameterSet const &iConfig)
Definition: DQMEDHarvester.h:67
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:165
DQMEDHarvester
Definition: DQMEDHarvester.py:1
DQMEDHarvester::jobmegetter_
edm::GetterOfProducts< DQMToken > jobmegetter_
Definition: DQMEDHarvester.h:59
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:132
ParameterSet.h
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:158
edm::InputTag
Definition: InputTag.h:15
edm::ProcessBlock
Definition: ProcessBlock.h:36
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