1 #ifndef RECOCALOTOOLS_NAVIGATION_CALONAVIGATOR_H
2 #define RECOCALOTOOLS_NAVIGATION_CALONAVIGATOR_H 1
7 template <
class T,
class TOPO=CaloSubdetectorTopology>
17 inline void setHome(
const T& startingPoint);
20 inline void setTopology(
const TOPO *);
29 inline void home()
const ;
32 T pos()
const {
return currentPoint_; }
40 currentPoint_=myTopology_->goNorth(currentPoint_);
47 currentPoint_=myTopology_->goSouth(currentPoint_);
54 currentPoint_=myTopology_->goEast(currentPoint_);
61 currentPoint_=myTopology_->goWest(currentPoint_);
68 currentPoint_=myTopology_->goUp(currentPoint_);
75 currentPoint_=myTopology_->goDown(currentPoint_);
82 for(
int x=0;
x <
abs(deltaX) && currentPoint_ !=
T(0);
x++)
84 if(deltaX > 0)
east();
88 for(
int y=0;
y <
abs(deltaY) && currentPoint_ !=
T(0);
y++)
90 if(deltaY > 0)
north();
104 template <
class T,
class TOPO>
106 void CaloNavigator<T,TOPO>::setHome(
const T& startingPoint)
108 startingPoint_=startingPoint;
112 template <
class T,
class TOPO>
114 void CaloNavigator<T,TOPO>::home()
const
116 currentPoint_=startingPoint_;
119 template <
class T,
class TOPO>
121 void CaloNavigator<T,TOPO>::setTopology(
const TOPO * topology)
123 if (myTopology_ == 0)
124 myTopology_=topology;
T operator*() const
get the current position
T pos() const
get the current position
T down() const
move the navigator west
const TOPO * getTopology() const
set the starting position
T up() const
move the navigator west
CaloNavigator(const T &home, const TOPO *topology)
Abs< T >::type abs(const T &t)
T east() const
move the navigator east
T west() const
move the navigator west
T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
T north() const
move the navigator north
T south() const
move the navigator south
Unlimited (trivial) bounds.