]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpNeighboursPadIterator.h
Adding CreateIterator(void) and GetNeighbours() pure virtual methods,
[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     typedef std::vector<AliMpPad>  PadVector;
38     typedef std::set<AliMpPad>     PadSet;
39     typedef PadSet::const_iterator PadSetCIterator;
40 #endif
41 #ifdef WITH_ROOT
42     typedef TObjArray  PadVector;
43     typedef TObjArray  PadSet;
44 #endif
45
46   public:
47     AliMpNeighboursPadIterator();
48     AliMpNeighboursPadIterator(const AliMpVSegmentation* segmentation,
49                                const AliMpPad& centerPad,
50                                Bool_t includeCenter=kFALSE);
51     AliMpNeighboursPadIterator(const AliMpNeighboursPadIterator& right);
52     virtual ~AliMpNeighboursPadIterator();
53
54     // operators
55     AliMpNeighboursPadIterator& 
56       operator = (const AliMpNeighboursPadIterator& right);
57
58     // methods
59     virtual void First();
60     virtual void Next();
61     virtual Bool_t IsDone() const;
62     virtual AliMpPad CurrentItem() const;
63     virtual void Invalidate();
64
65   private:
66     // static members
67     static const UInt_t   fgkInvalidIndex; // invalid index number
68
69     // private methods
70     Bool_t    IsNeighbour(const AliMpPad& pad) const;
71 #ifdef WITH_STL
72     PadVector PadVectorLine(const AliMpPad& from,
73                             const AliMpIntPair& direction) const;
74     void      UpdateTotalSet(PadSet& setTotal, const PadVector& from) const;
75 #endif
76 #ifdef WITH_ROOT
77     PadVector* PadVectorLine(const AliMpPad& from,
78                              const AliMpIntPair& direction) const;
79     void      UpdateTotalSet(PadSet& setTotal, PadVector* from) const;
80 #endif
81     void      FillPadsVector(Bool_t includeCenter);
82     Bool_t    IsValid() const;
83
84     // private data members
85     const AliMpVSegmentation* fkSegmentation; ///< \brief The segmentation
86                            ///  segmentation over which to iterate
87     AliMpPad   fCenterPad; ///< Pad arround which we iterate
88     PadVector  fPads;      ///< The list of pad arround fCenterIndices
89     UInt_t     fIndex;     ///< Current index inside the fPads vector
90
91   ClassDef(AliMpNeighboursPadIterator,1) // iterator over motif's pads
92 };
93
94 #endif // ALI_MP_NEIGHBOURS_PAD_ITERATOR_H