CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/RecoTracker/CkfPattern/interface/GroupedTrajCandLess.h

Go to the documentation of this file.
00001 #ifndef GroupedTrajCandLess_H
00002 #define GroupedTrajCandLess_H
00003 
00004 #include <functional>
00005 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00006 #include "TrackingTools/PatternTools/interface/TempTrajectory.h"
00007 
00013 class GroupedTrajCandLess : public std::binary_function< const Trajectory&,
00014                             const Trajectory&, bool>
00015 {
00016 public:
00017 
00018   GroupedTrajCandLess( float p=5, float b=0) : penalty(p), bonus(b) {}
00019 
00020   bool operator()( const Trajectory& a, const Trajectory& b) const {
00021     return score(a) < score(b);
00022   }
00023 
00024   bool operator()( const TempTrajectory& a, const TempTrajectory& b) const {
00025     return score(a) < score(b);
00026   }
00027 
00028 private:
00029   float score (const Trajectory& t) const
00030   {
00031 //     int ndf(-5);
00032 //     float chi2(0.);
00033 //     vector<TrajectoryMeasurement> measurements(t.measurements());
00034 //     for ( vector<TrajectoryMeasurement>::const_iterator im=measurements.begin();
00035 //        im!=measurements.end(); im++ ) {
00036 //       if ( im->recHit().isValid() ) {
00037 //      ndf += im->recHit().dimension();
00038 //      chi2 += im->estimate();
00039 //       }
00040 //     }
00041 
00042 //     float normChi2(0.);
00043 //     if ( ndf>0 ) {
00044 //       // normalise chi2 to number of (2d) hits
00045 //       normChi2 = chi2/ndf*2;
00046 //     }
00047 //     else {
00048 // //       // include bonus for found hits
00049 // //       normChi2 = chi2 - ndf/2*penalty;
00050 //     }
00051 //     normChi2 -= t.foundHits()*2*b;
00052 //     return normChi2+t.lostHits()*penalty;
00053     return t.chiSquared()-t.foundHits()*bonus+t.lostHits()*penalty;
00054   }
00055   float score (const TempTrajectory& t) const
00056   {
00057     return t.chiSquared()-t.foundHits()*bonus+t.lostHits()*penalty;
00058   }
00059 
00060  private:
00061   
00062   float penalty;
00063   float bonus;
00064 
00065 };
00066 
00067 #endif