AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpVIndexed.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: 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 
33 
34 //_____________________________________________________________________________
36  : TObject(),
37  fLowLimit(0),
38  fHighLimit(0),
39  fLowValid(false),
40  fHighValid(false)
41 {
43 }
44 
45 //_____________________________________________________________________________
47 {
49 }
50 
51 //_____________________________________________________________________________
53 {
55 
56  return fLowLimit + localIndices;
57 }
58 
59 //_____________________________________________________________________________
60 Int_t AliMpVIndexed::GlobalIx(Int_t localIx) const
61 {
63 
64  return GetLowLimitIx() + localIx;
65 }
66 
67 
68 //_____________________________________________________________________________
69 Int_t AliMpVIndexed::GlobalIy(Int_t localIy) const
70 {
72 
73  return GetLowLimitIy() + localIy;
74 }
75 
76 //_____________________________________________________________________________
78 {
80 
81  fLowLimit = limit;
82  fLowValid = valid ;
83 }
84 
85 //_____________________________________________________________________________
86 void AliMpVIndexed::SetLowIndicesLimit(Int_t ix, Int_t iy, Bool_t valid)
87 {
89 
90  fLowLimit = AliMp::Pair(ix, iy);
91  fLowValid = valid;
92 }
93 
94 //_____________________________________________________________________________
96 {
98 
99  fHighLimit = limit;
100  fHighValid = valid ;
101 }
102 
103 //_____________________________________________________________________________
104 void AliMpVIndexed::SetHighIndicesLimit(Int_t ix, Int_t iy, Bool_t valid)
105 {
107 
108  fHighLimit = AliMp::Pair(ix, iy);
109  fHighValid = valid;
110 }
111 
112 //_____________________________________________________________________________
113 Bool_t AliMpVIndexed::HasIndices(MpPair_t indices) const
114 {
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 {
127 
128  return (ix >= GetLowLimitIx() &&
129  iy >= GetLowLimitIy() &&
130  ix <= GetHighLimitIx() &&
131  iy <= GetHighLimitIy() );
132 }
133 
134 //_____________________________________________________________________________
136 {
138 
139  return ( fLowValid && fHighValid );
140 }
141 
142 //_____________________________________________________________________________
144 {
146 
147  // if ( ! fLowValid ) return 0;
148 
149  return fLowLimit;
150 }
151 
152 //_____________________________________________________________________________
154 {
156 
157  // if ( ! fLowValid ) return 0;
158 
159  return AliMp::PairFirst(fLowLimit);
160 }
161 
162 //_____________________________________________________________________________
164 {
166 
167  // if ( ! fLowValid ) return 0;
168 
169  return AliMp::PairSecond(fLowLimit);
170 }
171 
172 //_____________________________________________________________________________
174 {
176 
177  return fLowValid;
178 }
179 
180 //_____________________________________________________________________________
182 {
184 
185  // if ( ! fHighValid ) return 0;
186 
187  return fHighLimit;
188 }
189 
190 //_____________________________________________________________________________
192 {
194 
195  // if ( ! fHighValid ) return 0;
196 
197  return AliMp::PairFirst(fHighLimit);
198 }
199 
200 //_____________________________________________________________________________
202 {
204 
205  // if ( ! fHighValid ) return 0;
206 
207  return AliMp::PairSecond(fHighLimit);
208 }
209 
210 //_____________________________________________________________________________
212 {
214 
215  return fHighValid;
216 }
217 
218 
219 
220 
void SetLowIndicesLimit(MpPair_t limit, Bool_t valid=true)
Int_t GetLowLimitIx() const
Bool_t HasIndices(MpPair_t indices) const
Bool_t IsHighLimitValid() const
MpPair_t Pair(Int_t first, Int_t second)
Encode the pair of integers to another integer.
Int_t GetLowLimitIy() const
Int_t GetHighLimitIy() const
virtual Int_t GlobalIy(Int_t localIy) const
Bool_t fHighValid
true, if high indices imit is set
Definition: AliMpVIndexed.h:64
Base class that defines the limits of global pad indices.
Definition: AliMpVIndexed.h:22
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
MpPair_t GetHighIndicesLimit() const
virtual Int_t GlobalIx(Int_t localIx) const
MpPair_t fLowLimit
the lowest global pad indices
Definition: AliMpVIndexed.h:61
void SetHighIndicesLimit(MpPair_t limit, Bool_t valid=true)
MpPair_t GetLowIndicesLimit() const
Bool_t fLowValid
true, if low indices limit is set
Definition: AliMpVIndexed.h:63
MpPair_t fHighLimit
the highest global pad indices
Definition: AliMpVIndexed.h:62
Int_t MpPair_t
virtual MpPair_t GlobalIndices(MpPair_t localIndices) const
Int_t PairFirst(MpPair_t pair)
Decode the first integer from encoded pair.
virtual ~AliMpVIndexed()
Int_t PairSecond(MpPair_t pair)
Decode the second integer from encoded pair.
Int_t GetHighLimitIx() const
Bool_t IsLowLimitValid() const
Bool_t HasValidIndices() const