]>
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 | //_____________________________________________________________________________ |
98 | AliTRDpadPlane::~AliTRDpadPlane() | |
99 | { | |
100 | // | |
101 | // AliTRDpadPlane destructor | |
102 | // | |
103 | ||
e0d47c25 | 104 | if (fPadRow) { |
105 | delete [] fPadRow; | |
106 | fPadRow = 0; | |
107 | } | |
108 | ||
109 | if (fPadCol) { | |
110 | delete [] fPadCol; | |
111 | fPadCol = 0; | |
112 | } | |
113 | ||
114 | } | |
115 | ||
116 | //_____________________________________________________________________________ | |
117 | void AliTRDpadPlane::Copy(TObject &p) const | |
118 | { | |
119 | // | |
120 | // Copy function | |
121 | // | |
122 | ||
123 | Int_t iBin = 0; | |
124 | ||
58897a75 | 125 | ((AliTRDpadPlane &) p).fLayer = fLayer; |
126 | ((AliTRDpadPlane &) p).fStack = fStack; | |
e0d47c25 | 127 | |
58897a75 | 128 | ((AliTRDpadPlane &) p).fLength = fLength; |
129 | ((AliTRDpadPlane &) p).fWidth = fWidth; | |
130 | ((AliTRDpadPlane &) p).fLengthRim = fLengthRim; | |
131 | ((AliTRDpadPlane &) p).fWidthRim = fWidthRim; | |
132 | ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad; | |
133 | ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad; | |
134 | ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad; | |
135 | ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad; | |
e0d47c25 | 136 | |
58897a75 | 137 | ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing; |
138 | ((AliTRDpadPlane &) p).fColSpacing = fColSpacing; | |
e0d47c25 | 139 | |
58897a75 | 140 | ((AliTRDpadPlane &) p).fNrows = fNrows; |
141 | ((AliTRDpadPlane &) p).fNcols = fNcols; | |
e0d47c25 | 142 | |
58897a75 | 143 | ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle; |
144 | ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan; | |
e0d47c25 | 145 | |
58897a75 | 146 | ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset; |
147 | ((AliTRDpadPlane &) p).fAnodeWireOffset = fAnodeWireOffset; | |
e0d47c25 | 148 | |
f881dc35 | 149 | if (((AliTRDpadPlane &) p).fPadRow) { |
150 | delete [] ((AliTRDpadPlane &) p).fPadRow; | |
151 | } | |
e0d47c25 | 152 | ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows]; |
153 | for (iBin = 0; iBin < fNrows; iBin++) { | |
154 | ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin]; | |
155 | } | |
156 | ||
f881dc35 | 157 | if (((AliTRDpadPlane &) p).fPadCol) { |
158 | delete [] ((AliTRDpadPlane &) p).fPadCol; | |
159 | } | |
e0d47c25 | 160 | ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows]; |
161 | for (iBin = 0; iBin < fNrows; iBin++) { | |
162 | ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin]; | |
163 | } | |
164 | ||
165 | TObject::Copy(p); | |
166 | ||
167 | } | |
168 | ||
f18d4f83 | 169 | //_____________________________________________________________________________ |
170 | void AliTRDpadPlane::SetTiltingAngle(Double_t t) | |
171 | { | |
172 | // | |
173 | // Set the tilting angle of the pads | |
174 | // | |
175 | ||
176 | fTiltingAngle = t; | |
177 | fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle); | |
178 | ||
179 | } | |
180 | ||
e0d47c25 | 181 | //_____________________________________________________________________________ |
98ce8151 | 182 | Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const |
e0d47c25 | 183 | { |
184 | // | |
4329977a | 185 | // Finds the pad row number for a given z-position in local supermodule system |
e0d47c25 | 186 | // |
187 | ||
188 | Int_t row = 0; | |
189 | Int_t nabove = 0; | |
190 | Int_t nbelow = 0; | |
191 | Int_t middle = 0; | |
192 | ||
f881dc35 | 193 | if ((z > GetRow0() ) || |
194 | (z < GetRowEnd())) { | |
a5cadd36 | 195 | |
e0d47c25 | 196 | row = -1; |
a5cadd36 | 197 | |
4329977a | 198 | } |
199 | else { | |
200 | ||
201 | nabove = fNrows + 1; | |
202 | nbelow = 0; | |
203 | while (nabove - nbelow > 1) { | |
204 | middle = (nabove + nbelow) / 2; | |
205 | if (z == (fPadRow[middle-1] + fPadRowSMOffset)) { | |
206 | row = middle; | |
207 | } | |
208 | if (z > (fPadRow[middle-1] + fPadRowSMOffset)) { | |
209 | nabove = middle; | |
210 | } | |
211 | else { | |
212 | nbelow = middle; | |
213 | } | |
214 | } | |
215 | row = nbelow - 1; | |
216 | ||
217 | } | |
218 | ||
219 | return row; | |
220 | ||
221 | } | |
222 | ||
223 | //_____________________________________________________________________________ | |
224 | Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const | |
225 | { | |
226 | // | |
227 | // Finds the pad row number for a given z-position in local ROC system | |
228 | // | |
229 | ||
230 | Int_t row = 0; | |
231 | Int_t nabove = 0; | |
232 | Int_t nbelow = 0; | |
233 | Int_t middle = 0; | |
234 | ||
235 | if ((z > GetRow0ROC() ) || | |
236 | (z < GetRowEndROC())) { | |
237 | ||
238 | row = -1; | |
239 | ||
e0d47c25 | 240 | } |
241 | else { | |
a5cadd36 | 242 | |
f881dc35 | 243 | nabove = fNrows + 1; |
e0d47c25 | 244 | nbelow = 0; |
245 | while (nabove - nbelow > 1) { | |
246 | middle = (nabove + nbelow) / 2; | |
f881dc35 | 247 | if (z == fPadRow[middle-1]) { |
248 | row = middle; | |
249 | } | |
250 | if (z > fPadRow[middle-1]) { | |
251 | nabove = middle; | |
252 | } | |
253 | else { | |
254 | nbelow = middle; | |
255 | } | |
e0d47c25 | 256 | } |
257 | row = nbelow - 1; | |
a5cadd36 | 258 | |
e0d47c25 | 259 | } |
260 | ||
261 | return row; | |
262 | ||
263 | } | |
264 | ||
265 | //_____________________________________________________________________________ | |
4329977a | 266 | Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const |
e0d47c25 | 267 | { |
268 | // | |
023b669c | 269 | // Finds the pad column number for a given rphi-position |
e0d47c25 | 270 | // |
271 | ||
4329977a | 272 | Int_t col = 0; |
273 | Int_t nabove = 0; | |
274 | Int_t nbelow = 0; | |
275 | Int_t middle = 0; | |
2f4fac20 | 276 | |
023b669c | 277 | if ((rphi < GetCol0() ) || |
278 | (rphi > GetColEnd())) { | |
e0d47c25 | 279 | |
e0d47c25 | 280 | col = -1; |
a5cadd36 | 281 | |
e0d47c25 | 282 | } |
283 | else { | |
a5cadd36 | 284 | |
023b669c | 285 | nabove = fNcols; |
e0d47c25 | 286 | nbelow = 0; |
287 | while (nabove - nbelow > 1) { | |
288 | middle = (nabove + nbelow) / 2; | |
023b669c | 289 | if (rphi == fPadCol[middle]) { |
f881dc35 | 290 | col = middle; |
291 | } | |
023b669c | 292 | if (rphi > fPadCol[middle]) { |
293 | nbelow = middle; | |
f881dc35 | 294 | } |
295 | else { | |
023b669c | 296 | nabove = middle; |
f881dc35 | 297 | } |
e0d47c25 | 298 | } |
023b669c | 299 | col = nbelow; |
e0d47c25 | 300 | |
e0d47c25 | 301 | } |
e0d47c25 | 302 | |
a5cadd36 | 303 | return col; |
e0d47c25 | 304 | |
305 | } |