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 
8 
21 
50 namespace SingleTopTChannelLepton {
53 
55  public:
58 
59  public:
61  MonitorEnsemble(const char* label,
62  const edm::ParameterSet& cfg,
63  const edm::VParameterSet& vcfg,
67 
69  void book(DQMStore::IBooker& ibooker);
71  void fill(const edm::Event& event, const edm::EventSetup& setup);
72 
73  private:
76  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
79  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
80 
82  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
84  void fill(const edm::Event& event,
85  const edm::TriggerResults& triggerTable,
86  std::string channel,
87  const std::vector<std::string> labels) const;
88 
90  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
92  void fill(const std::string histName, double value) const {
93  if (booked(histName))
94  hists_.find(histName)->second->Fill(value);
95  };
97  void fill(const std::string histName, double xValue, double yValue) const {
98  if (booked(histName))
99  hists_.find(histName)->second->Fill(xValue, yValue);
100  };
102  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
103  if (booked(histName))
104  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
105  };
106 
107  private:
113  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
114  // std::vector<edm::InputTag> mets_;
121 
122  // edm::InputTag elecs_, elecs_gsf_, muons_, muons_reco_, jets_, pvs_;
123 
125  // edm::InputTag triggerTable_;
127 
130  std::vector<std::string> triggerPaths_;
131 
133  // edm::InputTag electronId_;
146  // int eidPattern_;
147  // the cut for the MVA Id
148  double eidCutValue_;
152  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecSelect_;
154 
157  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
158 
160  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonIso_;
161 
163  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonSelect_;
168 
170  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
171  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetlooseSelection_;
172  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelection_;
180  // edm::InputTag btagEff_, btagPur_, btagVtx_, btagCombVtx_;
182 
187 
189  int logged_;
192  std::map<std::string, MonitorElement*> hists_;
194 
196 
197  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonSelect;
198  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonIso;
199 
200  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecSelect;
201  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecIso;
202  };
203 
204  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
205  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
206  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
207  hists_[channel + "Eff_"]->setBinLabel(
208  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
209  }
210  }
211 
213  const edm::TriggerResults& triggerTable,
214  std::string channel,
215  const std::vector<std::string> labels) const {
216  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
217  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
218  fill(channel + "Mon_", idx + 0.5);
219  // take care to fill triggerMon_ before evts is being called
220  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
221  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
222  fill(
223  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
224  }
225  }
226  }
227 } // namespace SingleTopTChannelLepton
228 
229 #include <utility>
230 
235 
240 
272 // using SingleTopTChannelLepton::MonitorEnsemble;
274 
276 public:
281 
283  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
284 
285 protected:
286  //Book histograms
287  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
288 
289 private:
292  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
295  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
296 
297 private:
300 
302  std::vector<std::string> triggerPaths_;
307  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
308 
313  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
314 
317  std::vector<std::string> selectionOrder_;
323  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<SingleTopTChannelLepton::MonitorEnsemble> > >
325 
326  std::unique_ptr<SelectionStep<reco::Muon> > MuonStep;
327  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFMuonStep;
328  std::unique_ptr<SelectionStep<reco::GsfElectron> > ElectronStep;
329  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFElectronStep;
330  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
331 
332  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
333  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
334  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
335 
336  std::unique_ptr<SelectionStep<reco::MET> > METStep;
337  std::vector<edm::ParameterSet> sel;
338 };
339 
340 #endif
std::vector< std::string > selectionOrder_
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::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:35
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
edm::EDGetTokenT< reco::JetTagCollection > btagCombVtx_
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
SingleTopTChannelLeptonDQM(const edm::ParameterSet &cfg)
default constructor
bool booked(const std::string histName) const
check if histogram was booked
dqm::reco::DQMStore DQMStore
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
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_gsf_
std::string monitorPath(const std::string &label) const
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
Definition: value.py:1
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonIso
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
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
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
edm::EDGetTokenT< reco::JetCorrector > jetCorrector_
jetCorrector
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
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 > btagCSV_
std::string selectionStep(const std::string &label)
std::unique_ptr< SelectionStep< reco::GsfElectron > > ElectronStep
dqm::legacy::MonitorElement MonitorElement
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
std::string selectionPath(const std::string &label) const
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::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
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