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
PFTrackAlgoTools::nonIterative
bool nonIterative(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:210
reco::TrackBase::hltIter2
Definition: TrackBase.h:126
StandaloneTrackMonitor_cfi.trackQuality
trackQuality
Definition: StandaloneTrackMonitor_cfi.py:11
MessageLogger.h
reco::TrackBase::detachedQuadStep
Definition: TrackBase.h:115
reco::TrackBase::lowPtQuadStep
Definition: TrackBase.h:114
PFTrackAlgoTools::step45
bool step45(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:221
PFTrackAlgoTools::step5
bool step5(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:232
PFTrackAlgoTools::dPtCut
double dPtCut(const reco::TrackBase::TrackAlgorithm &, const std::vector< double > &, bool)
Definition: PFTrackAlgoTools.cc:6
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
reco::TrackBase::hltIter3
Definition: TrackBase.h:127
reco::TrackBase::TrackAlgorithm
TrackAlgorithm
track algorithm
Definition: TrackBase.h:89
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
reco::TrackBase::lowPtTripletStep
Definition: TrackBase.h:95
PFTrackAlgoTools::highQuality
bool highQuality(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:193
reco::TrackBase::hltIter1
Definition: TrackBase.h:125
reco::TrackBase::mixedTripletStep
Definition: TrackBase.h:98
edm::Ref< TrackCollection >
cmsdt::algo
algo
Definition: constants.h:164
reco::TrackBase::muonSeededStepOutIn
Definition: TrackBase.h:104
reco::TrackBase::jetCoreRegionalStep
Definition: TrackBase.h:101
PFTrackAlgoTools::isFifthStep
bool isFifthStep(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:163
PVValHelper::pT
Definition: PVValidationHelpers.h:70
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::TrackBase::cosmics
Definition: TrackBase.h:93
PFTrackAlgoTools
Definition: PFTrackAlgoTools.h:3
PFTrackAlgoTools.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
reco::TrackBase::detachedTripletStep
Definition: TrackBase.h:97
PFTrackAlgoTools::isGoodForEGMPrimary
bool isGoodForEGMPrimary(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:144
reco::TrackBase::undefAlgorithm
Definition: TrackBase.h:90
reco::TrackBase::initialStep
Definition: TrackBase.h:94
PFTrackAlgoTools::goodPtResolution
bool goodPtResolution(const reco::TrackRef &, const std::vector< double > &DPtovPtCut, const std::vector< unsigned > &NHitCut, bool useIterTracking, const reco::TrackBase::TrackQuality trackQuality)
Definition: PFTrackAlgoTools.cc:236
reco::TrackBase::tobTecStep
Definition: TrackBase.h:100
reco::HitPattern::TRACK_HITS
Definition: HitPattern.h:155
reco::TrackBase::pixelPairStep
Definition: TrackBase.h:96
reco::TrackBase::muonSeededStepInOut
Definition: TrackBase.h:103
reco::TrackBase::ctf
Definition: TrackBase.h:91
reco::TrackBase::highPtTripletStep
Definition: TrackBase.h:113
electrons_cff.lostHits
lostHits
Definition: electrons_cff.py:428
PFTrackAlgoTools::isGoodForEGM
bool isGoodForEGM(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:117
PFTrackAlgoTools::nHitCut
unsigned int nHitCut(const reco::TrackBase::TrackAlgorithm &, const std::vector< unsigned int > &, bool)
Definition: PFTrackAlgoTools.cc:46
PFTrackAlgoTools::errorScale
double errorScale(const reco::TrackBase::TrackAlgorithm &, const std::vector< double > &)
Definition: PFTrackAlgoTools.cc:86
L1TMuonDQMOffline_cfi.cuts
cuts
Definition: L1TMuonDQMOffline_cfi.py:41
reco::TrackBase::hltIterX
Definition: TrackBase.h:130
reco::TrackBase::pixelLessStep
Definition: TrackBase.h:99
reco::TrackBase::hltIter4
Definition: TrackBase.h:128
reco::TrackBase::duplicateMerge
Definition: TrackBase.h:92
reco::TrackBase::hltIter0
Definition: TrackBase.h:124