New macro to keep track of timing performances of the segmentation methods (Laurent)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpNeighboursPadIterator.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 // $Id$
5 // $MpId: AliMpNeighboursPadIterator.h,v 1.12 2006/05/24 13:58:21 ivana Exp $
6
7 /// \ingroup sector
8 /// \class AliMpNeighboursPadIterator
9 /// \brief An iterator over the pads surrounding a given pad
10 ///
11 /// \author David Guez, Ivana Hrivnacova; IPN Orsay
12
13 #ifndef ALI_MP_NEIGHBOURS_PAD_ITERATOR_H
14 #define ALI_MP_NEIGHBOURS_PAD_ITERATOR_H
15
16 #include "AliMpContainers.h"
17
18 #include "AliMpVPadIterator.h"
19 #include "AliMpPad.h"
20
21 #ifdef WITH_ROOT
22 #include <TObjArray.h>
23 #endif
24
25 #ifdef WITH_STL
26 #include <vector>
27 #include <set>
28 #endif
29
30 class AliMpVSegmentation;
31 class AliMpIntPair;
32
33 class AliMpNeighboursPadIterator : public AliMpVPadIterator
34 {
35   public:
36 #ifdef WITH_STL
37     /// Pad vector type
38     typedef std::vector<AliMpPad>  PadVector;
39     /// Pad set type
40     typedef std::set<AliMpPad>     PadSet;
41     /// Pad set iterator type
42     typedef PadSet::const_iterator PadSetCIterator;
43 #endif
44 #ifdef WITH_ROOT
45     /// Pad vector type
46     typedef TObjArray  PadVector;
47     /// Pad set type
48     typedef TObjArray  PadSet;
49 #endif
50
51   public:
52     AliMpNeighboursPadIterator();
53     AliMpNeighboursPadIterator(const AliMpVSegmentation* segmentation,
54                                const AliMpPad& centerPad,
55                                Bool_t includeCenter=kFALSE);
56     AliMpNeighboursPadIterator(const AliMpNeighboursPadIterator& right);
57     virtual ~AliMpNeighboursPadIterator();
58
59     // operators
60     AliMpNeighboursPadIterator& 
61       operator = (const AliMpNeighboursPadIterator& right);
62
63     // methods
64     virtual void First();
65     virtual void Next();
66     virtual Bool_t IsDone() const;
67     virtual AliMpPad CurrentItem() const;
68     virtual void Invalidate();
69
70   private:
71     // static members
72     static const UInt_t   fgkInvalidIndex; ///< invalid index number
73
74     // private methods
75     Bool_t    IsNeighbour(const AliMpPad& pad) const;
76 #ifdef WITH_STL
77     PadVector PadVectorLine(const AliMpPad& from,
78                             const AliMpIntPair& direction) const;
79     void      UpdateTotalSet(PadSet& setTotal, const PadVector& from) const;
80 #endif
81 #ifdef WITH_ROOT
82     PadVector* PadVectorLine(const AliMpPad& from,
83                              const AliMpIntPair& direction) const;
84     void      UpdateTotalSet(PadSet& setTotal, PadVector* from) const;
85 #endif
86     void      FillPadsVector(Bool_t includeCenter);
87     Bool_t    IsValid() const;
88
89     // private data members
90     const AliMpVSegmentation* fkSegmentation; ///< \brief The segmentation
91                            ///  segmentation over which to iterate
92     AliMpPad   fCenterPad; ///< Pad arround which we iterate
93     PadVector  fPads;      ///< The list of pad arround fCenterIndices
94     UInt_t     fIndex;     ///< Current index inside the fPads vector
95
96   ClassDef(AliMpNeighboursPadIterator,1) // iterator over motif's pads
97 };
98
99 #endif // ALI_MP_NEIGHBOURS_PAD_ITERATOR_H