File indexing completed on 2024-04-06 12:31:27
0001 #ifndef TkNavigation_TkLayerLess_H
0002 #define TkNavigation_TkLayerLess_H
0003
0004 #include "TrackingTools/DetLayers/interface/NavigationDirection.h"
0005 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
0006 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
0007 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
0008 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
0009
0010
0011
0012
0013
0014 class TkLayerLess {
0015 public:
0016 TkLayerLess(NavigationDirection dir = insideOut, const DetLayer* fromLayer = nullptr) : theDir(dir) {
0017 if (fromLayer) {
0018 theOriginLayer = true;
0019 theFromLayerSign = (fromLayer->position().z() > 0 ? 1 : -1);
0020 } else
0021 theOriginLayer = false;
0022 }
0023
0024 bool operator()(const DetLayer* a, const DetLayer* b) const {
0025 if (!theOriginLayer) {
0026 if (theDir == insideOut)
0027 return insideOutLess(a, b);
0028 else
0029 return insideOutLess(b, a);
0030 } else {
0031 if (theDir == insideOut)
0032 return insideOutLessSigned(a, b);
0033 else
0034 return insideOutLessSigned(b, a);
0035 }
0036 }
0037
0038 private:
0039 NavigationDirection theDir;
0040 bool theOriginLayer;
0041 int theFromLayerSign;
0042
0043 bool insideOutLess(const DetLayer*, const DetLayer*) const;
0044 bool insideOutLessSigned(const DetLayer*, const DetLayer*) const;
0045
0046 bool barrelForwardLess(const BarrelDetLayer* blb, const ForwardDetLayer* fla) const;
0047 };
0048
0049 #endif