CMS 3D CMS Logo

SingleTopTChannelLeptonDQM_miniAOD.h
Go to the documentation of this file.
1 #ifndef SINGLETOPTCHANNELLEPTONDQM_MINIAOD
2 #define SINGLETOPTCHANNELLEPTONDQM_MINIAOD
3 
4 #include <string>
5 #include <vector>
6 
10 
24 
25 
27 
29  public:
31  enum Level {
35  };
36 
37  public:
39  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg,
40  const edm::VParameterSet& vcfg, edm::ConsumesCollector&& iC);
43 
45  void book(DQMStore::IBooker & ibooker);
47  void fill(const edm::Event& event, const edm::EventSetup& setup);
48 
49  private:
53  return label.substr(label.find(':') + 1);
54  };
58  return label.substr(0, label.find(':'));
59  };
60 
62  void triggerBinLabels(std::string channel,
63  const std::vector<std::string> labels);
65  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable,
66  std::string channel, const std::vector<std::string> labels) const;
67 
69  bool booked(const std::string histName) const {
70  return hists_.find(histName) != hists_.end();
71  };
73  void fill(const std::string histName, double value) const {
74  if (booked(histName))
75  hists_.find(histName)->second->Fill(value);
76  };
78  void fill(const std::string histName, double xValue, double yValue) const {
79  if (booked(histName))
80  hists_.find(histName)->second->Fill(xValue, yValue);
81  };
83  void fill(const std::string histName, double xValue, double yValue,
84  double zValue) const {
85  if (booked(histName))
86  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
87  };
88 
89  private:
95  std::vector<edm::EDGetTokenT<edm::View<pat::MET> > > mets_;
96  // std::vector<edm::InputTag> mets_;
103 
104  // edm::InputTag elecs_, elecs_gsf_, muons_, muons_reco_, jets_, pvs_;
105 
107  // edm::InputTag triggerTable_;
109 
112  std::vector<std::string> triggerPaths_;
113 
115  // edm::InputTag electronId_;
117 
118 
119  double eidCutValue_;
124 
127  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
128 
133 
138 
140  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
141 
149  // edm::InputTag btagEff_, btagPur_, btagVtx_, btagCombVtx_;
151  btagCombVtx_;
152 
157 
159  int logged_;
162  std::map<std::string, MonitorElement*> hists_;
164 
166 
167  std::unique_ptr<StringCutObjectSelector<pat::Muon, true> > muonSelect;
168  std::unique_ptr<StringCutObjectSelector<pat::Muon, true> > muonIso;
169 
170  std::unique_ptr<StringCutObjectSelector<reco::CaloJet> > jetSelectCalo;
171  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelectPF;
172  std::unique_ptr<StringCutObjectSelector<pat::Jet> > jetSelectJet;
173 
174  std::unique_ptr<StringCutObjectSelector<pat::Electron, true> > elecSelect;
175  std::unique_ptr<StringCutObjectSelector<pat::Electron, true> > elecIso;
176 
177 
178 };
179 
181  std::string channel, const std::vector<std::string> labels) {
182  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
183  hists_[channel + "Mon_"]
184  ->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
185  hists_[channel + "Eff_"]
186  ->setBinLabel(idx + 1, "[" + selectionPath(labels[idx]) + "]|[" +
187  monitorPath(labels[idx]) + "]",
188  1);
189  }
190 }
191 
193  const edm::TriggerResults& triggerTable,
194  std::string channel,
195  const std::vector<std::string> labels) const {
196  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
197  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
198  fill(channel + "Mon_", idx + 0.5);
199  // take care to fill triggerMon_ before evts is being called
200  int evts = hists_.find(channel + "Mon_")
201  ->second->getBinContent(idx + 1);
202  double value = hists_.find(channel + "Eff_")
203  ->second->getBinContent(idx + 1);
204  fill(
205  channel + "Eff_", idx + 0.5,
206  1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) -
207  value));
208  }
209  }
210 }
211 }
212 
213 #include <utility>
214 
219 
225 
226 
227 
229  public:
234 
236  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
237 
238  protected:
239  //Book histograms
241  edm::Run const &, edm::EventSetup const &) override;
242 
243  private:
247  return label.substr(0, label.find(':'));
248  };
252  return label.substr(label.find(':') + 1);
253  };
254 
255  private:
258 
260  std::vector<std::string> triggerPaths_;
265  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
266 
271  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
272 
273 
274  std::vector<std::string> selectionOrder_;
275 
276  std::map<
277  std::string,
278  std::pair<edm::ParameterSet,
279  std::unique_ptr<SingleTopTChannelLepton_miniAOD::MonitorEnsemble> > >
281 
282  std::unique_ptr<SelectionStep<pat::Muon> > muonStep_;
283  std::unique_ptr<SelectionStep<pat::Electron> > electronStep_;
284  std::unique_ptr<SelectionStep<reco::Vertex> > pvStep_;
285 
286  std::vector<std::unique_ptr<SelectionStep<pat::Jet> > > jetSteps_;
287 
288  std::unique_ptr<SelectionStep<pat::MET> > metStep_;
289  std::vector<edm::ParameterSet> sel;
290 };
291 
292 #endif
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, const edm::VParameterSet &vcfg, edm::ConsumesCollector &&iC)
default contructor
std::unique_ptr< SelectionStep< pat::Electron > > electronStep_
~SingleTopTChannelLeptonDQM_miniAOD() override
default destructor
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
std::string selectionPath(const std::string &label) const
edm::EDGetTokenT< edm::View< pat::Electron > > elecs_gsf_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
std::unique_ptr< StringCutObjectSelector< pat::Muon, true > > muonIso
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton_miniAOD::MonitorEnsemble > > > selection_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
std::string monitorPath(const std::string &label) const
void bookHistograms(fwlite::EventContainer &eventCont)
edm::EDGetTokenT< edm::View< pat::Jet > > jets_
input sources for monitoring
std::unique_ptr< StringCutObjectSelector< pat::Electron, true > > elecSelect
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
std::string selectionStep(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::CaloJet > > jetSelectCalo
std::unique_ptr< SelectionStep< pat::MET > > metStep_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
std::string objectType(const std::string &label)
std::unique_ptr< SelectionStep< pat::Muon > > muonStep_
Definition: value.py:1
std::string muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
std::vector< std::unique_ptr< SelectionStep< pat::Jet > > > jetSteps_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
trigger paths
std::unique_ptr< StringCutObjectSelector< pat::Muon, true > > muonSelect
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
std::unique_ptr< StringCutObjectSelector< pat::Jet > > jetSelectJet
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< pat::Electron, true > > elecIso
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
bool booked(const std::string histName) const
check if histogram was booked
std::vector< edm::EDGetTokenT< edm::View< pat::MET > > > mets_
considers a vector of METs
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::unique_ptr< SelectionStep< reco::Vertex > > pvStep_
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelectPF
std::string elecIso_
extra isolation criterion on electron
Definition: event.py:1
Definition: Run.h:43