CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
9 const reco::Candidate*
11  const reco::Candidate* tempStatus1Muon = status3Muon;
12  int status = tempStatus1Muon->status();
13  while(tempStatus1Muon == 0 || tempStatus1Muon->numberOfDaughters()!=0){
14  if (status == 1) break;
15  //std::vector<const reco::Candidate*> daughters;
16  for (unsigned int i=0; i<tempStatus1Muon->numberOfDaughters(); ++i){
17  if ( tempStatus1Muon->daughter(i)->pdgId()==tempStatus1Muon->pdgId() ){
18  tempStatus1Muon = tempStatus1Muon->daughter(i);
19  status = tempStatus1Muon->status();
20  break;
21  }else continue;
22  }//for loop
23  }//while loop
24 
25  return tempStatus1Muon;
26 }
27 
28 
30 {
31  reco::TrackRef iTrack = aMuon->innerTrack();
32  const reco::HitPattern& p = iTrack->hitPattern();
33 
34  reco::TrackRef gTrack = aMuon->globalTrack();
35  const reco::HitPattern& q = gTrack->hitPattern();
36 
37  return (//isMuonInAccept(aMuon) &&// no acceptance cuts!
38  iTrack->found() > 11 &&
39  gTrack->chi2()/gTrack->ndof() < 20.0 &&
40  q.numberOfValidMuonHits() > 0 &&
41  iTrack->chi2()/iTrack->ndof() < 4.0 &&
42  aMuon->muonID("TrackerMuonArbitrated") &&
43  aMuon->muonID("TMLastStationAngTight") &&
45  fabs(iTrack->dxy()) < 3.0 && //should be done w.r.t. PV!
46  fabs(iTrack->dz()) < 15.0 //should be done w.r.t. PV!
47  );
48 }
49 
51 {
52  reco::TrackRef iTrack = aMuon->innerTrack();
53  const reco::HitPattern& p = iTrack->hitPattern();
54 
55  return (//isMuonInAccept(aMuon) // no acceptance cuts!
56  iTrack->found() > 11 &&
57  iTrack->chi2()/iTrack->ndof() < 4.0 &&
58  aMuon->muonID("TrackerMuonArbitrated") &&
59  aMuon->muonID("TMLastStationAngTight") &&
61  fabs(iTrack->dxy()) < 3.0 && //should be done w.r.t. PV!
62  fabs(iTrack->dz()) < 15.0 //should be done w.r.t. PV!
63  );
64 }
65 
66 // Note that at this level we save all the information. Events for which no suitable muon pair is found
67 // are removed from the tree (together with the gen and sim information) at a later stage.
68 // It would be better to remove them directly at this point.
69 void MuScleFitMuonSelector::selectMuons(const edm::Event & event, std::vector<MuScleFitMuon> & muons,
70  std::vector<GenMuonPair> & genPair,
71  std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
72  MuScleFitPlotter * plotter)
73 {
75  try {event.getByLabel("onia2MuMuPatTrkTrk",collAll);}
76  catch (...) {std::cout << "J/psi not present in event!" << std::endl;}
77  std::vector<const pat::Muon*> collMuSel;
78 
79  //================onia cuts===========================/
80 
81  if( muonType_ <= -1 && PATmuons_) {
82  std::vector<const pat::CompositeCandidate*> collSelGG;
83  std::vector<const pat::CompositeCandidate*> collSelGT;
84  std::vector<const pat::CompositeCandidate*> collSelTT;
85  if (collAll.isValid()) {
86 
87  for(std::vector<pat::CompositeCandidate>::const_iterator it=collAll->begin();
88  it!=collAll->end();++it) {
89 
90  const pat::CompositeCandidate* cand = &(*it);
91  // cout << "Now checking candidate of type " << theJpsiCat << " with pt = " << cand->pt() << endl;
92  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(cand->daughter("muon1"));
93  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(cand->daughter("muon2"));
94 
95  if((muon1->charge() * muon2->charge())>0)
96  continue;
97  // global + global?
98  if (muon1->isGlobalMuon() && muon2->isGlobalMuon() ) {
99  if (selGlobalMuon(muon1) && selGlobalMuon(muon2) && cand->userFloat("vProb") > 0.001 ) {
100  collSelGG.push_back(cand);
101  continue;
102  }
103  }
104  // global + tracker? (x2)
105  if (muon1->isGlobalMuon() && muon2->isTrackerMuon() ) {
106  if (selGlobalMuon(muon1) && selTrackerMuon(muon2) && cand->userFloat("vProb") > 0.001 ) {
107  collSelGT.push_back(cand);
108  continue;
109  }
110  }
111  if (muon2->isGlobalMuon() && muon1->isTrackerMuon() ) {
112  if (selGlobalMuon(muon2) && selTrackerMuon(muon1) && cand->userFloat("vProb") > 0.001) {
113  collSelGT.push_back(cand);
114  continue;
115  }
116  }
117  // tracker + tracker?
118  if (muon1->isTrackerMuon() && muon2->isTrackerMuon() ) {
119  if (selTrackerMuon(muon1) && selTrackerMuon(muon2) && cand->userFloat("vProb") > 0.001) {
120  collSelTT.push_back(cand);
121  continue;
122  }
123  }
124  }
125  }
126  // Split them in independent collections if using muonType_ == -2, -3 or -4. Take them all if muonType_ == -1.
127  std::vector<reco::Track> tracks;
128  if(collSelGG.size()){
129  //CHECK THAT THEY ARE ORDERED BY PT !!!!!!!!!!!!!!!!!!!!!!!
130  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(collSelGG[0]->daughter("muon1"));
131  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(collSelGG[0]->daughter("muon2"));
132  if( muonType_ == -1 || muonType_ == -2 ) {
133  tracks.push_back(*(muon1->innerTrack()));
134  tracks.push_back(*(muon2->innerTrack()));
135  collMuSel.push_back(muon1);
136  collMuSel.push_back(muon2);
137  }
138  }
139  else if(!collSelGG.size() && collSelGT.size()){
140  //CHECK THAT THEY ARE ORDERED BY PT !!!!!!!!!!!!!!!!!!!!!!!
141  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(collSelGT[0]->daughter("muon1"));
142  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(collSelGT[0]->daughter("muon2"));
143  if( muonType_ == -1 || muonType_ == -3 ) {
144  tracks.push_back(*(muon1->innerTrack()));
145  tracks.push_back(*(muon2->innerTrack()));
146  collMuSel.push_back(muon1);
147  collMuSel.push_back(muon2);
148  }
149  }
150  else if(!collSelGG.size() && !collSelGT.size() && collSelTT.size()){
151  //CHECK THAT THEY ARE ORDERED BY PT !!!!!!!!!!!!!!!!!!!!!!!
152  const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(collSelTT[0]->daughter("muon1"));
153  const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(collSelTT[0]->daughter("muon2"));
154  if( muonType_ == -1 || muonType_ == -4 ) {
155  tracks.push_back(*(muon1->innerTrack()));
156  tracks.push_back(*(muon2->innerTrack()));
157  collMuSel.push_back(muon1);
158  collMuSel.push_back(muon2);
159  }
160  }
161  if (tracks.size() != 2 && tracks.size() != 0){
162  std::cout<<"ERROR strange number of muons selected by onia cuts!"<<std::endl;
163  abort();
164  }
165  muons = fillMuonCollection(tracks);
166  }
167  else if( (muonType_<4 && muonType_>=0) || muonType_>=10 ) { // Muons (glb,sta,trk)
168  std::vector<reco::Track> tracks;
169  if( PATmuons_ == true ) {
171  event.getByLabel( muonLabel_, allMuons );
172  if( muonType_ == 0 ) {
173  // Take directly the muon
174  muons = fillMuonCollection(*allMuons);
175  }
176  else {
177  for( std::vector<pat::Muon>::const_iterator muon = allMuons->begin(); muon != allMuons->end(); ++muon ) {
178  //std::cout<<"pat muon is global "<<muon->isGlobalMuon()<<std::endl;
179  takeSelectedMuonType(muon, tracks);
180  }
181  muons = fillMuonCollection(tracks);
182  }
183  }
184  else {
186  event.getByLabel (muonLabel_, allMuons);
187  if( muonType_ == 0 ) {
188  // Take directly the muon
189  muons = fillMuonCollection(*allMuons);
190  }
191  else {
192  for( std::vector<reco::Muon>::const_iterator muon = allMuons->begin(); muon != allMuons->end(); ++muon ) {
193  takeSelectedMuonType(muon, tracks);
194  }
195  muons = fillMuonCollection(tracks);
196  }
197  }
198  }
199  else if(muonType_==4){ //CaloMuons
201  event.getByLabel (muonLabel_, caloMuons);
202  std::vector<reco::Track> tracks;
203  for (std::vector<reco::CaloMuon>::const_iterator muon = caloMuons->begin(); muon != caloMuons->end(); ++muon){
204  tracks.push_back(*(muon->track()));
205  }
206  muons = fillMuonCollection(tracks);
207  }
208 
209  else if (muonType_==5) { // Inner tracker tracks
211  event.getByLabel (muonLabel_, tracks);
212  muons = fillMuonCollection(*tracks);
213  }
214  plotter->fillRec(muons);
215 
216  // Generation and simulation part
217  if( speedup_ == false )
218  {
219  if( PATmuons_ ) {
220  selectGeneratedMuons(collAll, collMuSel, genPair, plotter);
221  }
222  else {
223  selectGenSimMuons(event, genPair, simPair, plotter);
224  }
225  }
226 }
227 
230  const std::vector<const pat::Muon*> & collMuSel,
231  std::vector<GenMuonPair> & genPair,
232  MuScleFitPlotter * plotter)
233 {
235 
236  //explicitly for JPsi but can be adapted!!!!!
237  for(std::vector<pat::CompositeCandidate>::const_iterator it=collAll->begin();
238  it!=collAll->end();++it) {
239  reco::GenParticleRef genJpsi = it->genParticleRef();
240  bool isMatched = (genJpsi.isAvailable() && genJpsi->pdgId() == 443);
241  if (isMatched){
242  genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genJpsi.get())));
243  }
244  }
245 
246  if(collMuSel.size()==2) {
247  reco::GenParticleRef genMu1 = collMuSel[0]->genParticleRef();
248  reco::GenParticleRef genMu2 = collMuSel[1]->genParticleRef();
249  bool isMuMatched = (genMu1.isAvailable() && genMu2.isAvailable() &&
250  genMu1->pdgId()*genMu2->pdgId() == -169);
251  if (isMuMatched) {
252  genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genMu1.get())));
253  genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genMu2.get())));
254 
255  unsigned int motherId = 0;
256  if( genMu1->mother() != 0 ) {
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(const_cast <reco::GenParticleCollection*> (genPatParticles), true);
266 
267  if (debug_>0) std::cout << "Found genParticles in PAT" << std::endl;
268  }
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  }
276  else{
277  std::cout << "No recomuon selected so no access to generated info"<<std::endl;
278  // Fill it in any case, otherwise it will not be in sync with the event number
279  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
280  genPair.push_back( GenMuonPair(lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.), 0 ) );
281  }
282  if(debug_>0) {
283  std::cout << "genParticles:" << std::endl;
284  // std::cout << genPair.back().first << " , " << genPair.back().second << std::endl;
285  std::cout << genPair.back().mu1 << " , " << genPair.back().mu2 << std::endl;
286  }
287 }
288 
290  std::vector<GenMuonPair> & genPair,
291  std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
292  MuScleFitPlotter * plotter)
293 {
294  // Find and store in histograms the generated and simulated resonance and muons
295  // ----------------------------------------------------------------------------
298 
299  // Fill gen information only in the first loop
300  bool ifHepMC=false;
301 
302  event.getByLabel( genParticlesName_, evtMC );
303  event.getByLabel( genParticlesName_, genParticles );
304  if( evtMC.isValid() ) {
305  genPair.push_back( findGenMuFromRes(evtMC.product()) );
306  plotter->fillGen(evtMC.product(), sherpa_);
307  ifHepMC = true;
308  if (debug_>0) std::cout << "Found hepMC" << std::endl;
309  }
310  else if( genParticles.isValid() ) {
311  genPair.push_back( findGenMuFromRes(genParticles.product()) );
312  plotter->fillGen(genParticles.product());
313  if (debug_>0) std::cout << "Found genParticles" << std::endl;
314  }
315  else {
316  std::cout<<"ERROR "<<"non generation info and speedup true!!!!!!!!!!!!"<<std::endl;
317  // Fill it in any case, otherwise it will not be in sync with the event number
318  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
319  genPair.push_back( GenMuonPair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.), 0 ) );
320  }
321  if(debug_>0) {
322  std::cout << "genParticles:" << std::endl;
323  std::cout << genPair.back().mu1 << " , " << genPair.back().mu2 << std::endl;
324  }
325  selectSimulatedMuons(event, ifHepMC, evtMC, simPair, plotter);
326 }
327 
329  const bool ifHepMC, edm::Handle<edm::HepMCProduct> evtMC,
330  std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
331  MuScleFitPlotter * plotter)
332 {
334  bool simTracksFound = false;
335  event.getByLabel(simTracksCollectionName_, simTracks);
336  if( simTracks.isValid() ) {
337  plotter->fillSim(simTracks);
338  if(ifHepMC) {
339  simPair.push_back( findSimMuFromRes(evtMC, simTracks) );
340  simTracksFound = true;
341  plotter->fillGenSim(evtMC,simTracks);
342  }
343  }
344  else {
345  std::cout << "SimTracks not existent" << std::endl;
346  }
347  if( !simTracksFound ) {
348  simPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
349  }
350 }
351 
353 {
354  const HepMC::GenEvent* Evt = evtMC->GetEvent();
355  GenMuonPair muFromRes;
356  //Loop on generated particles
357  for (HepMC::GenEvent::particle_const_iterator part=Evt->particles_begin();
358  part!=Evt->particles_end(); part++) {
359  if (fabs((*part)->pdg_id())==13 && (*part)->status()==1) {
360  bool fromRes = false;
361  unsigned int motherPdgId = 0;
362  for (HepMC::GenVertex::particle_iterator mother = (*part)->production_vertex()->particles_begin(HepMC::ancestors);
363  mother != (*part)->production_vertex()->particles_end(HepMC::ancestors); ++mother) {
364  motherPdgId = (*mother)->pdg_id();
365 
366  // For sherpa the resonance is not saved. The muons from the resonance can be identified
367  // by having as mother a muon of status 3.
368  if( sherpa_ ) {
369  if( motherPdgId == 13 && (*mother)->status() == 3 ) fromRes = true;
370  }
371  else {
372  for( int ires = 0; ires < 6; ++ires ) {
373  if( motherPdgId == motherPdgIdArray[ires] && resfind_[ires] ) fromRes = true;
374  }
375  }
376  }
377  if(fromRes){
378  if((*part)->pdg_id()==13) {
379  // muFromRes.first = (*part)->momentum();
380  muFromRes.mu1 = (lorentzVector((*part)->momentum().px(),(*part)->momentum().py(),
381  (*part)->momentum().pz(),(*part)->momentum().e()));
382  }
383  else {
384  muFromRes.mu2 = (lorentzVector((*part)->momentum().px(),(*part)->momentum().py(),
385  (*part)->momentum().pz(),(*part)->momentum().e()));
386  }
387  muFromRes.motherId = motherPdgId;
388  }
389  }
390  }
391  return muFromRes;
392 }
393 
394 // std::pair<lorentzVector, lorentzVector> MuScleFitMuonSelector::findGenMuFromRes( const reco::GenParticleCollection* genParticles)
396 {
397  // std::pair<lorentzVector,lorentzVector> muFromRes;
398  GenMuonPair muFromRes;
399 
400  //Loop on generated particles
401  if( debug_>0 ) std::cout << "Starting loop on " << genParticles->size() << " genParticles" << std::endl;
402  for( reco::GenParticleCollection::const_iterator part=genParticles->begin(); part!=genParticles->end(); ++part ) {
403  if (debug_>0) std::cout<<"genParticle has pdgId = "<<fabs(part->pdgId())<<" and status = "<<part->status()<<std::endl;
404  if (fabs(part->pdgId())==13){// && part->status()==3) {
405  bool fromRes = false;
406  unsigned int motherPdgId = part->mother()->pdgId();
407  if( debug_>0 ) {
408  std::cout << "Found a muon with mother: " << motherPdgId << std::endl;
409  }
410  for( int ires = 0; ires < 6; ++ires ) {
411  if( motherPdgId == motherPdgIdArray[ires] && resfind_[ires] ) fromRes = true;
412  }
413  if(fromRes){
414  if (debug_>0) std::cout<<"fromRes = true, motherPdgId = "<<motherPdgId<<std::endl;
415  const reco::Candidate* status3Muon = &(*part);
416  const reco::Candidate* status1Muon = getStatus1Muon(status3Muon);
417  if(part->pdgId()==13) {
418  if (status1Muon->p4().pt()!=0) muFromRes.mu1 = MuScleFitMuon(status1Muon->p4(),-1);
419  else muFromRes.mu1 = MuScleFitMuon(status3Muon->p4(),-1);
420  if( debug_>0 ) std::cout << "Found a genMuon - : " << muFromRes.mu1 << std::endl;
421  // muFromRes.first = (lorentzVector(status1Muon->p4().px(),status1Muon->p4().py(),
422  // status1Muon->p4().pz(),status1Muon->p4().e()));
423  }
424  else {
425  if (status1Muon->p4().pt()!=0) muFromRes.mu2 = MuScleFitMuon(status1Muon->p4(),+1);
426  else muFromRes.mu2 = MuScleFitMuon(status3Muon->p4(),+1);
427  if( debug_>0 ) std::cout << "Found a genMuon + : " << muFromRes.mu2 << std::endl;
428  // muFromRes.second = (lorentzVector(status1Muon->p4().px(),status1Muon->p4().py(),
429  // status1Muon->p4().pz(),status1Muon->p4().e()));
430  }
431  }
432  }
433  }
434  return muFromRes;
435 }
436 
437 std::pair<lorentzVector, lorentzVector> MuScleFitMuonSelector::findSimMuFromRes( const edm::Handle<edm::HepMCProduct> & evtMC,
438  const edm::Handle<edm::SimTrackContainer> & simTracks )
439 {
440  //Loop on simulated tracks
441  std::pair<lorentzVector, lorentzVector> simMuFromRes;
442  for( edm::SimTrackContainer::const_iterator simTrack=simTracks->begin(); simTrack!=simTracks->end(); ++simTrack ) {
443  //Chose muons
444  if (fabs((*simTrack).type())==13) {
445  //If tracks from IP than find mother
446  if ((*simTrack).genpartIndex()>0) {
447  HepMC::GenParticle* gp = evtMC->GetEvent()->barcode_to_particle ((*simTrack).genpartIndex());
448  if( gp != 0 ) {
449 
450  for (HepMC::GenVertex::particle_iterator mother = gp->production_vertex()->particles_begin(HepMC::ancestors);
451  mother!=gp->production_vertex()->particles_end(HepMC::ancestors); ++mother) {
452 
453  bool fromRes = false;
454  unsigned int motherPdgId = (*mother)->pdg_id();
455  for( int ires = 0; ires < 6; ++ires ) {
456  if( motherPdgId == motherPdgIdArray[ires] && resfind_[ires] ) fromRes = true;
457  }
458  if( fromRes ) {
459  if(gp->pdg_id() == 13)
460  simMuFromRes.first = lorentzVector(simTrack->momentum().px(),simTrack->momentum().py(),
461  simTrack->momentum().pz(),simTrack->momentum().e());
462  else
463  simMuFromRes.second = lorentzVector(simTrack->momentum().px(),simTrack->momentum().py(),
464  simTrack->momentum().pz(),simTrack->momentum().e());
465  }
466  }
467  }
468  // else LogDebug("MuScleFitUtils") << "WARNING: no matching genParticle found for simTrack" << std::endl;
469  }
470  }
471  }
472  return simMuFromRes;
473 }
Analysis-level particle class.
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
int i
Definition: DBlmapReader.cc:9
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.
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:73
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) ...
const std::string genParticlesName_
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...
bool muonID(const std::string &name) const
Definition: Muon.cc:374
void fillGenSim(edm::Handle< edm::HepMCProduct > evtMC, edm::Handle< edm::SimTrackContainer > simTracks)
bool isTrackerMuon() const
Definition: Muon.h:219
virtual int status() const =0
status word
int ires[2]
std::vector< MuScleFitMuon > fillMuonCollection(const std::vector< T > &tracks)
Template function used to convert the muon collection to a vector of reco::LeafCandidate.
int pixelLayersWithMeasurement() const
Definition: HitPattern.h:745
bool selTrackerMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select trackerMuons.
bool isGlobalMuon() const
Definition: Muon.h:218
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:54
bool isAvailable() const
Definition: Ref.h:276
Int_t motherId
Definition: GenMuonPair.h:56
float userFloat(const std::string &key) const
Definition: PATObject.h:755
reco::Particle::LorentzVector lorentzVector
Definition: GenMuonPair.h:9
static const unsigned int motherPdgIdArray[6]
const edm::InputTag muonLabel_
static const double mMu2
virtual size_type numberOfDaughters() const =0
number of daughters
void fillRec(std::vector< MuScleFitMuon > &muons)
Used when running on the root tree containing preselected muon pairs.
void fillSim(edm::Handle< edm::SimTrackContainer > simTracks)
tuple allMuons
Definition: allMuons_cfi.py:3
bool isMatched(TrackingRecHit const &hit)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:81
virtual int pdgId() const =0
PDG identifier.
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:35
tuple tracks
Definition: testEve_cfg.py:39
virtual int charge() const GCC11_FINAL
electric charge
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)
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
T const * product() const
Definition: Handle.h:81
const edm::InputTag simTracksCollectionName_
tuple muons
Definition: patZpeak.py:38
void fillGen(const reco::GenParticleCollection *genParticles, bool=false)
bool selGlobalMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select globalMuons.
tuple cout
Definition: gather_cfg.py:121
void takeSelectedMuonType(const T &muon, std::vector< reco::Track > &tracks)
Template function used to extract the selected muon type from the muon collection.
int numberOfValidMuonHits() const
Definition: HitPattern.h:597
tuple status
Definition: ntuplemaker.py:245
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
const std::vector< int > resfind_
Analysis-level muon class.
Definition: Muon.h:50
MuScleFitMuon mu2
Definition: GenMuonPair.h:55
const reco::Candidate * getStatus1Muon(const reco::Candidate *status3Muon)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector