AliRoot Core  3dc7879 (3dc7879)
AliMpMotifPositionPadIterator.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: AliMpMotifPositionPadIterator.cxx,v 1.6 2006/05/24 13:58:41 ivana Exp $
18 // Category: motif
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpMotifPositionPadIterator
22 // -----------------------------------
23 // Class, which defines an iterator over the pads of a given motif type
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26 //-----------------------------------------------------------------------------
27 
29 #include "AliMpMotifPosition.h"
30 #include "AliMpMotifType.h"
31 #include "AliMpConnection.h"
32 #include "AliMpEncodePair.h"
33 
37 
38 //______________________________________________________________________________
41  fkMotifPos(0),
42  fIterator()
43 {
45 }
46 
47 //______________________________________________________________________________
48 
50  const AliMpMotifPosition* motifPos)
52  fkMotifPos(motifPos),
53  fIterator(motifPos->GetMotif()->GetMotifType())
54 {
56 }
57 
58 //______________________________________________________________________________
60  const AliMpMotifPositionPadIterator& right)
61  : AliMpVPadIterator(right),
62  fkMotifPos(right.fkMotifPos),
63  fIterator(right.fIterator)
64 
65 {
67 }
68 
69 //______________________________________________________________________________
71 {
73 }
74 
75 // operators
76 
77 //______________________________________________________________________________
80 {
82 
83 // if the right hand iterator isn't of good type
84 // the current operator is invalidated
85 
86  // check assignment to self
87  if (this == &right) return *this;
88 
89  // base class assignment
91 
92  fkMotifPos = right.fkMotifPos;
93  fIterator = right.fIterator;
94 
95  return *this;
96 }
97 
98 //private methods
99 
100 
101 //______________________________________________________________________________
103 {
105 
106  return (fkMotifPos!=0) && (!fIterator.IsDone());
107 }
108 
109 //
110 // public methods
111 //
112 
113 //______________________________________________________________________________
115 {
118 
119  if (!fkMotifPos) {
120  Invalidate();
121  return ;
122  }
123 
124  fIterator.First();
125  return;
126 }
127 
128 //______________________________________________________________________________
130 {
132 
133  fIterator.Next();
134 }
135 
136 //______________________________________________________________________________
138 {
140 
141  return !IsValid();
142 }
143 
144 //______________________________________________________________________________
146 {
148 
149  if (!fkMotifPos)
150  return AliMpPad::Invalid();
151  else {
154  AliMpConnection* connect =
156 
157  Double_t posx, posy;
158  fkMotifPos->GetMotif()->PadPositionLocal(ind, posx, posy);
159  posx += fkMotifPos->GetPositionX();
160  posy += fkMotifPos->GetPositionY();
161 
162  Double_t dx, dy;
164 
165  return AliMpPad(
166  fkMotifPos->GetID(),connect->GetManuChannel(),
168  posx, posy, dx, dy);
169  }
170 }
171 
172 //______________________________________________________________________________
174 {
176 
178 }
179 
Double_t GetPositionY() const
Return y position.
virtual void Next()
Set iterator to the next pad.
A connection properties.
virtual Bool_t IsDone() const
Is iterator done.
virtual Bool_t IsDone() const
Is iterator done.
virtual void Next()
Set iterator to the next pad.
virtual AliMpPad CurrentItem() const
Return current pad.
virtual void First()
Set iterator to the first pad.
AliMpConnection * FindConnectionByLocalIndices(MpPair_t localIndices) const
MpPair_t GetIndices() const
Return pad indices as encoded pair (ix, iy)
Definition: AliMpPad.h:74
const AliMpMotifPosition * fkMotifPos
the AliMpMotifPosition over which iterate
AliMpMotifType * GetMotifType() const
Return the motif type.
Definition: AliMpVMotif.h:87
static AliMpPad Invalid()
Return invalid pad.
Definition: AliMpPad.h:57
virtual AliMpPad CurrentItem() const
Return current pad.
Int_t GetID() const
Return motif position ID = manu id.
virtual void First()
Set iterator to the first pad.
A placed motif.
An interface for an iterator over pads.
virtual void Invalidate()
Invalidate iterator (.
AliMpVMotif * GetMotif() const
Return motif.
virtual void PadPositionLocal(MpPair_t localIndices, Double_t &posx, Double_t &posy) const =0
Fill local position of the pad specified by local indices.
An iterator over the pads of a given motif position.
AliMpMotifPositionPadIterator & operator=(const AliMpMotifPositionPadIterator &right)
Int_t MpPair_t
virtual MpPair_t GlobalIndices(MpPair_t localIndices) const
Int_t GetManuChannel() const
Return manu channel number.
Class which encapsuate all information about a pad.
Definition: AliMpPad.h:22
virtual void Invalidate()
Invalidate iterator (.
Double_t GetPositionX() const
Return x position.
AliMpVPadIterator & operator=(const AliMpVPadIterator &right)
AliMpMotifTypePadIterator fIterator
Iterator over the motif type.
Class that defines the motif properties.
virtual void GetPadDimensionsByIndices(MpPair_t localIndices, Double_t &dx, Double_t &dy) const =0
Return the dimensions of the pad specified by localIndices.