1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpVIndexed.cxx,v 1.7 2006/05/24 13:58:29 ivana Exp $
20 //-----------------------------------------------------------------------------
21 // Class AliMpVIndexed
22 // -------------------
23 // Class that defines the limits of global pad indices.
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26 //-----------------------------------------------------------------------------
28 #include "AliMpVIndexed.h"
31 ClassImp(AliMpVIndexed)
34 //_____________________________________________________________________________
35 AliMpVIndexed::AliMpVIndexed()
42 /// Default constructor
45 //_____________________________________________________________________________
46 AliMpVIndexed::~AliMpVIndexed()
51 //_____________________________________________________________________________
52 MpPair_t AliMpVIndexed::GlobalIndices(MpPair_t localIndices) const
54 /// Return the global indices corresponding to the given local indices.
56 return fLowLimit + localIndices;
59 //_____________________________________________________________________________
60 Int_t AliMpVIndexed::GlobalIx(Int_t localIx) const
62 /// Return the global indices ix corresponding to the given local indices
64 return GetLowLimitIx() + localIx;
68 //_____________________________________________________________________________
69 Int_t AliMpVIndexed::GlobalIy(Int_t localIy) const
71 /// Return the global indices iy corresponding to the given local indices
73 return GetLowLimitIy() + localIy;
76 //_____________________________________________________________________________
77 void AliMpVIndexed::SetLowIndicesLimit(MpPair_t limit, Bool_t valid)
79 /// Set low indices limit
85 //_____________________________________________________________________________
86 void AliMpVIndexed::SetLowIndicesLimit(Int_t ix, Int_t iy, Bool_t valid)
88 /// Set low indices limit
90 fLowLimit = AliMp::Pair(ix, iy);
94 //_____________________________________________________________________________
95 void AliMpVIndexed::SetHighIndicesLimit(MpPair_t limit, Bool_t valid)
97 /// Set high indices limit
103 //_____________________________________________________________________________
104 void AliMpVIndexed::SetHighIndicesLimit(Int_t ix, Int_t iy, Bool_t valid)
106 /// Set high indices limit
108 fHighLimit = AliMp::Pair(ix, iy);
112 //_____________________________________________________________________________
113 Bool_t AliMpVIndexed::HasIndices(MpPair_t indices) const
115 /// Return true in the specified indices are within the limits.
117 return ( AliMp::PairFirst(indices) >= GetLowLimitIx() &&
118 AliMp::PairSecond(indices) >= GetLowLimitIy() &&
119 AliMp::PairFirst(indices) <= GetHighLimitIx() &&
120 AliMp::PairSecond(indices) <= GetHighLimitIy() );
123 //_____________________________________________________________________________
124 Bool_t AliMpVIndexed::HasIndices(Int_t ix, Int_t iy) const
126 /// Return true in the specified indices are within the limits.
128 return (ix >= GetLowLimitIx() &&
129 iy >= GetLowLimitIy() &&
130 ix <= GetHighLimitIx() &&
131 iy <= GetHighLimitIy() );
134 //_____________________________________________________________________________
135 Bool_t AliMpVIndexed::HasValidIndices() const
137 /// Returns true if both indices limits have valid values.
139 return ( fLowValid && fHighValid );
142 //_____________________________________________________________________________
143 MpPair_t AliMpVIndexed::GetLowIndicesLimit() const
145 /// Return low indices limit
147 // if ( ! fLowValid ) return 0;
152 //_____________________________________________________________________________
153 Int_t AliMpVIndexed::GetLowLimitIx() const
155 /// Return low indices ix limit
157 // if ( ! fLowValid ) return 0;
159 return AliMp::PairFirst(fLowLimit);
162 //_____________________________________________________________________________
163 Int_t AliMpVIndexed::GetLowLimitIy() const
165 /// Return low indices iy limit
167 // if ( ! fLowValid ) return 0;
169 return AliMp::PairSecond(fLowLimit);
172 //_____________________________________________________________________________
173 Bool_t AliMpVIndexed::IsLowLimitValid() const
175 /// Return true, if low indices limit is set
180 //_____________________________________________________________________________
181 MpPair_t AliMpVIndexed::GetHighIndicesLimit() const
183 /// Return high indices limit
185 // if ( ! fHighValid ) return 0;
190 //_____________________________________________________________________________
191 Int_t AliMpVIndexed::GetHighLimitIx() const
193 /// Return high indices ix limit
195 // if ( ! fHighValid ) return 0;
197 return AliMp::PairFirst(fHighLimit);
200 //_____________________________________________________________________________
201 Int_t AliMpVIndexed::GetHighLimitIy() const
203 /// Return high indices iy limit
205 // if ( ! fHighValid ) return 0;
207 return AliMp::PairSecond(fHighLimit);
210 //_____________________________________________________________________________
211 Bool_t AliMpVIndexed::IsHighLimitValid() const
213 /// Return true, if high indices limit is set