]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDpadPlane.cxx
Add new FEE parameter class by Ken
[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. //
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
36ClassImp(AliTRDpadPlane)
37
38//_____________________________________________________________________________
2745a409 39AliTRDpadPlane::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//_____________________________________________________________________________
68AliTRDpadPlane::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 97AliTRDpadPlane::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//_____________________________________________________________________________
144AliTRDpadPlane::~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//_____________________________________________________________________________
163AliTRDpadPlane &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//_____________________________________________________________________________
178void 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
229//_____________________________________________________________________________
98ce8151 230Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
e0d47c25 231{
232 //
4329977a 233 // Finds the pad row number for a given z-position in local supermodule system
e0d47c25 234 //
235
236 Int_t row = 0;
237 Int_t nabove = 0;
238 Int_t nbelow = 0;
239 Int_t middle = 0;
240
f881dc35 241 if ((z > GetRow0() ) ||
242 (z < GetRowEnd())) {
a5cadd36 243
e0d47c25 244 row = -1;
a5cadd36 245
4329977a 246 }
247 else {
248
249 nabove = fNrows + 1;
250 nbelow = 0;
251 while (nabove - nbelow > 1) {
252 middle = (nabove + nbelow) / 2;
253 if (z == (fPadRow[middle-1] + fPadRowSMOffset)) {
254 row = middle;
255 }
256 if (z > (fPadRow[middle-1] + fPadRowSMOffset)) {
257 nabove = middle;
258 }
259 else {
260 nbelow = middle;
261 }
262 }
263 row = nbelow - 1;
264
265 }
266
267 return row;
268
269}
270
271//_____________________________________________________________________________
272Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const
273{
274 //
275 // Finds the pad row number for a given z-position in local ROC system
276 //
277
278 Int_t row = 0;
279 Int_t nabove = 0;
280 Int_t nbelow = 0;
281 Int_t middle = 0;
282
283 if ((z > GetRow0ROC() ) ||
284 (z < GetRowEndROC())) {
285
286 row = -1;
287
e0d47c25 288 }
289 else {
a5cadd36 290
f881dc35 291 nabove = fNrows + 1;
e0d47c25 292 nbelow = 0;
293 while (nabove - nbelow > 1) {
294 middle = (nabove + nbelow) / 2;
f881dc35 295 if (z == fPadRow[middle-1]) {
296 row = middle;
297 }
298 if (z > fPadRow[middle-1]) {
299 nabove = middle;
300 }
301 else {
302 nbelow = middle;
303 }
e0d47c25 304 }
305 row = nbelow - 1;
a5cadd36 306
e0d47c25 307 }
308
309 return row;
310
311}
312
313//_____________________________________________________________________________
4329977a 314Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const
e0d47c25 315{
316 //
317 // Finds the pad column number for a given global rphi-position
318 //
319
4329977a 320 Int_t col = 0;
321 Int_t nabove = 0;
322 Int_t nbelow = 0;
323 Int_t middle = 0;
2f4fac20 324
f881dc35 325 if ((rphi > GetCol0() ) ||
326 (rphi < GetColEnd())) {
e0d47c25 327
e0d47c25 328 col = -1;
a5cadd36 329
e0d47c25 330 }
331 else {
a5cadd36 332
f881dc35 333 nabove = fNcols + 1;
e0d47c25 334 nbelow = 0;
335 while (nabove - nbelow > 1) {
336 middle = (nabove + nbelow) / 2;
f881dc35 337 if (rphi == fPadCol[middle-1]) {
338 col = middle;
339 }
340 if (rphi > fPadCol[middle-1]) {
341 nabove = middle;
342 }
343 else {
344 nbelow = middle;
345 }
e0d47c25 346 }
347 col = nbelow - 1;
e0d47c25 348
e0d47c25 349 }
e0d47c25 350
a5cadd36 351 return col;
e0d47c25 352
353}