Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:59

0001 #ifndef GroupedTrajCandLess_H
0002 #define GroupedTrajCandLess_H
0003 
0004 #include <functional>
0005 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0006 #include "TrackingTools/PatternTools/interface/TempTrajectory.h"
0007 
0008 /** Defines an ordering of Trajectories in terms of "goodness"
0009  *  The comparison is done in terms of total chi**2 / ndf plus
0010  *  a penalty for "lost" hits.
0011  */
0012 
0013 class dso_internal GroupedTrajCandLess {
0014 public:
0015   GroupedTrajCandLess(float p = 5, float b = 0) : penalty(p), bonus(b) {}
0016 
0017   template <typename T>
0018   bool operator()(const T& a, const T& b) const {
0019     return score(a) < score(b);
0020   }
0021 
0022 private:
0023   template <typename T>
0024   float looperPenalty(const T& t) const {
0025     return (t.dPhiCacheForLoopersReconstruction() == 0)
0026                ? 0.f
0027                : 0.5f * (1.f - std::cos(t.dPhiCacheForLoopersReconstruction())) * penalty;
0028   }
0029 
0030   template <typename T>
0031   float score(const T& t) const {
0032     auto bb = (t.dPhiCacheForLoopersReconstruction() == 0 && t.foundHits() > 8)
0033                   ? 2 * bonus
0034                   : bonus;  //extra bonus for long tracks not loopers
0035     if (t.lastMeasurement().updatedState().globalMomentum().perp2() < 0.81f)
0036       bb *= 0.5f;
0037     return t.chiSquared() - t.foundHits() * bb + t.lostHits() * penalty + looperPenalty(t);
0038   }
0039 
0040 private:
0041   float penalty;
0042   float bonus;
0043 };
0044 
0045 #endif