Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef MinHitsTrajectoryFilter_H
0002 #define MinHitsTrajectoryFilter_H
0003 
0004 #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0006 
0007 /** A TrajectoryFilter that stops reconstruction if P_t drops
0008  *  below some value at some confidence level.
0009  *  The CkfTrajectoryBuilder uses this class to
0010  *  implement the minimal P_t cut.
0011  */
0012 
0013 class MinHitsTrajectoryFilter final : public TrajectoryFilter {
0014 public:
0015   explicit MinHitsTrajectoryFilter(int minHits = 5,
0016                                    double highEtaSwitch = sinh(5.0),
0017                                    int minHitsAtHighEta = 5,
0018                                    int seedPairPenalty = 0)
0019       : theMinHits(minHits),
0020         theHighEtaSwitch(highEtaSwitch),
0021         theMinHitsAtHighEta(minHitsAtHighEta),
0022         theSeedPairPenalty(seedPairPenalty) {}
0023 
0024   MinHitsTrajectoryFilter(const edm::ParameterSet& pset, edm::ConsumesCollector& iC)
0025       : theMinHits(pset.getParameter<int>("minimumNumberOfHits")),
0026         theHighEtaSwitch(sinh(pset.getParameter<double>("highEtaSwitch"))),
0027         theMinHitsAtHighEta(pset.getParameter<int>("minHitsAtHighEta")),
0028         theSeedPairPenalty(pset.getParameter<int>("seedPairPenalty")) {}
0029 
0030   static void fillPSetDescription(edm::ParameterSetDescription& iDesc) {
0031     iDesc.add<int>("minimumNumberOfHits", 5);
0032     iDesc.add<double>("highEtaSwitch", 5.0);
0033     iDesc.add<int>("minHitsAtHighEta", 5);
0034     iDesc.add<int>("seedPairPenalty", 0);
0035   }
0036 
0037   bool qualityFilter(const Trajectory& traj) const override { return QF<Trajectory>(traj); }
0038   bool qualityFilter(const TempTrajectory& traj) const override { return QF<TempTrajectory>(traj); }
0039 
0040   bool toBeContinued(TempTrajectory&) const override { return TrajectoryFilter::toBeContinuedIfNotContributing; }
0041   bool toBeContinued(Trajectory&) const override { return TrajectoryFilter::toBeContinuedIfNotContributing; }
0042 
0043   std::string name() const override { return "MinHitsTrajectoryFilter"; }
0044 
0045 protected:
0046   template <class T>
0047   bool QF(const T& traj) const {
0048     int seedPenalty = (2 == traj.seedNHits()) ? theSeedPairPenalty : 0;  // increase by one if seed-doublet...
0049     bool passed = false;
0050 
0051     if (!traj.empty()) {
0052       auto pt2 = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().perp2();
0053       auto pz = traj.lastMeasurement().updatedState().freeTrajectoryState()->momentum().z();
0054       auto sinhTrajEta2 = (pz * pz) / pt2;
0055       if (sinhTrajEta2 < (theHighEtaSwitch * theHighEtaSwitch)) {
0056         if (traj.foundHits() >= theMinHits + seedPenalty)
0057           passed = true;
0058       } else {  //absTrajEta>theHighEtaSwitch, so apply relaxed cuts
0059         if (traj.foundHits() >= theMinHitsAtHighEta + seedPenalty)
0060           passed = true;
0061       }
0062     }
0063     return passed;
0064   }
0065 
0066   int theMinHits;
0067   double theHighEtaSwitch;
0068   int theMinHitsAtHighEta;
0069   int theSeedPairPenalty;
0070 };
0071 
0072 #endif