CMS 3D CMS Logo

SeedExtensionTrajectoryFilter.h
Go to the documentation of this file.
1 #ifndef SeedExtensionTrajectoryFilter_H
2 #define SeedExtensionTrajectoryFilter_H
3 
5 
7 public:
8 
10 
12  theStrict(pset.getParameter<bool>("strictSeedExtension")),
13  thePixel(pset.getParameter<bool>("pixelSeedExtension")),
14  theExtension(pset.getParameter<int>("seedExtension")) {}
15 
16  bool qualityFilter( const Trajectory& traj) const override { return QF(traj); }
17  bool qualityFilter( const TempTrajectory& traj) const override { return QF(traj); }
18 
19  bool toBeContinued( TempTrajectory& traj) const override { return TBC<TempTrajectory>(traj);}
20  bool toBeContinued( Trajectory& traj) const override{ return TBC<Trajectory>(traj);}
21 
22  std::string name() const override{return "LostHitsFractionTrajectoryFilter";}
23 
24 private:
25  template<class T> bool QF(const T & traj) const {
26  return traj.stopReason() != StopReason::SEED_EXTENSION; // reject tracks killed by seed extension
27  }
28 
29  template<class T> bool TBC(T& traj) const {
30  if(theExtension <= 0) return true; // skipping checks explicitly when intended to be disabled is the safest way
31  const bool ret = theStrict? strictTBC(traj) : looseTBC(traj);
32  if(!ret) traj.setStopReason(StopReason::SEED_EXTENSION);
33  return ret;
34  }
35  template<class T> bool looseTBC(const T& traj) const;
36  template<class T> bool strictTBC(const T& traj) const;
37 
38 
39  bool theStrict=false;
40  bool thePixel=false;
41  int theExtension = 0;
42 
43 
44 };
45 
46 template<class T> bool SeedExtensionTrajectoryFilter::looseTBC(const T& traj) const {
47  int nhits = 0;
48  if(thePixel) {
49  for(const auto& tm: traj.measurements()) {
50  if(Trajectory::pixel(*(tm.recHit())))
51  ++nhits;
52  }
53  }
54  else {
55  nhits = traj.measurements().size();
56  }
57  return (nhits>int(traj.seedNHits())+theExtension) | (0==traj.lostHits());
58 }
59 
60 
61 // strict case as a real seeding: do not allow even inactive
62 template<class T> bool SeedExtensionTrajectoryFilter::strictTBC(const T& traj) const {
63  const int nhits = thePixel ? traj.foundPixelHits() : traj.foundHits();
64  return nhits>=int(traj.seedNHits())+theExtension;
65 }
66 
67 
68 
69 
70 #endif
SeedExtensionTrajectoryFilter(edm::ParameterSet const &pset, edm::ConsumesCollector &)
bool qualityFilter(const TempTrajectory &traj) const override
bool qualityFilter(const Trajectory &traj) const override
static bool pixel(const TrackingRecHit &hit)
Definition: Trajectory.cc:177
bool toBeContinued(Trajectory &traj) const override
bool toBeContinued(TempTrajectory &traj) const override
long double T