CMS 3D CMS Logo

SingleTopTChannelLeptonDQM_miniAOD.h
Go to the documentation of this file.
1 #ifndef SINGLETOPTCHANNELLEPTONDQM_MINIAOD
2 #define SINGLETOPTCHANNELLEPTONDQM_MINIAOD
3 
4 #include <string>
5 #include <vector>
10 
22 
23 
28 
29 
31 
33  public:
35  enum Level {
39  };
40 
41  public:
43  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg,
47 
49  void book(DQMStore::IBooker & ibooker);
51  void fill(const edm::Event& event, const edm::EventSetup& setup);
52 
53  private:
57  return label.substr(label.find(':') + 1);
58  };
62  return label.substr(0, label.find(':'));
63  };
64 
66  void triggerBinLabels(std::string channel,
67  const std::vector<std::string> labels);
69  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable,
70  std::string channel, const std::vector<std::string> labels) const;
71 
73  bool booked(const std::string histName) const {
74  return hists_.find(histName.c_str()) != hists_.end();
75  };
77  void fill(const std::string histName, double value) const {
78  if (booked(histName.c_str()))
79  hists_.find(histName.c_str())->second->Fill(value);
80  };
82  void fill(const std::string histName, double xValue, double yValue) const {
83  if (booked(histName.c_str()))
84  hists_.find(histName.c_str())->second->Fill(xValue, yValue);
85  };
87  void fill(const std::string histName, double xValue, double yValue,
88  double zValue) const {
89  if (booked(histName.c_str()))
90  hists_.find(histName.c_str())->second->Fill(xValue, yValue, zValue);
91  };
92 
93  private:
99  std::vector<edm::EDGetTokenT<edm::View<pat::MET> > > mets_;
109  std::vector<std::string> triggerPaths_;
110 
112 
115 
116  double eidCutValue_;
118  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecIso_;
120  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecSelect_;
121 
124  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
125 
127  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonIso_;
128 
130  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonSelect_;
131 
137  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
141  std::unique_ptr<StringCutObjectSelector<pat::Jet> > jetSelect;
147  btagCSV_;
152 
154  int logged_;
155 
157  std::map<std::string, MonitorElement*> hists_;
160 };
161 
163  std::string channel, const std::vector<std::string> labels) {
164  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
165  hists_[(channel + "Mon_").c_str()]
166  ->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
167  hists_[(channel + "Eff_").c_str()]
168  ->setBinLabel(idx + 1, "[" + selectionPath(labels[idx]) + "]|[" +
169  monitorPath(labels[idx]) + "]",
170  1);
171  }
172 }
173 
175  const edm::TriggerResults& triggerTable,
176  std::string channel,
177  const std::vector<std::string> labels) const {
178  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
179  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
180  fill((channel + "Mon_").c_str(), idx + 0.5);
181  // take care to fill triggerMon_ before evts is being called
182  int evts = hists_.find((channel + "Mon_").c_str())
183  ->second->getBinContent(idx + 1);
184  double value = hists_.find((channel + "Eff_").c_str())
185  ->second->getBinContent(idx + 1);
186  fill(
187  (channel + "Eff_").c_str(), idx + 0.5,
188  1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) -
189  value));
190  }
191  }
192 }
193 }
194 
195 #include <utility>
196 
201 
207 
208 
210  public:
215 
217  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
218 
219  protected:
220  //Book histograms
222  edm::Run const &, edm::EventSetup const &) override;
223 
224  private:
228  return label.substr(0, label.find(':'));
229  };
233  return label.substr(label.find(':') + 1);
234  };
235 
236  private:
240  std::vector<std::string> triggerPaths_;
242  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
243 
248  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
249 
252  std::vector<std::string> selectionOrder_;
259  std::pair<edm::ParameterSet, std::unique_ptr<SingleTopTChannelLepton_miniAOD::MonitorEnsemble> > >
261  std::unique_ptr<SelectionStep<pat::Muon> > MuonStep;
262  std::unique_ptr<SelectionStep<pat::Electron> > ElectronStep;
263  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
264  std::unique_ptr<SelectionStep<pat::MET> > METStep;
265  std::vector<std::unique_ptr<SelectionStep<pat::Jet> > > JetSteps;
266 
267 
268  std::vector<edm::ParameterSet> sel_;
270 };
271 
272 #endif
273 
274 /* Local Variables: */
275 /* show-trailing-whitespace: t */
276 /* truncate-lines: t */
277 /* End: */
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
std::string selectionPath(const std::string &label) const
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::map< std::string, MonitorElement * > hists_
histogram container
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< std::unique_ptr< SelectionStep< pat::Jet > > > JetSteps
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
edm::EDGetTokenT< edm::View< pat::Electron > > elecs_
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecIso_
extra isolation criterion on electron
std::string monitorPath(const std::string &label) const
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< edm::View< pat::Jet > > jets_
input sources for monitoring
U second(std::pair< T, U > const &p)
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton_miniAOD::MonitorEnsemble > > > selection_
std::unique_ptr< SelectionStep< pat::Muon > > MuonStep
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
std::string selectionStep(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
std::string objectType(const std::string &label)
Definition: value.py:1
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecSelect_
extra selection on electrons
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
trigger paths
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
std::unique_ptr< SelectionStep< pat::MET > > METStep
std::unique_ptr< StringCutObjectSelector< pat::Jet > > jetSelect
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonSelect_
extra selection on muons
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
bool booked(const std::string histName) const
check if histogram was booked
std::vector< edm::EDGetTokenT< edm::View< pat::MET > > > mets_
considers a vector of METs
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::TriggerResults > triggerTable__
trigger table
Definition: event.py:1
Definition: Run.h:44
std::unique_ptr< SelectionStep< pat::Electron > > ElectronStep