]>
Commit | Line | Data |
---|---|---|
e0d47c25 | 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 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Describes a pad plane of a TRD ROC // | |
21 | // // | |
22 | // Contains the information on pad postions, pad dimensions, // | |
23 | // tilting angle, etc. // | |
24 | // It also provides methods to identify the current pad number from // | |
25 | // global coordinates. // | |
3148e21a | 26 | // The numbering and coordinates should follow the official convention // |
27 | // (see David Emschermanns note on TRD convention // | |
e0d47c25 | 28 | // // |
29 | /////////////////////////////////////////////////////////////////////////////// | |
30 | ||
090026bf | 31 | #include <TMath.h> |
32 | ||
e0d47c25 | 33 | #include "AliTRDpadPlane.h" |
bd0f8685 | 34 | #include "AliTRDgeometry.h" |
e0d47c25 | 35 | |
36 | ClassImp(AliTRDpadPlane) | |
37 | ||
38 | //_____________________________________________________________________________ | |
2745a409 | 39 | AliTRDpadPlane::AliTRDpadPlane() |
40 | :TObject() | |
2745a409 | 41 | ,fPla(0) |
42 | ,fCha(0) | |
43 | ,fLength(0) | |
44 | ,fWidth(0) | |
45 | ,fLengthRim(0) | |
46 | ,fWidthRim(0) | |
47 | ,fLengthOPad(0) | |
48 | ,fWidthOPad(0) | |
49 | ,fLengthIPad(0) | |
50 | ,fWidthIPad(0) | |
51 | ,fRowSpacing(0) | |
52 | ,fColSpacing(0) | |
53 | ,fNrows(0) | |
54 | ,fNcols(0) | |
55 | ,fTiltingAngle(0) | |
56 | ,fTiltingTan(0) | |
57 | ,fPadRow(0) | |
58 | ,fPadCol(0) | |
4329977a | 59 | ,fPadRowSMOffset(0) |
e0d47c25 | 60 | { |
61 | // | |
62 | // Default constructor | |
63 | // | |
64 | ||
e0d47c25 | 65 | } |
66 | ||
5dfd5caf | 67 | //_____________________________________________________________________________ |
68 | AliTRDpadPlane::AliTRDpadPlane(Int_t plane, Int_t chamber) | |
69 | :TObject() | |
70 | ,fPla(plane) | |
71 | ,fCha(chamber) | |
72 | ,fLength(0) | |
73 | ,fWidth(0) | |
74 | ,fLengthRim(0) | |
75 | ,fWidthRim(0) | |
76 | ,fLengthOPad(0) | |
77 | ,fWidthOPad(0) | |
78 | ,fLengthIPad(0) | |
79 | ,fWidthIPad(0) | |
80 | ,fRowSpacing(0) | |
81 | ,fColSpacing(0) | |
82 | ,fNrows(0) | |
83 | ,fNcols(0) | |
84 | ,fTiltingAngle(0) | |
85 | ,fTiltingTan(0) | |
86 | ,fPadRow(0) | |
87 | ,fPadCol(0) | |
88 | ,fPadRowSMOffset(0) | |
89 | { | |
90 | // | |
91 | // Constructor | |
92 | // | |
93 | ||
94 | } | |
95 | ||
e0d47c25 | 96 | //_____________________________________________________________________________ |
2745a409 | 97 | AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p) |
98 | :TObject(p) | |
2745a409 | 99 | ,fPla(p.fPla) |
100 | ,fCha(p.fCha) | |
101 | ,fLength(p.fLength) | |
102 | ,fWidth(p.fWidth) | |
103 | ,fLengthRim(p.fLengthRim) | |
104 | ,fWidthRim(p.fLengthRim) | |
105 | ,fLengthOPad(p.fLengthOPad) | |
106 | ,fWidthOPad(p.fWidthOPad) | |
107 | ,fLengthIPad(p.fLengthIPad) | |
108 | ,fWidthIPad(p.fWidthIPad) | |
109 | ,fRowSpacing(p.fRowSpacing) | |
110 | ,fColSpacing(p.fColSpacing) | |
111 | ,fNrows(p.fNrows) | |
112 | ,fNcols(p.fNcols) | |
113 | ,fTiltingAngle(p.fTiltingAngle) | |
114 | ,fTiltingTan(p.fTiltingTan) | |
115 | ,fPadRow(0) | |
116 | ,fPadCol(0) | |
4329977a | 117 | ,fPadRowSMOffset(p.fPadRowSMOffset) |
e0d47c25 | 118 | { |
119 | // | |
120 | // AliTRDpadPlane copy constructor | |
121 | // | |
122 | ||
2745a409 | 123 | Int_t iBin = 0; |
124 | ||
f881dc35 | 125 | if (((AliTRDpadPlane &) p).fPadRow) { |
126 | delete [] ((AliTRDpadPlane &) p).fPadRow; | |
127 | } | |
2745a409 | 128 | ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows]; |
129 | for (iBin = 0; iBin < fNrows; iBin++) { | |
130 | ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin]; | |
131 | } | |
132 | ||
f881dc35 | 133 | if (((AliTRDpadPlane &) p).fPadCol) { |
134 | delete [] ((AliTRDpadPlane &) p).fPadCol; | |
135 | } | |
2745a409 | 136 | ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows]; |
137 | for (iBin = 0; iBin < fNrows; iBin++) { | |
138 | ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin]; | |
139 | } | |
e0d47c25 | 140 | |
141 | } | |
142 | ||
143 | //_____________________________________________________________________________ | |
144 | AliTRDpadPlane::~AliTRDpadPlane() | |
145 | { | |
146 | // | |
147 | // AliTRDpadPlane destructor | |
148 | // | |
149 | ||
e0d47c25 | 150 | if (fPadRow) { |
151 | delete [] fPadRow; | |
152 | fPadRow = 0; | |
153 | } | |
154 | ||
155 | if (fPadCol) { | |
156 | delete [] fPadCol; | |
157 | fPadCol = 0; | |
158 | } | |
159 | ||
160 | } | |
161 | ||
3c537e64 | 162 | //_____________________________________________________________________________ |
163 | AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p) | |
164 | { | |
165 | // | |
166 | // Assignment operator | |
167 | // | |
168 | ||
f881dc35 | 169 | if (this != &p) { |
170 | ((AliTRDpadPlane &) p).Copy(*this); | |
171 | } | |
172 | ||
3c537e64 | 173 | return *this; |
174 | ||
175 | } | |
176 | ||
e0d47c25 | 177 | //_____________________________________________________________________________ |
178 | void AliTRDpadPlane::Copy(TObject &p) const | |
179 | { | |
180 | // | |
181 | // Copy function | |
182 | // | |
183 | ||
184 | Int_t iBin = 0; | |
185 | ||
4329977a | 186 | ((AliTRDpadPlane &) p).fPla = fPla; |
187 | ((AliTRDpadPlane &) p).fCha = fCha; | |
e0d47c25 | 188 | |
4329977a | 189 | ((AliTRDpadPlane &) p).fLength = fLength; |
190 | ((AliTRDpadPlane &) p).fWidth = fWidth; | |
191 | ((AliTRDpadPlane &) p).fLengthRim = fLengthRim; | |
192 | ((AliTRDpadPlane &) p).fWidthRim = fWidthRim; | |
193 | ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad; | |
194 | ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad; | |
195 | ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad; | |
196 | ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad; | |
e0d47c25 | 197 | |
4329977a | 198 | ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing; |
199 | ((AliTRDpadPlane &) p).fColSpacing = fColSpacing; | |
e0d47c25 | 200 | |
4329977a | 201 | ((AliTRDpadPlane &) p).fNrows = fNrows; |
202 | ((AliTRDpadPlane &) p).fNcols = fNcols; | |
e0d47c25 | 203 | |
4329977a | 204 | ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle; |
205 | ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan; | |
e0d47c25 | 206 | |
4329977a | 207 | ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset; |
e0d47c25 | 208 | |
f881dc35 | 209 | if (((AliTRDpadPlane &) p).fPadRow) { |
210 | delete [] ((AliTRDpadPlane &) p).fPadRow; | |
211 | } | |
e0d47c25 | 212 | ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows]; |
213 | for (iBin = 0; iBin < fNrows; iBin++) { | |
214 | ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin]; | |
215 | } | |
216 | ||
f881dc35 | 217 | if (((AliTRDpadPlane &) p).fPadCol) { |
218 | delete [] ((AliTRDpadPlane &) p).fPadCol; | |
219 | } | |
e0d47c25 | 220 | ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows]; |
221 | for (iBin = 0; iBin < fNrows; iBin++) { | |
222 | ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin]; | |
223 | } | |
224 | ||
225 | TObject::Copy(p); | |
226 | ||
227 | } | |
228 | ||
f18d4f83 | 229 | //_____________________________________________________________________________ |
230 | void AliTRDpadPlane::SetTiltingAngle(Double_t t) | |
231 | { | |
232 | // | |
233 | // Set the tilting angle of the pads | |
234 | // | |
235 | ||
236 | fTiltingAngle = t; | |
237 | fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle); | |
238 | ||
239 | } | |
240 | ||
e0d47c25 | 241 | //_____________________________________________________________________________ |
98ce8151 | 242 | Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const |
e0d47c25 | 243 | { |
244 | // | |
4329977a | 245 | // Finds the pad row number for a given z-position in local supermodule system |
e0d47c25 | 246 | // |
247 | ||
248 | Int_t row = 0; | |
249 | Int_t nabove = 0; | |
250 | Int_t nbelow = 0; | |
251 | Int_t middle = 0; | |
252 | ||
f881dc35 | 253 | if ((z > GetRow0() ) || |
254 | (z < GetRowEnd())) { | |
a5cadd36 | 255 | |
e0d47c25 | 256 | row = -1; |
a5cadd36 | 257 | |
4329977a | 258 | } |
259 | else { | |
260 | ||
261 | nabove = fNrows + 1; | |
262 | nbelow = 0; | |
263 | while (nabove - nbelow > 1) { | |
264 | middle = (nabove + nbelow) / 2; | |
265 | if (z == (fPadRow[middle-1] + fPadRowSMOffset)) { | |
266 | row = middle; | |
267 | } | |
268 | if (z > (fPadRow[middle-1] + fPadRowSMOffset)) { | |
269 | nabove = middle; | |
270 | } | |
271 | else { | |
272 | nbelow = middle; | |
273 | } | |
274 | } | |
275 | row = nbelow - 1; | |
276 | ||
277 | } | |
278 | ||
279 | return row; | |
280 | ||
281 | } | |
282 | ||
283 | //_____________________________________________________________________________ | |
284 | Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const | |
285 | { | |
286 | // | |
287 | // Finds the pad row number for a given z-position in local ROC system | |
288 | // | |
289 | ||
290 | Int_t row = 0; | |
291 | Int_t nabove = 0; | |
292 | Int_t nbelow = 0; | |
293 | Int_t middle = 0; | |
294 | ||
295 | if ((z > GetRow0ROC() ) || | |
296 | (z < GetRowEndROC())) { | |
297 | ||
298 | row = -1; | |
299 | ||
e0d47c25 | 300 | } |
301 | else { | |
a5cadd36 | 302 | |
f881dc35 | 303 | nabove = fNrows + 1; |
e0d47c25 | 304 | nbelow = 0; |
305 | while (nabove - nbelow > 1) { | |
306 | middle = (nabove + nbelow) / 2; | |
f881dc35 | 307 | if (z == fPadRow[middle-1]) { |
308 | row = middle; | |
309 | } | |
310 | if (z > fPadRow[middle-1]) { | |
311 | nabove = middle; | |
312 | } | |
313 | else { | |
314 | nbelow = middle; | |
315 | } | |
e0d47c25 | 316 | } |
317 | row = nbelow - 1; | |
a5cadd36 | 318 | |
e0d47c25 | 319 | } |
320 | ||
321 | return row; | |
322 | ||
323 | } | |
324 | ||
325 | //_____________________________________________________________________________ | |
4329977a | 326 | Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const |
e0d47c25 | 327 | { |
328 | // | |
329 | // Finds the pad column number for a given global rphi-position | |
330 | // | |
331 | ||
4329977a | 332 | Int_t col = 0; |
333 | Int_t nabove = 0; | |
334 | Int_t nbelow = 0; | |
335 | Int_t middle = 0; | |
2f4fac20 | 336 | |
f881dc35 | 337 | if ((rphi > GetCol0() ) || |
338 | (rphi < GetColEnd())) { | |
e0d47c25 | 339 | |
e0d47c25 | 340 | col = -1; |
a5cadd36 | 341 | |
e0d47c25 | 342 | } |
343 | else { | |
a5cadd36 | 344 | |
f881dc35 | 345 | nabove = fNcols + 1; |
e0d47c25 | 346 | nbelow = 0; |
347 | while (nabove - nbelow > 1) { | |
348 | middle = (nabove + nbelow) / 2; | |
f881dc35 | 349 | if (rphi == fPadCol[middle-1]) { |
350 | col = middle; | |
351 | } | |
352 | if (rphi > fPadCol[middle-1]) { | |
353 | nabove = middle; | |
354 | } | |
355 | else { | |
356 | nbelow = middle; | |
357 | } | |
e0d47c25 | 358 | } |
359 | col = nbelow - 1; | |
e0d47c25 | 360 | |
e0d47c25 | 361 | } |
e0d47c25 | 362 | |
a5cadd36 | 363 | return col; |
e0d47c25 | 364 | |
365 | } |