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