Line data Source code
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 48 : ClassImp(AliTRDpadPlane)
36 :
37 : //_____________________________________________________________________________
38 : AliTRDpadPlane::AliTRDpadPlane()
39 90 : :TObject()
40 90 : ,fLayer(0)
41 90 : ,fStack(0)
42 90 : ,fLength(0)
43 90 : ,fWidth(0)
44 90 : ,fLengthRim(0)
45 90 : ,fWidthRim(0)
46 90 : ,fLengthOPad(0)
47 90 : ,fWidthOPad(0)
48 90 : ,fLengthIPad(0)
49 90 : ,fWidthIPad(0)
50 90 : ,fRowSpacing(0)
51 90 : ,fColSpacing(0)
52 90 : ,fNrows(0)
53 90 : ,fNcols(0)
54 90 : ,fTiltingAngle(0)
55 90 : ,fTiltingTan(0)
56 90 : ,fPadRow(0)
57 90 : ,fPadCol(0)
58 90 : ,fPadRowSMOffset(0)
59 90 : ,fAnodeWireOffset(0)
60 450 : {
61 : //
62 : // Default constructor
63 : //
64 :
65 180 : }
66 :
67 : //_____________________________________________________________________________
68 : AliTRDpadPlane::AliTRDpadPlane(Int_t layer, Int_t stack)
69 0 : :TObject()
70 0 : ,fLayer(layer)
71 0 : ,fStack(stack)
72 0 : ,fLength(0)
73 0 : ,fWidth(0)
74 0 : ,fLengthRim(0)
75 0 : ,fWidthRim(0)
76 0 : ,fLengthOPad(0)
77 0 : ,fWidthOPad(0)
78 0 : ,fLengthIPad(0)
79 0 : ,fWidthIPad(0)
80 0 : ,fRowSpacing(0)
81 0 : ,fColSpacing(0)
82 0 : ,fNrows(0)
83 0 : ,fNcols(0)
84 0 : ,fTiltingAngle(0)
85 0 : ,fTiltingTan(0)
86 0 : ,fPadRow(0)
87 0 : ,fPadCol(0)
88 0 : ,fPadRowSMOffset(0)
89 0 : ,fAnodeWireOffset(0)
90 0 : {
91 : //
92 : // Constructor
93 : //
94 :
95 0 : }
96 :
97 : //_____________________________________________________________________________
98 : AliTRDpadPlane::~AliTRDpadPlane()
99 540 : {
100 : //
101 : // AliTRDpadPlane destructor
102 : //
103 :
104 90 : if (fPadRow) {
105 180 : delete [] fPadRow;
106 90 : fPadRow = 0;
107 90 : }
108 :
109 90 : if (fPadCol) {
110 180 : delete [] fPadCol;
111 90 : fPadCol = 0;
112 90 : }
113 :
114 270 : }
115 :
116 : //_____________________________________________________________________________
117 : void AliTRDpadPlane::Copy(TObject &p) const
118 : {
119 : //
120 : // Copy function
121 : //
122 :
123 : Int_t iBin = 0;
124 :
125 0 : ((AliTRDpadPlane &) p).fLayer = fLayer;
126 0 : ((AliTRDpadPlane &) p).fStack = fStack;
127 :
128 0 : ((AliTRDpadPlane &) p).fLength = fLength;
129 0 : ((AliTRDpadPlane &) p).fWidth = fWidth;
130 0 : ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
131 0 : ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
132 0 : ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
133 0 : ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
134 0 : ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
135 0 : ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
136 :
137 0 : ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
138 0 : ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
139 :
140 0 : ((AliTRDpadPlane &) p).fNrows = fNrows;
141 0 : ((AliTRDpadPlane &) p).fNcols = fNcols;
142 :
143 0 : ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
144 0 : ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
145 :
146 0 : ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset;
147 0 : ((AliTRDpadPlane &) p).fAnodeWireOffset = fAnodeWireOffset;
148 :
149 0 : if (((AliTRDpadPlane &) p).fPadRow) {
150 0 : delete [] ((AliTRDpadPlane &) p).fPadRow;
151 : }
152 0 : ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
153 0 : for (iBin = 0; iBin < fNrows; iBin++) {
154 0 : ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
155 : }
156 :
157 0 : if (((AliTRDpadPlane &) p).fPadCol) {
158 0 : delete [] ((AliTRDpadPlane &) p).fPadCol;
159 : }
160 0 : ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
161 0 : for (iBin = 0; iBin < fNrows; iBin++) {
162 0 : ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
163 : }
164 :
165 0 : TObject::Copy(p);
166 :
167 0 : }
168 :
169 : //_____________________________________________________________________________
170 : void AliTRDpadPlane::SetTiltingAngle(Double_t t)
171 : {
172 : //
173 : // Set the tilting angle of the pads
174 : //
175 :
176 180 : fTiltingAngle = t;
177 90 : fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
178 :
179 90 : }
180 :
181 : //_____________________________________________________________________________
182 : Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
183 : {
184 : //
185 : // Finds the pad row number for a given z-position in local supermodule system
186 : //
187 :
188 : Int_t row = 0;
189 : Int_t nabove = 0;
190 : Int_t nbelow = 0;
191 : Int_t middle = 0;
192 :
193 0 : if ((z > GetRow0() ) ||
194 0 : (z < GetRowEnd())) {
195 :
196 : row = -1;
197 :
198 0 : }
199 : else {
200 :
201 0 : nabove = fNrows + 1;
202 : nbelow = 0;
203 0 : while (nabove - nbelow > 1) {
204 0 : middle = (nabove + nbelow) / 2;
205 0 : if (z == (fPadRow[middle-1] + fPadRowSMOffset)) {
206 : row = middle;
207 0 : }
208 0 : if (z > (fPadRow[middle-1] + fPadRowSMOffset)) {
209 : nabove = middle;
210 0 : }
211 : else {
212 : nbelow = middle;
213 : }
214 : }
215 0 : row = nbelow - 1;
216 :
217 : }
218 :
219 0 : 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 1791401 : if ((z > GetRow0ROC() ) ||
236 597129 : (z < GetRowEndROC())) {
237 :
238 : row = -1;
239 :
240 8 : }
241 : else {
242 :
243 597128 : nabove = fNrows + 1;
244 : nbelow = 0;
245 3514096 : while (nabove - nbelow > 1) {
246 2319840 : middle = (nabove + nbelow) / 2;
247 2319840 : if (z == fPadRow[middle-1]) {
248 : row = middle;
249 0 : }
250 2319840 : if (z > fPadRow[middle-1]) {
251 : nabove = middle;
252 923918 : }
253 : else {
254 : nbelow = middle;
255 : }
256 : }
257 597128 : row = nbelow - 1;
258 :
259 : }
260 :
261 597136 : return row;
262 :
263 : }
264 :
265 : //_____________________________________________________________________________
266 : Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const
267 : {
268 : //
269 : // Finds the pad column number for a given rphi-position
270 : //
271 :
272 : Int_t col = 0;
273 : Int_t nabove = 0;
274 : Int_t nbelow = 0;
275 : Int_t middle = 0;
276 :
277 1791384 : if ((rphi < GetCol0() ) ||
278 597128 : (rphi > GetColEnd())) {
279 :
280 : col = -1;
281 :
282 0 : }
283 : else {
284 :
285 597128 : nabove = fNcols;
286 : nbelow = 0;
287 5508153 : while (nabove - nbelow > 1) {
288 4313897 : middle = (nabove + nbelow) / 2;
289 4313897 : if (rphi == fPadCol[middle]) {
290 : col = middle;
291 0 : }
292 4313897 : if (rphi > fPadCol[middle]) {
293 : nbelow = middle;
294 2346092 : }
295 : else {
296 : nabove = middle;
297 : }
298 : }
299 : col = nbelow;
300 :
301 : }
302 :
303 597128 : return col;
304 :
305 : }
|