CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThresholdPtTrajectoryFilter.h
Go to the documentation of this file.
1 #ifndef ThresholdPtTrajectoryFilter_H
2 #define ThresholdPtTrajectoryFilter_H
3 
7 
11 
19 public:
20 
21  explicit ThresholdPtTrajectoryFilter( double ptThreshold, float nSigma = 5.F, int nH=3): thePtThreshold( ptThreshold), theNSigma(nSigma), theMinHits(nH) {}
22 
24  thePtThreshold(pset.getParameter<double>("thresholdPt")),
25  theNSigma(pset.getParameter<double>("nSigmaThresholdPt")),
26  theMinHits(pset.getParameter<int>("minHitsThresholdPt"))
27  {}
28 
29  virtual bool qualityFilter( const Trajectory& traj) const { return !test(traj.lastMeasurement(),traj.foundHits());}
30  virtual bool qualityFilter( const TempTrajectory& traj) const { return !test(traj.lastMeasurement(),traj.foundHits());}
31 
32  virtual bool toBeContinued( Trajectory& traj) const { return test(traj.lastMeasurement(),traj.foundHits()); }
33  virtual bool toBeContinued( TempTrajectory& traj) const { return test(traj.lastMeasurement(),traj.foundHits()); }
34 
35  virtual std::string name() const {return "ThresholdPtTrajectoryFilter";}
36 
37  protected:
38 
39  bool test( const TrajectoryMeasurement & tm, int foundHits) const
40  {
41  //first check min number of hits
42  if (foundHits < theMinHits ){ return true;}
43 
44  // check for momentum below limit
46 
47  //avoid doing twice the check in TBC and QF
48  static bool answerMemory=false;
49  static FreeTrajectoryState ftsMemory;
50  if (ftsMemory.parameters().vector() == fts.parameters().vector()) { return answerMemory;}
51  ftsMemory=fts;
52 
53  //if p_T is way too small: stop
54  double pT = fts.momentum().perp();
55  if (pT<0.010) {answerMemory=false; return false;}
56  //if error is way too big: stop
57  double invError = TrajectoryStateAccessor(fts).inversePtError();
58  if (invError > 1.e10) {answerMemory=false;return false;}
59 
60  //calculate the actual pT cut:
61  if ((1/pT + theNSigma*invError ) < 1/thePtThreshold ) {answerMemory=false; return false;}
62  // first term is the minimal value of pT (pT-N*sigma(pT))
63  // secon term is the cut
64 
65  answerMemory=true; return true;
66  }
67 
69  double theNSigma;
71 
72 };
73 
74 #endif
virtual bool toBeContinued(Trajectory &traj) const
int foundHits() const
Definition: Trajectory.h:224
T perp() const
Definition: PV3DBase.h:71
const GlobalTrajectoryParameters & parameters() const
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
int foundHits() const
obsolete name, use measurements() instead.
ThresholdPtTrajectoryFilter(double ptThreshold, float nSigma=5.F, int nH=3)
virtual bool toBeContinued(TempTrajectory &traj) const
virtual bool qualityFilter(const Trajectory &traj) const
const TrajectoryMeasurement & lastMeasurement() const
bool test(const TrajectoryMeasurement &tm, int foundHits) const
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
TrajectoryStateOnSurface updatedState() const
GlobalVector momentum() const
virtual std::string name() const
ThresholdPtTrajectoryFilter(const edm::ParameterSet &pset)
virtual bool qualityFilter(const TempTrajectory &traj) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
AlgebraicVector6 vector() const