]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpSectorAreaVPadIterator.cxx
Updated comments for Doxygen - corrected warnings
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSectorAreaVPadIterator.cxx
CommitLineData
dee1d5f1 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
5f91c9e8 16// $Id$
13985652 17// $MpId: AliMpSectorAreaVPadIterator.cxx,v 1.8 2006/05/24 13:58:46 ivana Exp $
5f91c9e8 18// Category: sector
19//
20// Class AliMpSectorAreaVPadIterator
21// ---------------------------------
22// Class, which defines an iterator over the pads
23// inside a given area in a sector in vertical direction.
dbe945cc 24// Included in AliRoot: 2003/05/02
5f91c9e8 25// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26
5f91c9e8 27#include "AliMpSectorAreaVPadIterator.h"
28#include "AliMpSectorSegmentation.h"
29#include "AliMpConstants.h"
30
2c605e66 31#include <Riostream.h>
32
13985652 33/// \cond CLASSIMP
5f91c9e8 34ClassImp(AliMpSectorAreaVPadIterator)
13985652 35/// \endcond
5f91c9e8 36
37//______________________________________________________________________________
38AliMpSectorAreaVPadIterator::AliMpSectorAreaVPadIterator(
39 const AliMpSectorSegmentation* segmentation,
40 const AliMpArea& area)
41 : AliMpVPadIterator(),
42 fkSegmentation(segmentation),
43 fkArea(area),
44 fCurrentPad(AliMpPad::Invalid()),
45 fCurrentColumnPosition(0.)
46{
dee1d5f1 47/// Standard constructor, start in invalid position
5f91c9e8 48}
49
50//______________________________________________________________________________
51AliMpSectorAreaVPadIterator::AliMpSectorAreaVPadIterator(
52 const AliMpSectorAreaVPadIterator& right)
53 : AliMpVPadIterator(right)
54{
dee1d5f1 55/// Protected copy constructor (not provided)
5f91c9e8 56
57 Fatal("Copy constructor", "Not implemented");
58}
59
60//______________________________________________________________________________
61AliMpSectorAreaVPadIterator::AliMpSectorAreaVPadIterator()
62 : AliMpVPadIterator(),
63 fkSegmentation(0),
64 fkArea(AliMpArea()),
65 fCurrentPad(AliMpPad::Invalid()),
66 fCurrentColumnPosition(0.)
67{
dee1d5f1 68/// Default constructor.
5f91c9e8 69}
70
71//______________________________________________________________________________
72AliMpSectorAreaVPadIterator::~AliMpSectorAreaVPadIterator()
73{
dee1d5f1 74/// Destructor
5f91c9e8 75}
76
77//
78// operators
79//
80
81//______________________________________________________________________________
82AliMpSectorAreaVPadIterator&
83AliMpSectorAreaVPadIterator::operator = (const AliMpSectorAreaVPadIterator& right)
84{
dee1d5f1 85/// Assignment operator
5f91c9e8 86
dee1d5f1 87 // check assignment to self
5f91c9e8 88 if (this == &right) return *this;
89
dee1d5f1 90 // base class assignment
5f91c9e8 91 AliMpVPadIterator::operator=(right);
92
93 fkSegmentation = right.fkSegmentation;
94 fkArea = right.fkArea;
95 fCurrentPad = right.fCurrentPad;
96 fCurrentColumnPosition = right.fCurrentColumnPosition;
97
98 return *this;
99}
100
101//
102// private methods
103//
104
105//______________________________________________________________________________
106Bool_t AliMpSectorAreaVPadIterator::IsValid() const
107{
dee1d5f1 108/// Is the iterator in a valid position?
5f91c9e8 109
110 return fCurrentPad.IsValid() ;
111}
112
113//______________________________________________________________________________
114void AliMpSectorAreaVPadIterator::MoveRight()
115{
dee1d5f1 116/// Increase the current row position and searches the first valid pad.
5f91c9e8 117
118 Double_t step = 2.* fkSegmentation->GetMinPadDimensions().X();
119
120 while ( !fCurrentPad.IsValid() &&
121 fCurrentColumnPosition + step < fkArea.RightBorder())
122 {
5f91c9e8 123 fCurrentColumnPosition += step;
124 TVector2 position = TVector2(fCurrentColumnPosition, fkArea.DownBorder());
125
126 fCurrentPad = fkSegmentation->PadByDirection(position, fkArea.UpBorder());
127 }
128}
129
130//
131// public methods
132//
133
134//______________________________________________________________________________
135void AliMpSectorAreaVPadIterator::First()
136{
dee1d5f1 137/// Reset the iterator, so that it points to the first available
138/// pad in the area
5f91c9e8 139
140 if (!fkSegmentation) {
141 Fatal("First", "Segmentation is not defined");
142 return;
143 }
144
145 // Start position = left down corner of the area
146 //
bd7175ff 147 fCurrentColumnPosition = fkArea.LeftBorder();
5f91c9e8 148 TVector2 position(fkArea.LeftDownCorner());
149
150 fCurrentPad = fkSegmentation->PadByDirection(position, fkArea.UpBorder());
151
152 MoveRight();
153
154 // Set the column position to the center of pad
155 //
156 if (fCurrentPad.IsValid()) fCurrentColumnPosition = fCurrentPad.Position().X();
157}
158
159//______________________________________________________________________________
160void AliMpSectorAreaVPadIterator::Next()
161{
dee1d5f1 162/// Move the iterator to the next valid pad.
5f91c9e8 163
164 if (!IsValid()) return;
165
166 // Start position = up board of current pad + little step
167 //
168 TVector2 position
169 = fCurrentPad.Position()
170 + TVector2(0., fCurrentPad.Dimensions().Y() + AliMpConstants::LengthStep());
171
172 fCurrentPad = fkSegmentation->PadByDirection(position, fkArea.UpBorder());
173
174 if (fCurrentPad.IsValid()) return;
175
176 MoveRight();
177}
178
179//______________________________________________________________________________
180Bool_t AliMpSectorAreaVPadIterator::IsDone() const
181{
dee1d5f1 182/// Is the iterator in the end ?
183
5f91c9e8 184 return !IsValid();
185}
186
187//______________________________________________________________________________
188AliMpPad AliMpSectorAreaVPadIterator::CurrentItem () const
189{
dee1d5f1 190/// Return current pad.
5f91c9e8 191
192 return fCurrentPad;
193}
194//______________________________________________________________________________
195void AliMpSectorAreaVPadIterator::Invalidate()
196{
dee1d5f1 197/// Let the iterator point to the invalid position
198
5f91c9e8 199 fCurrentPad = AliMpPad::Invalid();
200 fCurrentColumnPosition = 0;
201}
202
203
204