CMS 3D CMS Logo

SingleTopTChannelLeptonDQM_miniAOD.h
Go to the documentation of this file.
1 #ifndef SINGLETOPTCHANNELLEPTONDQM_MINIAOD
2 #define SINGLETOPTCHANNELLEPTONDQM_MINIAOD
3 
5 #include <string>
6 #include <vector>
8 
20 
25 
29 
31  public:
34 
35  public:
40 
42  void book(DQMStore::IBooker& ibooker);
44  void fill(const edm::Event& event, const edm::EventSetup& setup);
45 
46  private:
49  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
52  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
53 
55  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
57  void fill(const edm::Event& event,
58  const edm::TriggerResults& triggerTable,
59  std::string channel,
60  const std::vector<std::string> labels) const;
61 
63  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
65  void fill(const std::string histName, double value) const {
66  if (booked(histName))
67  hists_.find(histName)->second->Fill(value);
68  };
70  void fill(const std::string histName, double xValue, double yValue) const {
71  if (booked(histName))
72  hists_.find(histName)->second->Fill(xValue, yValue);
73  };
75  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
76  if (booked(histName))
77  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
78  };
79 
80  private:
86  std::vector<edm::EDGetTokenT<edm::View<pat::MET> > > mets_;
96  std::vector<std::string> triggerPaths_;
97 
99 
102 
103  double eidCutValue_;
105  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecIso_;
107  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecSelect_;
108 
111  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
112 
114  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonIso_;
115 
117  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonSelect_;
118 
124  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
128  std::unique_ptr<StringCutObjectSelector<pat::Jet> > jetSelect;
138 
140  int logged_;
141 
143  std::map<std::string, MonitorElement*> hists_;
146  };
147 
148  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
149  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
150  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
151  hists_[channel + "Eff_"]->setBinLabel(
152  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
153  }
154  }
155 
157  const edm::TriggerResults& triggerTable,
158  std::string channel,
159  const std::vector<std::string> labels) const {
160  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
161  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
162  fill(channel + "Mon_", idx + 0.5);
163  // take care to fill triggerMon_ before evts is being called
164  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
165  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
166  fill(
167  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
168  }
169  }
170  }
171 } // namespace SingleTopTChannelLepton_miniAOD
172 
173 #include <utility>
174 
179 
184 
186 public:
191 
193  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
194 
195 protected:
196  //Book histograms
197  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
198 
199 private:
202  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
205  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
206 
207 private:
211  std::vector<std::string> triggerPaths_;
213  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
214 
219  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
220 
223  std::vector<std::string> selectionOrder_;
229  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<SingleTopTChannelLepton_miniAOD::MonitorEnsemble> > >
231  std::unique_ptr<SelectionStep<pat::Muon> > MuonStep;
232  std::unique_ptr<SelectionStep<pat::Electron> > ElectronStep;
233  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
234  std::unique_ptr<SelectionStep<pat::MET> > METStep;
235  std::vector<std::unique_ptr<SelectionStep<pat::Jet> > > JetSteps;
236 
237  std::vector<edm::ParameterSet> sel_;
239 };
240 
241 #endif
242 
243 /* Local Variables: */
244 /* show-trailing-whitespace: t */
245 /* truncate-lines: t */
246 /* End: */
~SingleTopTChannelLeptonDQM_miniAOD() override
default destructor
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::map< std::string, MonitorElement * > hists_
histogram container
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< std::unique_ptr< SelectionStep< pat::Jet > > > JetSteps
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
bool booked(const std::string histName) const
check if histogram was booked
edm::EDGetTokenT< edm::View< pat::Electron > > elecs_
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecIso_
extra isolation criterion on electron
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< edm::View< pat::Jet > > jets_
input sources for monitoring
dqm::reco::DQMStore DQMStore
char const * label
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton_miniAOD::MonitorEnsemble > > > selection_
std::unique_ptr< SelectionStep< pat::Muon > > MuonStep
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
std::string selectionStep(const std::string &label)
std::string monitorPath(const std::string &label) const
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
std::string objectType(const std::string &label)
Definition: value.py:1
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecSelect_
extra selection on electrons
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
trigger paths
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
std::string selectionPath(const std::string &label) const
dqm::legacy::MonitorElement MonitorElement
edm::ESGetToken< JetCorrector, JetCorrectionsRecord > jetCorrector_
jetCorrector
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
std::unique_ptr< SelectionStep< pat::MET > > METStep
std::unique_ptr< StringCutObjectSelector< pat::Jet > > jetSelect
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonSelect_
extra selection on muons
std::vector< edm::EDGetTokenT< edm::View< pat::MET > > > mets_
considers a vector of METs
SingleTopTChannelLeptonDQM_miniAOD(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
Definition: event.py:1
Definition: Run.h:45
std::unique_ptr< SelectionStep< pat::Electron > > ElectronStep