AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpSectorAreaVPadIterator.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: AliMpSectorAreaVPadIterator.cxx,v 1.8 2006/05/24 13:58:46 ivana Exp $
18 // Category: sector
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpSectorAreaVPadIterator
22 // ---------------------------------
23 // Class, which defines an iterator over the pads
24 // inside a given area in a sector in vertical direction.
25 // Included in AliRoot: 2003/05/02
26 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
27 //-----------------------------------------------------------------------------
28 
31 #include "AliMpConstants.h"
32 
33 #include "AliLog.h"
34 
35 #include <Riostream.h>
36 
40 
41 //______________________________________________________________________________
43  const AliMpSectorSegmentation* segmentation,
44  const AliMpArea& area)
46  fkSegmentation(segmentation),
47  fkArea(area),
48  fCurrentPad(AliMpPad::Invalid()),
49  fCurrentColumnPosition(0.)
50 {
52 }
53 
54 //______________________________________________________________________________
56  const AliMpSectorAreaVPadIterator& right)
57  : AliMpVPadIterator(right),
58  fkSegmentation(0),
59  fkArea(AliMpArea()),
60  fCurrentPad(AliMpPad::Invalid()),
61  fCurrentColumnPosition(0.)
62 {
64 
65  *this = right;
66 }
67 
68 //______________________________________________________________________________
71  fkSegmentation(0),
72  fkArea(AliMpArea()),
73  fCurrentPad(AliMpPad::Invalid()),
74  fCurrentColumnPosition(0.)
75 {
77 }
78 
79 //______________________________________________________________________________
81 {
83 }
84 
85 //
86 // operators
87 //
88 
89 //______________________________________________________________________________
92 {
94 
95  // check assignment to self
96  if (this == &right) return *this;
97 
98  // base class assignment
100 
102  fkArea = right.fkArea;
103  fCurrentPad = right.fCurrentPad;
105 
106  return *this;
107 }
108 
109 //
110 // private methods
111 //
112 
113 //______________________________________________________________________________
115 {
117 
118  return fCurrentPad.IsValid() ;
119 }
120 
121 //______________________________________________________________________________
123 {
125 
126  Double_t dx = fkSegmentation->GetMinPadDimensionX();
127 
128  while ( !fCurrentPad.IsValid() &&
130  {
131  fCurrentColumnPosition += 2.*dx;
132 
133  fCurrentPad
135  fkArea.UpBorder());
136  }
137 }
138 
139 //
140 // public methods
141 //
142 
143 //______________________________________________________________________________
145 {
148 
149  if (!fkSegmentation) {
150  AliFatal("Segmentation is not defined");
151  return;
152  }
153 
154  // Start position = left down corner of the area
155  //
157 
158  Double_t posx, posy;
159  fkArea.LeftDownCorner(posx, posy);
160 
162 
163  MoveRight();
164 
165  // Set the column position to the center of pad
166  //
168 }
169 
170 //______________________________________________________________________________
172 {
174 
175  if (!IsValid()) return;
176 
177  // Start position = up board of current pad + little step
178  //
179  fCurrentPad
184  fkArea.UpBorder());
185 
186  if (fCurrentPad.IsValid()) return;
187 
188  MoveRight();
189 }
190 
191 //______________________________________________________________________________
193 {
195 
196  return !IsValid();
197 }
198 
199 //______________________________________________________________________________
201 {
203 
204  return fCurrentPad;
205 }
206 //______________________________________________________________________________
208 {
210 
213 }
214 
215 
216 
virtual void First()
Set iterator to the first pad.
Double_t LeftBorder() const
Definition: AliMpArea.cxx:124
virtual AliMpPad CurrentItem() const
Return current pad.
virtual AliMpPad PadByDirection(Double_t startx, Double_t starty, Double_t distance) const
An iterator over the pads inside a given area in a sector in vertical direction.
A rectangle area positioned in plane..
Definition: AliMpArea.h:20
virtual Bool_t IsDone() const
Is iterator done.
AliMpArea fkArea
over which we iterate
static AliMpPad Invalid()
Return invalid pad.
Definition: AliMpPad.h:57
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
virtual void Invalidate()
Invalidate iterator (.
const AliMpSectorSegmentation * fkSegmentation
the sector segmentation
void LeftDownCorner(Double_t &x, Double_t &y) const
Definition: AliMpArea.cxx:156
An interface for an iterator over pads.
Double_t GetPositionY() const
Return the pad x position (in cm)
Definition: AliMpPad.h:81
static Double_t LengthStep()
Return the step in length used to move from a geometric border.
Double_t UpBorder() const
Definition: AliMpArea.cxx:140
virtual void Next()
Set iterator to the next pad.
AliMpSectorAreaVPadIterator & operator=(const AliMpSectorAreaVPadIterator &right)
Double_t DownBorder() const
Definition: AliMpArea.cxx:148
Bool_t IsValid() const
Return validity.
Definition: AliMpPad.h:89
A segmentation of the sector.
Double_t GetDimensionY() const
Return the y pad dimension - half length (in cm)
Definition: AliMpPad.h:86
Class which encapsuate all information about a pad.
Definition: AliMpPad.h:22
Double_t fCurrentColumnPosition
the current column position
Double_t GetPositionX() const
Return the pad x position (in cm)
Definition: AliMpPad.h:79
AliMpPad fCurrentPad
the current pad
AliMpVPadIterator & operator=(const AliMpVPadIterator &right)
Double_t RightBorder() const
Definition: AliMpArea.cxx:132