CMS 3D CMS Logo

ThresholdPtTrajectoryFilter.cc
Go to the documentation of this file.
2 
3 namespace {
4 struct TLS {
5  bool answerMemory=false;
6  FreeTrajectoryState ftsMemory;
7 
8 };
9 
10 thread_local TLS tls;
11 }
12 
13  bool ThresholdPtTrajectoryFilter::test( const TrajectoryMeasurement & tm, int foundHits) const
14  {
15  //first check min number of hits
16  if (foundHits < theMinHits ){ return true;}
17 
18  // check for momentum below limit
19  if (!tm.updatedState().isValid()) return false;
21 
22  //avoid doing twice the check in TBC and QF
23  // We make it thread local so that we avoid race conditions between
24  // threads, and we make sure there is no cache contention between them.
25  if (tls.ftsMemory.parameters().vector() == fts.parameters().vector()) { return tls.answerMemory;}
26  tls.ftsMemory=fts;
27 
28  //if p_T is way too small: stop
29  double pT = fts.momentum().perp();
30  if (pT<0.010) {tls.answerMemory=false; return false;}
31  //if error is way too big: stop
32  double invError = TrajectoryStateAccessor(fts).inversePtError();
33  if (invError > 1.e10) {tls.answerMemory=false;return false;}
34 
35  //calculate the actual pT cut:
36  if ((1/pT + theNSigma*invError ) < 1/thePtThreshold ) {tls.answerMemory=false; return false;}
37  // first term is the minimal value of pT (pT-N*sigma(pT))
38  // secon term is the cut
39 
40  tls.answerMemory=true; return true;
41  }
42 
T perp() const
Definition: PV3DBase.h:72
const GlobalTrajectoryParameters & parameters() const
bool test(const TrajectoryMeasurement &tm, int foundHits) const
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
GlobalVector momentum() const
TrajectoryStateOnSurface const & updatedState() const
AlgebraicVector6 vector() const