Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-10 06:14:23

0001 #ifndef MinPtTrajectoryFilter_H
0002 #define MinPtTrajectoryFilter_H
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h"
0006 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0007 #include "TrackingTools/PatternTools/interface/TempTrajectory.h"
0008 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0009 #include "TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryError.h"
0010 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateAccessor.h"
0011 
0012 /** A TrajectoryFilter that stops reconstruction if P_t drops
0013  *  below some value at some confidence level.
0014  *  The CkfTrajectoryBuilder uses this class to
0015  *  implement the minimal P_t cut.
0016  */
0017 
0018 class MinPtTrajectoryFilter final : public TrajectoryFilter {
0019 public:
0020   explicit MinPtTrajectoryFilter(float ptMin, float nSigma = 5.F, int nH = 3)
0021       : thePtMin2(ptMin * ptMin), theInvPtMin(1.f / ptMin), theNSigma(nSigma), theMinHits(nH) {}
0022 
0023   explicit MinPtTrajectoryFilter(const edm::ParameterSet& pset, edm::ConsumesCollector& iC)
0024       : thePtMin2(pset.getParameter<double>("minPt")),
0025         theInvPtMin(1.f / thePtMin2),
0026         theNSigma(pset.getParameter<double>("nSigmaMinPt")),
0027         theMinHits(pset.getParameter<int>("minHitsMinPt")) {
0028     thePtMin2 *= thePtMin2;
0029   }
0030 
0031   static void fillPSetDescription(edm::ParameterSetDescription& iDesc) {
0032     iDesc.add<double>("minPt", 0.9);
0033     iDesc.add<double>("nSigmaMinPt", 5.0);
0034     iDesc.add<int>("minHitsMinPt", 3);
0035   }
0036 
0037   bool qualityFilter(const Trajectory& traj) const override { return test(traj.lastMeasurement(), traj.foundHits()); }
0038   bool qualityFilter(const TempTrajectory& traj) const override {
0039     return test(traj.lastMeasurement(), traj.foundHits());
0040   }
0041 
0042   bool toBeContinued(Trajectory& traj) const override {
0043     bool ret = test(traj.lastMeasurement(), traj.foundHits());
0044     if (!ret)
0045       traj.setStopReason(StopReason::MIN_PT);
0046     return ret;
0047   }
0048   bool toBeContinued(TempTrajectory& traj) const override {
0049     bool ret = test(traj.lastMeasurement(), traj.foundHits());
0050     if (!ret)
0051       traj.setStopReason(StopReason::MIN_PT);
0052     return ret;
0053   }
0054 
0055   std::string name() const override { return "MinPtTrajectoryFilter"; }
0056 
0057 protected:
0058   bool test(const TrajectoryMeasurement& tm, int foundHits) const;
0059 
0060   float thePtMin2;
0061   float theInvPtMin;
0062   float theNSigma;
0063   int theMinHits;
0064 };
0065 
0066 #endif