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 
24 
53 namespace SingleTopTChannelLepton {
54 
56  public:
58  enum Level {
62  };
63 
64  public:
66  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg,
67  const edm::VParameterSet& vcfg, edm::ConsumesCollector&& iC);
70 
72  void book(DQMStore::IBooker & ibooker);
74  void fill(const edm::Event& event, const edm::EventSetup& setup);
75 
76  private:
80  return label.substr(label.find(':') + 1);
81  };
85  return label.substr(0, label.find(':'));
86  };
87 
89  void triggerBinLabels(std::string channel,
90  const std::vector<std::string> labels);
92  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable,
93  std::string channel, const std::vector<std::string> labels) const;
94 
96  bool booked(const std::string histName) const {
97  return hists_.find(histName) != hists_.end();
98  };
100  void fill(const std::string histName, double value) const {
101  if (booked(histName))
102  hists_.find(histName)->second->Fill(value);
103  };
105  void fill(const std::string histName, double xValue, double yValue) const {
106  if (booked(histName))
107  hists_.find(histName)->second->Fill(xValue, yValue);
108  };
110  void fill(const std::string histName, double xValue, double yValue,
111  double zValue) const {
112  if (booked(histName))
113  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
114  };
115 
116  private:
122  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
123  // std::vector<edm::InputTag> mets_;
130 
131  // edm::InputTag elecs_, elecs_gsf_, muons_, muons_reco_, jets_, pvs_;
132 
134  // edm::InputTag triggerTable_;
136 
139  std::vector<std::string> triggerPaths_;
140 
142  // edm::InputTag electronId_;
144  // Jet corrector
157  // int eidPattern_;
158  // the cut for the MVA Id
159  double eidCutValue_;
163  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecSelect_;
165 
168  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
169 
171  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonIso_;
172 
174  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonSelect_;
179 
181  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
182  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetlooseSelection_;
183  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelection_;
191  // edm::InputTag btagEff_, btagPur_, btagVtx_, btagCombVtx_;
193  btagCombVtx_;
194 
199 
201  int logged_;
204  std::map<std::string, MonitorElement*> hists_;
206 
208 
209  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonSelect;
210  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonIso;
211 
212 
213  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecSelect;
214  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecIso;
215 
216 
217 };
218 
220  std::string channel, const std::vector<std::string> labels) {
221  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
222  hists_[channel + "Mon_"]
223  ->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
224  hists_[channel + "Eff_"]
225  ->setBinLabel(idx + 1, "[" + selectionPath(labels[idx]) + "]|[" +
226  monitorPath(labels[idx]) + "]",
227  1);
228  }
229 }
230 
232  const edm::TriggerResults& triggerTable,
233  std::string channel,
234  const std::vector<std::string> labels) const {
235  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
236  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
237  fill(channel + "Mon_", idx + 0.5);
238  // take care to fill triggerMon_ before evts is being called
239  int evts = hists_.find(channel + "Mon_")
240  ->second->getBinContent(idx + 1);
241  double value = hists_.find(channel + "Eff_")
242  ->second->getBinContent(idx + 1);
243  fill(
244  channel + "Eff_", idx + 0.5,
245  1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) -
246  value));
247  }
248  }
249 }
250 }
251 
252 #include <utility>
253 
258 
264 
296 // using SingleTopTChannelLepton::MonitorEnsemble;
298 
300  public:
305 
307  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
308 
309  protected:
310  //Book histograms
312  edm::Run const &, edm::EventSetup const &) override;
313 
314  private:
318  return label.substr(0, label.find(':'));
319  };
323  return label.substr(label.find(':') + 1);
324  };
325 
326  private:
329 
331  std::vector<std::string> triggerPaths_;
336  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
337 
342  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
343 
346  std::vector<std::string> selectionOrder_;
352  std::map<
353  std::string,
354  std::pair<edm::ParameterSet,
355  std::unique_ptr<SingleTopTChannelLepton::MonitorEnsemble> > >
357 
358  std::unique_ptr<SelectionStep<reco::Muon> > MuonStep;
359  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFMuonStep;
360  std::unique_ptr<SelectionStep<reco::GsfElectron> > ElectronStep;
361  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFElectronStep;
362  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
363 
364  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
365  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
366  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
367 
368  std::unique_ptr<SelectionStep<reco::MET> > METStep;
369  std::vector<edm::ParameterSet> sel;
370 };
371 
372 #endif
std::vector< std::string > selectionOrder_
std::map< std::string, MonitorElement * > hists_
std::string objectType(const std::string &label)
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
trigger paths
Level verbosity_
verbosity level for booking
~SingleTopTChannelLeptonDQM() override
default destructor
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetlooseSelection_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > elecSelect
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:2
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::InputTag vertex_
primary vertex
char const * label
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonIso_
extra isolation criterion on muon
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
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
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_
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
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_
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
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
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
Definition: event.py:1
Definition: Run.h:45
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFMuonStep
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonSelect
std::string elecIso_
extra isolation criterion on electron