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