CMS 3D CMS Logo

PFTrackAlgoTools.cc
Go to the documentation of this file.
3 
4 namespace PFTrackAlgoTools {
5 
6  double dPtCut(const reco::TrackBase::TrackAlgorithm& algo,const std::vector<double>& cuts,bool hltIterativeTracking = true){
7  switch (algo) {
16  return cuts[0];
19  return cuts[1];
21  return cuts[2];
23  return cuts[3];
25  return cuts[4];
28  return cuts.at(5);
32  return cuts[0];
34  return hltIterativeTracking ? cuts[1] : cuts[0];
36  return hltIterativeTracking ? cuts[2] : cuts[0];
38  return cuts[0];
39  default:
40  return hltIterativeTracking ? cuts.at(5):cuts[0];
41 
42  }
43  }
44 
45 
46 
47  unsigned int nHitCut(const reco::TrackBase::TrackAlgorithm& algo,const std::vector<unsigned int>& cuts,bool hltIterativeTracking = true){
48  switch (algo) {
57  return cuts[0];
60  return cuts[1];
62  return cuts[2];
64  return cuts[3];
66  return cuts[4];
69  return cuts.at(5);
73  return cuts[0];
75  return hltIterativeTracking ? cuts[1] : cuts[0];
77  return hltIterativeTracking ? cuts[2] : cuts[0];
79  return cuts[0];
80  default:
81  return hltIterativeTracking ? cuts.at(5):cuts[0];
82 
83  }
84  }
85 
86 
87 
88  double errorScale(const reco::TrackBase::TrackAlgorithm& algo,const std::vector<double>& errorScale){
89  switch (algo) {
109  return 1.0;
111  return errorScale[0];
113  return errorScale[1];
114  default:
115  return 1E9;
116  }
117  }
118 
119 
121 
122 
123  switch (algo) {
143  return true;
144  default:
145  return false;
146  }
147 
148 }
149 
151  switch (algo) {
163  return true;
164  default:
165  return false;
166  }
167 
168 }
169 
171  switch (algo) {
192  return false;
194  return true;
195  default:
196  return true;
197  }
198 
199 }
200 
201 
203  switch (algo) {
213  return true;
214  default:
215  return false;
216  }
217 
218 }
219 
220 
222  switch (algo) {
226  return true;
227  default:
228  return false;
229 
230  }
231 
232 }
233 
234 
236  switch (algo) {
240  return true;
241  default:
242  return false;
243  }
244 
245 }
246 
247 
250 }
251 
252 bool goodPtResolution(const reco::TrackRef& trackref,
253  const std::vector<double>& DPtovPtCut,
254  const std::vector<unsigned>& NHitCut,
255  bool useIterTracking,
256  bool debug) {
257  //recheck that the track is high purity!
258  if (!trackref->quality(reco::TrackBase::highPurity))
259  return false;
260 
261  const double p = trackref->p();
262  const double pT = trackref->pt();
263  const double dpT = trackref->ptError();
264  const unsigned int nHit =
265  trackref->hitPattern().trackerLayersWithMeasurement();
266  const unsigned int nLostHit =
267  trackref->hitPattern().trackerLayersWithoutMeasurement(reco::HitPattern::TRACK_HITS);
268  const unsigned int lostHits = trackref->numberOfLostHits();
269  const double sigmaHad = std::sqrt(1.20*1.20/p+0.06*0.06) / (1.+lostHits);
270 
271  // Protection against 0 momentum tracks
272  if ( p < 0.05 ) return false;
273 
274  LogDebug("goodPtResolution") << " PFBlockAlgo: PFrecTrack->Track Pt= "
275  << pT << " DPt = " << dpT << std::endl;
276 
277 
278  double dptCut = dPtCut(trackref->algo(),DPtovPtCut,useIterTracking);
279  unsigned int nhitCut = nHitCut(trackref->algo(),NHitCut,useIterTracking);
280 
281  if ( ( dptCut > 0. &&
282  dpT/pT > dptCut*sigmaHad ) ||
283  nHit < nhitCut ) {
284  LogDebug("goodPtResolution") << " PFBlockAlgo: skip badly measured track"
285  << ", P = " << p
286  << ", Pt = " << pT
287  << " DPt = " << dpT
288  << ", N(hits) = " << nHit
289  << " (Lost : " << lostHits << "/" << nLostHit << ")"
290  << ", Algo = " << trackref->algo()
291  << std::endl;
292  LogDebug("goodPtResolution") << " cut is DPt/Pt < " << dptCut * sigmaHad << std::endl;
293  LogDebug("goodPtResolution") << " cut is NHit >= " << nhitCut << std::endl;
294  return false;
295  }
296 
297  return true;
298 }
299 
300 }
#define LogDebug(id)
double errorScale(const reco::TrackBase::TrackAlgorithm &, const std::vector< double > &)
TrackAlgorithm
track algorithm
Definition: TrackBase.h:99
unsigned int nHitCut(const reco::TrackBase::TrackAlgorithm &, const std::vector< unsigned int > &, bool)
bool isGoodForEGM(const reco::TrackBase::TrackAlgorithm &)
T sqrt(T t)
Definition: SSEVec.h:18
bool nonIterative(const reco::TrackBase::TrackAlgorithm &)
bool step45(const reco::TrackBase::TrackAlgorithm &)
bool highQuality(const reco::TrackBase::TrackAlgorithm &)
#define debug
Definition: HDRShower.cc:19
bool isFifthStep(const reco::TrackBase::TrackAlgorithm &)
double dPtCut(const reco::TrackBase::TrackAlgorithm &, const std::vector< double > &, bool)
bool isGoodForEGMPrimary(const reco::TrackBase::TrackAlgorithm &)
bool step5(const reco::TrackBase::TrackAlgorithm &)
bool goodPtResolution(const reco::TrackRef &, const std::vector< double > &DPtovPtCut, const std::vector< unsigned > &NHitCut, bool useIterTracking, bool debug=false)