CMS 3D CMS Logo

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