]>
Commit | Line | Data |
---|---|---|
55a288e5 | 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 | // AliTRDCalibraMode | |
21 | // | |
22 | // This class is for the modes of the TRD calibration. | |
0bc7827a | 23 | // The user has to choose with the functions SetNz and SetNrphi |
24 | // the precision of the calibration. | |
25 | // Author: | |
26 | // R. Bailhache (R.Bailhache@gsi.de) | |
27 | // | |
55a288e5 | 28 | //Begin_Html |
29 | /* | |
30 | <br> | |
31 | <CENTER> | |
32 | <TABLE border=1> | |
33 | <TR><TD><center>Nz</center></TD><TD><center> 0 </center></TD><TD><center> 1 </center></TD><TD><center> 2 </center></TD><TD><center> 3 </center></TD><TD><center> 4 </center></TD></TR> | |
34 | <TR><TD><CENTER>group of row pads per detector</CENTER></TD><TD><CENTER>1</CENTER></TD><TD><CENTER>2</CENTER></TD><TD><CENTER>4</CENTER></TD><TD><CENTER>6(chamb2)<br> 8(others chambers)</CENTER></TD><TD><CENTER>12 (chamb2)<br> 16 (chamb0)</CENTER></TD></TR> | |
35 | <TR><TD><CENTER>row pads per group</CENTER></TD><TD><CENTER>12 (chamb2)<br> 16 (chamb0)</CENTER></TD><TD><CENTER>6 (chamb2)<br> 8 (chamb0)</CENTER></TD><TD><CENTER>3 (chamb2)<br> 4 (chamb0)</CENTER></TD><TD><CENTER>2</CENTER></TD><TD><CENTER>1</CENTER></TD></TR> | |
36 | <TR><TD><CENTER>~distance [cm]</CENTER></TD><TD><CENTER>106 (chamb2)<br> 130 (chamb0)</CENTER></TD><TD><CENTER>53 (chamb2)<br> 65 (chamb0)</CENTER></TD><TD><CENTER>26.5 (chamb2)<br> 32.5 (chamb0)</CENTER></TD><TD><CENTER>17 (chamb2)<br> 17 (chamb0)</CENTER></TD><TD><CENTER>9 (chamb2)<br> 9 (chamb0)</CENTER></TD></TR> | |
37 | <CAPTION>In the z direction</CAPTION> | |
38 | </TABLE> | |
39 | </CENTER> | |
40 | <CENTER> | |
41 | <br> | |
42 | <TABLE border=1> | |
43 | <TR><TD><center>Nrphi</center></TD><TD><center> 0 </center></TD><TD><center> 1 </center></TD><TD><center> 2 </center></TD><TD><center> 3 </center></TD><TD><center> 4 </center></TD><TD><center> 5 </center></TD><TD><center> 6 </center></TD></TR> | |
44 | <TR><TD><CENTER>group of col pads per detector</CENTER></TD><TD><CENTER>1</CENTER></TD><TD><CENTER>2</CENTER></TD><TD><CENTER>4</CENTER></TD><TD><CENTER>8</CENTER></TD><TD><CENTER>16</CENTER></TD><TD><center>36</center></TD><TD><center>144</center></TD></TR> | |
45 | <TR><TD><CENTER>col pads per group</CENTER></TD><TD><CENTER>144</CENTER></TD><TD><CENTER>72</CENTER></TD><TD><CENTER>36</CENTER></TD><TD><CENTER>18</CENTER></TD><TD><CENTER>9</CENTER></TD><TD><center>4</center></TD><TD><center>1</center></TD></TR> | |
46 | <TR><TD><CENTER>~distance [cm]</CENTER></TD><TD><CENTER>113.4</CENTER></TD><TD><CENTER>56.7</CENTER></TD><TD><CENTER>25.3</CENTER></TD><TD><CENTER>14.3</CENTER></TD><TD><CENTER>7.25</CENTER></TD><TD><center>3.2</center></TD><TD><center>0.8</center></TD></TR> | |
47 | <CAPTION>In the rphi direction</CAPTION> | |
48 | </TABLE> | |
49 | </CENTER> | |
50 | <br> | |
51 | */ | |
52 | //End_Html | |
53 | // | |
54 | // | |
55a288e5 | 55 | ////////////////////////////////////////////////////////////////////////////////////// |
56 | ||
57 | #include "AliLog.h" | |
58 | ||
59 | #include "AliTRDCalibraMode.h" | |
f162af62 | 60 | #include "AliTRDgeometry.h" |
55a288e5 | 61 | |
62 | ClassImp(AliTRDCalibraMode) | |
63 | ||
64 | //______________________________________________________________________________________ | |
65 | AliTRDCalibraMode::AliTRDCalibraMode() | |
66 | :TObject() | |
f162af62 | 67 | ,fGeo(0) |
55a288e5 | 68 | { |
69 | // | |
70 | // Default constructor | |
71 | // | |
72 | ||
73 | for (Int_t i = 0; i < 3; i++) { | |
74 | fNz[i] = 0; | |
75 | fNrphi[i] = 0; | |
76 | } | |
77 | ||
78 | for (Int_t k = 0; k < 3; k++) { | |
79 | fDetChamb2[k] = 0; | |
80 | fDetChamb0[k] = 0; | |
81 | } | |
82 | ||
83 | for (Int_t i = 0; i < 3; i++) { | |
84 | fRowMin[i] = -1; | |
85 | fRowMax[i] = -1; | |
86 | fColMax[i] = -1; | |
87 | fColMin[i] = -1; | |
88 | fNnZ[i] = -1; | |
89 | fNnRphi[i] = -1; | |
90 | fNfragZ[i] = -1; | |
91 | fNfragRphi[i] = -1; | |
92 | fXbins[i] = -1; | |
93 | } | |
f162af62 | 94 | |
95 | fGeo = new AliTRDgeometry(); | |
96 | ||
55a288e5 | 97 | } |
98 | ||
99 | //______________________________________________________________________________________ | |
100 | AliTRDCalibraMode::AliTRDCalibraMode(const AliTRDCalibraMode &c) | |
101 | :TObject(c) | |
f162af62 | 102 | ,fGeo(0) |
55a288e5 | 103 | { |
104 | // | |
105 | // Copy constructor | |
106 | // | |
107 | ||
cf46274d | 108 | for(Int_t k = 0; k < 3; k++){ |
109 | fNz[k] = c.fNz[k]; | |
110 | fNrphi[k] = c.fNrphi[k]; | |
111 | fNnZ[k] = c.fNnZ[k]; | |
112 | fNnRphi[k] = c.fNnRphi[k]; | |
113 | fNfragZ[k] = c.fNfragZ[k]; | |
114 | fNfragRphi[k] = c.fNfragRphi[k]; | |
115 | fRowMin[k] = c.fRowMin[k]; | |
116 | fRowMax[k] = c.fRowMax[k]; | |
117 | fColMin[k] = c.fColMin[k]; | |
118 | fColMax[k] = c.fColMax[k]; | |
119 | fXbins[k] = c.fXbins[k]; | |
120 | fDetChamb0[k] = c.fDetChamb0[k]; | |
121 | fDetChamb2[k] = c.fDetChamb2[k]; | |
122 | } | |
55a288e5 | 123 | |
f162af62 | 124 | if (fGeo) { |
125 | delete fGeo; | |
126 | } | |
127 | fGeo = new AliTRDgeometry(); | |
128 | ||
cf46274d | 129 | } |
f162af62 | 130 | |
55a288e5 | 131 | //____________________________________________________________________________________ |
132 | AliTRDCalibraMode::~AliTRDCalibraMode() | |
133 | { | |
134 | // | |
135 | // AliTRDCalibraMode destructor | |
136 | // | |
137 | ||
f162af62 | 138 | if (fGeo) { |
139 | delete fGeo; | |
140 | } | |
141 | ||
55a288e5 | 142 | } |
143 | ||
144 | //_____________________________________________________________________________ | |
145 | void AliTRDCalibraMode::SetNz(Int_t i, Short_t Nz) | |
146 | { | |
147 | // | |
148 | // Set the mode of calibration group in the z direction for the parameter i | |
149 | // | |
150 | ||
151 | if ((Nz >= 0) && | |
152 | (Nz < 5)) { | |
153 | fNz[i] = Nz; | |
154 | } | |
155 | else { | |
156 | AliInfo("You have to choose between 0 and 4"); | |
157 | } | |
158 | ||
159 | } | |
160 | ||
161 | //_____________________________________________________________________________ | |
162 | void AliTRDCalibraMode::SetNrphi(Int_t i, Short_t Nrphi) | |
163 | { | |
164 | // | |
165 | // Set the mode of calibration group in the rphi direction for the parameter i | |
166 | // | |
167 | ||
168 | if ((Nrphi >= 0) && | |
169 | (Nrphi < 7)) { | |
170 | fNrphi[i] = Nrphi; | |
171 | } | |
172 | else { | |
173 | AliInfo("You have to choose between 0 and 6"); | |
174 | } | |
175 | ||
176 | } | |
177 | ||
178 | //_______________________________________________________________________________________ | |
179 | void AliTRDCalibraMode::ModePadCalibration(Int_t iChamb, Int_t i) | |
180 | { | |
181 | // | |
182 | // Definition of the calibration mode | |
183 | // from Nz and Nrphi, the number of row and col pads per calibration groups are setted | |
184 | // | |
185 | ||
186 | ||
187 | fNnZ[i] = 0; | |
188 | fNnRphi[i] = 0; | |
189 | ||
190 | if ((fNz[i] == 0) && (iChamb == 2)) { | |
191 | fNnZ[i] = 12; | |
192 | } | |
193 | if ((fNz[i] == 0) && (iChamb != 2)) { | |
194 | fNnZ[i] = 16; | |
195 | } | |
196 | if ((fNz[i] == 1) && (iChamb == 2)) { | |
197 | fNnZ[i] = 6; | |
198 | } | |
199 | if ((fNz[i] == 1) && (iChamb != 2)) { | |
200 | fNnZ[i] = 8; | |
201 | } | |
202 | if ((fNz[i] == 2) && (iChamb == 2)) { | |
203 | fNnZ[i] = 3; | |
204 | } | |
205 | if ((fNz[i] == 2) && (iChamb != 2)) { | |
206 | fNnZ[i] = 4; | |
207 | } | |
208 | if (fNz[i] == 3) { | |
209 | fNnZ[i] = 2; | |
210 | } | |
211 | if (fNz[i] == 4) { | |
212 | fNnZ[i] = 1; | |
213 | } | |
214 | ||
215 | if (fNrphi[i] == 0) { | |
216 | fNnRphi[i] = 144; | |
217 | } | |
218 | if (fNrphi[i] == 1) { | |
219 | fNnRphi[i] = 72; | |
220 | } | |
221 | if (fNrphi[i] == 2) { | |
222 | fNnRphi[i] = 36; | |
223 | } | |
224 | if (fNrphi[i] == 3) { | |
225 | fNnRphi[i] = 18; | |
226 | } | |
227 | if (fNrphi[i] == 4) { | |
228 | fNnRphi[i] = 9; | |
229 | } | |
230 | if (fNrphi[i] == 5) { | |
231 | fNnRphi[i] = 4; | |
232 | } | |
233 | if (fNrphi[i] == 6) { | |
234 | fNnRphi[i] = 1; | |
235 | } | |
236 | ||
237 | } | |
238 | ||
239 | //_____________________________________________________________________________________________ | |
053767a4 | 240 | Bool_t AliTRDCalibraMode::ModePadFragmentation(Int_t iLayer,Int_t iStack, Int_t iSect, Int_t i) |
55a288e5 | 241 | { |
242 | // | |
243 | // Definition of the calibration mode | |
244 | // From the number of row and col pads per calibration groups the | |
245 | // number of calibration groups are setted | |
246 | // | |
247 | ||
248 | fNfragZ[i] = 0; | |
249 | fNfragRphi[i] = 0; | |
55a288e5 | 250 | |
251 | // A little geometry: | |
053767a4 | 252 | Int_t rowMax = fGeo->GetRowMax(iLayer,iStack,iSect); |
253 | Int_t colMax = fGeo->GetColMax(iLayer); | |
55a288e5 | 254 | |
255 | // The fragmentation | |
256 | if (fNnZ[i] != 0) { | |
257 | fNfragZ[i] = (Int_t) rowMax / fNnZ[i]; | |
258 | } | |
259 | ||
260 | if (fNnRphi[i] != 0) { | |
261 | fNfragRphi[i] = (Int_t) colMax / fNnRphi[i]; | |
262 | } | |
263 | ||
264 | return kTRUE; | |
265 | ||
266 | } | |
267 | ||
268 | //_____________________________________________________________________________ | |
269 | void AliTRDCalibraMode::ReconstructionRowPadGroup(Int_t idect, Int_t i) | |
270 | { | |
271 | // | |
272 | // For the calibration group idect in a detector calculate the | |
273 | // first and last row pad and col pad. | |
274 | // The pads in the interval will have the same calibrated coefficients | |
275 | // | |
276 | ||
277 | Int_t posc = -1; | |
278 | Int_t posr = -1; | |
279 | fRowMin[i] = -1; | |
280 | fRowMax[i] = -1; | |
281 | fColMin[i] = -1; | |
282 | fColMax[i] = -1; | |
283 | ||
284 | if (fNfragZ[i] != 0) { | |
285 | posc = (Int_t) idect / fNfragZ[i]; | |
286 | } | |
287 | if (fNfragRphi[i] != 0) { | |
288 | posr = (Int_t) idect % fNfragZ[i]; | |
289 | } | |
290 | fRowMin[i] = posr * fNnZ[i]; | |
291 | fRowMax[i] = (posr+1) * fNnZ[i]; | |
292 | fColMin[i] = posc * fNnRphi[i]; | |
293 | fColMax[i] = (posc+1) * fNnRphi[i]; | |
294 | ||
295 | } | |
296 | ||
297 | //_____________________________________________________________________________ | |
298 | void AliTRDCalibraMode::CalculXBins(Int_t idect, Int_t i) | |
299 | { | |
300 | // | |
301 | // For the detector idect calcul the first Xbins | |
302 | // | |
303 | ||
304 | fXbins[i] = 0; | |
305 | AliDebug(2, Form("detector: %d", idect)); | |
306 | ||
307 | // In which sector? | |
308 | Int_t sector = GetSector(idect); | |
309 | fXbins[i] += sector*(6*fDetChamb2[i]+6*4*fDetChamb0[i]); | |
310 | ||
053767a4 | 311 | // In which stack? |
312 | Int_t stack = GetStack(idect); | |
55a288e5 | 313 | Int_t kc = 0; |
053767a4 | 314 | while (kc < stack) { |
55a288e5 | 315 | if (kc == 2) { |
316 | fXbins[i] += 6 * fDetChamb2[i]; | |
317 | } | |
318 | else { | |
319 | fXbins[i] += 6 * fDetChamb0[i]; | |
320 | } | |
321 | kc ++; | |
322 | } | |
323 | ||
053767a4 | 324 | // In which layer? |
325 | Int_t layer = GetLayer(idect); | |
326 | if (stack == 2) { | |
327 | fXbins[i] += layer*fDetChamb2[i]; | |
55a288e5 | 328 | } |
329 | else { | |
053767a4 | 330 | fXbins[i] += layer*fDetChamb0[i]; |
55a288e5 | 331 | } |
332 | ||
333 | } | |
334 | ||
335 | //_____________________________________________________________________________ | |
336 | void AliTRDCalibraMode::ResetMinMax(Int_t i) | |
337 | { | |
338 | // | |
339 | // Reset fRowMin fRowMax fColMin fColMax [i] | |
340 | // | |
341 | ||
342 | fRowMin[i] = -1; | |
343 | fRowMax[i] = -1; | |
344 | fColMin[i] = -1; | |
345 | fColMax[i] = -1; | |
346 | ||
347 | } | |
348 | ||
349 | //_____________________________________________________________________________ | |
350 | void AliTRDCalibraMode::SetDetChamb0(Int_t i) | |
351 | { | |
352 | // | |
353 | // Set the number of calibration group per detector != 2 | |
354 | // | |
355 | ||
356 | fDetChamb0[i] = fNfragZ[i] * fNfragRphi[i]; | |
357 | ||
358 | } | |
359 | ||
360 | //_____________________________________________________________________________ | |
361 | void AliTRDCalibraMode::SetDetChamb2(Int_t i) | |
362 | { | |
363 | // | |
364 | // Set the number of calibration group per detector == 2 | |
365 | // | |
366 | ||
367 | fDetChamb2[i] = fNfragZ[i] * fNfragRphi[i]; | |
368 | ||
369 | } | |
370 | ||
371 | //_____________________________________________________________________________ | |
053767a4 | 372 | Int_t AliTRDCalibraMode::GetLayer(Int_t d) const |
55a288e5 | 373 | { |
374 | // | |
375 | // Reconstruct the plane number from the detector number | |
376 | // | |
377 | ||
378 | return ((Int_t) (d % 6)); | |
379 | ||
380 | } | |
381 | ||
382 | //_____________________________________________________________________________ | |
053767a4 | 383 | Int_t AliTRDCalibraMode::GetStack(Int_t d) const |
55a288e5 | 384 | { |
385 | // | |
053767a4 | 386 | // Reconstruct the stack number from the detector number |
55a288e5 | 387 | // |
388 | ||
053767a4 | 389 | const Int_t kNlayer = 6; |
55a288e5 | 390 | |
053767a4 | 391 | return ((Int_t) (d % 30) / kNlayer); |
55a288e5 | 392 | |
393 | } | |
394 | ||
395 | //_____________________________________________________________________________ | |
396 | Int_t AliTRDCalibraMode::GetSector(Int_t d) const | |
397 | { | |
398 | // | |
399 | // Reconstruct the sector number from the detector number | |
400 | // | |
401 | ||
402 | Int_t fg = 30; | |
403 | ||
404 | return ((Int_t) (d / fg)); | |
405 | ||
406 | } |