CMS 3D CMS Logo

TopSingleLeptonDQM.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONDQM
2 #define TOPSINGLELEPTONDQM
3 
4 #include <string>
5 #include <vector>
6 
10 
23 
24 
53 namespace TopSingleLepton {
54 
56  public:
58  enum Level {
62  };
63 
64  public:
66  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg,
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.c_str()) != hists_.end();
98  };
100  void fill(const std::string histName, double value) const {
101  if (booked(histName.c_str()))
102  hists_.find(histName.c_str())->second->Fill(value);
103  };
105  void fill(const std::string histName, double xValue, double yValue) const {
106  if (booked(histName.c_str()))
107  hists_.find(histName.c_str())->second->Fill(xValue, yValue);
108  };
110  void fill(const std::string histName, double xValue, double yValue,
111  double zValue) const {
112  if (booked(histName.c_str()))
113  hists_.find(histName.c_str())->second->Fill(xValue, yValue, zValue);
114  };
115 
116  private:
122  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
132  std::vector<std::string> triggerPaths_;
133 
137 
149  // int eidPattern_;
150  // the cut for the MVA Id
151  double eidCutValue_;
152  // electron ISO things
153 
155 
157 
158  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecSelect_;
159 
162  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
163 
165  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonIso_;
166 
168  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonSelect_;
169 
172 
175 
176  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
179  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetlooseSelection_;
180  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelection_;
186  btagCSV_;
191 
193  int logged_;
194 
196  std::map<std::string, MonitorElement*> hists_;
198 
200 };
201 
203  std::string channel, const std::vector<std::string> labels) {
204  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
205  hists_[(channel + "Mon_").c_str()]
206  ->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
207  hists_[(channel + "Eff_").c_str()]
208  ->setBinLabel(idx + 1, "[" + selectionPath(labels[idx]) + "]|[" +
209  monitorPath(labels[idx]) + "]",
210  1);
211  }
212 }
213 
215  const edm::TriggerResults& triggerTable,
216  std::string channel,
217  const std::vector<std::string> labels) const {
218  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
219  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
220  fill((channel + "Mon_").c_str(), idx + 0.5);
221  // take care to fill triggerMon_ before evts is being called
222  int evts = hists_.find((channel + "Mon_").c_str())
223  ->second->getBinContent(idx + 1);
224  double value = hists_.find((channel + "Eff_").c_str())
225  ->second->getBinContent(idx + 1);
226  fill(
227  (channel + "Eff_").c_str(), idx + 0.5,
228  1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) -
229  value));
230  }
231  }
232 }
233 }
234 
235 #include <utility>
236 
241 
247 
286 // using TopSingleLepton::MonitorEnsemble;
288 
290  public:
295 
297  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
298 
299  protected:
300  //Book histograms
302  edm::Run const &, edm::EventSetup const &) override;
303 
304  private:
308  return label.substr(0, label.find(':'));
309  };
313  return label.substr(label.find(':') + 1);
314  };
315 
316  private:
320  std::vector<std::string> triggerPaths_;
322  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
323 
328  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
329 
332  std::vector<std::string> selectionOrder_;
339  std::pair<edm::ParameterSet, std::unique_ptr<TopSingleLepton::MonitorEnsemble> > >
341  std::unique_ptr<SelectionStep<reco::PFCandidate> > MuonStep;
342  std::unique_ptr<SelectionStep<reco::PFCandidate> > ElectronStep;
343  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
344  std::unique_ptr<SelectionStep<reco::MET> > METStep;
345  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
346  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
347  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
348 
349  std::vector<edm::ParameterSet> sel_;
351 };
352 
353 #endif
354 
355 /* Local Variables: */
356 /* show-trailing-whitespace: t */
357 /* truncate-lines: t */
358 /* 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_
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)
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
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
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
define MonitorEnsembple to be used
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:30
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
double lowerEdge_
mass window upper and lower edge
U second(std::pair< T, U > const &p)
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::string jetSelect_
extra selection on jets
edm::InputTag beamspot_
beamspot
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
~MonitorEnsemble()
default destructor
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
Definition: value.py:1
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
std::string label_
instance label
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
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::string jetCorrector_
jetCorrector
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
~TopSingleLeptonDQM()
default destructor
std::string monitorPath(const std::string &label) const
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
Definition: event.py:1
Definition: Run.h:43
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