CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TopSingleLeptonDQM.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONDQM
2 #define TOPSINGLELEPTONDQM
3 
5 #include <string>
6 #include <vector>
7 
20 
49 namespace TopSingleLepton {
52 
54  public:
57 
58  public:
63 
65  void book(DQMStore::IBooker& ibooker);
67  void fill(const edm::Event& event, const edm::EventSetup& setup);
68 
69  private:
72  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
75  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
76 
78  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
80  void fill(const edm::Event& event,
81  const edm::TriggerResults& triggerTable,
82  std::string channel,
83  const std::vector<std::string> labels) const;
84 
86  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
88  void fill(const std::string histName, double value) const {
89  if (booked(histName))
90  hists_.find(histName)->second->Fill(value);
91  };
93  void fill(const std::string histName, double xValue, double yValue) const {
94  if (booked(histName))
95  hists_.find(histName)->second->Fill(xValue, yValue);
96  };
98  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
99  if (booked(histName))
100  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
101  };
102 
103  private:
109  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
119  std::vector<std::string> triggerPaths_;
120 
124 
136  // int eidPattern_;
137  // the cut for the MVA Id
138  double eidCutValue_;
139  // electron ISO things
140 
142 
144 
145  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecSelect_;
146 
149  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
150 
152  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonIso_;
153 
155  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonSelect_;
156 
159 
162 
163  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
166  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetlooseSelection_;
167  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelection_;
177 
179  int logged_;
180 
182  std::map<std::string, MonitorElement*> hists_;
184 
186  };
187 
188  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
189  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
190  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
191  hists_[channel + "Eff_"]->setBinLabel(
192  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
193  }
194  }
195 
197  const edm::TriggerResults& triggerTable,
198  std::string channel,
199  const std::vector<std::string> labels) const {
200  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
201  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
202  fill(channel + "Mon_", idx + 0.5);
203  // take care to fill triggerMon_ before evts is being called
204  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
205  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
206  fill(
207  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
208  }
209  }
210  }
211 } // namespace TopSingleLepton
212 
213 #include <utility>
214 
219 
224 
263 // using TopSingleLepton::MonitorEnsemble;
265 
267 public:
271  ~TopSingleLeptonDQM() override{};
272 
274  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
275 
276 protected:
277  //Book histograms
278  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
279 
280 private:
283  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
286  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
287 
288 private:
292  std::vector<std::string> triggerPaths_;
294  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
295 
300  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
301 
304  std::vector<std::string> selectionOrder_;
310  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<TopSingleLepton::MonitorEnsemble> > > selection_;
311  std::unique_ptr<SelectionStep<reco::PFCandidate> > MuonStep;
312  std::unique_ptr<SelectionStep<reco::PFCandidate> > ElectronStep;
313  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
314  std::unique_ptr<SelectionStep<reco::MET> > METStep;
315  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
316  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
317  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
318 
319  std::vector<edm::ParameterSet> sel_;
321 };
322 
323 #endif
324 
325 /* Local Variables: */
326 /* show-trailing-whitespace: t */
327 /* truncate-lines: t */
328 /* End: */
std::map< std::string, MonitorElement * > hists_
histogram container
std::string selectionPath(const std::string &label) const
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
int logged_
number of logged interesting events
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
double btagEffWP_
btag working points
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
tuple cfg
Definition: looper.py:296
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::vector< std::string > triggerPaths_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
define MonitorEnsembple to be used
TopSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< reco::BeamSpot > beamspot__
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopSingleLepton::MonitorEnsemble > > > selection_
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
std::vector< std::string > triggerPaths_
trigger paths
std::vector< std::string > selectionOrder_
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::string selectionStep(const std::string &label)
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
Level verbosity_
verbosity level for booking
dqm::reco::DQMStore DQMStore
double lowerEdge_
mass window upper and lower edge
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
char const * label
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::string jetSelect_
extra selection on jets
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::InputTag beamspot_
beamspot
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
~MonitorEnsemble()
default destructor
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
edm::ESGetToken< JetCorrector, JetCorrectionsRecord > jetCorrector_
jetCorrector
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
dqm::legacy::MonitorElement MonitorElement
std::string label_
instance label
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
~TopSingleLeptonDQM() override
default destructor
Level
different verbosity levels
std::string objectType(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetlooseSelection_
std::vector< edm::ParameterSet > sel_
edm::ParameterSet setup_
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
std::string monitorPath(const std::string &label) const
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
Definition: Run.h:45
bool booked(const std::string histName) const
check if histogram was booked
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonIso_
extra isolation criterion on muon