Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:38

0001 #ifndef CD_RecHitLessByDet_H_
0002 #define CD_RecHitLessByDet_H_
0003 
0004 /** \class RecHitLessByDet
0005  *  A comparison operator for RecHits.
0006  *  Returns true if the hits are in the order in which they
0007  *  would be seen by an outgoing (or an incoming) track.
0008  *  Only meaningful for RecHits from the same trajectory. Ported from ORCA
0009  *
0010  *  \author todorov, cerati
0011  */
0012 
0013 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0014 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0015 
0016 class RecHitLessByDet {
0017   typedef TransientTrackingRecHit::ConstRecHitPointer RecHitPointer;
0018 
0019 public:
0020   RecHitLessByDet(const PropagationDirection& dir) : theDirection(dir) {}
0021 
0022   ~RecHitLessByDet() {}
0023 
0024   bool operator()(const RecHitPointer& aHit, const RecHitPointer& bHit) const {
0025     return (theDirection == alongMomentum ? (aHit->surface()->toGlobal(aHit->localPosition()).mag() <
0026                                              bHit->surface()->toGlobal(bHit->localPosition()).mag())
0027                                           : (aHit->surface()->toGlobal(aHit->localPosition()).mag() >
0028                                              bHit->surface()->toGlobal(bHit->localPosition()).mag()));
0029   }
0030 
0031 private:
0032   PropagationDirection theDirection;
0033 };
0034 #endif  //CD_RecHitLessByDet_H_