CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  GlobalVector gtp = tsos.globalMomentum();
24 
25  //avoid doing twice the check in TBC and QF
26 
27 
28  if ( gtp == tls.ftsMemory) { return tls.answerMemory;}
29  tls.ftsMemory= gtp;
30 
31  auto pT2 = gtp.perp2();
32 
33  //if p_T is way too small: stop
34  if (pT2<0.0010f) {tls.answerMemory=false; return false;}
35 
36  // if large enouth go
37  if (pT2> thePtMin2) { tls.answerMemory=true; return true;}
38 
39  //if error is way too big: stop
40  float invError = TrajectoryStateAccessor(*tsos.freeTrajectoryState()).inversePtError();
41  if (invError > 1.e10f) {tls.answerMemory=false;return false;}
42 
43  //calculate the actual pT cut:
44  if ((1.f/std::sqrt(pT2) - theNSigma*invError) > theInvPtMin ) {tls.answerMemory=false; return false;}
45  // first term if the max value of pT (pT+N*sigma(pT))
46  // second tern is the cut
47 
48  tls.answerMemory=true; return true;
49  }
50 
bool test(const TrajectoryMeasurement &tm, int foundHits) const
T perp2() const
Definition: PV3DBase.h:71
T sqrt(T t)
Definition: SSEVec.h:48
double f[11][100]
TrajectoryStateOnSurface const & updatedState() const