CMS 3D CMS Logo

SUSY_HLT_SingleLepton.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 #include <limits>
5 
9 
11 
13 
15 
19 
20 namespace {
23 
24  bool Contains(const std::string &text, const std::string &pattern) { return text.find(pattern) != std::string::npos; }
25 
26  void SetBinLabels(MonitorElement *const me) {
27  if (!me)
28  return;
29  me->setBinLabel(1, "No CSV Reqs.");
30  me->setBinLabel(2, "N_{CSVL} >= 1");
31  me->setBinLabel(3, "N_{CSVL} >= 2");
32  me->setBinLabel(4, "N_{CSVL} >= 3");
33  me->setBinLabel(5, "N_{CSVL} >= 4");
34  me->setBinLabel(6, "N_{CSVM} >= 1");
35  me->setBinLabel(7, "N_{CSVM} >= 2");
36  me->setBinLabel(8, "N_{CSVM} >= 3");
37  me->setBinLabel(9, "N_{CSVM} >= 4");
38  me->setBinLabel(10, "N_{CSVT} >= 1");
39  me->setBinLabel(11, "N_{CSVT} >= 2");
40  me->setBinLabel(12, "N_{CSVT} >= 3");
41  me->setBinLabel(13, "N_{CSVT} >= 4");
42  }
43 
44  bool IsGood(const reco::GsfElectron &el,
45  const reco::Vertex::Point &pv_position,
46  const reco::BeamSpot::Point &bs_position,
48  const float dEtaIn = el.deltaEtaSuperClusterTrackAtVtx();
49  const float dPhiIn = el.deltaPhiSuperClusterTrackAtVtx();
50  const float sigmaietaieta = el.full5x5_sigmaIetaIeta();
51  const float hOverE = el.hcalOverEcal();
52  float d0 = 0.0, dz = 0.0;
53 
54  if (el.gsfTrack().isNull()) {
55  edm::LogError("SUSY_HLT_SingleLepton") << "Could not read electron.gsfTrack().\n";
56  return false;
57  }
58  d0 = -(el.gsfTrack()->dxy(pv_position));
59  dz = el.gsfTrack()->dz(pv_position);
60 
61  float ooemoop = 1e30;
62  if (el.ecalEnergy() > 0.0 && std::isfinite(el.ecalEnergy())) {
63  ooemoop = fabs(1.0 / el.ecalEnergy() - el.eSuperClusterOverP() / el.ecalEnergy());
64  }
65  const auto &iso = el.pfIsolationVariables();
66  const float absiso =
67  iso.sumChargedHadronPt + std::max(0.0, iso.sumNeutralHadronEt + iso.sumPhotonEt - 0.5 * iso.sumPUPt);
68  const float relisowithdb = absiso / el.pt();
69 
70  bool pass_conversion = false;
71  if (convs.isValid()) {
72  pass_conversion = !ConversionTools::hasMatchedConversion(el, *convs, bs_position);
73  } else {
74  edm::LogError("SUSY_HLT_SingleLepton") << "Electron conversion matching failed.\n";
75  return false;
76  }
77 
78  float etasc = 0.0;
79  if (el.superCluster().isNull()) {
80  edm::LogError("SUSY_HLT_SingleLepton") << "Could not read electron.superCluster().\n";
81  return false;
82  }
83  etasc = el.superCluster()->eta();
84  if (fabs(etasc) > 2.5) {
85  return false;
86  } else if (fabs(etasc) > 1.479) {
87  if (fabs(dEtaIn) > 0.0106)
88  return false;
89  if (fabs(dPhiIn) > 0.0359)
90  return false;
91  if (sigmaietaieta > 0.0305)
92  return false;
93  if (hOverE > 0.0835)
94  return false;
95  if (fabs(d0) > 0.0163)
96  return false;
97  if (fabs(dz) > 0.5999)
98  return false;
99  if (fabs(ooemoop) > 0.1126)
100  return false;
101  if (relisowithdb > 0.2075)
102  return false;
103  if (!pass_conversion)
104  return false;
105  } else {
106  if (fabs(dEtaIn) > 0.0091)
107  return false;
108  if (fabs(dPhiIn) > 0.031)
109  return false;
110  if (sigmaietaieta > 0.0106)
111  return false;
112  if (hOverE > 0.0532)
113  return false;
114  if (fabs(d0) > 0.0126)
115  return false;
116  if (fabs(dz) > 0.0116)
117  return false;
118  if (fabs(ooemoop) > 0.0609)
119  return false;
120  if (relisowithdb > 0.1649)
121  return false;
122  if (!pass_conversion)
123  return false;
124  }
125  return true;
126  }
127 
128  bool IsGood(const reco::Muon &mu, const reco::Vertex::Point &pv_position) {
129  if (!mu.isGlobalMuon())
130  return false;
131  if (!mu.isPFMuon())
132  return false;
133  if (mu.globalTrack().isNull()) {
134  edm::LogWarning("SUSY_HLT_SingleLepton") << "Could not read muon.globalTrack().\n";
135  return false;
136  }
137  if (mu.globalTrack()->normalizedChi2() >= 10.)
138  return false;
139  if (mu.globalTrack()->hitPattern().numberOfValidMuonHits() <= 0)
140  return false;
141  if (mu.numberOfMatchedStations() <= 1)
142  return false;
143  if (mu.muonBestTrack().isNull()) {
144  edm::LogWarning("SUSY_HLT_SingleLepton") << "Could not read muon.muonBestTrack().\n";
145  return false;
146  }
147  if (fabs(mu.muonBestTrack()->dxy(pv_position)) >= 0.2)
148  return false;
149  if (fabs(mu.muonBestTrack()->dz(pv_position)) >= 0.5)
150  return false;
151  if (mu.innerTrack().isNull()) {
152  edm::LogWarning("SUSY_HLT_SingleLepton") << "Could not read muon.innerTrack().\n";
153  return false;
154  }
155  if (mu.innerTrack()->hitPattern().numberOfValidPixelHits() <= 0)
156  return false;
157  if (mu.innerTrack()->hitPattern().trackerLayersWithMeasurement() <= 5)
158  return false;
159 
160  return true;
161  }
162 } // namespace
163 
165  : theElectronTag_(ps.getParameter<edm::InputTag>("electronCollection")),
166  theElectronCollection_(consumes<reco::GsfElectronCollection>(theElectronTag_)),
167  theMuonTag_(ps.getParameter<edm::InputTag>("muonCollection")),
168  theMuonCollection_(consumes<reco::MuonCollection>(theMuonTag_)),
169  thePfMETTag_(ps.getParameter<edm::InputTag>("pfMetCollection")),
170  thePfMETCollection_(consumes<reco::PFMETCollection>(thePfMETTag_)),
171  thePfJetTag_(ps.getParameter<edm::InputTag>("pfJetCollection")),
172  thePfJetCollection_(consumes<reco::PFJetCollection>(thePfJetTag_)),
173  theJetTagTag_(ps.getParameter<edm::InputTag>("jetTagCollection")),
174  theJetTagCollection_(consumes<reco::JetTagCollection>(theJetTagTag_)),
175 
176  theVertexCollectionTag_(ps.getParameter<edm::InputTag>("vertexCollection")),
177  theVertexCollection_(consumes<reco::VertexCollection>(theVertexCollectionTag_)),
178  theConversionCollectionTag_(ps.getParameter<edm::InputTag>("conversionCollection")),
179  theConversionCollection_(consumes<reco::ConversionCollection>(theConversionCollectionTag_)),
180  theBeamSpotTag_(ps.getParameter<edm::InputTag>("beamSpot")),
181  theBeamSpot_(consumes<reco::BeamSpot>(theBeamSpotTag_)),
182 
183  theLeptonFilterTag_(ps.getParameter<edm::InputTag>("leptonFilter")),
184  theHLTHTTag_(ps.getParameter<edm::InputTag>("hltHt")),
185  theHLTHT_(consumes<reco::METCollection>(theHLTHTTag_)),
186  theHLTMETTag_(ps.getParameter<edm::InputTag>("hltMet")),
187  theHLTMET_(consumes<reco::METCollection>(theHLTMETTag_)),
188  theHLTJetCollectionTag_(ps.getParameter<edm::InputTag>("hltJets")),
189  theHLTJetCollection_(consumes<reco::CaloJetCollection>(theHLTJetCollectionTag_)),
190  theHLTJetTagCollectionTag_(ps.getParameter<edm::InputTag>("hltJetTags")),
191  theHLTJetTagCollection_(consumes<reco::JetTagCollection>(theHLTJetTagCollectionTag_)),
192 
193  theTriggerResultsTag_(ps.getParameter<edm::InputTag>("triggerResults")),
194  theTriggerResults_(consumes<edm::TriggerResults>(theTriggerResultsTag_)),
195  theTrigSummaryTag_(ps.getParameter<edm::InputTag>("trigSummary")),
196  theTrigSummary_(consumes<trigger::TriggerEvent>(theTrigSummaryTag_)),
197 
198  fHltConfig_(),
199 
200  HLTProcess_(ps.getParameter<std::string>("hltProcess")),
201 
202  triggerPath_(ps.getParameter<std::string>("triggerPath")),
203  triggerPathAuxiliary_(ps.getParameter<std::string>("triggerPathAuxiliary")),
204  triggerPathLeptonAuxiliary_(ps.getParameter<std::string>("triggerPathLeptonAuxiliary")),
205 
206  csvlCut_(ps.getUntrackedParameter<double>("csvlCut")),
207  csvmCut_(ps.getUntrackedParameter<double>("csvmCut")),
208  csvtCut_(ps.getUntrackedParameter<double>("csvtCut")),
209 
210  jetPtCut_(ps.getUntrackedParameter<double>("jetPtCut")),
211  jetEtaCut_(ps.getUntrackedParameter<double>("jetEtaCut")),
212  metCut_(ps.getUntrackedParameter<double>("metCut")),
213  htCut_(ps.getUntrackedParameter<double>("htCut")),
214 
215  lep_pt_threshold_(ps.getUntrackedParameter<double>("leptonPtThreshold")),
216  ht_threshold_(ps.getUntrackedParameter<double>("htThreshold")),
217  met_threshold_(ps.getUntrackedParameter<double>("metThreshold")),
218  csv_threshold_(ps.getUntrackedParameter<double>("csvThreshold")),
219 
220  h_triggerLepPt_(nullptr),
221  h_triggerLepEta_(nullptr),
222  h_triggerLepPhi_(nullptr),
223  h_HT_(nullptr),
224  h_MET_(nullptr),
225  h_maxCSV_(nullptr),
226  h_leptonTurnOn_num_(nullptr),
227  h_leptonTurnOn_den_(nullptr),
228  h_pfHTTurnOn_num_(nullptr),
229  h_pfHTTurnOn_den_(nullptr),
230  h_pfMetTurnOn_num_(nullptr),
231  h_pfMetTurnOn_den_(nullptr),
232  h_CSVTurnOn_num_(nullptr),
233  h_CSVTurnOn_den_(nullptr),
234  h_btagTurnOn_num_(nullptr),
235  h_btagTurnOn_den_(nullptr) {
236  edm::LogInfo("SUSY_HLT_SingleLepton") << "Constructor SUSY_HLT_SingleLepton::SUSY_HLT_SingleLepton\n";
237 }
238 
240  edm::LogInfo("SUSY_HLT_SingleLepton") << "Destructor SUSY_HLT_SingleLepton::~SUSY_HLT_SingleLepton\n";
241 }
242 
244  bool changed;
245 
246  if (!fHltConfig_.init(run, e, HLTProcess_, changed)) {
247  edm::LogError("SUSY_HLT_SingleLepton") << "Initialization of HLTConfigProvider failed!!\n";
248  return;
249  }
250 
251  bool pathFound = false;
252  for (const auto &trig_name : fHltConfig_.triggerNames()) {
253  if (Contains(trig_name, triggerPath_))
254  pathFound = true;
255  }
256 
257  if (!pathFound) {
258  LogDebug("SUSY_HLT_SingleLepton") << "Path not found: " << triggerPath_ << '\n';
259  return;
260  }
261 
262  edm::LogInfo("SUSY_HLT_SingleLepton") << "SUSY_HLT_SingleLepton::beginRun\n";
263 }
264 
266  edm::LogInfo("SUSY_HLT_SingleLepton") << "SUSY_HLT_SingleLepton::bookHistograms\n";
267  // book at beginRun
268  ibooker.cd();
269  ibooker.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
270 
271  bool is_mu = false;
272  bool is_ele = false;
273  if (theElectronTag_.label().empty() && !theMuonTag_.label().empty()) {
274  is_mu = true;
275  } else if (!theElectronTag_.label().empty() && theMuonTag_.label().empty()) {
276  is_ele = true;
277  }
278  std::string lepton = "lepton", Lepton = "Lepton";
279  if (is_mu && !is_ele) {
280  lepton = "muon";
281  Lepton = "Muon";
282  } else if (is_ele && !is_mu) {
283  lepton = "electron";
284  Lepton = "Electron";
285  }
286 
287  // online quantities
288  h_triggerLepPt_ = ibooker.book1D("triggerLepPt", (";" + Lepton + " p_{T} [GeV];").c_str(), 20, 0.0, 500.0);
289  h_triggerLepEta_ = ibooker.book1D("triggerLepEta", (";" + Lepton + " #eta;").c_str(), 20, -3.0, 3.0);
290  h_triggerLepPhi_ = ibooker.book1D("triggerLepPhi", (";" + Lepton + " #phi;").c_str(), 20, -3.5, 3.5);
291 
292  if (!theHLTHTTag_.label().empty()) {
293  h_HT_ = ibooker.book1D("HT", ";HLT HT [GeV];", 40, 0.0, 1000.0);
294  }
295 
296  if (!theHLTMETTag_.label().empty()) {
297  h_MET_ = ibooker.book1D("MET", ";HLT MET [GeV];", 40, 0.0, 1000.0);
298  }
299 
300  if (!theHLTJetCollectionTag_.label().empty() && !theHLTJetTagCollectionTag_.label().empty()) {
301  h_maxCSV_ = ibooker.book1D("maxCSV", ";Max HLT CSV;", 20, 0.0, 1.0);
302  }
303 
304  // num and den hists to be divided in harvesting step to make turn on curves
306  ibooker.book1D("leptonTurnOn_num", ("Numerator;Offline " + lepton + " p_{T} [GeV];").c_str(), 30, 0.0, 150);
308  ibooker.book1D("leptonTurnOn_den", ("Denominator;Offline " + lepton + " p_{T} [GeV];").c_str(), 30, 0.0, 150.0);
309  h_pfHTTurnOn_num_ = ibooker.book1D("pfHTTurnOn_num", "Numerator;Offline H_{T} [GeV];", 30, 0.0, 1500.0);
310  h_pfHTTurnOn_den_ = ibooker.book1D("pfHTTurnOn_den", "Denominator;Offline H_{T} [GeV];", 30, 0.0, 1500.0);
311 
312  if (!theHLTMETTag_.label().empty()) {
313  h_pfMetTurnOn_num_ = ibooker.book1D("pfMetTurnOn_num", "Numerator;Offline MET [GeV];", 20, 0.0, 500.0);
314  h_pfMetTurnOn_den_ = ibooker.book1D("pfMetTurnOn_den", "Denominator;Offline MET [GeV];", 20, 0.0, 500.0);
315  }
316 
317  if (!theHLTJetCollectionTag_.label().empty() && !theHLTJetTagCollectionTag_.label().empty()) {
318  h_CSVTurnOn_num_ = ibooker.book1D("CSVTurnOn_num", "Numerator;Offline Max CSV Discriminant;", 20, 0.0, 1.0);
319  h_CSVTurnOn_den_ = ibooker.book1D("CSVTurnOn_den", "Denominator;Offline Max CSV Discriminant;", 20, 0.0, 1.0);
320 
321  h_btagTurnOn_num_ = ibooker.book1D("btagTurnOn_num", "Numerator;Offline CSV Requirement;", 13, -0.5, 12.5);
322  h_btagTurnOn_den_ = ibooker.book1D("btagTurnOn_den", "Denominator;Offline CSV Requirements;", 13, -0.5, 12.5);
323 
324  SetBinLabels(h_btagTurnOn_num_);
325  SetBinLabels(h_btagTurnOn_den_);
326  }
327  ibooker.cd();
328 }
329 
331  edm::LogInfo("SUSY_HLT_SingleLepton") << "SUSY_HLT_SingleLepton::analyze\n";
332 
333  // HLT HT
335  if (!theHLTHTTag_.label().empty()) {
336  e.getByToken(theHLTHT_, HLTHT);
337  if (!HLTHT.isValid()) {
338  edm::LogInfo("SUSY_HLT_SingleLepton") << "Invalid METCollection: " << theHLTHTTag_.label() << '\n';
339  }
340  }
341 
342  // HLT MET
344  if (!theHLTMETTag_.label().empty()) {
345  e.getByToken(theHLTMET_, HLTMET);
346  if (!HLTMET.isValid()) {
347  edm::LogInfo("SUSY_HLT_SingleLepton") << "Invalid METCollection: " << theHLTMETTag_.label() << '\n';
348  }
349  }
350 
351  // HLT Jets
352  edm::Handle<reco::CaloJetCollection> HLTJetCollection;
353  if (!theHLTJetCollectionTag_.label().empty()) {
354  e.getByToken(theHLTJetCollection_, HLTJetCollection);
355  if (!HLTJetCollection.isValid()) {
356  edm::LogInfo("SUSY_HLT_SingleLepton") << "Invalid CaloJetCollection: " << theHLTJetCollectionTag_.label() << '\n';
357  }
358  }
359 
360  // HLT Jet Tags
361  edm::Handle<reco::JetTagCollection> HLTJetTagCollection;
362  if (!theHLTJetTagCollectionTag_.label().empty()) {
363  e.getByToken(theHLTJetTagCollection_, HLTJetTagCollection);
364  if (!HLTJetTagCollection.isValid()) {
365  edm::LogInfo("SUSY_HLT_SingleLepton")
366  << "Invalid JetTagCollection: " << theHLTJetTagCollectionTag_.label() << '\n';
367  }
368  }
369 
370  // Vertex
372  if (!theVertexCollectionTag_.label().empty()) {
374  if (!VertexCollection.isValid()) {
375  edm::LogWarning("SUSY_HLT_SingleLepton")
376  << "Invalid VertexCollection: " << theVertexCollectionTag_.label() << '\n';
377  }
378  }
379 
380  // Conversions
382  if (!theConversionCollectionTag_.label().empty()) {
384  if (!ConversionCollection.isValid()) {
385  edm::LogWarning("SUSY_HLT_SingleLepton")
386  << "Invalid ConversionCollection: " << theConversionCollectionTag_.label() << '\n';
387  }
388  }
389 
390  // Beam Spot
392  if (!theBeamSpotTag_.label().empty()) {
393  e.getByToken(theBeamSpot_, BeamSpot);
394  if (!BeamSpot.isValid()) {
395  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid BeamSpot: " << theBeamSpotTag_.label() << '\n';
396  }
397  }
398 
399  // MET
401  if (!thePfMETTag_.label().empty()) {
403  if (!pfMETCollection.isValid()) {
404  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid PFMETCollection: " << thePfMETTag_.label() << '\n';
405  }
406  }
407 
408  // Jets
410  if (!thePfJetTag_.label().empty()) {
412  if (!pfJetCollection.isValid()) {
413  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid PFJetCollection: " << thePfJetTag_.label() << '\n';
414  }
415  }
416 
417  // b-tags
419  if (!theJetTagTag_.label().empty()) {
421  if (!jetTagCollection.isValid()) {
422  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid JetTagCollection: " << theJetTagTag_.label() << '\n';
423  }
424  }
425 
426  // Electron
428  if (!theElectronTag_.label().empty()) {
430  if (!ElectronCollection.isValid()) {
431  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid GsfElectronCollection: " << theElectronTag_.label() << '\n';
432  }
433  }
434 
435  // Muon
437  if (!theMuonTag_.label().empty()) {
438  e.getByToken(theMuonCollection_, MuonCollection);
439  if (!MuonCollection.isValid()) {
440  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid MuonCollection: " << theMuonTag_.label() << '\n';
441  }
442  }
443 
444  // Trigger
446  if (!theTriggerResultsTag_.label().empty()) {
447  e.getByToken(theTriggerResults_, hltresults);
448  if (!hltresults.isValid()) {
449  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid TriggerResults: " << theTriggerResultsTag_.label() << '\n';
450  }
451  }
453  if (!theTrigSummaryTag_.label().empty()) {
454  e.getByToken(theTrigSummary_, triggerSummary);
455  if (!triggerSummary.isValid()) {
456  edm::LogWarning("SUSY_HLT_SingleLepton") << "Invalid TriggerEvent: " << theTrigSummaryTag_.label() << '\n';
457  }
458  }
459 
460  // Get online leptons
461  std::vector<float> ptLepton, etaLepton, phiLepton;
462  if (triggerSummary.isValid()) {
463  // Leptons
464  size_t filterIndex = triggerSummary->filterIndex(theLeptonFilterTag_);
466  if (!(filterIndex >= triggerSummary->sizeFilters())) {
467  size_t ilep = 0, num_keys = triggerSummary->filterKeys(filterIndex).size();
468  ptLepton.resize(num_keys);
469  etaLepton.resize(num_keys);
470  phiLepton.resize(num_keys);
471  for (const auto &key : triggerSummary->filterKeys(filterIndex)) {
472  const trigger::TriggerObject &foundObject = triggerObjects[key];
473 
474  if (h_triggerLepPt_)
475  h_triggerLepPt_->Fill(foundObject.pt());
476  if (h_triggerLepEta_)
477  h_triggerLepEta_->Fill(foundObject.eta());
478  if (h_triggerLepPhi_)
479  h_triggerLepPhi_->Fill(foundObject.phi());
480 
481  ptLepton.at(ilep) = foundObject.pt();
482  etaLepton.at(ilep) = foundObject.eta();
483  phiLepton.at(ilep) = foundObject.phi();
484  ++ilep;
485  }
486  }
487  }
488 
489  // Get online ht and met
490  const float hlt_ht = ((HLTHT.isValid() && !HLTHT->empty()) ? HLTHT->front().sumEt() : -1.0);
491  if (h_HT_)
492  h_HT_->Fill(hlt_ht);
493  const float hlt_met = ((HLTMET.isValid() && !HLTMET->empty()) ? HLTMET->front().pt() : -1.0);
494  if (h_MET_)
495  h_MET_->Fill(hlt_met);
496 
497  // Get online csv and fill plot
498  float hlt_csv = -1.0;
499  if (HLTJetCollection.isValid() && HLTJetTagCollection.isValid()) {
500  for (const auto &jet : *HLTJetTagCollection) {
501  if (jet.second > hlt_csv)
502  hlt_csv = jet.second;
503  }
504  }
505  if (h_maxCSV_)
506  h_maxCSV_->Fill(hlt_csv);
507 
508  // Test whether main and auxilliary triggers fired
509  bool hasFired = false;
510  bool hasFiredAuxiliary = false;
511  bool hasFiredLeptonAuxiliary = false;
512  if (hltresults.isValid()) {
513  const edm::TriggerNames &trigNames = e.triggerNames(*hltresults);
514  for (unsigned int hltIndex = 0; hltIndex < trigNames.size(); ++hltIndex) {
515  if (hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) {
516  const std::string &name = trigNames.triggerName(hltIndex);
517  if (Contains(name, triggerPath_))
518  hasFired = true;
519  if (Contains(name, triggerPathAuxiliary_))
520  hasFiredAuxiliary = true;
521  if (Contains(name, triggerPathLeptonAuxiliary_))
522  hasFiredLeptonAuxiliary = true;
523  }
524  }
525  }
526 
527  // Get offline HT
528  double pfHT = -1.0;
529  if (pfJetCollection.isValid()) {
530  pfHT = 0.0;
531  for (const auto &pfjet : *pfJetCollection) {
532  if (pfjet.pt() < jetPtCut_)
533  continue;
534  if (fabs(pfjet.eta()) > jetEtaCut_)
535  continue;
536  pfHT += pfjet.pt();
537  }
538  }
539 
540  // Get offline MET
541  double pfMET = -1.0;
542  if (pfMETCollection.isValid() && !pfMETCollection->empty()) {
543  pfMET = pfMETCollection->front().et();
544  }
545 
546  // Get offline b-tagging info
547  float maxCSV = -1.0;
548  unsigned num_csvl = 0;
549  unsigned num_csvm = 0;
550  unsigned num_csvt = 0;
551  if (jetTagCollection.isValid()) {
552  for (const auto &jet : *jetTagCollection) {
553  const float CSV = jet.second;
554  if (jet.first->pt() > jetPtCut_) {
555  if (CSV > maxCSV) {
556  maxCSV = CSV;
557  }
558  if (CSV > csvlCut_) {
559  ++num_csvl;
560  if (CSV > csvmCut_) {
561  ++num_csvm;
562  if (CSV > csvtCut_) {
563  ++num_csvt;
564  }
565  }
566  }
567  }
568  }
569  }
570  if (h_maxCSV_)
571  h_maxCSV_->Fill(maxCSV);
572 
573  // Fill lepton pt efficiency plot
574  double lep_max_pt = -1.0;
575  if (VertexCollection.isValid() && !VertexCollection->empty()) { // for quality checks
576  // Try to find a reco electron
577  if (ElectronCollection.isValid() && ConversionCollection.isValid() && BeamSpot.isValid()) {
578  for (const auto &electron : *ElectronCollection) {
579  if (IsGood(electron, VertexCollection->front().position(), BeamSpot->position(), ConversionCollection)) {
580  if (electron.pt() > lep_max_pt)
581  lep_max_pt = electron.pt();
582  }
583  }
584  }
585 
586  // Try to find a reco muon
587  if (MuonCollection.isValid()) {
588  for (const auto &muon : *MuonCollection) {
589  if (IsGood(muon, VertexCollection->front().position())) {
590  if (muon.pt() > lep_max_pt) {
591  lep_max_pt = muon.pt();
592  }
593  }
594  }
595  }
596  }
597 
598  const bool lep_plateau = lep_max_pt > lep_pt_threshold_ || lep_pt_threshold_ < 0.0;
599  const bool ht_plateau = pfHT > ht_threshold_ || ht_threshold_ < 0.0;
600  const bool met_plateau = pfMET > met_threshold_ || met_threshold_ < 0.0;
601  const bool csv_plateau = maxCSV > csv_threshold_ || csv_threshold_ < 0.0;
602 
603  // Fill lepton turn-on histograms
604  if (hasFiredLeptonAuxiliary || triggerPathLeptonAuxiliary_.empty() || !e.isRealData()) {
605  // Fill histograms using highest pt reco lepton
606  if (ht_plateau && met_plateau && csv_plateau && (pfMET > metCut_ || metCut_ < 0.0) &&
607  (pfHT > htCut_ || htCut_ < 0.0)) {
609  h_leptonTurnOn_den_->Fill(lep_max_pt);
610  if (h_leptonTurnOn_num_ && hasFired)
611  h_leptonTurnOn_num_->Fill(lep_max_pt);
612  }
613  }
614 
615  // Fill remaining turn-on histograms
616  if (hasFiredAuxiliary || triggerPathAuxiliary_.empty() || !e.isRealData()) {
617  // Fill HT efficiency plot
618  if (lep_plateau && met_plateau && csv_plateau) {
619  if (h_pfHTTurnOn_den_)
620  h_pfHTTurnOn_den_->Fill(pfHT);
621  if (h_pfHTTurnOn_num_ && hasFired)
622  h_pfHTTurnOn_num_->Fill(pfHT);
623  }
624 
625  // Fill MET efficiency plot
626  if (lep_plateau && ht_plateau && csv_plateau) {
627  if (h_pfMetTurnOn_den_)
629  if (h_pfMetTurnOn_num_ && hasFired)
631  }
632 
633  // Fill CSV efficiency plot
634  if (lep_plateau && ht_plateau && met_plateau) {
635  if (h_CSVTurnOn_den_)
636  h_CSVTurnOn_den_->Fill(maxCSV);
637  if (h_CSVTurnOn_num_ && hasFired)
638  h_CSVTurnOn_num_->Fill(maxCSV);
639 
640  if (h_btagTurnOn_den_) {
641  switch (num_csvl) {
642  default:
644  [[fallthrough]];
645  case 3:
647  [[fallthrough]];
648  case 2:
650  [[fallthrough]];
651  case 1:
653  [[fallthrough]];
654  case 0:
656  }
657  switch (num_csvm) {
658  default:
660  [[fallthrough]];
661  case 3:
663  [[fallthrough]];
664  case 2:
666  [[fallthrough]];
667  case 1:
669  [[fallthrough]];
670  case 0:
671  break; // Don't double count in the no tag bin
672  }
673  switch (num_csvt) {
674  default:
675  h_btagTurnOn_den_->Fill(12);
676  [[fallthrough]];
677  case 3:
678  h_btagTurnOn_den_->Fill(11);
679  [[fallthrough]];
680  case 2:
681  h_btagTurnOn_den_->Fill(10);
682  [[fallthrough]];
683  case 1:
685  [[fallthrough]];
686  case 0:
687  break; // Don't double count in the no tag bin
688  }
689  }
690  if (h_btagTurnOn_num_ && hasFired) {
691  switch (num_csvl) {
692  default:
694  [[fallthrough]];
695  case 3:
697  [[fallthrough]];
698  case 2:
700  [[fallthrough]];
701  case 1:
703  [[fallthrough]];
704  case 0:
706  }
707  switch (num_csvm) {
708  default:
710  [[fallthrough]];
711  case 3:
713  [[fallthrough]];
714  case 2:
716  [[fallthrough]];
717  case 1:
719  [[fallthrough]];
720  case 0:
721  break; // Don't double count in the no tag bin
722  }
723  switch (num_csvt) {
724  default:
725  h_btagTurnOn_num_->Fill(12);
726  [[fallthrough]];
727  case 3:
728  h_btagTurnOn_num_->Fill(11);
729  [[fallthrough]];
730  case 2:
731  h_btagTurnOn_num_->Fill(10);
732  [[fallthrough]];
733  case 1:
735  [[fallthrough]];
736  case 0:
737  break; // Don't double count in the no tag bin
738  }
739  }
740  }
741  }
742 }
743 
744 // define this as a plug-in
edm::EDGetTokenT< edm::TriggerResults > theTriggerResults_
std::string triggerPathLeptonAuxiliary_
edm::InputTag theConversionCollectionTag_
double pt() const final
transverse momentum
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
edm::EDGetTokenT< reco::MuonCollection > theMuonCollection_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< reco::METCollection > theHLTMET_
edm::InputTag theTriggerResultsTag_
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &e) override
HLTConfigProvider fHltConfig_
MonitorElement * h_triggerLepPt_
MonitorElement * h_pfMetTurnOn_den_
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
void analyze(const edm::Event &e, const edm::EventSetup &eSetup) override
MonitorElement * h_leptonTurnOn_num_
MonitorElement * h_CSVTurnOn_num_
MonitorElement * h_pfHTTurnOn_num_
std::string const & label() const
Definition: InputTag.h:36
JetFloatAssociation::Container JetTagCollection
Definition: JetTag.h:17
Log< level::Error, false > LogError
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
edm::EDGetTokenT< reco::JetTagCollection > theJetTagCollection_
MonitorElement * h_CSVTurnOn_den_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::EDGetTokenT< reco::CaloJetCollection > theHLTJetCollection_
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
dqm::reco::DQMStore DQMStore
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
edm::EDGetTokenT< reco::GsfElectronCollection > theElectronCollection_
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:729
edm::EDGetTokenT< reco::ConversionCollection > theConversionCollection_
MonitorElement * h_btagTurnOn_den_
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
MonitorElement * h_triggerLepPhi_
Collection of MET.
bool isNull() const
Checks for null.
Definition: Ref.h:235
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
float hcalOverEcal(const ShowerShape &ss, int depth) const
Definition: GsfElectron.h:425
edm::EDGetTokenT< reco::JetTagCollection > theHLTJetTagCollection_
edm::InputTag theHLTJetCollectionTag_
edm::EDGetTokenT< reco::BeamSpot > theBeamSpot_
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:228
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
Log< level::Info, false > LogInfo
edm::EDGetTokenT< reco::PFJetCollection > thePfJetCollection_
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
static constexpr float d0
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
MonitorElement * h_pfHTTurnOn_den_
dqm::legacy::MonitorElement MonitorElement
float ecalEnergy() const
Definition: GsfElectron.h:896
MonitorElement * h_triggerLepEta_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
MonitorElement * h_pfMetTurnOn_num_
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
edm::EDGetTokenT< reco::VertexCollection > theVertexCollection_
const std::vector< std::string > & triggerNames() const
names of trigger paths
bool isValid() const
Definition: HandleBase.h:70
std::vector< PFJet > PFJetCollection
collection of PFJet objects
fixed size matrix
HLT enums.
MonitorElement * h_btagTurnOn_num_
Definition: Lepton.py:1
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:471
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:663
SUSY_HLT_SingleLepton(const edm::ParameterSet &ps)
MonitorElement * h_leptonTurnOn_den_
edm::EDGetTokenT< reco::METCollection > theHLTHT_
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
edm::InputTag theVertexCollectionTag_
Definition: Run.h:45
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
#define LogDebug(id)
edm::InputTag theHLTJetTagCollectionTag_
Collection of PF MET.