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