]>
Commit | Line | Data |
---|---|---|
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: AliMpVIndexed.cxx,v 1.7 2006/05/24 13:58:29 ivana Exp $ | |
18 | // Category: basic | |
19 | ||
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 | //----------------------------------------------------------------------------- | |
27 | ||
28 | #include "AliMpVIndexed.h" | |
29 | ||
30 | /// \cond CLASSIMP | |
31 | ClassImp(AliMpVIndexed) | |
32 | /// \endcond | |
33 | ||
34 | //_____________________________________________________________________________ | |
35 | AliMpVIndexed::AliMpVIndexed() | |
36 | : TObject(), | |
37 | fLowLimit(0), | |
38 | fHighLimit(0), | |
39 | fLowValid(false), | |
40 | fHighValid(false) | |
41 | { | |
42 | /// Default constructor | |
43 | } | |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliMpVIndexed::~AliMpVIndexed() | |
47 | { | |
48 | /// Destructor | |
49 | } | |
50 | ||
51 | //_____________________________________________________________________________ | |
52 | MpPair_t AliMpVIndexed::GlobalIndices(MpPair_t localIndices) const | |
53 | { | |
54 | /// Return the global indices corresponding to the given local indices. | |
55 | ||
56 | return fLowLimit + localIndices; | |
57 | } | |
58 | ||
59 | //_____________________________________________________________________________ | |
60 | Int_t AliMpVIndexed::GlobalIx(Int_t localIx) const | |
61 | { | |
62 | /// Return the global indices ix corresponding to the given local indices | |
63 | ||
64 | return GetLowLimitIx() + localIx; | |
65 | } | |
66 | ||
67 | ||
68 | //_____________________________________________________________________________ | |
69 | Int_t AliMpVIndexed::GlobalIy(Int_t localIy) const | |
70 | { | |
71 | /// Return the global indices iy corresponding to the given local indices | |
72 | ||
73 | return GetLowLimitIy() + localIy; | |
74 | } | |
75 | ||
76 | //_____________________________________________________________________________ | |
77 | void AliMpVIndexed::SetLowIndicesLimit(MpPair_t limit, Bool_t valid) | |
78 | { | |
79 | /// Set low indices limit | |
80 | ||
81 | fLowLimit = limit; | |
82 | fLowValid = valid ; | |
83 | } | |
84 | ||
85 | //_____________________________________________________________________________ | |
86 | void AliMpVIndexed::SetLowIndicesLimit(Int_t ix, Int_t iy, Bool_t valid) | |
87 | { | |
88 | /// Set low indices limit | |
89 | ||
90 | fLowLimit = AliMp::Pair(ix, iy); | |
91 | fLowValid = valid; | |
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
95 | void AliMpVIndexed::SetHighIndicesLimit(MpPair_t limit, Bool_t valid) | |
96 | { | |
97 | /// Set high indices limit | |
98 | ||
99 | fHighLimit = limit; | |
100 | fHighValid = valid ; | |
101 | } | |
102 | ||
103 | //_____________________________________________________________________________ | |
104 | void AliMpVIndexed::SetHighIndicesLimit(Int_t ix, Int_t iy, Bool_t valid) | |
105 | { | |
106 | /// Set high indices limit | |
107 | ||
108 | fHighLimit = AliMp::Pair(ix, iy); | |
109 | fHighValid = valid; | |
110 | } | |
111 | ||
112 | //_____________________________________________________________________________ | |
113 | Bool_t AliMpVIndexed::HasIndices(MpPair_t indices) const | |
114 | { | |
115 | /// Return true in the specified indices are within the limits. | |
116 | ||
117 | return ( AliMp::PairFirst(indices) >= GetLowLimitIx() && | |
118 | AliMp::PairSecond(indices) >= GetLowLimitIy() && | |
119 | AliMp::PairFirst(indices) <= GetHighLimitIx() && | |
120 | AliMp::PairSecond(indices) <= GetHighLimitIy() ); | |
121 | } | |
122 | ||
123 | //_____________________________________________________________________________ | |
124 | Bool_t AliMpVIndexed::HasIndices(Int_t ix, Int_t iy) const | |
125 | { | |
126 | /// Return true in the specified indices are within the limits. | |
127 | ||
128 | return (ix >= GetLowLimitIx() && | |
129 | iy >= GetLowLimitIy() && | |
130 | ix <= GetHighLimitIx() && | |
131 | iy <= GetHighLimitIy() ); | |
132 | } | |
133 | ||
134 | //_____________________________________________________________________________ | |
135 | Bool_t AliMpVIndexed::HasValidIndices() const | |
136 | { | |
137 | /// Returns true if both indices limits have valid values. | |
138 | ||
139 | return ( fLowValid && fHighValid ); | |
140 | } | |
141 | ||
142 | //_____________________________________________________________________________ | |
143 | MpPair_t AliMpVIndexed::GetLowIndicesLimit() const | |
144 | { | |
145 | /// Return low indices limit | |
146 | ||
147 | // if ( ! fLowValid ) return 0; | |
148 | ||
149 | return fLowLimit; | |
150 | } | |
151 | ||
152 | //_____________________________________________________________________________ | |
153 | Int_t AliMpVIndexed::GetLowLimitIx() const | |
154 | { | |
155 | /// Return low indices ix limit | |
156 | ||
157 | // if ( ! fLowValid ) return 0; | |
158 | ||
159 | return AliMp::PairFirst(fLowLimit); | |
160 | } | |
161 | ||
162 | //_____________________________________________________________________________ | |
163 | Int_t AliMpVIndexed::GetLowLimitIy() const | |
164 | { | |
165 | /// Return low indices iy limit | |
166 | ||
167 | // if ( ! fLowValid ) return 0; | |
168 | ||
169 | return AliMp::PairSecond(fLowLimit); | |
170 | } | |
171 | ||
172 | //_____________________________________________________________________________ | |
173 | Bool_t AliMpVIndexed::IsLowLimitValid() const | |
174 | { | |
175 | /// Return true, if low indices limit is set | |
176 | ||
177 | return fLowValid; | |
178 | } | |
179 | ||
180 | //_____________________________________________________________________________ | |
181 | MpPair_t AliMpVIndexed::GetHighIndicesLimit() const | |
182 | { | |
183 | /// Return high indices limit | |
184 | ||
185 | // if ( ! fHighValid ) return 0; | |
186 | ||
187 | return fHighLimit; | |
188 | } | |
189 | ||
190 | //_____________________________________________________________________________ | |
191 | Int_t AliMpVIndexed::GetHighLimitIx() const | |
192 | { | |
193 | /// Return high indices ix limit | |
194 | ||
195 | // if ( ! fHighValid ) return 0; | |
196 | ||
197 | return AliMp::PairFirst(fHighLimit); | |
198 | } | |
199 | ||
200 | //_____________________________________________________________________________ | |
201 | Int_t AliMpVIndexed::GetHighLimitIy() const | |
202 | { | |
203 | /// Return high indices iy limit | |
204 | ||
205 | // if ( ! fHighValid ) return 0; | |
206 | ||
207 | return AliMp::PairSecond(fHighLimit); | |
208 | } | |
209 | ||
210 | //_____________________________________________________________________________ | |
211 | Bool_t AliMpVIndexed::IsHighLimitValid() const | |
212 | { | |
213 | /// Return true, if high indices limit is set | |
214 | ||
215 | return fHighValid; | |
216 | } | |
217 | ||
218 | ||
219 | ||
220 |