CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/TrackingTools/DetLayers/src/DetLessZ.h

Go to the documentation of this file.
00001 #ifndef DetLayers_DetLessZ_H
00002 #define DetLayers_DetLessZ_H
00003 
00004 #include "TrackingTools/DetLayers/interface/GeometricSearchDet.h"
00005 
00009 typedef GeometricSearchDet Det;
00010 
00011 class DetLessZ : public std::binary_function<const Det*, const Det*, bool> {
00012 public:
00013   bool operator()( const Det* a, const Det* b) const {
00014 
00015     // multiply by 1+epsilon to make it numericaly stable
00016     // the epsilon should depend on the scalar precision,
00017     // this is just a quick fix!
00018     if (a->position().z() > 0) {
00019       return a->position().z()*1.000001 < b->position().z();
00020     }
00021     else if (b->position().z() < 0) {
00022       return a->position().z() < b->position().z()*1.000001;
00023     }
00024     else return true;
00025   }
00026 
00027 };
00028 
00029 #endif