CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TopSingleLeptonDQM_miniAOD.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONDQM_MINIAOD
2 #define TOPSINGLELEPTONDQM_MINIAOD
3 
5 #include <string>
6 #include <vector>
8 
20 
25 
26 namespace TopSingleLepton_miniAOD {
29 
31  public:
34 
35  public:
40 
42  void book(DQMStore::IBooker& ibooker);
44  void fill(const edm::Event& event, const edm::EventSetup& setup);
45 
46  private:
49  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
52  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
53 
55  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
57  void fill(const edm::Event& event,
58  const edm::TriggerResults& triggerTable,
59  std::string channel,
60  const std::vector<std::string> labels) const;
61 
63  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
65  void fill(const std::string histName, double value) const {
66  if (booked(histName))
67  hists_.find(histName)->second->Fill(value);
68  };
70  void fill(const std::string histName, double xValue, double yValue) const {
71  if (booked(histName))
72  hists_.find(histName)->second->Fill(xValue, yValue);
73  };
75  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
76  if (booked(histName))
77  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
78  };
79 
80  private:
86  std::vector<edm::EDGetTokenT<edm::View<pat::MET> > > mets_;
96  std::vector<std::string> triggerPaths_;
97 
99 
102 
103  double eidCutValue_;
105  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecIso_;
107  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecSelect_;
108 
111  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
112 
114  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonIso_;
115 
117  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonSelect_;
118 
124  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
128  std::unique_ptr<StringCutObjectSelector<pat::Jet> > jetSelect;
138 
140  int logged_;
141 
143  std::map<std::string, MonitorElement*> hists_;
146  };
147 
148  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
149  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
150  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
151  hists_[channel + "Eff_"]->setBinLabel(
152  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
153  }
154  }
155 
157  const edm::TriggerResults& triggerTable,
158  std::string channel,
159  const std::vector<std::string> labels) const {
160  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
161  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
162  fill(channel + "Mon_", idx + 0.5);
163  // take care to fill triggerMon_ before evts is being called
164  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
165  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
166  fill(
167  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
168  }
169  }
170  }
171 } // namespace TopSingleLepton_miniAOD
172 
173 #include <utility>
174 
179 
184 
186 public:
191 
193  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
194 
195 protected:
196  //Book histograms
197  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
198 
199 private:
202  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
205  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
206 
207 private:
211  std::vector<std::string> triggerPaths_;
213  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
214 
219  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
220 
223  std::vector<std::string> selectionOrder_;
229  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<TopSingleLepton_miniAOD::MonitorEnsemble> > >
231  std::unique_ptr<SelectionStep<pat::Muon> > MuonStep;
232  std::unique_ptr<SelectionStep<pat::Electron> > ElectronStep;
233  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
234  std::unique_ptr<SelectionStep<pat::MET> > METStep;
235  std::vector<std::unique_ptr<SelectionStep<pat::Jet> > > JetSteps;
236 
237  std::vector<edm::ParameterSet> sel_;
239 };
240 
241 #endif
242 
243 /* Local Variables: */
244 /* show-trailing-whitespace: t */
245 /* truncate-lines: t */
246 /* End: */
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonIso_
extra isolation criterion on muon
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
std::vector< edm::EDGetTokenT< edm::View< pat::MET > > > mets_
considers a vector of METs
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonSelect_
extra selection on muons
tuple cfg
Definition: looper.py:296
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::string objectType(const std::string &label)
bool booked(const std::string histName) const
check if histogram was booked
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< edm::View< pat::Jet > > jets_
input sources for monitoring
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
edm::EDGetTokenT< edm::View< pat::Electron > > elecs_
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopSingleLepton_miniAOD::MonitorEnsemble > > > selection_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
std::vector< edm::ParameterSet > sel_
std::vector< std::string > selectionOrder_
TopSingleLeptonDQM_miniAOD(const edm::ParameterSet &cfg)
default constructor
dqm::reco::DQMStore DQMStore
char const * label
edm::EDGetTokenT< reco::BeamSpot > beamspot__
std::string selectionStep(const std::string &label)
std::unique_ptr< StringCutObjectSelector< pat::Jet > > jetSelect
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
std::string monitorPath(const std::string &label) const
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
std::map< std::string, MonitorElement * > hists_
histogram container
std::vector< std::string > triggerPaths_
trigger paths
std::unique_ptr< SelectionStep< pat::MET > > METStep
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
std::vector< std::unique_ptr< SelectionStep< pat::Jet > > > JetSteps
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
std::unique_ptr< SelectionStep< pat::Muon > > MuonStep
edm::EDGetTokenT< edm::View< pat::Muon > > muons_
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
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::View< reco::Vertex > > pvs_
dqm::legacy::MonitorElement MonitorElement
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
double lowerEdge_
mass window upper and lower edge
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
int logged_
number of logged interesting events
std::string selectionPath(const std::string &label) const
~TopSingleLeptonDQM_miniAOD() override
default destructor
edm::ESGetToken< JetCorrector, JetCorrectionsRecord > jetCorrector_
jetCorrector
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecSelect_
extra selection on electrons
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
Level verbosity_
verbosity level for booking
std::unique_ptr< SelectionStep< pat::Electron > > ElectronStep
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
Definition: Run.h:45
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type