CMS 3D CMS Logo

PFTrackAlgoTools.cc
Go to the documentation of this file.
2 
3 namespace PFTrackAlgoTools {
4 
5  double dPtCut(const reco::TrackBase::TrackAlgorithm& algo,const std::vector<double>& cuts,bool hltIterativeTracking = true){
6  switch (algo) {
15  return cuts[0];
18  return cuts[1];
20  return cuts[2];
22  return cuts[3];
24  return cuts[4];
27  return cuts.at(5);
31  return cuts[0];
33  return hltIterativeTracking ? cuts[1] : cuts[0];
35  return hltIterativeTracking ? cuts[2] : cuts[0];
37  return cuts[0];
38  default:
39  return hltIterativeTracking ? cuts.at(5):cuts[0];
40 
41  }
42  }
43 
44 
45 
46  unsigned int nHitCut(const reco::TrackBase::TrackAlgorithm& algo,const std::vector<unsigned int>& cuts,bool hltIterativeTracking = true){
47  switch (algo) {
56  return cuts[0];
59  return cuts[1];
61  return cuts[2];
63  return cuts[3];
65  return cuts[4];
68  return cuts.at(5);
72  return cuts[0];
74  return hltIterativeTracking ? cuts[1] : cuts[0];
76  return hltIterativeTracking ? cuts[2] : cuts[0];
78  return cuts[0];
79  default:
80  return hltIterativeTracking ? cuts.at(5):cuts[0];
81 
82  }
83  }
84 
85 
86 
87  double errorScale(const reco::TrackBase::TrackAlgorithm& algo,const std::vector<double>& errorScale){
88  switch (algo) {
108  return 1.0;
110  return errorScale[0];
112  return errorScale[1];
113  default:
114  return 1E9;
115  }
116  }
120 
122  switch (algo) {
142  return true;
143  default:
144  return false;
145  }
147 }
148 
150  switch (algo) {
162  return true;
163  default:
164  return false;
165  }
167 }
168 
170  switch (algo) {
191  return false;
193  return true;
194  default:
195  return true;
196  }
197 
198 }
199 
200 
202  switch (algo) {
212  return true;
213  default:
214  return false;
215  }
217 }
218 
221  switch (algo) {
225  return true;
226  default:
227  return false;
229  }
230 
231 }
232 
233 
235  switch (algo) {
239  return true;
240  default:
241  return false;
242  }
243 
244 }
246 
249 }
250 
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 }
double errorScale(const reco::TrackBase::TrackAlgorithm &, const std::vector< double > &)
TrackAlgorithm
track algorithm
Definition: TrackBase.h:99
#define LogDebug(id)
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)