Go to the documentation of this file.00001 #ifndef TkNavigation_TkLayerLess_H
00002 #define TkNavigation_TkLayerLess_H
00003
00004 #include "TrackingTools/DetLayers/interface/NavigationDirection.h"
00005 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00006 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
00007 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
00008 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
00009 #include <functional>
00010
00015 class TkLayerLess
00016 : public std::binary_function< const DetLayer*,const DetLayer*,bool> {
00017 public:
00018
00019 TkLayerLess( NavigationDirection dir = insideOut, const DetLayer * fromLayer = 0) :
00020 theDir(dir) {
00021 if (fromLayer){
00022 theOriginLayer = true;
00023 theFromLayerSign = (fromLayer->position().z()>0 ? 1 : -1) ;
00024 }else theOriginLayer = false;
00025 }
00026
00027 bool operator()( const DetLayer* a, const DetLayer* b) const {
00028 if (!theOriginLayer){
00029 if (theDir == insideOut) return insideOutLess( a, b);
00030 else return insideOutLess( b, a);
00031 }
00032 else{
00033 if (theDir == insideOut) return insideOutLessSigned( a, b);
00034 else return insideOutLessSigned(b, a);
00035 }
00036 }
00037
00038 private:
00039
00040 NavigationDirection theDir;
00041 bool theOriginLayer;
00042 int theFromLayerSign;
00043
00044 bool insideOutLess( const DetLayer*,const DetLayer*) const;
00045 bool insideOutLessSigned( const DetLayer*,const DetLayer*) const;
00046
00047 bool barrelForwardLess( const BarrelDetLayer* blb,
00048 const ForwardDetLayer* fla) const;
00049
00050 };
00051
00052 #endif