CMS 3D CMS Logo

LeptonSkimming.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: SkimmingForB/LeptonSkimming
5 // Class: LeptonSkimming
6 //
14 //
15 // Original Author: Georgios Karathanasis georgios.karathanasis@cern.ch
16 // Created: Thu, 29 Nov 2018 15:23:09 GMT
17 //
18 //
19 
21 
22 using namespace edm;
23 using namespace reco;
24 using namespace std;
25 
27  : electronsToken_(consumes<std::vector<reco::GsfElectron>>(iConfig.getParameter<edm::InputTag>("electrons"))),
28  eleBWPToken_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("eleBiasedWP"))),
29  eleUnBWPToken_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("eleUnbiasedWP"))),
30  muonsToken_(consumes<std::vector<reco::Muon>>(iConfig.getParameter<edm::InputTag>("muons"))),
31  Tracks_(consumes<std::vector<reco::Track>>(iConfig.getParameter<edm::InputTag>("tracks"))),
32  vtxToken_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("vertices"))),
33  beamSpotToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
34  conversionsToken_(consumes<reco::ConversionCollection>(iConfig.getParameter<edm::InputTag>("conversions"))),
35 
36  trgresultsToken_(consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("triggerresults"))),
37  trigobjectsToken_(consumes<trigger::TriggerEvent>(iConfig.getParameter<edm::InputTag>("triggerobjects"))),
38  HLTFilter_(iConfig.getParameter<vector<string>>("HLTFilter")),
39  HLTPath_(iConfig.getParameter<vector<string>>("HLTPath")) {
41  //mu matching with trigger
42  MuTrgMatchCone = runParameters.getParameter<double>("MuTrgMatchCone");
43  SkipIfNoMuMatch = runParameters.getParameter<bool>("SkipIfNoMuMatch");
44  //track cuts
45  PtTrack_Cut = runParameters.getParameter<double>("PtTrack_Cut");
46  EtaTrack_Cut = runParameters.getParameter<double>("EtaTrack_Cut");
47  MinChi2Track_Cut = runParameters.getParameter<double>("MinChi2Track_Cut");
48  MaxChi2Track_Cut = runParameters.getParameter<double>("MaxChi2Track_Cut");
49  MuTrkMinDR_Cut = runParameters.getParameter<double>("MuTrkMinDR_Cut");
50  TrackMuDz_Cut = runParameters.getParameter<double>("TrackMuDz_Cut");
51  TrgExclusionCone = runParameters.getParameter<double>("TrgExclusionCone");
52  //lepton cuts
53  PtMu_Cut = runParameters.getParameter<double>("PtMu_Cut");
54  PtEl_Cut = runParameters.getParameter<double>("PtEl_Cut");
55  QualMu_Cut = runParameters.getParameter<double>("QualMu_Cut");
56  MuTrgExclusionCone = runParameters.getParameter<double>("MuTrgExclusionCone");
57  ElTrgExclusionCone = runParameters.getParameter<double>("ElTrgExclusionCone");
58  TrkObjExclusionCone = runParameters.getParameter<double>("TrkObjExclusionCone");
59  MuTrgMuDz_Cut = runParameters.getParameter<double>("MuTrgMuDz_Cut");
60  ElTrgMuDz_Cut = runParameters.getParameter<double>("ElTrgMuDz_Cut");
61  BiasedWP = runParameters.getParameter<double>("BiasedWP");
62  UnbiasedWP = runParameters.getParameter<double>("UnbiasedWP");
63  SkimOnlyMuons = runParameters.getParameter<bool>("SkimOnlyMuons");
64  SkimOnlyElectrons = runParameters.getParameter<bool>("SkimOnlyElectrons");
65  //pair cuts
66  MaxMee_Cut = runParameters.getParameter<double>("MaxMee_Cut");
67  MinMee_Cut = runParameters.getParameter<double>("MinMee_Cut");
68  Probee_Cut = runParameters.getParameter<double>("Probee_Cut");
69  Cosee_Cut = runParameters.getParameter<double>("Cosee_Cut");
70  EpairZvtx_Cut = runParameters.getParameter<double>("EpairZvtx_Cut");
71  //kaon
72  PtKTrack_Cut = runParameters.getParameter<double>("PtKTrack_Cut");
73  TrackSdxy_Cut = runParameters.getParameter<double>("TrackSdxy_Cut");
74  Ksdxy_Cut = runParameters.getParameter<double>("Ksdxy_Cut");
75  //triplet
76  MaxMB_Cut = runParameters.getParameter<double>("MaxMB_Cut");
77  MinMB_Cut = runParameters.getParameter<double>("MinMB_Cut");
78  ProbeeK_Cut = runParameters.getParameter<double>("ProbeeK_Cut");
79  CoseeK_Cut = runParameters.getParameter<double>("CoseeK_Cut");
80  SLxy_Cut = runParameters.getParameter<double>("SLxy_Cut");
81  PtB_Cut = runParameters.getParameter<double>("PtB_Cut");
82 
83  ObjPtLargerThanTrack = runParameters.getParameter<bool>("ObjPtLargerThanTrack");
84 }
85 
87  // do anything here that needs to be done at destruction time
88  // (e.g. close files, deallocate resources etc.)
89 }
90 
91 bool LeptonSkimming::hltFired(const edm::Event& iEvent, const edm::EventSetup& iSetup, std::vector<string> HLTPath) {
92  using namespace std;
93  using namespace edm;
94  using namespace reco;
95  using namespace trigger;
96 
98  iEvent.getByToken(trgresultsToken_, trigResults);
99  bool fire = false;
100  if (trigResults.failedToGet())
101  return false;
102  for (unsigned int ip = 0; ip < HLTPath.size(); ip++) {
103  int N_Triggers = trigResults->size();
104  const edm::TriggerNames& trigName = iEvent.triggerNames(*trigResults);
105  for (int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig) {
106  if (!trigResults->accept(i_Trig))
107  continue;
108  const std::string& TrigPath = trigName.triggerName(i_Trig);
109  if (TrigPath.find(HLTPath[ip]) != std::string::npos)
110  fire = true;
111  }
112  }
113  return fire;
114 }
115 
116 std::array<float, 5> LeptonSkimming::hltObject(const edm::Event& iEvent,
117  const edm::EventSetup& iSetup,
118  std::vector<string> Seed) {
119  using namespace std;
120  using namespace edm;
121  using namespace reco;
122  using namespace trigger;
123 
124  edm::Handle<trigger::TriggerEvent> triggerObjectsSummary;
125  iEvent.getByToken(trigobjectsToken_, triggerObjectsSummary);
126  trigger::TriggerObjectCollection selectedObjects;
127 
128  std::vector<std::array<float, 5>> max_per_trigger;
129 
130  for (unsigned int ipath = 0; ipath < Seed.size(); ipath++) {
131  std::vector<std::array<float, 5>> tot_tr_obj_pt_eta_phi;
132  if (!triggerObjectsSummary.isValid())
133  continue;
134  size_t filterIndex = (*triggerObjectsSummary).filterIndex(InputTag(Seed[ipath], "", "HLT"));
135  trigger::TriggerObjectCollection allTriggerObjects = triggerObjectsSummary->getObjects();
136  if (filterIndex < (*triggerObjectsSummary).sizeFilters()) {
137  const trigger::Keys& keys = (*triggerObjectsSummary).filterKeys(filterIndex);
138  for (size_t j = 0; j < keys.size(); j++) {
139  const trigger::TriggerObject& foundObject = (allTriggerObjects)[keys[j]];
140  std::array<float, 5> tr_obj_pt_eta_phi;
141  if (fabs(foundObject.id()) != 13)
142  continue;
143  tr_obj_pt_eta_phi[0] = foundObject.pt();
144  tr_obj_pt_eta_phi[1] = foundObject.eta();
145  tr_obj_pt_eta_phi[2] = foundObject.phi();
146  tr_obj_pt_eta_phi[3] = foundObject.id() / fabs(foundObject.id());
147  tot_tr_obj_pt_eta_phi.push_back(tr_obj_pt_eta_phi);
148  }
149  }
150  //take the max per hlt
151  if (!tot_tr_obj_pt_eta_phi.empty()) {
152  std::sort(tot_tr_obj_pt_eta_phi.begin(),
153  tot_tr_obj_pt_eta_phi.end(),
154  [](const std::array<float, 5>& a, const std::array<float, 5>& b) { return a[0] > b[0]; });
155  max_per_trigger.push_back(tot_tr_obj_pt_eta_phi.at(0));
156  }
157  }
158  //we know that at least a trigger fired
159  //find the total max
160  std::sort(max_per_trigger.begin(),
161  max_per_trigger.end(),
162  [](const std::array<float, 5>& a, const std::array<float, 5>& b) { return a[0] > b[0]; });
163  return max_per_trigger.at(0);
164 }
165 
166 // ------------ method called on each new Event ------------
168  using namespace std;
169  using namespace edm;
170  using namespace reco;
171  using namespace trigger;
172  // using namespace PhysicsTools;
173 
174  test_ev++;
175  //Get a few collections to apply basic electron ID
176  //Get electrons
178  iEvent.getByToken(electronsToken_, electrons);
179  //get bdt values
180  edm::Handle<edm::ValueMap<float>> ele_mva_wp_biased;
181  iEvent.getByToken(eleBWPToken_, ele_mva_wp_biased);
182  edm::Handle<edm::ValueMap<float>> ele_mva_wp_unbiased;
183  iEvent.getByToken(eleUnBWPToken_, ele_mva_wp_unbiased);
184  //get muons
186  iEvent.getByToken(muonsToken_, muons);
187  //Get conversions
189  iEvent.getByToken(conversionsToken_, conversions);
190  // Get the beam spot
191  edm::Handle<reco::BeamSpot> theBeamSpot;
192  iEvent.getByToken(beamSpotToken_, theBeamSpot);
193  //Get vertices
195  iEvent.getByToken(vtxToken_, vertices);
196  //continue if there are no vertices
197  if (vertices->empty())
198  return false;
200  iEvent.getByToken(Tracks_, tracks);
202  iEvent.getByToken(trgresultsToken_, trigResults);
203  edm::ESHandle<MagneticField> bFieldHandle;
204  iSetup.get<IdealMagneticFieldRecord>().get(bFieldHandle);
205  KalmanVertexFitter theKalmanFitter(false);
206  TransientVertex LLvertex;
207 
208  // trigger1=0; trigger2=0; trigger3=0; trigger4=0; trigger5=0; trigger6=0;
209  nmuons = 0;
210  nel = 0;
211  ntracks = 0;
212 
213  SelectedMu_index = -1;
215  muon_pt.clear();
216  muon_eta.clear();
217  muon_phi.clear();
218  Result = false;
219  el_pt.clear();
220  el_eta.clear();
221  el_phi.clear();
222  Trk_container.clear();
223  MuTracks.clear();
224  ElTracks.clear();
225  object_container.clear();
226  object_id.clear();
227  cleanedTracks.clear();
228  Epair_ObjectId.clear();
229  muon_soft.clear();
230  muon_medium.clear();
231  muon_tight.clear();
232  Epair_ObjectIndex.clear();
233  cleanedObjTracks.clear();
234  cleanedPairTracks.clear();
235  Epair_ObjectIndex.clear();
236  Epair_ObjectId.clear();
237  Epair_TrkIndex.clear();
238  //internal stuff
240  std::array<float, 5> SelectedTrgObj_PtEtaPhiCharge{{-999, -999, -999, -999, -999}};
241  vertex_point.SetCoordinates(-1 * std::numeric_limits<float>::max(),
244  for (const reco::Vertex& vtx : *vertices) {
245  bool isFake = vtx.isFake();
246  if (isFake)
247  continue;
248  vertex_point.SetCoordinates(vtx.x(), vtx.y(), vtx.z());
250  break;
251  }
253  return false;
254 
255  beam_x = theBeamSpot->x0();
256  beam_y = theBeamSpot->y0();
257  beam_z = theBeamSpot->z0();
258  if (!hltFired(iEvent, iSetup, HLTPath_))
259  return false;
260 
263  MuTracks.clear();
264  object_container.clear();
265  object_id.clear();
266  nmuons = 0;
267  for (const reco::Muon& mu : *muons) {
268  if (fabs(mu.eta()) > EtaTrack_Cut)
269  continue;
270  //find triggering muon
271  float deltaRmu = deltaR(mu.eta(), mu.phi(), SelectedTrgObj_PtEtaPhiCharge[1], SelectedTrgObj_PtEtaPhiCharge[2]);
272  if (deltaRmu < MuTrgMatchCone && SelectedMu_DR > deltaRmu) {
274  ZvertexTrg = mu.vz();
275  }
276  //save muons that we want to skim
277  if (!SkimOnlyElectrons) {
278  bool tight = false, soft = false;
279  if (vertices.isValid()) {
280  tight = isTightMuonCustom(*(&mu), (*vertices)[0]);
281  soft = muon::isSoftMuon(*(&mu), (*vertices)[0]);
282  }
283  const Track* mutrack = mu.bestTrack();
284  muon_medium.push_back(isMediumMuonCustom(*(&mu)));
285  muon_tight.push_back(tight);
286  muon_soft.push_back(soft);
287  muon_pt.push_back(mu.pt());
288  muon_eta.push_back(mu.eta());
289  muon_phi.push_back(mu.phi());
290  auto muTrack = std::make_shared<reco::Track>(*mutrack);
291  MuTracks.push_back(muTrack);
292  object_container.push_back(nmuons);
293  object_id.push_back(13);
294  nmuons++;
295  }
296  }
297 
299  return false;
300  }
301 
302  //Save electrons we want to skim
303  ElTracks.clear();
304  if (!SkimOnlyMuons) {
305  unsigned int count_el = -1;
306  for (const reco::GsfElectron& el : *electrons) {
307  count_el++;
308  bool passConvVeto = !ConversionTools::hasMatchedConversion(*(&el), *conversions, theBeamSpot->position());
309  if (!passConvVeto)
310  continue;
311  reco::GsfTrackRef seed = el.gsfTrack();
312  if (seed.isNull())
313  continue;
314  if ((*ele_mva_wp_biased)[seed] < BiasedWP)
315  continue;
316  if ((*ele_mva_wp_unbiased)[seed] < UnbiasedWP)
317  continue;
318  const Track* eltrack = el.bestTrack();
319  if (fabs(eltrack->eta()) > EtaTrack_Cut)
320  continue;
321  if (eltrack->pt() < PtEl_Cut)
322  continue;
323  auto ElTrack = std::make_shared<reco::Track>(*eltrack);
324  ElTracks.push_back(ElTrack);
325  object_container.push_back(nel);
326  el_pt.push_back(eltrack->pt());
327  el_eta.push_back(eltrack->eta());
328  el_phi.push_back(eltrack->phi());
329  nel++;
330  object_id.push_back(11);
331  }
332  }
333 
334  //Save tracks we want to skim: used both as mu or e candidate
335  cleanedTracks.clear();
336  trk_index = 0;
337  for (const reco::Track& trk : *tracks) {
338  if (!trk.quality(Track::highPurity))
339  continue;
340  if (trk.pt() < PtTrack_Cut)
341  continue;
342  if (fabs(trk.eta()) > EtaTrack_Cut)
343  continue;
344  if (trk.charge() == 0)
345  continue;
346  if (trk.normalizedChi2() > MaxChi2Track_Cut || trk.normalizedChi2() < MinChi2Track_Cut)
347  continue;
348  if (fabs(trk.dxy()) / trk.dxyError() < TrackSdxy_Cut)
349  continue;
351  if (fabs(ZvertexTrg - trk.vz()) > TrackMuDz_Cut)
352  continue;
353  if (deltaR(trk.eta(), trk.phi(), SelectedTrgObj_PtEtaPhiCharge[1], SelectedTrgObj_PtEtaPhiCharge[2]) <
355  continue;
356  }
357  //assignments
358  auto cleanTrack = std::make_shared<reco::Track>(trk);
359  cleanedTracks.push_back(cleanTrack);
360  Trk_container.push_back(trk_index);
361  trk_index++;
362  }
363 
364  //create ll combination
365 
366  // fit track pairs
367  cleanedObjTracks.clear();
368  cleanedPairTracks.clear();
369  TLorentzVector vel1, vel2;
370  std::vector<std::shared_ptr<reco::Track>> cleanedObjects;
371  //add tracks of objects
372  if (!SkimOnlyElectrons) {
373  for (auto& vec : MuTracks)
374  cleanedObjects.push_back(vec);
375  }
376 
377  if (!SkimOnlyMuons) {
378  for (auto& vec : ElTracks)
379  cleanedObjects.push_back(vec);
380  }
381 
382  if (cleanedObjects.empty())
383  return false;
384 
385  for (auto& obj : cleanedObjects) {
386  auto tranobj = std::make_shared<reco::TransientTrack>(reco::TransientTrack(*obj, &(*bFieldHandle)));
387  unsigned int iobj = &obj - &cleanedObjects[0];
388  unsigned int index = object_container.at(iobj);
389  float massLep = 0.0005;
390  if (object_id.at(iobj) == 13)
391  massLep = 0.105;
392  //posible cut in mu quality
393  if (object_id.at(iobj) == 13 && QualMu_Cut == 1 && !muon_soft.at(index))
394  continue;
395  if (object_id.at(iobj) == 13 && QualMu_Cut == 2 && !muon_medium.at(index))
396  continue;
397  if (object_id.at(iobj) == 13 && QualMu_Cut == 3 && !muon_tight.at(index))
398  continue;
399  // take the corresponding lepton track for lorentz vector
400  vel1.SetPtEtaPhiM(obj->pt(), obj->eta(), obj->phi(), massLep);
401  if (object_id.at(iobj) == 13 && vel1.Pt() < PtMu_Cut)
402  continue;
403  for (auto& trk2 : cleanedTracks) {
404  unsigned int itrk2 = &trk2 - &cleanedTracks[0];
405  //opposite sign
406  if (obj->charge() * trk2->charge() == 1)
407  continue;
408  if (ObjPtLargerThanTrack && vel1.Pt() < trk2->pt())
409  continue;
410  vel2.SetPtEtaPhiM(trk2->pt(), trk2->eta(), trk2->phi(), massLep);
411  //probe side cuts
412  if (object_id.at(iobj) == 13 &&
415  continue;
416  if (object_id.at(iobj) == 11 &&
419  continue;
421  if (object_id.at(iobj) == 13 && fabs(ZvertexTrg - obj->vz()) > MuTrgMuDz_Cut)
422  continue;
423  if (object_id.at(iobj) == 11 && fabs(ZvertexTrg - obj->vz()) > ElTrgMuDz_Cut)
424  continue;
425  }
426  //additional cuts
427  float InvMassLepLep = (vel1 + vel2).M();
428  if (InvMassLepLep > MaxMee_Cut || InvMassLepLep < MinMee_Cut)
429  continue;
430  auto trantrk2 = std::make_shared<reco::TransientTrack>(reco::TransientTrack(*trk2, &(*bFieldHandle)));
431  std::vector<reco::TransientTrack> tempTracks;
432  tempTracks.reserve(2);
433  tempTracks.push_back(*tranobj);
434  tempTracks.push_back(*trantrk2);
435  LLvertex = theKalmanFitter.vertex(tempTracks);
436  if (!LLvertex.isValid())
437  continue;
438  if (ChiSquaredProbability(LLvertex.totalChiSquared(), LLvertex.degreesOfFreedom()) < Probee_Cut)
439  continue;
441  fabs(ZvertexTrg - LLvertex.position().z()) > EpairZvtx_Cut)
442  continue;
443  GlobalError err = LLvertex.positionError();
444  GlobalPoint Dispbeamspot(-1 * ((theBeamSpot->x0() - LLvertex.position().x()) +
445  (LLvertex.position().z() - theBeamSpot->z0()) * theBeamSpot->dxdz()),
446  -1 * ((theBeamSpot->y0() - LLvertex.position().y()) +
447  (LLvertex.position().z() - theBeamSpot->z0()) * theBeamSpot->dydz()),
448  0);
449  math::XYZVector pperp((vel1 + vel2).Px(), (vel1 + vel2).Py(), 0);
450  math::XYZVector vperp(Dispbeamspot.x(), Dispbeamspot.y(), 0.);
451  float tempCos = vperp.Dot(pperp) / (vperp.R() * pperp.R());
452  if (tempCos < Cosee_Cut)
453  continue;
454  cleanedObjTracks.push_back(obj);
455  cleanedPairTracks.push_back(trk2);
456  Epair_ObjectIndex.push_back(object_container.at(iobj));
457  Epair_ObjectId.push_back(object_id.at(iobj));
458  Epair_TrkIndex.push_back(Trk_container.at(itrk2));
459  }
460  }
461 
462  // B recontrsuction
463  TLorentzVector vK;
464  for (unsigned int iobj = 0; iobj < cleanedObjTracks.size(); iobj++) {
465  auto objtrk = cleanedObjTracks.at(iobj);
466  auto pairtrk = cleanedPairTracks.at(iobj);
467  auto tranobj = std::make_shared<reco::TransientTrack>(reco::TransientTrack(*objtrk, &(*bFieldHandle)));
468  auto tranpair = std::make_shared<reco::TransientTrack>(reco::TransientTrack(*pairtrk, &(*bFieldHandle)));
469  //unsigned int index=Epair_ObjectIndex.at(iobj);
470  float massLep = 0.0005;
471  if (Epair_ObjectId.at(iobj) == 13)
472  massLep = 0.105;
473  vel1.SetPtEtaPhiM(objtrk->pt(), objtrk->eta(), objtrk->phi(), massLep);
474  vel2.SetPtEtaPhiM(pairtrk->pt(), pairtrk->eta(), pairtrk->phi(), massLep);
475  for (auto& trk : cleanedTracks) {
476  //reject track corresponding to mu or e
477  if (trk->charge() == objtrk->charge() &&
478  deltaR(objtrk->eta(), objtrk->phi(), trk->eta(), trk->phi()) < TrkObjExclusionCone)
479  continue;
480  if (trk->pt() < PtKTrack_Cut)
481  continue;
482  if (fabs(trk->dxy(vertex_point)) / trk->dxyError() < Ksdxy_Cut)
483  continue;
484  // skip the track that was used as mu or e
485  if (Epair_TrkIndex.at(iobj) == &trk - &cleanedTracks[0])
486  continue;
487  vK.SetPtEtaPhiM(trk->pt(), trk->eta(), trk->phi(), 0.493);
488  //final cuts
489  float InvMass = (vel1 + vel2 + vK).M();
490  if (InvMass > MaxMB_Cut || InvMass < MinMB_Cut)
491  continue;
492  if ((vel1 + vel2 + vK).Pt() < PtB_Cut)
493  continue;
494  auto trantrk = std::make_shared<reco::TransientTrack>(reco::TransientTrack(*trk, &(*bFieldHandle)));
495  std::vector<reco::TransientTrack> tempTracks;
496  tempTracks.reserve(3);
497  tempTracks.push_back(*tranobj);
498  tempTracks.push_back(*tranpair);
499  tempTracks.push_back(*trantrk);
500  LLvertex = theKalmanFitter.vertex(tempTracks);
501  if (!LLvertex.isValid())
502  continue;
503  if (ChiSquaredProbability(LLvertex.totalChiSquared(), LLvertex.degreesOfFreedom()) < ProbeeK_Cut)
504  continue;
505  GlobalError err = LLvertex.positionError();
506  GlobalPoint Dispbeamspot(-1 * ((theBeamSpot->x0() - LLvertex.position().x()) +
507  (LLvertex.position().z() - theBeamSpot->z0()) * theBeamSpot->dxdz()),
508  -1 * ((theBeamSpot->y0() - LLvertex.position().y()) +
509  (LLvertex.position().z() - theBeamSpot->z0()) * theBeamSpot->dydz()),
510  0);
511  math::XYZVector pperp((vel1 + vel2 + vK).Px(), (vel1 + vel2 + vK).Py(), 0);
512  math::XYZVector vperp(Dispbeamspot.x(), Dispbeamspot.y(), 0.);
513  float tempCos = vperp.Dot(pperp) / (vperp.R() * pperp.R());
514  if (tempCos < CoseeK_Cut)
515  continue;
516  if (SLxy_Cut > Dispbeamspot.perp() / sqrt(err.rerr(Dispbeamspot)))
517  continue;
518  Result = true;
519  break;
520  }
521  if (Result)
522  break;
523  }
524  //decission
525  return Result;
526 }
527 
528 // ------------ method called once each stream before processing any runs, lumis or events ------------
530 
531 // ------------ method called once each stream after processing all runs, lumis and events ------------
533 
534 // ------------ method called when starting to processes a run ------------
535 /*
536 void
537 LeptonSkimming::beginRun(edm::Run const&, edm::EventSetup const&)
538 {
539 }
540 */
541 
542 // ------------ method called when ending the processing of a run ------------
543 /*
544 void
545 LeptonSkimming::endRun(edm::Run const&, edm::EventSetup const&)
546 {
547 }
548 */
549 
550 // ------------ method called when starting to processes a luminosity block ------------
551 /*
552 void
553 LeptonSkimming::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
554 {
555 }
556 */
557 
558 // ------------ method called when ending the processing of a luminosity block ------------
559 /*
560 void
561 LeptonSkimming::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
562 {
563 }
564 */
565 
566 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
568  //The following says we do not know what parameters are allowed so do no validation
569  // Please change this to state exactly what you do use, even if it is no parameters
571  desc.setUnknown();
572  descriptions.addDefault(desc);
573 }
574 //define this as a plug-in
trigger::TriggerObject::phi
float phi() const
Definition: TriggerObject.h:54
edm::StreamID
Definition: StreamID.h:30
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
LeptonSkimming::object_container
std::vector< unsigned int > object_container
Definition: LeptonSkimming.h:133
LeptonSkimming::EpairZvtx_Cut
double EpairZvtx_Cut
Definition: LeptonSkimming.h:156
KalmanVertexFitter::vertex
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
Definition: KalmanVertexFitter.h:49
LeptonSkimming::Result
bool Result
Definition: LeptonSkimming.h:112
LeptonSkimming::cleanedObjTracks
std::vector< std::shared_ptr< reco::Track > > cleanedObjTracks
Definition: LeptonSkimming.h:127
LeptonSkimming::nmuons
unsigned int nmuons
Definition: LeptonSkimming.h:135
LeptonSkimming::ElTrgExclusionCone
double ElTrgExclusionCone
Definition: LeptonSkimming.h:168
LeptonSkimming::Ksdxy_Cut
double Ksdxy_Cut
Definition: LeptonSkimming.h:157
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
LeptonSkimming::trigobjectsToken_
edm::EDGetTokenT< trigger::TriggerEvent > trigobjectsToken_
Definition: LeptonSkimming.h:109
muon::isSoftMuon
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
Definition: MuonSelectors.cc:916
LeptonSkimming::ElTrgMuDz_Cut
double ElTrgMuDz_Cut
Definition: LeptonSkimming.h:171
isTightMuonCustom
bool isTightMuonCustom(const reco::Muon &recoMu, const reco::Vertex recoVtx)
Definition: MuonID.h:36
LeptonSkimming::beam_z
float beam_z
Definition: LeptonSkimming.h:113
LeptonSkimming::SkimOnlyElectrons
bool SkimOnlyElectrons
Definition: LeptonSkimming.h:177
isMediumMuonCustom
bool isMediumMuonCustom(const reco::Muon &recoMu)
Definition: MuonID.h:27
LeptonSkimming::TrackSdxy_Cut
double TrackSdxy_Cut
Definition: LeptonSkimming.h:148
TransientVertex::isValid
bool isValid() const
Definition: TransientVertex.h:195
LeptonSkimming::MuTrgMuDz_Cut
double MuTrgMuDz_Cut
Definition: LeptonSkimming.h:170
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
LeptonSkimming::ntracks
unsigned int ntracks
Definition: LeptonSkimming.h:135
LeptonSkimming::ElTracks
std::vector< std::shared_ptr< reco::Track > > ElTracks
Definition: LeptonSkimming.h:130
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
reco::BeamSpot::z0
double z0() const
z coordinate
Definition: BeamSpot.h:65
ChiSquaredProbability
float ChiSquaredProbability(double chiSquared, double nrDOF)
Definition: ChiSquaredProbability.cc:13
edm
HLT enums.
Definition: AlignableModifier.h:19
LeptonSkimming::HLTPath_
std::vector< string > HLTPath_
Definition: LeptonSkimming.h:110
LeptonSkimming::MinMB_Cut
double MinMB_Cut
Definition: LeptonSkimming.h:145
LeptonSkimming::TrgExclusionCone
double TrgExclusionCone
Definition: LeptonSkimming.h:161
LeptonSkimming
Definition: LeptonSkimming.h:85
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
LeptonSkimming::vertex_point
reco::TrackBase::Point vertex_point
Definition: LeptonSkimming.h:125
LeptonSkimming::TrkObjExclusionCone
double TrkObjExclusionCone
Definition: LeptonSkimming.h:169
TransientVertex::position
GlobalPoint position() const
Definition: TransientVertex.h:169
LeptonSkimming::ProbeeK_Cut
double ProbeeK_Cut
Definition: LeptonSkimming.h:158
LeptonSkimming::muon_soft
std::vector< float > muon_soft
Definition: LeptonSkimming.h:116
LeptonSkimming::muonsToken_
edm::EDGetToken muonsToken_
Definition: LeptonSkimming.h:103
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
LeptonSkimming::BiasedWP
double BiasedWP
Definition: LeptonSkimming.h:174
LeptonSkimming::trgresultsToken_
edm::EDGetTokenT< edm::TriggerResults > trgresultsToken_
Definition: LeptonSkimming.h:108
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::BeamSpot::dxdz
double dxdz() const
dxdz slope
Definition: BeamSpot.h:78
LeptonSkimming::cleanedPairTracks
std::vector< std::shared_ptr< reco::Track > > cleanedPairTracks
Definition: LeptonSkimming.h:128
LeptonSkimming.h
LeptonSkimming::PtB_Cut
double PtB_Cut
Definition: LeptonSkimming.h:163
edm::Handle< edm::TriggerResults >
LeptonSkimming::MinChi2Track_Cut
double MinChi2Track_Cut
Definition: LeptonSkimming.h:139
LeptonSkimming::conversionsToken_
edm::EDGetTokenT< reco::ConversionCollection > conversionsToken_
Definition: LeptonSkimming.h:107
Muon
Definition: Muon.py:1
LeptonSkimming::el_phi
std::vector< float > el_phi
Definition: LeptonSkimming.h:116
LeptonSkimming::MaxMB_Cut
double MaxMB_Cut
Definition: LeptonSkimming.h:144
LeptonSkimming::beginStream
void beginStream(edm::StreamID) override
Definition: LeptonSkimming.cc:529
reco::Muon
Definition: Muon.h:27
edm::Ref< GsfTrackCollection >
reco::ConversionCollection
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
LeptonSkimming::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: LeptonSkimming.cc:567
fileCollector.seed
seed
Definition: fileCollector.py:127
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:637
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
LeptonSkimming::EtaTrack_Cut
double EtaTrack_Cut
Definition: LeptonSkimming.h:138
trigger::TriggerObject::pt
float pt() const
Definition: TriggerObject.h:52
LeptonSkimming::LeptonSkimming
LeptonSkimming(const edm::ParameterSet &)
Definition: LeptonSkimming.cc:26
LeptonSkimming::trk_index
unsigned int trk_index
Definition: LeptonSkimming.h:124
LeptonSkimming::muon_eta
std::vector< float > muon_eta
Definition: LeptonSkimming.h:116
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
LeptonSkimming::eleUnBWPToken_
edm::EDGetTokenT< edm::ValueMap< float > > eleUnBWPToken_
Definition: LeptonSkimming.h:102
LeptonSkimming::PtEl_Cut
double PtEl_Cut
Definition: LeptonSkimming.h:166
LeptonSkimming::UnbiasedWP
double UnbiasedWP
Definition: LeptonSkimming.h:175
LeptonSkimming::Epair_ObjectId
std::vector< unsigned int > Epair_ObjectId
Definition: LeptonSkimming.h:117
edm::HLTGlobalStatus::size
unsigned int size() const
Get number of paths stored.
Definition: HLTGlobalStatus.h:35
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
LeptonSkimming::hltFired
bool hltFired(const edm::Event &iEvent, const edm::EventSetup &iSetup, std::vector< string > HLTPath)
Definition: LeptonSkimming.cc:91
ConversionTools::hasMatchedConversion
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)
Definition: ConversionTools.cc:181
reco::BeamSpot
Definition: BeamSpot.h:21
LeptonSkimming::SkimOnlyMuons
bool SkimOnlyMuons
Definition: LeptonSkimming.h:176
reco::Track
Definition: Track.h:27
edm::ESHandle< MagneticField >
LeptonSkimming::Trk_container
std::vector< unsigned int > Trk_container
Definition: LeptonSkimming.h:133
LeptonSkimming::beam_x
float beam_x
Definition: LeptonSkimming.h:113
LeptonSkimming::MuTracks
std::vector< std::shared_ptr< reco::Track > > MuTracks
Definition: LeptonSkimming.h:129
reco::GsfElectron
Definition: GsfElectron.h:34
reco::BeamSpot::position
const Point & position() const
position
Definition: BeamSpot.h:59
LeptonSkimming::el_pt
std::vector< float > el_pt
Definition: LeptonSkimming.h:116
LeptonSkimming::eleBWPToken_
edm::EDGetTokenT< edm::ValueMap< float > > eleBWPToken_
Definition: LeptonSkimming.h:101
Point3DBase< float, GlobalTag >
LeptonSkimming::Probee_Cut
double Probee_Cut
Definition: LeptonSkimming.h:151
b
double b
Definition: hdecay.h:118
reco::TrackBase::phi
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
trigger::TriggerObject
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LeptonSkimming::QualMu_Cut
double QualMu_Cut
Definition: LeptonSkimming.h:165
LeptonSkimming::endStream
void endStream() override
Definition: LeptonSkimming.cc:532
EgHLTOffTrigSelection_cfi.trigName
trigName
Definition: EgHLTOffTrigSelection_cfi.py:8
LeptonSkimming::Tracks_
edm::EDGetToken Tracks_
Definition: LeptonSkimming.h:104
LeptonSkimming::MaxMee_Cut
double MaxMee_Cut
Definition: LeptonSkimming.h:142
LeptonSkimming::cleanedTracks
std::vector< std::shared_ptr< reco::Track > > cleanedTracks
Definition: LeptonSkimming.h:131
LeptonSkimming::Cosee_Cut
double Cosee_Cut
Definition: LeptonSkimming.h:152
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
edm::ParameterSet
Definition: ParameterSet.h:47
LeptonSkimming::MuTrgMatchCone
double MuTrgMatchCone
Definition: LeptonSkimming.h:154
a
double a
Definition: hdecay.h:119
LeptonSkimming::ZvertexTrg
float ZvertexTrg
Definition: LeptonSkimming.h:123
LeptonSkimming::beamSpotToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: LeptonSkimming.h:106
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LeptonSkimming::muon_pt
std::vector< float > muon_pt
Definition: LeptonSkimming.h:116
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
trigger::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
LeptonSkimming::MuTrkMinDR_Cut
double MuTrkMinDR_Cut
Definition: LeptonSkimming.h:141
reco::TrackBase::eta
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
trigger::TriggerObject::id
int id() const
getters
Definition: TriggerObject.h:51
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
iEvent
int iEvent
Definition: GenABIO.cc:224
LeptonSkimming::~LeptonSkimming
~LeptonSkimming() override
Definition: LeptonSkimming.cc:86
trigger::Keys
std::vector< size_type > Keys
Definition: TriggerTypeDefs.h:19
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
trigger::TriggerObject::eta
float eta() const
Definition: TriggerObject.h:53
LeptonSkimming::nel
unsigned int nel
Definition: LeptonSkimming.h:135
GlobalErrorBase< double, ErrorMatrixTag >
TransientVertex
Definition: TransientVertex.h:18
edm::EventSetup
Definition: EventSetup.h:58
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
LeptonSkimming::test_ev
int test_ev
Definition: LeptonSkimming.h:178
get
#define get
LeptonSkimming::ObjPtLargerThanTrack
bool ObjPtLargerThanTrack
Definition: LeptonSkimming.h:173
trigger::TriggerEvent::getObjects
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
LeptonSkimming::Epair_ObjectIndex
std::vector< unsigned int > Epair_ObjectIndex
Definition: LeptonSkimming.h:117
environment_file_cff.runParameters
runParameters
Definition: environment_file_cff.py:13
LeptonSkimming::muon_phi
std::vector< float > muon_phi
Definition: LeptonSkimming.h:116
reco::BeamSpot::dydz
double dydz() const
dydz slope
Definition: BeamSpot.h:80
LeptonSkimming::MuTrgExclusionCone
double MuTrgExclusionCone
Definition: LeptonSkimming.h:167
reco::BeamSpot::x0
double x0() const
x coordinate
Definition: BeamSpot.h:61
LeptonSkimming::object_id
std::vector< unsigned int > object_id
Definition: LeptonSkimming.h:133
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
LeptonSkimming::vtxToken_
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
Definition: LeptonSkimming.h:105
reco::TransientTrack
Definition: TransientTrack.h:19
LeptonSkimming::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: LeptonSkimming.cc:167
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
edm::ValueMap
Definition: ValueMap.h:107
LeptonSkimming::PtMu_Cut
double PtMu_Cut
Definition: LeptonSkimming.h:164
edm::TriggerNames
Definition: TriggerNames.h:55
LeptonSkimming::SelectedMu_DR
float SelectedMu_DR
Definition: LeptonSkimming.h:122
LeptonSkimming::SLxy_Cut
double SLxy_Cut
Definition: LeptonSkimming.h:162
muons_cff.highPurity
highPurity
Definition: muons_cff.py:136
LeptonSkimming::SkipIfNoMuMatch
bool SkipIfNoMuMatch
Definition: LeptonSkimming.h:155
LeptonSkimming::MinMee_Cut
double MinMee_Cut
Definition: LeptonSkimming.h:150
LeptonSkimming::SelectedTrgObj_PtEtaPhiCharge
std::vector< float > SelectedTrgObj_PtEtaPhiCharge
Definition: LeptonSkimming.h:119
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
LeptonSkimming::PtTrack_Cut
double PtTrack_Cut
Definition: LeptonSkimming.h:137
edm::HLTGlobalStatus::accept
bool accept() const
Has at least one path accepted the event?
Definition: HLTGlobalStatus.h:49
LeptonSkimming::beam_y
float beam_y
Definition: LeptonSkimming.h:113
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trigger
Definition: HLTPrescaleTableCond.h:8
pwdgSkimBPark_cfi.HLTPath
HLTPath
Definition: pwdgSkimBPark_cfi.py:19
LeptonSkimming::HLTFilter_
std::vector< string > HLTFilter_
Definition: LeptonSkimming.h:110
LeptonSkimming::hltObject
std::array< float, 5 > hltObject(const edm::Event &iEvent, const edm::EventSetup &iSetup, std::vector< string > Seed)
Definition: LeptonSkimming.cc:116
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
LeptonSkimming::electronsToken_
edm::EDGetToken electronsToken_
Definition: LeptonSkimming.h:100
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
pwdgSkimBPark_cfi.conversions
conversions
Definition: pwdgSkimBPark_cfi.py:10
LeptonSkimming::Epair_TrkIndex
std::vector< unsigned int > Epair_TrkIndex
Definition: LeptonSkimming.h:117
reco::BeamSpot::y0
double y0() const
y coordinate
Definition: BeamSpot.h:63
edm::Event
Definition: Event.h:73
LeptonSkimming::PtKTrack_Cut
double PtKTrack_Cut
Definition: LeptonSkimming.h:143
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
LeptonSkimming::CoseeK_Cut
double CoseeK_Cut
Definition: LeptonSkimming.h:159
LeptonSkimming::muon_tight
std::vector< float > muon_tight
Definition: LeptonSkimming.h:116
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
LeptonSkimming::MaxChi2Track_Cut
double MaxChi2Track_Cut
Definition: LeptonSkimming.h:140
edm::InputTag
Definition: InputTag.h:15
LeptonSkimming::el_eta
std::vector< float > el_eta
Definition: LeptonSkimming.h:116
edm::TriggerResults
Definition: TriggerResults.h:35
reco::Vertex
Definition: Vertex.h:35
LeptonSkimming::muon_medium
std::vector< float > muon_medium
Definition: LeptonSkimming.h:116
TransientVertex::positionError
GlobalError positionError() const
Definition: TransientVertex.h:170
ZCounting_cff.TriggerEvent
TriggerEvent
Definition: ZCounting_cff.py:5
LeptonSkimming::TrackMuDz_Cut
double TrackMuDz_Cut
Definition: LeptonSkimming.h:160
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
KalmanVertexFitter
Definition: KalmanVertexFitter.h:22
LeptonSkimming::SelectedMu_index
int SelectedMu_index
Definition: LeptonSkimming.h:120