Adding comment lines to class description needed for Root documentation,
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifPositionPadIterator.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: AliMpMotifPositionPadIterator.cxx,v 1.6 2006/05/24 13:58:41 ivana Exp $
5f91c9e8 18// Category: motif
3d1463c8 19
20//-----------------------------------------------------------------------------
5f91c9e8 21// Class AliMpMotifPositionPadIterator
22// -----------------------------------
23// Class, which defines an iterator over the pads of a given motif type
dbe945cc 24// Included in AliRoot: 2003/05/02
5f91c9e8 25// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
3d1463c8 26//-----------------------------------------------------------------------------
5f91c9e8 27
28#include "AliMpMotifPositionPadIterator.h"
29#include "AliMpMotifPosition.h"
30#include "AliMpMotifType.h"
31#include "AliMpConnection.h"
32
13985652 33/// \cond CLASSIMP
5f91c9e8 34ClassImp(AliMpMotifPositionPadIterator)
13985652 35/// \endcond
5f91c9e8 36
37//______________________________________________________________________________
38AliMpMotifPositionPadIterator::AliMpMotifPositionPadIterator():
39 AliMpVPadIterator(),
40 fMotifPos(0),
41 fIterator()
42{
dee1d5f1 43/// Default constructor, set the current position to "invalid"
5f91c9e8 44}
45
46//______________________________________________________________________________
47
48AliMpMotifPositionPadIterator::AliMpMotifPositionPadIterator(
49 const AliMpMotifPosition* motifPos)
50 : AliMpVPadIterator(),
51 fMotifPos(motifPos),
52 fIterator(motifPos->GetMotif()->GetMotifType())
53{
dee1d5f1 54/// Standard constructor, let *this to invalid position
5f91c9e8 55}
56
57//______________________________________________________________________________
58AliMpMotifPositionPadIterator::AliMpMotifPositionPadIterator(
59 const AliMpMotifPositionPadIterator& right)
60 : AliMpVPadIterator(right),
61 fMotifPos(right.fMotifPos),
62 fIterator(right.fIterator)
63
64{
dee1d5f1 65/// Copy constructor
5f91c9e8 66}
67
68//______________________________________________________________________________
69AliMpMotifPositionPadIterator::~AliMpMotifPositionPadIterator()
70{
dee1d5f1 71/// Destructor
5f91c9e8 72}
73
74// operators
75
76//______________________________________________________________________________
77AliMpMotifPositionPadIterator&
78AliMpMotifPositionPadIterator::operator = (const AliMpMotifPositionPadIterator& right)
79{
dee1d5f1 80/// Assignment operator
81
5f91c9e8 82// if the right hand iterator isn't of good type
83// the current operator is invalidated
84
dee1d5f1 85 // check assignment to self
5f91c9e8 86 if (this == &right) return *this;
87
dee1d5f1 88 // base class assignment
5f91c9e8 89 AliMpVPadIterator::operator=(right);
90
91 fMotifPos = right.fMotifPos;
92 fIterator = right.fIterator;
93
94 return *this;
95}
96
97//private methods
98
99
100//______________________________________________________________________________
101Bool_t AliMpMotifPositionPadIterator::IsValid() const
102{
dee1d5f1 103/// Is the iterator in a valid position?
5f91c9e8 104
105 return (fMotifPos!=0) && (!fIterator.IsDone());
106}
107
dee1d5f1 108//
109// public methods
110//
5f91c9e8 111
112//______________________________________________________________________________
113void AliMpMotifPositionPadIterator::First()
114{
dee1d5f1 115/// Reset the iterator, so that it points to the first available
116/// pad in the motif type
5f91c9e8 117
118 if (!fMotifPos) {
119 Invalidate();
120 return ;
121 }
122
123 fIterator.First();
124 return;
125}
126
127//______________________________________________________________________________
128void AliMpMotifPositionPadIterator::Next()
129{
dee1d5f1 130/// Move the iterator to the next valid pad.
131
5f91c9e8 132 fIterator.Next();
133}
134
135//______________________________________________________________________________
136Bool_t AliMpMotifPositionPadIterator::IsDone() const
137{
dee1d5f1 138/// Is the iterator in the end?
139
5f91c9e8 140 return !IsValid();
141}
142
143//______________________________________________________________________________
144AliMpPad AliMpMotifPositionPadIterator::CurrentItem() const
145{
dee1d5f1 146/// Return current pad.
5f91c9e8 147
148 if (!fMotifPos)
149 return AliMpPad::Invalid();
150 else {
151 AliMpIntPair ind = fIterator.CurrentItem().GetIndices();
152 AliMpMotifType* mt = fMotifPos->GetMotif()->GetMotifType();
153 AliMpConnection* connect =
154 mt->FindConnectionByLocalIndices(ind);
155 return AliMpPad(AliMpIntPair(fMotifPos->GetID(),connect->GetGassiNum()),
156 fMotifPos->GlobalIndices(ind),
157 fMotifPos->Position()+fMotifPos->GetMotif()->PadPositionLocal(ind),
158 fMotifPos->GetMotif()->GetPadDimensions(ind));
159 }
160}
161
162//______________________________________________________________________________
163void AliMpMotifPositionPadIterator::Invalidate()
164{
dee1d5f1 165/// Let the iterator point to the invalid position
166
5f91c9e8 167 fIterator.Invalidate();
168}
169