CMS 3D CMS Logo

SingleTopTChannelLeptonDQM.h
Go to the documentation of this file.
1 #ifndef SINGLETOPTCHANNELLEPTONDQM
2 #define SINGLETOPTCHANNELLEPTONDQM
3 
4 #include <string>
5 #include <vector>
6 
10 
23 
52 namespace SingleTopTChannelLepton {
53 
55  public:
57  enum Level {
61  };
62 
63  public:
65  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg,
66  const edm::VParameterSet& vcfg, edm::ConsumesCollector&& iC);
69 
71  void book(DQMStore::IBooker & ibooker);
73  void fill(const edm::Event& event, const edm::EventSetup& setup);
74 
75  private:
79  return label.substr(label.find(':') + 1);
80  };
84  return label.substr(0, label.find(':'));
85  };
86 
88  void triggerBinLabels(std::string channel,
89  const std::vector<std::string> labels);
91  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable,
92  std::string channel, const std::vector<std::string> labels) const;
93 
95  bool booked(const std::string histName) const {
96  return hists_.find(histName) != hists_.end();
97  };
99  void fill(const std::string histName, double value) const {
100  if (booked(histName))
101  hists_.find(histName)->second->Fill(value);
102  };
104  void fill(const std::string histName, double xValue, double yValue) const {
105  if (booked(histName))
106  hists_.find(histName)->second->Fill(xValue, yValue);
107  };
109  void fill(const std::string histName, double xValue, double yValue,
110  double zValue) const {
111  if (booked(histName))
112  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
113  };
114 
115  private:
121  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
122  // std::vector<edm::InputTag> mets_;
129 
130  // edm::InputTag elecs_, elecs_gsf_, muons_, muons_reco_, jets_, pvs_;
131 
133  // edm::InputTag triggerTable_;
135 
138  std::vector<std::string> triggerPaths_;
139 
141  // edm::InputTag electronId_;
143 
155  // int eidPattern_;
156  // the cut for the MVA Id
157  double eidCutValue_;
162 
165  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
166 
171 
176 
178  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
179 
187  // edm::InputTag btagEff_, btagPur_, btagVtx_, btagCombVtx_;
189  btagCombVtx_;
190 
195 
197  int logged_;
200  std::map<std::string, MonitorElement*> hists_;
202 
204 
205  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonSelect;
206  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonIso;
207 
208  std::unique_ptr<StringCutObjectSelector<reco::CaloJet> > jetSelectCalo;
209  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelectPF;
210  std::unique_ptr<StringCutObjectSelector<reco::Jet> > jetSelectJet;
211 
212  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecSelect;
213  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecIso;
214 
215 
216 };
217 
219  std::string channel, const std::vector<std::string> labels) {
220  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
221  hists_[channel + "Mon_"]
222  ->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
223  hists_[channel + "Eff_"]
224  ->setBinLabel(idx + 1, "[" + selectionPath(labels[idx]) + "]|[" +
225  monitorPath(labels[idx]) + "]",
226  1);
227  }
228 }
229 
231  const edm::TriggerResults& triggerTable,
232  std::string channel,
233  const std::vector<std::string> labels) const {
234  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
235  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
236  fill(channel + "Mon_", idx + 0.5);
237  // take care to fill triggerMon_ before evts is being called
238  int evts = hists_.find(channel + "Mon_")
239  ->second->getBinContent(idx + 1);
240  double value = hists_.find(channel + "Eff_")
241  ->second->getBinContent(idx + 1);
242  fill(
243  channel + "Eff_", idx + 0.5,
244  1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) -
245  value));
246  }
247  }
248 }
249 }
250 
251 #include <utility>
252 
257 
263 
295 // using SingleTopTChannelLepton::MonitorEnsemble;
297 
299  public:
304 
306  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
307 
308  protected:
309  //Book histograms
311  edm::Run const &, edm::EventSetup const &) override;
312 
313  private:
317  return label.substr(0, label.find(':'));
318  };
322  return label.substr(label.find(':') + 1);
323  };
324 
325  private:
328 
330  std::vector<std::string> triggerPaths_;
335  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
336 
341  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
342 
345  std::vector<std::string> selectionOrder_;
351  std::map<
352  std::string,
353  std::pair<edm::ParameterSet,
354  std::unique_ptr<SingleTopTChannelLepton::MonitorEnsemble> > >
356 
357  std::unique_ptr<SelectionStep<reco::Muon> > MuonStep;
358  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFMuonStep;
359  std::unique_ptr<SelectionStep<reco::GsfElectron> > ElectronStep;
360  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFElectronStep;
361  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
362 
363  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
364  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
365  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
366 
367  std::unique_ptr<SelectionStep<reco::MET> > METStep;
368  std::vector<edm::ParameterSet> sel;
369 };
370 
371 #endif
std::vector< std::string > selectionOrder_
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelectPF
std::map< std::string, MonitorElement * > hists_
std::string objectType(const std::string &label)
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::unique_ptr< StringCutObjectSelector< reco::CaloJet > > jetSelectCalo
std::vector< std::string > triggerPaths_
trigger paths
Level verbosity_
verbosity level for booking
~SingleTopTChannelLeptonDQM() override
default destructor
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > elecSelect
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
int logged_
number of logged interesting events
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
define MonitorEnsembple to be used
bool booked(const std::string histName) const
check if histogram was booked
edm::EDGetTokenT< reco::JetTagCollection > btagCombVtx_
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::string muonIso_
extra isolation criterion on muon
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
std::string muonSelect_
extra selection on muons
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
void bookHistograms(fwlite::EventContainer &eventCont)
edm::InputTag vertex_
primary vertex
std::string elecSelect_
extra selection on electrons
double lowerEdge_
mass window upper and lower edge
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
std::vector< edm::ParameterSet > sel
std::string monitorPath(const std::string &label) const
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_gsf_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
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< reco::JetTagCollection > btagPur_
Definition: value.py:1
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonIso
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > elecIso
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFElectronStep
std::string selectionPath(const std::string &label) const
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
std::string selectionStep(const std::string &label)
std::unique_ptr< SelectionStep< reco::GsfElectron > > ElectronStep
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
std::unique_ptr< SelectionStep< reco::MET > > METStep
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
edm::EDGetTokenT< reco::Vertex > vertex__
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, const edm::VParameterSet &vcfg, edm::ConsumesCollector &&iC)
default contructor
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
edm::EDGetTokenT< reco::BeamSpot > beamspot__
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
std::unique_ptr< SelectionStep< reco::Muon > > MuonStep
Definition: event.py:1
Definition: Run.h:43
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFMuonStep
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonSelect
std::string elecIso_
extra isolation criterion on electron
std::unique_ptr< StringCutObjectSelector< reco::Jet > > jetSelectJet