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