CMS 3D CMS Logo

MinPtTrajectoryFilter.cc
Go to the documentation of this file.
2 
3 namespace {
4 struct TLS {
5  bool answerMemory=false;
6  GlobalVector ftsMemory;
7 
8 };
9 
10 thread_local TLS tls;
11 }
12 
13 
14  bool MinPtTrajectoryFilter::test( const TrajectoryMeasurement & tm, int foundHits) const
15  {
16  //first check min number of hits
17  if (foundHits < theMinHits ){ return true;}
18 
19  // check for momentum below limit
20  // const FreeTrajectoryState& fts = *tm.updatedState().freeTrajectoryState();
21 
22  auto const & tsos = tm.updatedState();
23  if (!tsos.isValid()) return false;
24  GlobalVector gtp = tsos.globalMomentum();
25 
26  //avoid doing twice the check in TBC and QF
27 
28 
29  if ( gtp == tls.ftsMemory) { return tls.answerMemory;}
30  tls.ftsMemory= gtp;
31 
32  auto pT2 = gtp.perp2();
33 
34  //if p_T is way too small: stop
35  if (pT2<0.0010f) {tls.answerMemory=false; return false;}
36 
37  // if large enouth go
38  if (pT2> thePtMin2) { tls.answerMemory=true; return true;}
39 
40  //if error is way too big: stop
41  float invError = TrajectoryStateAccessor(*tsos.freeTrajectoryState()).inversePtError();
42  if (invError > 1.e10f) {tls.answerMemory=false;return false;}
43 
44  //calculate the actual pT cut:
45  if ((1.f/std::sqrt(pT2) - theNSigma*invError) > theInvPtMin ) {tls.answerMemory=false; return false;}
46  // first term if the max value of pT (pT+N*sigma(pT))
47  // second tern is the cut
48 
49  tls.answerMemory=true; return true;
50  }
51 
bool test(const TrajectoryMeasurement &tm, int foundHits) const
T perp2() const
Definition: PV3DBase.h:71
T sqrt(T t)
Definition: SSEVec.h:18
double f[11][100]
TrajectoryStateOnSurface const & updatedState() const