CMS 3D CMS Logo

PFTrackAlgoTools.cc
Go to the documentation of this file.
3 
4 namespace PFTrackAlgoTools {
5 
7  const std::vector<double>& cuts,
8  bool hltIterativeTracking = true) {
9  switch (algo) {
18  return cuts[0];
21  return cuts[1];
23  return cuts[2];
25  return cuts[3];
27  return cuts[4];
30  return cuts.at(5);
34  return cuts[0];
36  return hltIterativeTracking ? cuts[1] : cuts[0];
38  return hltIterativeTracking ? cuts[2] : cuts[0];
40  return cuts[0];
41  default:
42  return hltIterativeTracking ? cuts.at(5) : cuts[0];
43  }
44  }
45 
47  const std::vector<unsigned int>& cuts,
48  bool hltIterativeTracking = true) {
49  switch (algo) {
58  return cuts[0];
61  return cuts[1];
63  return cuts[2];
65  return cuts[3];
67  return cuts[4];
70  return cuts.at(5);
74  return cuts[0];
76  return hltIterativeTracking ? cuts[1] : cuts[0];
78  return hltIterativeTracking ? cuts[2] : cuts[0];
80  return cuts[0];
81  default:
82  return hltIterativeTracking ? cuts.at(5) : cuts[0];
83  }
84  }
85 
86  double errorScale(const reco::TrackBase::TrackAlgorithm& algo, const std::vector<double>& errorScale) {
87  switch (algo) {
107  return 1.0;
109  return errorScale[0];
111  return errorScale[1];
112  default:
113  return 1E9;
114  }
115  }
116 
118  switch (algo) {
138  return true;
139  default:
140  return false;
141  }
142  }
143 
145  switch (algo) {
157  return true;
158  default:
159  return false;
160  }
161  }
162 
164  switch (algo) {
185  return false;
187  return true;
188  default:
189  return true;
190  }
191  }
192 
194  switch (algo) {
204  return true;
205  default:
206  return false;
207  }
208  }
209 
211  switch (algo) {
215  return true;
216  default:
217  return false;
218  }
219  }
220 
222  switch (algo) {
226  return true;
227  default:
228  return false;
229  }
230  }
231 
234  }
235 
236  bool goodPtResolution(const reco::TrackRef& trackref,
237  const std::vector<double>& DPtovPtCut,
238  const std::vector<unsigned>& NHitCut,
239  bool useIterTracking,
241  //check quality of tracks
242  if (!trackref->quality(trackQuality))
243  return false;
244 
245  const double p = trackref->p();
246  const double pT = trackref->pt();
247  const double dpT = trackref->ptError();
248  const unsigned int nHit = trackref->hitPattern().trackerLayersWithMeasurement();
249  const unsigned int nLostHit = trackref->hitPattern().trackerLayersWithoutMeasurement(reco::HitPattern::TRACK_HITS);
250  const unsigned int lostHits = trackref->numberOfLostHits();
251  const double sigmaHad = std::sqrt(1.20 * 1.20 / p + 0.06 * 0.06) / (1. + lostHits);
252 
253  // Protection against 0 momentum tracks
254  if (p < 0.05)
255  return false;
256 
257  LogDebug("goodPtResolution") << " PFBlockAlgo: PFrecTrack->Track Pt= " << pT << " DPt = " << dpT << std::endl;
258 
259  double dptCut = dPtCut(trackref->algo(), DPtovPtCut, useIterTracking);
260  unsigned int nhitCut = nHitCut(trackref->algo(), NHitCut, useIterTracking);
261 
262  if ((dptCut > 0. && dpT / pT > dptCut * sigmaHad) || nHit < nhitCut) {
263  LogDebug("goodPtResolution") << " PFBlockAlgo: skip badly measured track"
264  << ", P = " << p << ", Pt = " << pT << " DPt = " << dpT << ", N(hits) = " << nHit
265  << " (Lost : " << lostHits << "/" << nLostHit << ")"
266  << ", Algo = " << trackref->algo() << std::endl;
267  LogDebug("goodPtResolution") << " cut is DPt/Pt < " << dptCut * sigmaHad << std::endl;
268  LogDebug("goodPtResolution") << " cut is NHit >= " << nhitCut << std::endl;
269  return false;
270  }
271 
272  return true;
273  }
274 
275 } // namespace PFTrackAlgoTools
bool goodPtResolution(const reco::TrackRef &, const std::vector< double > &DPtovPtCut, const std::vector< unsigned > &NHitCut, bool useIterTracking, const reco::TrackBase::TrackQuality trackQuality)
double errorScale(const reco::TrackBase::TrackAlgorithm &, const std::vector< double > &)
TrackQuality
track quality
Definition: TrackBase.h:150
TrackAlgorithm
track algorithm
Definition: TrackBase.h:89
unsigned int nHitCut(const reco::TrackBase::TrackAlgorithm &, const std::vector< unsigned int > &, bool)
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
bool isGoodForEGM(const reco::TrackBase::TrackAlgorithm &)
T sqrt(T t)
Definition: SSEVec.h:19
bool nonIterative(const reco::TrackBase::TrackAlgorithm &)
bool step45(const reco::TrackBase::TrackAlgorithm &)
bool highQuality(const reco::TrackBase::TrackAlgorithm &)
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 &)
#define LogDebug(id)