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,
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  // EM 2015.04.02 temporary fix to run on MINIAODSIM (which contains PAT muons) but not the "onia2MuMuPatTrkTrk" collection
221  // selectGeneratedMuons(collAll, collMuSel, genPair, plotter);
222  selectGenSimMuons(event, genPair, simPair, plotter);
223  }
224  else {
225  selectGenSimMuons(event, genPair, simPair, plotter);
226  }
227  }
228 }
229 
232  const std::vector<const pat::Muon*> & collMuSel,
233  std::vector<GenMuonPair> & genPair,
235 {
237 
238  //explicitly for JPsi but can be adapted!!!!!
239  for(std::vector<pat::CompositeCandidate>::const_iterator it=collAll->begin();
240  it!=collAll->end();++it) {
241  reco::GenParticleRef genJpsi = it->genParticleRef();
242  bool isMatched = (genJpsi.isAvailable() && genJpsi->pdgId() == 443);
243  if (isMatched){
244  genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genJpsi.get())));
245  }
246  }
247 
248  if(collMuSel.size()==2) {
249  reco::GenParticleRef genMu1 = collMuSel[0]->genParticleRef();
250  reco::GenParticleRef genMu2 = collMuSel[1]->genParticleRef();
251  bool isMuMatched = (genMu1.isAvailable() && genMu2.isAvailable() &&
252  genMu1->pdgId()*genMu2->pdgId() == -169);
253  if (isMuMatched) {
254  genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genMu1.get())));
255  genPatParticles->push_back(*(const_cast<reco::GenParticle*>(genMu2.get())));
256 
257  unsigned int motherId = 0;
258  if( genMu1->mother() != 0 ) {
259  motherId = genMu1->mother()->pdgId();
260  }
261  if(genMu1->pdgId()==13)
262  genPair.push_back(GenMuonPair(genMu1.get()->p4(), genMu2.get()->p4(), motherId));
263  else
264  // genPair.push_back(std::make_pair(genMu2.get()->p4(),genMu1.get()->p4()) );
265  genPair.push_back(GenMuonPair(genMu2.get()->p4(), genMu1.get()->p4(), motherId));
266 
267  plotter->fillGen(const_cast <reco::GenParticleCollection*> (genPatParticles), true);
268 
269  if (debug_>0) std::cout << "Found genParticles in PAT" << std::endl;
270  }
271  else {
272  std::cout << "No recomuon selected so no access to generated info"<<std::endl;
273  // Fill it in any case, otherwise it will not be in sync with the event number
274  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
275  genPair.push_back( GenMuonPair(lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.), 0 ) );
276  }
277  }
278  else{
279  std::cout << "No recomuon selected so no access to generated info"<<std::endl;
280  // Fill it in any case, otherwise it will not be in sync with the event number
281  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
282  genPair.push_back( GenMuonPair(lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.), 0 ) );
283  }
284  if(debug_>0) {
285  std::cout << "genParticles:" << std::endl;
286  // std::cout << genPair.back().first << " , " << genPair.back().second << std::endl;
287  std::cout << genPair.back().mu1 << " , " << genPair.back().mu2 << std::endl;
288  }
289 }
290 
292  std::vector<GenMuonPair> & genPair,
293  std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
295 {
296  // Find and store in histograms the generated and simulated resonance and muons
297  // ----------------------------------------------------------------------------
300 
301  // Fill gen information only in the first loop
302  bool ifHepMC=false;
303 
304  event.getByLabel( genParticlesName_, evtMC );
305  event.getByLabel( genParticlesName_, genParticles );
306  if( evtMC.isValid() ) {
307  genPair.push_back( findGenMuFromRes(evtMC.product()) );
308  plotter->fillGen(evtMC.product(), sherpa_);
309  ifHepMC = true;
310  if (debug_>0) std::cout << "Found hepMC" << std::endl;
311  }
312  else if( genParticles.isValid() ) {
313  genPair.push_back( findGenMuFromRes(genParticles.product()) );
314  plotter->fillGen(genParticles.product());
315  if (debug_>0) std::cout << "Found genParticles" << std::endl;
316  }
317  else {
318  std::cout<<"ERROR "<<"non generation info and speedup true!!!!!!!!!!!!"<<std::endl;
319  // Fill it in any case, otherwise it will not be in sync with the event number
320  // genPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
321  genPair.push_back( GenMuonPair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.), 0 ) );
322  }
323  if(debug_>0) {
324  std::cout << "genParticles:" << std::endl;
325  std::cout << genPair.back().mu1 << " , " << genPair.back().mu2 << std::endl;
326  }
327  selectSimulatedMuons(event, ifHepMC, evtMC, simPair, plotter);
328 }
329 
331  const bool ifHepMC, edm::Handle<edm::HepMCProduct> evtMC,
332  std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
334 {
336  bool simTracksFound = false;
337  event.getByLabel(simTracksCollectionName_, simTracks);
338  if( simTracks.isValid() ) {
339  plotter->fillSim(simTracks);
340  if(ifHepMC) {
341  simPair.push_back( findSimMuFromRes(evtMC, simTracks) );
342  simTracksFound = true;
343  plotter->fillGenSim(evtMC,simTracks);
344  }
345  }
346  else {
347  std::cout << "SimTracks not existent" << std::endl;
348  }
349  if( !simTracksFound ) {
350  simPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
351  }
352 }
353 
355 {
356  const HepMC::GenEvent* Evt = evtMC->GetEvent();
357  GenMuonPair muFromRes;
358  //Loop on generated particles
359  for (HepMC::GenEvent::particle_const_iterator part=Evt->particles_begin();
360  part!=Evt->particles_end(); part++) {
361  if (fabs((*part)->pdg_id())==13 && (*part)->status()==1) {
362  bool fromRes = false;
363  unsigned int motherPdgId = 0;
364  for (HepMC::GenVertex::particle_iterator mother = (*part)->production_vertex()->particles_begin(HepMC::ancestors);
365  mother != (*part)->production_vertex()->particles_end(HepMC::ancestors); ++mother) {
366  motherPdgId = (*mother)->pdg_id();
367 
368  // For sherpa the resonance is not saved. The muons from the resonance can be identified
369  // by having as mother a muon of status 3.
370  if( sherpa_ ) {
371  if( motherPdgId == 13 && (*mother)->status() == 3 ) fromRes = true;
372  }
373  else {
374  for( int ires = 0; ires < 6; ++ires ) {
375  if( motherPdgId == motherPdgIdArray[ires] && resfind_[ires] ) fromRes = true;
376  }
377  }
378  }
379  if(fromRes){
380  if((*part)->pdg_id()==13) {
381  // muFromRes.first = (*part)->momentum();
382  muFromRes.mu1 = (lorentzVector((*part)->momentum().px(),(*part)->momentum().py(),
383  (*part)->momentum().pz(),(*part)->momentum().e()));
384  }
385  else {
386  muFromRes.mu2 = (lorentzVector((*part)->momentum().px(),(*part)->momentum().py(),
387  (*part)->momentum().pz(),(*part)->momentum().e()));
388  }
389  muFromRes.motherId = motherPdgId;
390  }
391  }
392  }
393  return muFromRes;
394 }
395 
396 // std::pair<lorentzVector, lorentzVector> MuScleFitMuonSelector::findGenMuFromRes( const reco::GenParticleCollection* genParticles)
398 {
399  // std::pair<lorentzVector,lorentzVector> muFromRes;
400  GenMuonPair muFromRes;
401 
402  //Loop on generated particles
403  if( debug_>0 ) std::cout << "Starting loop on " << genParticles->size() << " genParticles" << std::endl;
404  for( reco::GenParticleCollection::const_iterator part=genParticles->begin(); part!=genParticles->end(); ++part ) {
405  if (debug_>0) std::cout<<"genParticle has pdgId = "<<fabs(part->pdgId())<<" and status = "<<part->status()<<std::endl;
406  if (fabs(part->pdgId())==13){// && part->status()==3) {
407  bool fromRes = false;
408  unsigned int motherPdgId = part->mother()->pdgId();
409  if( debug_>0 ) {
410  std::cout << "Found a muon with mother: " << motherPdgId << std::endl;
411  }
412  for( int ires = 0; ires < 6; ++ires ) {
413  if( motherPdgId == motherPdgIdArray[ires] && resfind_[ires] ) fromRes = true;
414  }
415  if(fromRes){
416  if (debug_>0) std::cout<<"fromRes = true, motherPdgId = "<<motherPdgId<<std::endl;
417  const reco::Candidate* status3Muon = &(*part);
418  const reco::Candidate* status1Muon = getStatus1Muon(status3Muon);
419  if(part->pdgId()==13) {
420  if (status1Muon->p4().pt()!=0) muFromRes.mu1 = MuScleFitMuon(status1Muon->p4(),-1);
421  else muFromRes.mu1 = MuScleFitMuon(status3Muon->p4(),-1);
422  if( debug_>0 ) std::cout << "Found a genMuon - : " << muFromRes.mu1 << std::endl;
423  // muFromRes.first = (lorentzVector(status1Muon->p4().px(),status1Muon->p4().py(),
424  // status1Muon->p4().pz(),status1Muon->p4().e()));
425  }
426  else {
427  if (status1Muon->p4().pt()!=0) muFromRes.mu2 = MuScleFitMuon(status1Muon->p4(),+1);
428  else muFromRes.mu2 = MuScleFitMuon(status3Muon->p4(),+1);
429  if( debug_>0 ) std::cout << "Found a genMuon + : " << muFromRes.mu2 << std::endl;
430  // muFromRes.second = (lorentzVector(status1Muon->p4().px(),status1Muon->p4().py(),
431  // status1Muon->p4().pz(),status1Muon->p4().e()));
432  }
433  }
434  }
435  }
436  return muFromRes;
437 }
438 
439 std::pair<lorentzVector, lorentzVector> MuScleFitMuonSelector::findSimMuFromRes( const edm::Handle<edm::HepMCProduct> & evtMC,
440  const edm::Handle<edm::SimTrackContainer> & simTracks )
441 {
442  //Loop on simulated tracks
443  std::pair<lorentzVector, lorentzVector> simMuFromRes;
444  for( edm::SimTrackContainer::const_iterator simTrack=simTracks->begin(); simTrack!=simTracks->end(); ++simTrack ) {
445  //Chose muons
446  if (fabs((*simTrack).type())==13) {
447  //If tracks from IP than find mother
448  if ((*simTrack).genpartIndex()>0) {
449  HepMC::GenParticle* gp = evtMC->GetEvent()->barcode_to_particle ((*simTrack).genpartIndex());
450  if( gp != 0 ) {
451 
452  for (HepMC::GenVertex::particle_iterator mother = gp->production_vertex()->particles_begin(HepMC::ancestors);
453  mother!=gp->production_vertex()->particles_end(HepMC::ancestors); ++mother) {
454 
455  bool fromRes = false;
456  unsigned int motherPdgId = (*mother)->pdg_id();
457  for( int ires = 0; ires < 6; ++ires ) {
458  if( motherPdgId == motherPdgIdArray[ires] && resfind_[ires] ) fromRes = true;
459  }
460  if( fromRes ) {
461  if(gp->pdg_id() == 13)
462  simMuFromRes.first = lorentzVector(simTrack->momentum().px(),simTrack->momentum().py(),
463  simTrack->momentum().pz(),simTrack->momentum().e());
464  else
465  simMuFromRes.second = lorentzVector(simTrack->momentum().px(),simTrack->momentum().py(),
466  simTrack->momentum().pz(),simTrack->momentum().e());
467  }
468  }
469  }
470  // else LogDebug("MuScleFitUtils") << "WARNING: no matching genParticle found for simTrack" << std::endl;
471  }
472  }
473  }
474  return simMuFromRes;
475 }
Analysis-level particle class.
bool isAvailable() const
Definition: Ref.h:576
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:72
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...
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.
bool selTrackerMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select trackerMuons.
bool isGlobalMuon() const
Definition: Muon.h:218
bool muonID(const std::string &name) const
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
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:458
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)
virtual int charge() const
electric charge
Definition: LeafCandidate.h:91
tuple allMuons
Definition: allMuons_cfi.py:3
bool isMatched(TrackingRecHit const &hit)
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
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:75
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:80
virtual int pdgId() const =0
PDG identifier.
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:35
T const * product() const
Definition: Handle.h:81
tuple tracks
Definition: testEve_cfg.py:39
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) ...
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:744
tuple status
Definition: ntuplemaker.py:245
const std::vector< int > resfind_
Analysis-level muon class.
Definition: Muon.h:49
MuScleFitMuon mu2
Definition: GenMuonPair.h:55
const reco::Candidate * getStatus1Muon(const reco::Candidate *status3Muon)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector