CMS 3D CMS Logo

MuScleFitMuonSelector.cc
Go to the documentation of this file.
5 
6 const double MuScleFitMuonSelector::mMu2 = 0.011163612;
7 const unsigned int MuScleFitMuonSelector::motherPdgIdArray[] = {23, 100553, 100553, 553, 100443, 443};
8 
10  const reco::Candidate* tempMuon = status3Muon;
11  // bool lastCopy = (static_cast<const reco::GenParticle*>(tempMuon))->isLastCopy(); // isLastCopy() likely not enough robust
12  bool isPromptFinalState = static_cast<const reco::GenParticle*>(tempMuon)
13  ->isPromptFinalState(); // pre-CMSSW_74X code: int status = tempStatus1Muon->status();
14  while (tempMuon == nullptr || tempMuon->numberOfDaughters() != 0) {
15  if (isPromptFinalState)
16  break; // pre-CMSSW_74X code: if (status == 1) break;
17  //std::vector<const reco::Candidate*> daughters;
18  for (unsigned int i = 0; i < tempMuon->numberOfDaughters(); ++i) {
19  if (tempMuon->daughter(i)->pdgId() == tempMuon->pdgId()) {
20  tempMuon = tempMuon->daughter(i);
21  isPromptFinalState = static_cast<const reco::GenParticle*>(tempMuon)
22  ->isPromptFinalState(); // pre-CMSSW_74X code: status = tempStatus1Muon->status();
23  break;
24  } else
25  continue;
26  } //for loop
27  } //while loop
28 
29  return tempMuon;
30 }
31 
33  const reco::Candidate* tempMuon = status3Muon;
34  bool lastCopy = static_cast<const reco::GenParticle*>(tempMuon)
35  ->isLastCopyBeforeFSR(); // pre-CMSSW_74X code: int status = tempStatus1Muon->status();
36  while (tempMuon == nullptr || tempMuon->numberOfDaughters() != 0) {
37  if (lastCopy)
38  break; // pre-CMSSW_74X code: if (status == 3) break;
39  //std::vector<const reco::Candidate*> daughters;
40  for (unsigned int i = 0; i < tempMuon->numberOfDaughters(); ++i) {
41  if (tempMuon->daughter(i)->pdgId() == tempMuon->pdgId()) {
42  tempMuon = tempMuon->daughter(i);
43  lastCopy = static_cast<const reco::GenParticle*>(tempMuon)
44  ->isLastCopyBeforeFSR(); // pre-CMSSW_74X code: status = tempStatus1Muon->status();
45  break;
46  } else
47  continue;
48  } //for loop
49  } //while loop
50 
51  return tempMuon;
52 }
53 
55  reco::TrackRef iTrack = aMuon->innerTrack();
56  const reco::HitPattern& p = iTrack->hitPattern();
57 
58  reco::TrackRef gTrack = aMuon->globalTrack();
59  const reco::HitPattern& q = gTrack->hitPattern();
60 
61  return ( //isMuonInAccept(aMuon) &&// no acceptance cuts!
62  iTrack->found() > 11 && gTrack->chi2() / gTrack->ndof() < 20.0 && q.numberOfValidMuonHits() > 0 &&
63  iTrack->chi2() / iTrack->ndof() < 4.0 && aMuon->muonID("TrackerMuonArbitrated") &&
64  aMuon->muonID("TMLastStationAngTight") && p.pixelLayersWithMeasurement() > 1 &&
65  std::abs(iTrack->dxy()) < 3.0 && //should be done w.r.t. PV!
66  std::abs(iTrack->dz()) < 15.0 //should be done w.r.t. PV!
67  );
68 }
69 
71  reco::TrackRef iTrack = aMuon->innerTrack();
72  const reco::HitPattern& p = iTrack->hitPattern();
73 
74  return ( //isMuonInAccept(aMuon) // no acceptance cuts!
75  iTrack->found() > 11 && iTrack->chi2() / iTrack->ndof() < 4.0 && aMuon->muonID("TrackerMuonArbitrated") &&
76  aMuon->muonID("TMLastStationAngTight") && p.pixelLayersWithMeasurement() > 1 &&
77  std::abs(iTrack->dxy()) < 3.0 && //should be done w.r.t. PV!
78  std::abs(iTrack->dz()) < 15.0 //should be done w.r.t. PV!
79  );
80 }
81 
82 // Note that at this level we save all the information. Events for which no suitable muon pair is found
83 // are removed from the tree (together with the gen and sim information) at a later stage.
84 // It would be better to remove them directly at this point.
86  std::vector<MuScleFitMuon>& muons,
87  std::vector<GenMuonPair>& genPair,
88  std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
91  if (!collAll.isValid()) {
92  edm::LogWarning("MuScleFitUtils") << "J/psi not present in event!";
93  }
94  std::vector<const pat::Muon*> collMuSel;
95 
96  //================onia cuts===========================/
97 
98  if (muonType_ <= -1 && PATmuons_) {
99  std::vector<const pat::CompositeCandidate*> collSelGG;
100  std::vector<const pat::CompositeCandidate*> collSelGT;
101  std::vector<const pat::CompositeCandidate*> collSelTT;
102  if (collAll.isValid()) {
103  for (std::vector<pat::CompositeCandidate>::const_iterator it = collAll->begin(); it != collAll->end(); ++it) {
104  const pat::CompositeCandidate* cand = &(*it);
105  // cout << "Now checking candidate of type " << theJpsiCat << " with pt = " << cand->pt() << endl;
106  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(cand->daughter("muon1"));
107  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(cand->daughter("muon2"));
108 
109  if ((muon1->charge() * muon2->charge()) > 0)
110  continue;
111  // global + global?
112  if (muon1->isGlobalMuon() && muon2->isGlobalMuon()) {
113  if (selGlobalMuon(muon1) && selGlobalMuon(muon2) && cand->userFloat("vProb") > 0.001) {
114  collSelGG.push_back(cand);
115  continue;
116  }
117  }
118  // global + tracker? (x2)
119  if (muon1->isGlobalMuon() && muon2->isTrackerMuon()) {
120  if (selGlobalMuon(muon1) && selTrackerMuon(muon2) && cand->userFloat("vProb") > 0.001) {
121  collSelGT.push_back(cand);
122  continue;
123  }
124  }
125  if (muon2->isGlobalMuon() && muon1->isTrackerMuon()) {
126  if (selGlobalMuon(muon2) && selTrackerMuon(muon1) && cand->userFloat("vProb") > 0.001) {
127  collSelGT.push_back(cand);
128  continue;
129  }
130  }
131  // tracker + tracker?
132  if (muon1->isTrackerMuon() && muon2->isTrackerMuon()) {
133  if (selTrackerMuon(muon1) && selTrackerMuon(muon2) && cand->userFloat("vProb") > 0.001) {
134  collSelTT.push_back(cand);
135  continue;
136  }
137  }
138  }
139  }
140  // Split them in independent collections if using muonType_ == -2, -3 or -4. Take them all if muonType_ == -1.
141  std::vector<reco::Track> tracks;
142  if (!collSelGG.empty()) {
143  //CHECK THAT THEY ARE ORDERED BY PT !!!!!!!!!!!!!!!!!!!!!!!
144  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(collSelGG[0]->daughter("muon1"));
145  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(collSelGG[0]->daughter("muon2"));
146  if (muonType_ == -1 || muonType_ == -2) {
147  tracks.push_back(*(muon1->innerTrack()));
148  tracks.push_back(*(muon2->innerTrack()));
149  collMuSel.push_back(muon1);
150  collMuSel.push_back(muon2);
151  }
152  } else if (collSelGG.empty() && !collSelGT.empty()) {
153  //CHECK THAT THEY ARE ORDERED BY PT !!!!!!!!!!!!!!!!!!!!!!!
154  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(collSelGT[0]->daughter("muon1"));
155  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(collSelGT[0]->daughter("muon2"));
156  if (muonType_ == -1 || muonType_ == -3) {
157  tracks.push_back(*(muon1->innerTrack()));
158  tracks.push_back(*(muon2->innerTrack()));
159  collMuSel.push_back(muon1);
160  collMuSel.push_back(muon2);
161  }
162  } else if (collSelGG.empty() && collSelGT.empty() && !collSelTT.empty()) {
163  //CHECK THAT THEY ARE ORDERED BY PT !!!!!!!!!!!!!!!!!!!!!!!
164  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(collSelTT[0]->daughter("muon1"));
165  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(collSelTT[0]->daughter("muon2"));
166  if (muonType_ == -1 || muonType_ == -4) {
167  tracks.push_back(*(muon1->innerTrack()));
168  tracks.push_back(*(muon2->innerTrack()));
169  collMuSel.push_back(muon1);
170  collMuSel.push_back(muon2);
171  }
172  }
173  if (tracks.size() != 2 && !tracks.empty()) {
174  std::cout << "ERROR strange number of muons selected by onia cuts!" << std::endl;
175  abort();
176  }
178  } else if ((muonType_ < 4 && muonType_ >= 0) || muonType_ >= 10) { // Muons (glb,sta,trk)
179  std::vector<reco::Track> tracks;
180  if (PATmuons_ == true) {
182  if (muonType_ == 0) {
183  // Take directly the muon
185  } else {
186  for (std::vector<pat::Muon>::const_iterator muon = allMuons->begin(); muon != allMuons->end(); ++muon) {
187  //std::cout<<"pat muon is global "<<muon->isGlobalMuon()<<std::endl;
189  }
191  }
192  } else {
194  if (muonType_ == 0) {
195  // Take directly the muon
197  } else {
198  for (std::vector<reco::Muon>::const_iterator muon = allMuons->begin(); muon != allMuons->end(); ++muon) {
200  }
202  }
203  }
204  } else if (muonType_ == 4) { //CaloMuons
206  std::vector<reco::Track> tracks;
207  for (std::vector<reco::CaloMuon>::const_iterator muon = caloMuons->begin(); muon != caloMuons->end(); ++muon) {
208  tracks.push_back(*(muon->track()));
209  }
211  }
212 
213  else if (muonType_ == 5) { // Inner tracker tracks
216  }
217  plotter->fillRec(muons);
218 
219  // Generation and simulation part
220  if (speedup_ == false) {
221  if (PATmuons_) {
222  // EM 2015.04.02 temporary fix to run on MINIAODSIM (which contains PAT muons) but not the "onia2MuMuPatTrkTrk" collection
223  // selectGeneratedMuons(collAll, collMuSel, genPair, plotter);
224  selectGenSimMuons(event, genPair, simPair, plotter);
225  } else {
226  selectGenSimMuons(event, genPair, simPair, plotter);
227  }
228  }
229 }
230 
233  const std::vector<const pat::Muon*>& collMuSel,
234  std::vector<GenMuonPair>& genPair,
236  reco::GenParticleCollection genPatParticles{};
237 
238  //explicitly for JPsi but can be adapted!!!!!
239  for (std::vector<pat::CompositeCandidate>::const_iterator it = collAll->begin(); it != collAll->end(); ++it) {
240  reco::GenParticleRef genJpsi = it->genParticleRef();
241  bool isMatched = (genJpsi.isAvailable() && genJpsi->pdgId() == 443);
242  if (isMatched) {
243  genPatParticles.push_back(*genJpsi.get());
244  }
245  }
246 
247  if (collMuSel.size() == 2) {
248  reco::GenParticleRef genMu1 = collMuSel[0]->genParticleRef();
249  reco::GenParticleRef genMu2 = collMuSel[1]->genParticleRef();
250  bool isMuMatched = (genMu1.isAvailable() && genMu2.isAvailable() && genMu1->pdgId() * genMu2->pdgId() == -169);
251  if (isMuMatched) {
252  genPatParticles.push_back(*genMu1.get());
253  genPatParticles.push_back(*genMu2.get());
254 
255  unsigned int motherId = 0;
256  if (genMu1->mother() != nullptr) {
257  motherId = genMu1->mother()->pdgId();
258  }
259  if (genMu1->pdgId() == 13)
260  genPair.push_back(GenMuonPair(genMu1.get()->p4(), genMu2.get()->p4(), motherId));
261  else
262  // genPair.push_back(std::make_pair(genMu2.get()->p4(),genMu1.get()->p4()) );
263  genPair.push_back(GenMuonPair(genMu2.get()->p4(), genMu1.get()->p4(), motherId));
264 
265  plotter->fillGen(genPatParticles, true);
266 
267  if (debug_ > 0)
268  std::cout << "Found genParticles in PAT" << std::endl;
269  } else {
270  std::cout << "No recomuon selected so no access to generated info" << std::endl;
271  // Fill it in any case, otherwise it will not be in sync with the event number
272  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
273  genPair.push_back(GenMuonPair(lorentzVector(0., 0., 0., 0.), lorentzVector(0., 0., 0., 0.), 0));
274  }
275  } else {
276  std::cout << "No recomuon selected so no access to generated info" << std::endl;
277  // Fill it in any case, otherwise it will not be in sync with the event number
278  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
279  genPair.push_back(GenMuonPair(lorentzVector(0., 0., 0., 0.), lorentzVector(0., 0., 0., 0.), 0));
280  }
281  if (debug_ > 0) {
282  std::cout << "genParticles:" << std::endl;
283  // std::cout << genPair.back().first << " , " << genPair.back().second << std::endl;
284  std::cout << genPair.back().mu1 << " , " << genPair.back().mu2 << std::endl;
285  }
286 }
287 
289  std::vector<GenMuonPair>& genPair,
290  std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
292  // Find and store in histograms the generated and simulated resonance and muons
293  // ----------------------------------------------------------------------------
294  edm::Handle<edm::HepMCProduct> evtMC = event.getHandle(evtMCToken_);
296 
297  // Fill gen information only in the first loop
298  bool ifHepMC = false;
299  if (evtMC.isValid()) {
300  genPair.push_back(findGenMuFromRes(evtMC.product()));
301  plotter->fillGen(*evtMC, sherpa_);
302  ifHepMC = true;
303  if (debug_ > 0)
304  std::cout << "Found hepMC" << std::endl;
305  } else if (genParticles.isValid()) {
306  genPair.push_back(findGenMuFromRes(genParticles.product()));
307  plotter->fillGen(*genParticles);
308  if (debug_ > 0)
309  std::cout << "Found genParticles" << std::endl;
310  } else {
311  std::cout << "ERROR "
312  << "non generation info and speedup true!!!!!!!!!!!!" << std::endl;
313  // Fill it in any case, otherwise it will not be in sync with the event number
314  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
315  genPair.push_back(GenMuonPair(lorentzVector(0., 0., 0., 0.), lorentzVector(0., 0., 0., 0.), 0));
316  }
317  if (debug_ > 0) {
318  std::cout << "genParticles:" << std::endl;
319  std::cout << genPair.back().mu1 << " , " << genPair.back().mu2 << std::endl;
320  }
321  selectSimulatedMuons(event, ifHepMC, evtMC, simPair, plotter);
322 }
323 
325  const bool ifHepMC,
327  std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
330  bool simTracksFound = false;
331  if (simTracks.isValid()) {
332  plotter->fillSim(simTracks);
333  if (ifHepMC) {
334  simPair.push_back(findSimMuFromRes(evtMC, simTracks));
335  simTracksFound = true;
336  plotter->fillGenSim(evtMC, simTracks);
337  }
338  } else {
339  std::cout << "SimTracks not existent" << std::endl;
340  }
341  if (!simTracksFound) {
342  simPair.push_back(std::make_pair(lorentzVector(0., 0., 0., 0.), lorentzVector(0., 0., 0., 0.)));
343  }
344 }
345 
347  const HepMC::GenEvent* Evt = evtMC->GetEvent();
348  GenMuonPair muFromRes;
349  //Loop on generated particles
350  for (HepMC::GenEvent::particle_const_iterator part = Evt->particles_begin(); part != Evt->particles_end(); part++) {
351  if (std::abs((*part)->pdg_id()) == 13 && (*part)->status() == 1) {
352  bool fromRes = false;
353  unsigned int motherPdgId = 0;
354  for (HepMC::GenVertex::particle_iterator mother = (*part)->production_vertex()->particles_begin(HepMC::ancestors);
355  mother != (*part)->production_vertex()->particles_end(HepMC::ancestors);
356  ++mother) {
357  motherPdgId = (*mother)->pdg_id();
358 
359  // For sherpa the resonance is not saved. The muons from the resonance can be identified
360  // by having as mother a muon of status 3.
361  if (sherpa_) {
362  if (motherPdgId == 13 && (*mother)->status() == 3)
363  fromRes = true;
364  } else {
365  for (int ires = 0; ires < 6; ++ires) {
366  if (motherPdgId == motherPdgIdArray[ires] && resfind_[ires])
367  fromRes = true;
368  }
369  }
370  }
371  if (fromRes) {
372  if ((*part)->pdg_id() == 13) {
373  // muFromRes.first = (*part)->momentum();
374  muFromRes.mu1 = (lorentzVector(
375  (*part)->momentum().px(), (*part)->momentum().py(), (*part)->momentum().pz(), (*part)->momentum().e()));
376  } else {
377  muFromRes.mu2 = (lorentzVector(
378  (*part)->momentum().px(), (*part)->momentum().py(), (*part)->momentum().pz(), (*part)->momentum().e()));
379  }
380  muFromRes.motherId = motherPdgId;
381  }
382  }
383  }
384  return muFromRes;
385 }
386 
387 // std::pair<lorentzVector, lorentzVector> MuScleFitMuonSelector::findGenMuFromRes( const reco::GenParticleCollection* genParticles)
389  // std::pair<lorentzVector,lorentzVector> muFromRes;
390  GenMuonPair muFromRes;
391 
392  //Loop on generated particles
393  if (debug_ > 0)
394  std::cout << "Starting loop on " << genParticles->size() << " genParticles" << std::endl;
395  for (reco::GenParticleCollection::const_iterator part = genParticles->begin(); part != genParticles->end(); ++part) {
396  if (debug_ > 0)
397  std::cout << "genParticle has pdgId = " << std::abs(part->pdgId()) << " and status = " << part->status()
398  << std::endl;
399  if (std::abs(part->pdgId()) == 13) { // && part->status()==3) {
400  bool fromRes = false;
401  unsigned int motherPdgId = part->mother()->pdgId();
402  if (debug_ > 0) {
403  std::cout << "Found a muon with mother: " << motherPdgId << std::endl;
404  }
405  for (int ires = 0; ires < 6; ++ires) {
406  // if( motherPdgId == motherPdgIdArray[ires] && resfind_[ires] ) fromRes = true; // changed by EM 2015.07.30
407  // begin of comment
408  // the list of resonances motherPdgIdArray does not contain the photon (PdgId = 21) while ~1% of the
409  // mu+mu- events in the range [50,120] GeV has a photon as the mother.
410  // It needs to be fixed without spoiling the logic of the selection of different resonances
411  // e.g. mixing up onia etc.
412  // end of comment
413  if ((motherPdgId == motherPdgIdArray[ires] && resfind_[ires]) || motherPdgId == 21)
414  fromRes = true;
415  }
416  if (fromRes) {
417  if (debug_ > 0)
418  std::cout << "fromRes = true, motherPdgId = " << motherPdgId << std::endl;
419  const reco::Candidate* status3Muon = &(*part);
420  const reco::Candidate* status1Muon = getStatus1Muon(status3Muon);
421  if (part->pdgId() == 13) {
422  if (status1Muon->p4().pt() != 0)
423  muFromRes.mu1 = MuScleFitMuon(status1Muon->p4(), -1);
424  else
425  muFromRes.mu1 = MuScleFitMuon(status3Muon->p4(), -1);
426  if (debug_ > 0)
427  std::cout << "Found a genMuon - : " << muFromRes.mu1 << std::endl;
428  // muFromRes.first = (lorentzVector(status1Muon->p4().px(),status1Muon->p4().py(),
429  // status1Muon->p4().pz(),status1Muon->p4().e()));
430  } else {
431  if (status1Muon->p4().pt() != 0)
432  muFromRes.mu2 = MuScleFitMuon(status1Muon->p4(), +1);
433  else
434  muFromRes.mu2 = MuScleFitMuon(status3Muon->p4(), +1);
435  if (debug_ > 0)
436  std::cout << "Found a genMuon + : " << muFromRes.mu2 << std::endl;
437  // muFromRes.second = (lorentzVector(status1Muon->p4().px(),status1Muon->p4().py(),
438  // status1Muon->p4().pz(),status1Muon->p4().e()));
439  }
440  muFromRes.motherId = motherPdgId;
441  }
442  }
443  }
444  return muFromRes;
445 }
446 
447 std::pair<lorentzVector, lorentzVector> MuScleFitMuonSelector::findSimMuFromRes(
449  //Loop on simulated tracks
450  std::pair<lorentzVector, lorentzVector> simMuFromRes;
451  for (edm::SimTrackContainer::const_iterator simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack) {
452  //Chose muons
453  if (std::abs((*simTrack).type()) == 13) {
454  //If tracks from IP than find mother
455  if ((*simTrack).genpartIndex() > 0) {
456  HepMC::GenParticle* gp = evtMC->GetEvent()->barcode_to_particle((*simTrack).genpartIndex());
457  if (gp != nullptr) {
458  for (HepMC::GenVertex::particle_iterator mother = gp->production_vertex()->particles_begin(HepMC::ancestors);
459  mother != gp->production_vertex()->particles_end(HepMC::ancestors);
460  ++mother) {
461  bool fromRes = false;
462  unsigned int motherPdgId = (*mother)->pdg_id();
463  for (int ires = 0; ires < 6; ++ires) {
464  if ((motherPdgId == motherPdgIdArray[ires] && resfind_[ires]) || motherPdgId == 21)
465  fromRes = true;
466  }
467  if (fromRes) {
468  if (gp->pdg_id() == 13)
469  simMuFromRes.first = lorentzVector(simTrack->momentum().px(),
470  simTrack->momentum().py(),
471  simTrack->momentum().pz(),
472  simTrack->momentum().e());
473  else
474  simMuFromRes.second = lorentzVector(simTrack->momentum().px(),
475  simTrack->momentum().py(),
476  simTrack->momentum().pz(),
477  simTrack->momentum().e());
478  }
479  }
480  }
481  // else LogDebug("MuScleFitUtils") << "WARNING: no matching genParticle found for simTrack" << std::endl;
482  }
483  }
484  }
485  return simMuFromRes;
486 }
Analysis-level particle class.
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::pair< lorentzVector, lorentzVector > findSimMuFromRes(const edm::Handle< edm::HepMCProduct > &evtMC, const edm::Handle< edm::SimTrackContainer > &simTracks)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
void selectMuons(const edm::Event &event, std::vector< MuScleFitMuon > &muons, std::vector< GenMuonPair > &genPair, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
Main method used to select muons of type specified by muonType_ from the collection specified by muon...
std::vector< MuScleFitMuon > fillMuonCollection(const std::vector< T > &tracks)
Template function used to convert the muon collection to a vector of reco::LeafCandidate.
T const * product() const
Definition: Handle.h:70
bool selTrackerMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select trackerMuons.
void selectGeneratedMuons(const edm::Handle< pat::CompositeCandidateCollection > &collAll, const std::vector< const pat::Muon *> &collMuSel, std::vector< GenMuonPair > &genPair, MuScleFitPlotter *plotter)
For PATmuons the generator information is read directly from the PAT object.
const edm::EDGetTokenT< edm::HepMCProduct > evtMCToken_
void selectSimulatedMuons(const edm::Event &event, const bool ifHepMC, edm::Handle< edm::HepMCProduct > evtMC, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
MuScleFitMuon mu1
Definition: GenMuonPair.h:51
const edm::EDGetTokenT< reco::CaloMuonCollection > caloMuonToken_
const edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
Int_t motherId
Definition: GenMuonPair.h:53
bool isTrackerMuon() const override
Definition: Muon.h:304
const edm::EDGetTokenT< pat::MuonCollection > patMuonToken_
reco::Particle::LorentzVector lorentzVector
Definition: GenMuonPair.h:9
static const unsigned int motherPdgIdArray[6]
static const double mMu2
virtual size_type numberOfDaughters() const =0
number of daughters
bool isAvailable() const
Definition: Ref.h:541
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isMatched(TrackingRecHit const &hit)
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
const edm::EDGetTokenT< edm::SimTrackContainer > simTrackToken_
virtual int pdgId() const =0
PDG identifier.
part
Definition: HCALResponse.h:20
GenMuonPair findGenMuFromRes(const reco::GenParticleCollection *genParticles)
void selectGenSimMuons(const edm::Event &event, std::vector< GenMuonPair > &genPair, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
reco::TrackRef globalTrack() const override
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:80
bool isValid() const
Definition: HandleBase.h:70
reco::TrackRef innerTrack() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:72
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
bool selGlobalMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select globalMuons.
const edm::EDGetTokenT< reco::MuonCollection > recoMuonToken_
void takeSelectedMuonType(const T &muon, std::vector< reco::Track > &tracks)
Template function used to extract the selected muon type from the muon collection.
Log< level::Warning, false > LogWarning
const reco::Candidate * getStatus3Muon(const reco::Candidate *status3Muon)
const edm::EDGetTokenT< pat::CompositeCandidateCollection > onia2MuMuToken_
const std::vector< int > resfind_
Analysis-level muon class.
Definition: Muon.h:51
const edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
bool isGlobalMuon() const override
Definition: Muon.h:303
MuScleFitMuon mu2
Definition: GenMuonPair.h:52
Definition: event.py:1
int charge() const final
electric charge
const reco::Candidate * getStatus1Muon(const reco::Candidate *status3Muon)
bool muonID(const std::string &name) const
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector