]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDpadPlane.cxx
renamed CorrectionMatrix class
[u/mrichter/AliRoot.git] / TRD / AliTRDpadPlane.cxx
CommitLineData
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. //
26// //
27///////////////////////////////////////////////////////////////////////////////
28
29#include "AliTRDpadPlane.h"
bd0f8685 30#include "AliTRDgeometry.h"
e0d47c25 31
32ClassImp(AliTRDpadPlane)
33
34//_____________________________________________________________________________
35AliTRDpadPlane::AliTRDpadPlane():TObject()
36{
37 //
38 // Default constructor
39 //
40
41 fGeo = 0;
42
43 fPla = 0;
44 fCha = 0;
45
46 fLength = 0.0;
47 fWidth = 0.0;
48 fLengthRim = 0.0;
49 fWidthRim = 0.0;
50 fLengthOPad = 0.0;
51 fWidthOPad = 0.0;
52 fLengthIPad = 0.0;
53 fWidthIPad = 0.0;
54
55 fRowSpacing = 0.0;
56 fColSpacing = 0.0;
57
58 fNrows = 0;
59 fNcols = 0;
60
61 fPadRow = 0;
62 fPadCol = 0;
63
64 fTiltingAngle = 0.0;
4ffb371b 65 fTiltingTan = 0.0;
e0d47c25 66
67}
68
69//_____________________________________________________________________________
a0cd5002 70AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject(),fPadRow(0),fPadCol(0)
e0d47c25 71{
72 //
73 // Constructor that initializes a given pad plane type
74 //
75
bd0f8685 76 fGeo = new AliTRDgeometry();
e0d47c25 77
78 fPla = p;
79 fCha = c;
80
e0d47c25 81 fRowSpacing = 0.0;
82 fColSpacing = 0.0;
83
84 fLengthRim = 1.0;
85 fWidthRim = 0.5;
86
87 fNcols = 144;
88
89 //
90 // The pad plane parameter
91 //
92 switch (p) {
93 case 0:
94 if (c == 2) {
95 // L0C0 type
96 fNrows = 12;
97 fLength = 108.0;
287c5d50 98 fWidth = 92.2;
e0d47c25 99 fLengthOPad = 8.0;
100 fWidthOPad = 0.515;
101 fLengthIPad = 9.0;
102 fWidthIPad = 0.635;
103 fTiltingAngle = -2.0;
104 }
105 else {
106 // L0C1 type
107 fNrows = 16;
108 fLength = 122.0;
287c5d50 109 fWidth = 92.2;
e0d47c25 110 fLengthOPad = 7.5;
111 fWidthOPad = 0.515;
112 fLengthIPad = 7.5;
113 fWidthIPad = 0.635;
114 fTiltingAngle = -2.0;
115 }
116 break;
117 case 1:
118 if (c == 2) {
119 // L1C0 type
120 fNrows = 12;
121 fLength = 108.0;
122 fWidth = 96.6;
123 fLengthOPad = 8.0;
124 fWidthOPad = 0.585;
125 fLengthIPad = 9.0;
126 fWidthIPad = 0.665;
127 fTiltingAngle = 2.0;
128 }
129 else {
130 // L1C1 type
131 fNrows = 16;
132 fLength = 122.0;
133 fWidth = 96.6;
134 fLengthOPad = 7.5;
135 fWidthOPad = 0.585;
136 fLengthIPad = 7.5;
137 fWidthIPad = 0.665;
138 fTiltingAngle = 2.0;
139 }
140 break;
141 case 2:
142 if (c == 2) {
143 // L2C0 type
144 fNrows = 12;
145 fLength = 108.0;
146 fWidth = 101.1;
147 fLengthOPad = 8.0;
148 fWidthOPad = 0.705;
149 fLengthIPad = 9.0;
150 fWidthIPad = 0.695;
151 fTiltingAngle = -2.0;
152 }
153 else {
154 // L2C1 type
155 fNrows = 16;
156 fLength = 129.0;
157 fWidth = 101.1;
158 fLengthOPad = 7.5;
159 fWidthOPad = 0.705;
160 fLengthIPad = 8.0;
161 fWidthIPad = 0.695;
162 fTiltingAngle = -2.0;
163 }
164 break;
165 case 3:
166 if (c == 2) {
167 // L3C0 type
168 fNrows = 12;
169 fLength = 108.0;
170 fWidth = 105.5;
171 fLengthOPad = 8.0;
172 fWidthOPad = 0.775;
173 fLengthIPad = 9.0;
174 fWidthIPad = 0.725;
175 fTiltingAngle = 2.0;
176 }
177 else {
178 // L3C1 type
179 fNrows = 16;
180 fLength = 136.0;
181 fWidth = 105.5;
182 fLengthOPad = 7.5;
183 fWidthOPad = 0.775;
184 fLengthIPad = 8.5;
185 fWidthIPad = 0.725;
186 fTiltingAngle = 2.0;
187 }
188 break;
189 case 4:
190 if (c == 2) {
191 // L4C0 type
192 fNrows = 12;
193 fLength = 108.0;
194 fWidth = 109.9;
195 fLengthOPad = 8.0;
196 fWidthOPad = 0.845;
197 fLengthIPad = 9.0;
198 fWidthIPad = 0.755;
199 fTiltingAngle = -2.0;
200 }
201 else {
202 // L4C1 type
203 fNrows = 16;
204 fLength = 143.0;
205 fWidth = 109.9;
206 fLengthOPad = 7.5;
207 fWidthOPad = 0.845;
208 fLengthIPad = 9.0;
209 fWidthIPad = 0.755;
210 fTiltingAngle = -2.0;
211 }
212 break;
213 case 5:
214 if (c == 2) {
215 // L5C0 type
216 fNrows = 12;
217 fLength = 108.0;
218 fWidth = 114.4;
219 fLengthOPad = 8.0;
220 fWidthOPad = 0.965;
221 fLengthIPad = 9.0;
222 fWidthIPad = 0.785;
223 fTiltingAngle = 2.0;
224 }
225 else {
226 // L5C1 type
227 fNrows = 16;
228 fLength = 145.0;
229 fWidth = 114.4;
230 fLengthOPad = 8.5;
231 fWidthOPad = 0.965;
232 fLengthIPad = 9.0;
233 fWidthIPad = 0.785;
234 fTiltingAngle = 2.0;
235 }
236 break;
237 };
238
a5cadd36 239 //
2f4fac20 240 // Store tilting angle as tangens
a5cadd36 241 //
2f4fac20 242 fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
a5cadd36 243
e0d47c25 244 //
245 // The positions of the borders of the pads
246 //
247 // Row direction
248 //
e0d47c25 249 fPadRow = new Double_t[fNrows];
250 Double_t row = fGeo->GetChamberLength(p,0)
251 + fGeo->GetChamberLength(p,1)
252 + fGeo->GetChamberLength(p,2) / 2.
a5cadd36 253 - fGeo->RpadW()
e0d47c25 254 - fLengthRim;
255 for (Int_t ic = 0; ic < c; ic++) {
256 row -= fGeo->GetChamberLength(p,ic);
257 }
258 for (Int_t ir = 0; ir < fNrows; ir++) {
259 fPadRow[ir] = row;
260 row -= fRowSpacing;
a5cadd36 261 if (ir == 0) {
e0d47c25 262 row -= fLengthOPad;
263 }
264 else {
265 row -= fLengthIPad;
266 }
267 }
268 //
269 // Column direction
270 //
e0d47c25 271 fPadCol = new Double_t[fNcols];
272 Double_t col = fGeo->GetChamberWidth(p) / 2.
287c5d50 273 + fGeo->CroWid()
e0d47c25 274 - fWidthRim;
275 for (Int_t ic = 0; ic < fNcols; ic++) {
276 fPadCol[ic] = col;
277 col -= fColSpacing;
a5cadd36 278 if (ic == 0) {
e0d47c25 279 col -= fWidthOPad;
280 }
281 else {
282 col -= fWidthIPad;
283 }
284 }
285
286}
287
288//_____________________________________________________________________________
289AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p):TObject(p)
290{
291 //
292 // AliTRDpadPlane copy constructor
293 //
294
295 ((AliTRDpadPlane &) p).Copy(*this);
296
297}
298
299//_____________________________________________________________________________
300AliTRDpadPlane::~AliTRDpadPlane()
301{
302 //
303 // AliTRDpadPlane destructor
304 //
305
306 if (fGeo) {
307 delete fGeo;
308 fGeo = 0;
309 }
310
311 if (fPadRow) {
312 delete [] fPadRow;
313 fPadRow = 0;
314 }
315
316 if (fPadCol) {
317 delete [] fPadCol;
318 fPadCol = 0;
319 }
320
321}
322
3c537e64 323//_____________________________________________________________________________
324AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
325{
326 //
327 // Assignment operator
328 //
329
330 if (this != &p) ((AliTRDpadPlane &) p).Copy(*this);
331 return *this;
332
333}
334
e0d47c25 335//_____________________________________________________________________________
336void AliTRDpadPlane::Copy(TObject &p) const
337{
338 //
339 // Copy function
340 //
341
342 Int_t iBin = 0;
343
344 ((AliTRDpadPlane &) p).fGeo = 0;
345
346 ((AliTRDpadPlane &) p).fPla = fPla;
347 ((AliTRDpadPlane &) p).fCha = fCha;
348
349 ((AliTRDpadPlane &) p).fLength = fLength;
350 ((AliTRDpadPlane &) p).fWidth = fWidth;
351 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
352 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
353 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
354 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
355 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
356 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
357
358 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
359 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
360
361 ((AliTRDpadPlane &) p).fNrows = fNrows;
362 ((AliTRDpadPlane &) p).fNcols = fNcols;
363
364 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
4ffb371b 365 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
e0d47c25 366
367 if (((AliTRDpadPlane &) p).fPadRow) delete [] ((AliTRDpadPlane &) p).fPadRow;
368 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
369 for (iBin = 0; iBin < fNrows; iBin++) {
370 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
371 }
372
373 if (((AliTRDpadPlane &) p).fPadCol) delete [] ((AliTRDpadPlane &) p).fPadCol;
374 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
375 for (iBin = 0; iBin < fNrows; iBin++) {
376 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
377 }
378
379 TObject::Copy(p);
380
381}
382
383//_____________________________________________________________________________
98ce8151 384Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
e0d47c25 385{
386 //
387 // Finds the pad row number for a given global z-position
388 //
389
390 Int_t row = 0;
391 Int_t nabove = 0;
392 Int_t nbelow = 0;
393 Int_t middle = 0;
394
a5cadd36 395 if ((z > GetRow0()) || (z < GetRowEnd())) {
396
e0d47c25 397 row = -1;
a5cadd36 398
e0d47c25 399 }
400 else {
a5cadd36 401
e0d47c25 402 nabove = fNrows+1;
403 nbelow = 0;
404 while (nabove - nbelow > 1) {
405 middle = (nabove + nbelow) / 2;
406 if (z == fPadRow[middle-1]) row = middle;
407 if (z > fPadRow[middle-1]) nabove = middle;
408 else nbelow = middle;
409 }
410 row = nbelow - 1;
a5cadd36 411
e0d47c25 412 }
413
414 return row;
415
416}
417
418//_____________________________________________________________________________
98ce8151 419Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi
21d9fcf1 420 , Double_t /*rowOffset*/) const
e0d47c25 421{
422 //
423 // Finds the pad column number for a given global rphi-position
424 //
425
a5cadd36 426 Int_t col = 0;
427 Int_t nabove = 0;
428 Int_t nbelow = 0;
429 Int_t middle = 0;
430 Double_t rphiShift = 0;
431
21d9fcf1 432 // MI change don't apply tilting angle here - better to do it directly on hit level
2f4fac20 433 // Take the tilting angle into account by shifting the hit position
434 // into the opposite direction
21d9fcf1 435 //
436
437
438 rphiShift = rphi ;
2f4fac20 439
440 if ((rphiShift > GetCol0()) || (rphiShift < GetColEnd())) {
e0d47c25 441
e0d47c25 442 col = -1;
a5cadd36 443
e0d47c25 444 }
445 else {
a5cadd36 446
e0d47c25 447 nabove = fNcols+1;
448 nbelow = 0;
449 while (nabove - nbelow > 1) {
450 middle = (nabove + nbelow) / 2;
2f4fac20 451 if (rphiShift == fPadCol[middle-1]) col = middle;
452 if (rphiShift > fPadCol[middle-1]) nabove = middle;
453 else nbelow = middle;
e0d47c25 454 }
455 col = nbelow - 1;
e0d47c25 456
e0d47c25 457 }
e0d47c25 458
a5cadd36 459 return col;
e0d47c25 460
461}