CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackSelector.cc
Go to the documentation of this file.
1 #include "TrackSelector.h"
4 
5 using namespace muonisolation;
6 using namespace reco;
7 
9 {
10  static const std::string metname = "MuonIsolation|TrackSelector";
11  result_type result;
12  for (input_type::const_iterator it = tracks.begin(); it != tracks.end(); it++) {
13 
14 // float tZ = it->vz();
15 // float tD0 = fabs(it->d0());
16 // float tD0Cor = fabs(it->dxy(thePars.beamPoint));
17 // float tEta = it->eta();
18 // float tPhi = it->phi();
19 // unsigned int tHits = it->numberOfValidHits();
20 // float tChi2Ndof = it->normalizedChi2();
21 // float tChi2Prob = ChiSquaredProbability(it->chi2(), it->ndof());
22 // float tPt = it->pt();
23 
24 // LogTrace(metname)<<"Tk vz: "<<tZ
25 // <<", d0: "<<tD0
26 // <<", d0wrtBeam: "<<tD0Cor
27 // <<", eta: "<<tEta
28 // <<", phi: "<<tPhi
29 // <<", nHits: "<<tHits
30 // <<", chi2Norm: "<<tChi2Ndof
31 // <<", chi2Prob: "<<tChi2Prob
32 // <<std::endl;
33 
37 
38  float tZ = it->vz();
39  float tPt = it->pt();
40  float tD0 = fabs(it->d0());
41  float tD0Cor = fabs(it->dxy(thePars.beamPoint));
42  float tEta = it->eta();
43  float tPhi = it->phi();
44  float tChi2Ndof = it->normalizedChi2();
45  LogTrace(metname)<<"Tk vz: "<<tZ
46  <<", pt: "<<tPt
47  <<", d0: "<<tD0
48  <<", d0wrtBeam: "<<tD0Cor
49  <<", eta: "<<tEta
50  <<", phi: "<<tPhi
51  <<", chi2Norm: "<<tChi2Ndof;
53 
54  if ( !thePars.zRange.inside( tZ ) ) continue;
55  if ( tPt < thePars.ptMin ) continue;
56  if ( !thePars.rRange.inside( tD0Cor) ) continue;
57  if ( thePars.dir.deltaR( reco::isodeposit::Direction(tEta, tPhi) ) > thePars.drMax ) continue;
58  if ( tChi2Ndof > thePars.chi2NdofMax ) continue;
59 
61  if (thePars.nHitsMin > 0 ){
62  unsigned int tHits = it->numberOfValidHits();
63  LogTrace(metname)<<", nHits: "<<tHits;
64  if ( tHits < thePars.nHitsMin ) continue;
65  }
66 
68  if(thePars.chi2ProbMin > 0){
69  float tChi2Prob = ChiSquaredProbability(it->chi2(), it->ndof());
70  LogTrace(metname)<<", chi2Prob: "<<tChi2Prob<<std::endl;
71  if ( tChi2Prob < thePars.chi2ProbMin ) continue;
72  }
73 
74  LogTrace(metname)<<" ..... accepted"<<std::endl;
75  result.push_back(&*it);
76  }
77  return result;
78 }
const std::string metname
std::list< const reco::Track * > result_type
Definition: TrackSelector.h:17
result_type operator()(const input_type &tracks) const
edm::View< reco::Track > input_type
Definition: TrackSelector.h:18
tuple result
Definition: query.py:137
float ChiSquaredProbability(double chiSquared, double nrDOF)
#define LogTrace(id)
tuple tracks
Definition: testEve_cfg.py:39