]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONmapping/AliMpVIndexed.cxx
o adapt Macro to new TPC structure (Benjamin Hess)
[u/mrichter/AliRoot.git] / MUON / MUONmapping / AliMpVIndexed.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: AliMpVIndexed.cxx,v 1.7 2006/05/24 13:58:29 ivana Exp $
5f91c9e8 18// Category: basic
3d1463c8 19
20//-----------------------------------------------------------------------------
5f91c9e8 21// Class AliMpVIndexed
22// -------------------
23// Class that defines the limits of global pad indices.
dbe945cc 24// Included in AliRoot: 2003/05/02
5f91c9e8 25// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
3d1463c8 26//-----------------------------------------------------------------------------
5f91c9e8 27
28#include "AliMpVIndexed.h"
29
13985652 30/// \cond CLASSIMP
5f91c9e8 31ClassImp(AliMpVIndexed)
13985652 32/// \endcond
5f91c9e8 33
5f91c9e8 34//_____________________________________________________________________________
35AliMpVIndexed::AliMpVIndexed()
36 : TObject(),
168e9c4d 37 fLowLimit(0),
38 fHighLimit(0),
39 fLowValid(false),
40 fHighValid(false)
dee1d5f1 41{
42/// Default constructor
5f91c9e8 43}
44
45//_____________________________________________________________________________
dee1d5f1 46AliMpVIndexed::~AliMpVIndexed()
47{
48/// Destructor
5f91c9e8 49}
50
5f91c9e8 51//_____________________________________________________________________________
168e9c4d 52MpPair_t AliMpVIndexed::GlobalIndices(MpPair_t localIndices) const
5f91c9e8 53{
dee1d5f1 54/// Return the global indices corresponding to the given local indices.
5f91c9e8 55
168e9c4d 56 return fLowLimit + localIndices;
57}
58
59//_____________________________________________________________________________
60Int_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//_____________________________________________________________________________
69Int_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//_____________________________________________________________________________
77void AliMpVIndexed::SetLowIndicesLimit(MpPair_t limit, Bool_t valid)
78{
79/// Set low indices limit
80
81 fLowLimit = limit;
82 fLowValid = valid ;
83}
84
85//_____________________________________________________________________________
86void 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//_____________________________________________________________________________
95void AliMpVIndexed::SetHighIndicesLimit(MpPair_t limit, Bool_t valid)
96{
97/// Set high indices limit
98
99 fHighLimit = limit;
100 fHighValid = valid ;
101}
102
103//_____________________________________________________________________________
104void AliMpVIndexed::SetHighIndicesLimit(Int_t ix, Int_t iy, Bool_t valid)
105{
106/// Set high indices limit
5f91c9e8 107
168e9c4d 108 fHighLimit = AliMp::Pair(ix, iy);
109 fHighValid = valid;
5f91c9e8 110}
111
112//_____________________________________________________________________________
168e9c4d 113Bool_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//_____________________________________________________________________________
124Bool_t AliMpVIndexed::HasIndices(Int_t ix, Int_t iy) const
5f91c9e8 125{
dee1d5f1 126/// Return true in the specified indices are within the limits.
5f91c9e8 127
168e9c4d 128 return (ix >= GetLowLimitIx() &&
129 iy >= GetLowLimitIy() &&
130 ix <= GetHighLimitIx() &&
131 iy <= GetHighLimitIy() );
5f91c9e8 132}
133
134//_____________________________________________________________________________
135Bool_t AliMpVIndexed::HasValidIndices() const
136{
dee1d5f1 137/// Returns true if both indices limits have valid values.
5f91c9e8 138
168e9c4d 139 return ( fLowValid && fHighValid );
5f91c9e8 140}
141
168e9c4d 142//_____________________________________________________________________________
143MpPair_t AliMpVIndexed::GetLowIndicesLimit() const
144{
145/// Return low indices limit
146
147 // if ( ! fLowValid ) return 0;
148
149 return fLowLimit;
150}
151
152//_____________________________________________________________________________
153Int_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//_____________________________________________________________________________
163Int_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//_____________________________________________________________________________
173Bool_t AliMpVIndexed::IsLowLimitValid() const
174{
175/// Return true, if low indices limit is set
176
177 return fLowValid;
178}
179
180//_____________________________________________________________________________
181MpPair_t AliMpVIndexed::GetHighIndicesLimit() const
182{
183/// Return high indices limit
184
185 // if ( ! fHighValid ) return 0;
186
187 return fHighLimit;
188}
189
190//_____________________________________________________________________________
191Int_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//_____________________________________________________________________________
201Int_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//_____________________________________________________________________________
211Bool_t AliMpVIndexed::IsHighLimitValid() const
212{
213/// Return true, if high indices limit is set
214
215 return fHighValid;
216}
217
218
5f91c9e8 219
220