File indexing completed on 2024-04-06 12:31:40
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 }
0011
0012 bool MinPtTrajectoryFilter::test(const TrajectoryMeasurement& tm, int foundHits) const {
0013
0014 if (foundHits < theMinHits) {
0015 return true;
0016 }
0017
0018
0019
0020
0021 auto const& tsos = tm.updatedState();
0022 if (!tsos.isValid())
0023 return false;
0024 GlobalVector gtp = tsos.globalMomentum();
0025
0026
0027
0028 if (gtp == tls.ftsMemory) {
0029 return tls.answerMemory;
0030 }
0031 tls.ftsMemory = gtp;
0032
0033 auto pT2 = gtp.perp2();
0034
0035
0036 if (pT2 < 0.0010f) {
0037 tls.answerMemory = false;
0038 return false;
0039 }
0040
0041
0042 if (pT2 > thePtMin2) {
0043 tls.answerMemory = true;
0044 return true;
0045 }
0046
0047
0048 float invError = TrajectoryStateAccessor(*tsos.freeTrajectoryState()).inversePtError();
0049 if (invError > 1.e10f) {
0050 tls.answerMemory = false;
0051 return false;
0052 }
0053
0054
0055 if ((1.f / std::sqrt(pT2) - theNSigma * invError) > theInvPtMin) {
0056 tls.answerMemory = false;
0057 return false;
0058 }
0059
0060
0061
0062 tls.answerMemory = true;
0063 return true;
0064 }