AliRoot Core  3dc7879 (3dc7879)
AliMpSectorPadIterator.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 // $Id$
17 // $MpId: AliMpSectorPadIterator.cxx,v 1.6 2006/05/24 13:58:46 ivana Exp $
18 // Category: sector
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpSectorPadIterator
22 // ----------------------------
23 // Class, which defines an iterator over the pads of a sector
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26 //-----------------------------------------------------------------------------
27 
28 
29 #include "AliMpSectorPadIterator.h"
30 #include "AliMpSector.h"
31 #include "AliMpMotifType.h"
32 
33 #include "AliMpRow.h"
34 #include "AliMpVRowSegment.h"
35 #include "AliMpMotifMap.h"
36 #include "AliMpMotifPosition.h"
37 
39 ClassImp(AliMpSectorPadIterator)
41 
42 //______________________________________________________________________________
45  fkSector(0),
46  fCurrentIndex(0),
47  fMotifPos(0),
48  fIterator()
49 {
51 }
52 
53 //______________________________________________________________________________
56  fkSector(sector),
57  fCurrentIndex(0),
58  fMotifPos(0),
59  fIterator()
60 {
62 }
63 
64 //______________________________________________________________________________
66  : AliMpVPadIterator(right),
67  fkSector(0),
68  fCurrentIndex(0),
69  fMotifPos(0),
70  fIterator()
71 {
73 
74  *this = right;
75 }
76 
77 //______________________________________________________________________________
79 {
81 }
82 
83 //
84 // operators
85 //
86 
87 //______________________________________________________________________________
90 {
92 
93  // check assignment to self
94  if (this == &right) return *this;
95 
96  // base class assignment
98 
99  fkSector = right.fkSector;
101  fMotifPos = right.fMotifPos;
102  fIterator = right.fIterator;
103 
104  return *this;
105 }
106 
107 //private methods
108 
109 //______________________________________________________________________________
111 {
115 
117  Invalidate();
118  return 0;
119  }
120 
123  fIterator.First();
124 
125  return fMotifPos;
126 }
127 
128 //______________________________________________________________________________
130 {
132 
133  return (fkSector!=0) && (fMotifPos!=0);
134 }
135 
136 //
137 //public methods
138 //
139 
140 //______________________________________________________________________________
142 {
145 
146  if (!fkSector) {
147  Invalidate();
148  return;
149  }
150  fCurrentIndex =0;
152 
153  return;
154 }
155 
156 //______________________________________________________________________________
158 {
160 
161  if (!IsValid()) return;
162 
163  fIterator.Next();
164 
165  if (!fIterator.IsDone()) return;
166 
167 
168  // Go to the next motif, in the current segment
169  ++fCurrentIndex;
170  if (ResetToCurrentMotifPosition()) return;
171 
172  Invalidate();
173  return;
174 
175 }
176 
177 //______________________________________________________________________________
179 {
181 
182  return ! IsValid();
183 }
184 
185 //______________________________________________________________________________
187 {
189 
190  if (!IsValid())
191  return AliMpPad::Invalid();
192 
193 
194  // no more verification, since IsValid() is TRUE here.
195  return fIterator.CurrentItem();
196 }
197 
198 //______________________________________________________________________________
200 {
202  fMotifPos = 0;
204 }
205 
virtual void Next()
Set iterator to the next pad.
virtual Bool_t IsDone() const
Is iterator done.
virtual void Next()
Set iterator to the next pad.
AliMpSectorPadIterator & operator=(const AliMpSectorPadIterator &right)
UInt_t GetNofMotifPositions() const
virtual AliMpPad CurrentItem() const
Return current pad.
An iterator over the pads of a sector.
static AliMpPad Invalid()
Return invalid pad.
Definition: AliMpPad.h:57
virtual void First()
Set iterator to the first pad.
A placed motif.
An interface for an iterator over pads.
virtual AliMpPad CurrentItem() const
Return current pad.
virtual void Invalidate()
Invalidate iterator (.
A sector (quadrant) of the MUON chamber of stations 1 and 2.
Definition: AliMpSector.h:34
AliMpMotifPosition * ResetToCurrentMotifPosition()
virtual Bool_t IsDone() const
Is iterator done.
const AliMpSector * fkSector
the sector over which to iterate
AliMpMotifPosition * GetMotifPosition(UInt_t index) const
AliMpMotifPosition * fMotifPos
the current motif position
virtual void Invalidate()
Invalidate iterator (.
AliMpMotifMap * GetMotifMap() const
Return the motif map.
Definition: AliMpSector.h:159
An iterator over the pads of a given motif position.
AliMpMotifPositionPadIterator fIterator
iterator over the current motif type
virtual void First()
Set iterator to the first pad.
Class which encapsuate all information about a pad.
Definition: AliMpPad.h:22
UInt_t fCurrentIndex
the current motif position index
AliMpVPadIterator & operator=(const AliMpVPadIterator &right)