CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
20 
21  //avoid doing twice the check in TBC and QF
22  // We make it thread local so that we avoid race conditions between
23  // threads, and we make sure there is no cache contention between them.
24  if (tls.ftsMemory.parameters().vector() == fts.parameters().vector()) { return tls.answerMemory;}
25  tls.ftsMemory=fts;
26 
27  //if p_T is way too small: stop
28  double pT = fts.momentum().perp();
29  if (pT<0.010) {tls.answerMemory=false; return false;}
30  //if error is way too big: stop
31  double invError = TrajectoryStateAccessor(fts).inversePtError();
32  if (invError > 1.e10) {tls.answerMemory=false;return false;}
33 
34  //calculate the actual pT cut:
35  if ((1/pT + theNSigma*invError ) < 1/thePtThreshold ) {tls.answerMemory=false; return false;}
36  // first term is the minimal value of pT (pT-N*sigma(pT))
37  // secon term is the cut
38 
39  tls.answerMemory=true; return true;
40  }
41 
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