CMS 3D CMS Logo

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 
19 
24 
25 namespace TopSingleLepton_miniAOD {
28 
30  public:
33 
34  public:
39 
41  void book(DQMStore::IBooker& ibooker);
43  void fill(const edm::Event& event, const edm::EventSetup& setup);
44 
45  private:
48  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
51  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
52 
54  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
56  void fill(const edm::Event& event,
57  const edm::TriggerResults& triggerTable,
58  std::string channel,
59  const std::vector<std::string> labels) const;
60 
62  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
64  void fill(const std::string histName, double value) const {
65  if (booked(histName))
66  hists_.find(histName)->second->Fill(value);
67  };
69  void fill(const std::string histName, double xValue, double yValue) const {
70  if (booked(histName))
71  hists_.find(histName)->second->Fill(xValue, yValue);
72  };
74  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
75  if (booked(histName))
76  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
77  };
78 
79  private:
85  std::vector<edm::EDGetTokenT<edm::View<pat::MET> > > mets_;
95  std::vector<std::string> triggerPaths_;
96 
98 
101 
102  double eidCutValue_;
104  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecIso_;
106  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecSelect_;
107 
110  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
111 
113  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonIso_;
114 
116  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonSelect_;
117 
121  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
125  std::unique_ptr<StringCutObjectSelector<pat::Jet> > jetSelect;
135 
137  int logged_;
138 
140  std::map<std::string, MonitorElement*> hists_;
143  };
144 
145  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
146  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
147  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
148  hists_[channel + "Eff_"]->setBinLabel(
149  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
150  }
151  }
152 
154  const edm::TriggerResults& triggerTable,
155  std::string channel,
156  const std::vector<std::string> labels) const {
157  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
158  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
159  fill(channel + "Mon_", idx + 0.5);
160  // take care to fill triggerMon_ before evts is being called
161  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
162  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
163  fill(
164  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
165  }
166  }
167  }
168 } // namespace TopSingleLepton_miniAOD
169 
170 #include <utility>
171 
176 
181 
183 public:
188 
190  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
191 
192 protected:
193  //Book histograms
194  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
195 
196 private:
199  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
202  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
203 
204 private:
208  std::vector<std::string> triggerPaths_;
210  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
211 
216  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
217 
220  std::vector<std::string> selectionOrder_;
226  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<TopSingleLepton_miniAOD::MonitorEnsemble> > >
228  std::unique_ptr<SelectionStep<pat::Muon> > MuonStep;
229  std::unique_ptr<SelectionStep<pat::Electron> > ElectronStep;
230  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
231  std::unique_ptr<SelectionStep<pat::MET> > METStep;
232  std::vector<std::unique_ptr<SelectionStep<pat::Jet> > > JetSteps;
233 
234  std::vector<edm::ParameterSet> sel_;
236 };
237 
238 #endif
239 
240 /* Local Variables: */
241 /* show-trailing-whitespace: t */
242 /* truncate-lines: t */
243 /* 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::string monitorPath(const std::string &label) const
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
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::string objectType(const std::string &label)
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_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::map< std::string, MonitorElement * > hists_
histogram container
std::vector< std::string > triggerPaths_
trigger paths
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
Definition: value.py:1
std::unique_ptr< SelectionStep< pat::MET > > METStep
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
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
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
dqm::legacy::MonitorElement MonitorElement
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
bool booked(const std::string histName) const
check if histogram was booked
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
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
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
Definition: event.py:1
Definition: Run.h:45
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type