AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpSectorAreaHPadIterator.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: AliMpSectorAreaHPadIterator.cxx,v 1.7 2006/05/24 13:58:46 ivana Exp $
18 // Category: sector
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpSectorAreaHPadIterator
22 // ---------------------------------
23 // Class, which defines an iterator over the pads
24 // inside a given area in a sector in horizontal 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 <Riostream.h>
34 
38 
39 //______________________________________________________________________________
41  const AliMpSectorSegmentation* segmentation,
42  const AliMpArea& area)
44  fkSegmentation(segmentation),
45  fkArea(area),
46  fCurrentPad(AliMpPad::Invalid()),
47  fCurrentRowPosition(0.)
48 {
50 }
51 
52 //______________________________________________________________________________
54  const AliMpSectorAreaHPadIterator& right)
55  : AliMpVPadIterator(right),
56  fkSegmentation(0),
57  fkArea(AliMpArea()),
58  fCurrentPad(AliMpPad::Invalid()),
59  fCurrentRowPosition(0.)
60 {
62 
63  *this = right;
64 }
65 
66 //______________________________________________________________________________
69  fkSegmentation(0),
70  fkArea(AliMpArea()),
71  fCurrentPad(AliMpPad::Invalid()),
72  fCurrentRowPosition(0.)
73 {
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 
100  fkArea = right.fkArea;
101  fCurrentPad = right.fCurrentPad;
103 
104  return *this;
105 }
106 
107 //
108 // private methods
109 //
110 
111 //______________________________________________________________________________
113 {
115 
116  return fCurrentPad.IsValid() ;
117 }
118 
119 //______________________________________________________________________________
121 {
123 
124  Double_t dy = fkSegmentation->GetMinPadDimensionY();
125 
126  while ( ! fCurrentPad.IsValid() &&
128  {
129  fCurrentRowPosition += 2.*dy;
130 
131  fCurrentPad
133  fkArea.RightBorder());
134  }
135 }
136 
137 //
138 // public methods
139 //
140 
141 //______________________________________________________________________________
143 {
146 
147  if ( ! fkSegmentation ) {
148  Fatal("First", "Segmentation is not defined");
149  return;
150  }
151 
152  // Start position = left down corner of the area
153  //
154 
156 
157  Double_t posx, posy;
158  fkArea.LeftDownCorner(posx, posy);
159 
161 
162  MoveUp();
163 
164  // Set the row position to the center of pad
165  //
167 }
168 
169 //______________________________________________________________________________
171 {
173 
174  if ( ! IsValid() ) return;
175 
176  // Start position = right board of current pad + little step
177 
178  fCurrentPad
183  fkArea.RightBorder());
184 
185  if ( fCurrentPad.IsValid() ) return;
186 
187  MoveUp();
188 }
189 
190 //______________________________________________________________________________
192 {
194 
195  return !IsValid();
196 }
197 
198 //______________________________________________________________________________
200 {
202 
203  return fCurrentPad;
204 }
205 //______________________________________________________________________________
207 {
209 
212 }
213 
214 
215 
Double_t LeftBorder() const
Definition: AliMpArea.cxx:124
virtual AliMpPad PadByDirection(Double_t startx, Double_t starty, Double_t distance) const
A rectangle area positioned in plane..
Definition: AliMpArea.h:20
static AliMpPad Invalid()
Return invalid pad.
Definition: AliMpPad.h:57
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
virtual void Next()
Set iterator to the next pad.
virtual Bool_t IsDone() const
Is iterator done.
AliMpArea fkArea
over which we iterate
AliMpSectorAreaHPadIterator & operator=(const AliMpSectorAreaHPadIterator &right)
virtual AliMpPad CurrentItem() const
Return current pad.
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
const AliMpSectorSegmentation * fkSegmentation
the sector segmentation
Double_t DownBorder() const
Definition: AliMpArea.cxx:148
Bool_t IsValid() const
Return validity.
Definition: AliMpPad.h:89
A segmentation of the sector.
An iterator over the pads inside a given area in a sector in horizontal direction.
Class which encapsuate all information about a pad.
Definition: AliMpPad.h:22
Double_t GetPositionX() const
Return the pad x position (in cm)
Definition: AliMpPad.h:79
virtual void First()
Set iterator to the first pad.
Double_t GetDimensionX() const
Return the x pad dimension - half length (in cm)
Definition: AliMpPad.h:84
AliMpVPadIterator & operator=(const AliMpVPadIterator &right)
Double_t RightBorder() const
Definition: AliMpArea.cxx:132
Double_t fCurrentRowPosition
the current row position
AliMpPad fCurrentPad
the current pad
virtual void Invalidate()
Invalidate iterator (.