Go to the documentation of this file.00001 #ifndef ThresholdPtTrajectoryFilter_H
00002 #define ThresholdPtTrajectoryFilter_H
00003
00004 #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h"
00005 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00006 #include "TrackingTools/PatternTools/interface/TempTrajectory.h"
00007
00008 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00009 #include "TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryError.h"
00010 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateAccessor.h"
00011
00018 class ThresholdPtTrajectoryFilter : public TrajectoryFilter {
00019 public:
00020
00021 explicit ThresholdPtTrajectoryFilter( double ptThreshold, float nSigma = 5.F, int nH=3): thePtThreshold( ptThreshold), theNSigma(nSigma), theMinHits(nH) {}
00022
00023 explicit ThresholdPtTrajectoryFilter( const edm::ParameterSet & pset) :
00024 thePtThreshold(pset.getParameter<double>("thresholdPt")),
00025 theNSigma(pset.getParameter<double>("nSigmaThresholdPt")),
00026 theMinHits(pset.getParameter<int>("minHitsThresholdPt"))
00027 {}
00028
00029 virtual bool qualityFilter( const Trajectory& traj) const { return !test(traj.lastMeasurement(),traj.foundHits());}
00030 virtual bool qualityFilter( const TempTrajectory& traj) const { return !test(traj.lastMeasurement(),traj.foundHits());}
00031
00032 virtual bool toBeContinued( Trajectory& traj) const { return test(traj.lastMeasurement(),traj.foundHits()); }
00033 virtual bool toBeContinued( TempTrajectory& traj) const { return test(traj.lastMeasurement(),traj.foundHits()); }
00034
00035 virtual std::string name() const {return "ThresholdPtTrajectoryFilter";}
00036
00037 protected:
00038
00039 bool test( const TrajectoryMeasurement & tm, int foundHits) const
00040 {
00041
00042 if (foundHits < theMinHits ){ return true;}
00043
00044
00045 const FreeTrajectoryState& fts = *tm.updatedState().freeTrajectoryState();
00046
00047
00048 static bool answerMemory=false;
00049 static FreeTrajectoryState ftsMemory;
00050 if (ftsMemory.parameters().vector() == fts.parameters().vector()) { return answerMemory;}
00051 ftsMemory=fts;
00052
00053
00054 double pT = fts.momentum().perp();
00055 if (pT<0.010) {answerMemory=false; return false;}
00056
00057 double invError = TrajectoryStateAccessor(fts).inversePtError();
00058 if (invError > 1.e10) {answerMemory=false;return false;}
00059
00060
00061 if ((1/pT + theNSigma*invError ) < 1/thePtThreshold ) {answerMemory=false; return false;}
00062
00063
00064
00065 answerMemory=true; return true;
00066 }
00067
00068 double thePtThreshold;
00069 double theNSigma;
00070 int theMinHits;
00071
00072 };
00073
00074 #endif