Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:50

0001 #include "TrackingTools/TrajectoryFiltering/interface/MinPtTrajectoryFilter.h"
0002 
0003 namespace {
0004   struct TLS {
0005     bool answerMemory = false;
0006     GlobalVector ftsMemory;
0007   };
0008 
0009   thread_local TLS tls;
0010 }  // namespace
0011 
0012 bool MinPtTrajectoryFilter::test(const TrajectoryMeasurement& tm, int foundHits) const {
0013   //first check min number of hits
0014   if (foundHits < theMinHits) {
0015     return true;
0016   }
0017 
0018   // check for momentum below limit
0019   //    const FreeTrajectoryState& fts = *tm.updatedState().freeTrajectoryState();
0020 
0021   auto const& tsos = tm.updatedState();
0022   if (!tsos.isValid())
0023     return false;
0024   GlobalVector gtp = tsos.globalMomentum();
0025 
0026   //avoid doing twice the check in TBC and QF
0027 
0028   if (gtp == tls.ftsMemory) {
0029     return tls.answerMemory;
0030   }
0031   tls.ftsMemory = gtp;
0032 
0033   auto pT2 = gtp.perp2();
0034 
0035   //if p_T is way too small: stop
0036   if (pT2 < 0.0010f) {
0037     tls.answerMemory = false;
0038     return false;
0039   }
0040 
0041   // if large enouth go
0042   if (pT2 > thePtMin2) {
0043     tls.answerMemory = true;
0044     return true;
0045   }
0046 
0047   //if error is way too big: stop
0048   float invError = TrajectoryStateAccessor(*tsos.freeTrajectoryState()).inversePtError();
0049   if (invError > 1.e10f) {
0050     tls.answerMemory = false;
0051     return false;
0052   }
0053 
0054   //calculate the actual pT cut:
0055   if ((1.f / std::sqrt(pT2) - theNSigma * invError) > theInvPtMin) {
0056     tls.answerMemory = false;
0057     return false;
0058   }
0059   //    first term if the max value of pT (pT+N*sigma(pT))
0060   //    second tern is the cut
0061 
0062   tls.answerMemory = true;
0063   return true;
0064 }