]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALCalibData.cxx
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibData.cxx
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 ///*-- Author: Yves Schutz (SUBATECH)
20 //           : Aleksei Pavlinov (WSU); Jun 30, 2006 - ALICE numbering scheme
21 //           : Add decalibration and time calibration arrays: Jul 21, 2011 (GCB)
22 //           : adapted for DCAL by M.L. Wang CCNU & Subatech Oct-18-2012
23 ///////////////////////////////////////////////////////////////////////////////
24 //                                                                           //
25 // class for EMCAL calibration                                               //
26 //                                                                           //
27 ///////////////////////////////////////////////////////////////////////////////
28
29 #include <TMath.h>
30
31 #include "AliEMCALCalibData.h"
32
33 ClassImp(AliEMCALCalibData)
34
35 //__________________________________________________________
36 AliEMCALCalibData::AliEMCALCalibData() : 
37 TNamed(), fADCchannelRef(0)
38 {
39   // Default constructor
40   Reset();
41 }
42
43 //________________________________________________________________________
44 AliEMCALCalibData::AliEMCALCalibData(const char* name) : 
45 TNamed(name,name),fADCchannelRef(0)
46 {
47   // Constructor
48   Reset();
49 }
50
51 //______________________________________________________________________
52 AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
53 TNamed(calibda), fADCchannelRef(calibda.fADCchannelRef)
54 {
55   // copy constructor
56   SetName (calibda.GetName());
57   SetTitle(calibda.GetName());
58   Reset();
59   
60   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
61   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
62   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
63
64     for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
65     nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
66     nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
67     // in reality they are 1/3 but leave them as 1/2
68
69     if(supermodule /2 == 5)
70       nRow = nRow/2;
71     if(supermodule > 11  && supermodule < 18)
72       nCol  = nCol*2/3;
73     
74     for(Int_t column = 0; column<nCol; column++) {
75       
76       for(Int_t row = 0; row<nRow; row++) {
77         
78         fADCchannel[supermodule][column][row] = 
79         calibda.GetADCchannel(supermodule,column,row);
80         
81         fADCchannelOnline[supermodule][column][row] =
82         calibda.GetADCchannelOnline(supermodule,column,row);
83         
84         fADCchannelDecal[supermodule][column][row] =
85         calibda.GetADCchannelDecal(supermodule,column,row);
86         
87         fADCpedestal[supermodule][column][row] = 
88         calibda.GetADCpedestal(supermodule,column,row);
89         
90         fTimeChannelDecal[supermodule][column][row] = 
91         calibda.GetTimeChannelDecal(supermodule,column,row);
92         
93         for(Int_t bc = 0; bc < 4; bc++)
94           fTimeChannel[supermodule][column][row][bc] = 
95           calibda.GetTimeChannel(supermodule,column,row,bc);
96         
97       }
98     }
99   }
100 }
101
102 //________________________________________________________________
103 AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
104 {
105   // assignment operator
106   SetName (calibda.GetName());
107   SetTitle(calibda.GetName());
108   Reset();
109   
110   fADCchannelRef = calibda.GetADCchannelRef() ;
111   
112   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
113   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
114   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
115
116  for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
117    nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
118    nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
119   // in reality they are 1/3 but leave them as 1/2
120
121     if(supermodule /2 == 5)
122       nRow = nRow/2;
123     if(supermodule > 11 && supermodule < 18)
124       nCol = nCol*2/3;
125     
126     for(Int_t column = 0; column<nCol; column++) {
127       
128       for(Int_t row = 0; row<nRow; row++) {
129         
130         fADCchannel[supermodule][column][row] = 
131         calibda.GetADCchannel(supermodule,column,row);
132
133         fADCchannelOnline[supermodule][column][row] =
134         calibda.GetADCchannelOnline(supermodule,column,row);
135         
136         fADCchannelDecal[supermodule][column][row] = 
137         calibda.GetADCchannelDecal(supermodule,column,row);
138         
139         fADCpedestal[supermodule][column][row] = 
140         calibda.GetADCpedestal(supermodule,column,row);
141         
142         fTimeChannelDecal[supermodule][column][row] = 
143         calibda.GetTimeChannelDecal(supermodule,column,row);
144         
145         for(Int_t bc = 0; bc < 4; bc++)
146           fTimeChannel[supermodule][column][row][bc] = 
147           calibda.GetTimeChannel(supermodule,column,row,bc);
148         
149       }
150     }
151   }
152   
153   return *this;
154 }
155
156 //_____________________________
157 void AliEMCALCalibData::Reset()
158 {
159   // Set all pedestals to 0 and all ADC channels widths to 1
160   
161   fADCchannelRef = 0.0162;      
162   
163   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
164   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
165   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
166
167    for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
168    nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
169    nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
170   // in reality they are 1/3 but leave them as 1/2
171     
172     if(supermodule /2 == 5)
173       nRow = nRow/2;
174     if(supermodule > 11 && supermodule < 18)
175       nCol  = nCol*2/3;
176
177     for (Int_t column=0; column < nCol; column++){
178       
179       for (Int_t row = 0; row < nRow; row++){
180         
181         fADCpedestal     [supermodule][column][row]=0.;
182         
183         fADCchannelDecal [supermodule][column][row]=1.;
184         fADCchannel      [supermodule][column][row]=fADCchannelRef;
185         fADCchannelOnline[supermodule][column][row]=fADCchannelRef;
186         
187         fTimeChannelDecal[supermodule][column][row]=0.;
188         
189         for(Int_t bc = 0; bc < 4; bc++)
190           fTimeChannel[supermodule][column][row][bc]=0;
191         
192       }
193     }
194   }     
195 }
196
197 //____________________________________________________
198 void  AliEMCALCalibData::Print(Option_t *option) const
199 {
200   // Print tables of pedestals and ADC channels widths
201   // options are: "gain", "ped", "decal", "time", "all"
202   
203   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
204   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
205   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
206
207   if (strstr(option,"ped") || strstr(option,"all")) {
208     printf("\n  ----    Pedestal values ----\n\n");
209     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
210        nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
211        nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
212       // in reality they are 1/3 but leave them as 1/2
213       if(supermodule /2 == 5)
214         nRow = nRow/2;
215       if(supermodule > 11 && supermodule < 18)
216          nCol = nCol*2/3;
217       printf("============== Supermodule %d\n",supermodule+1);
218       for (Int_t column=0; column<nCol; column++){
219         for (Int_t row=0; row<nRow; row++){
220           printf("[c%d,r%d] %2.4f ",column, row, fADCpedestal[supermodule][column][row]);
221         }
222         printf("\n");
223       }
224     } 
225   }
226   
227   if (strstr(option,"gain") || strstr(option,"all")) {
228     printf("\n  ----    ADC channel values      ----\n\n");
229     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
230         nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
231         nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
232
233       // in reality they are 1/3 but leave them as 1/2
234       if(supermodule /2 == 5)
235         nRow = nRow/2;
236       if(supermodule > 11 && supermodule < 18)
237         nCol = nCol*2/3;
238       printf("============== Supermodule %d\n",supermodule+1);
239       for (Int_t column=0; column<nCol; column++){
240         for (Int_t row=0; row<nRow; row++){
241           printf("[c%d,r%d] %2.4f ",column, row, fADCchannel[supermodule][column][row]);
242         }
243         printf("\n");
244       }
245     }   
246   }
247   
248   if (strstr(option,"adconline") || strstr(option,"all")) {
249     printf("\n  ----    ADC online channel values       ----\n\n");
250     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
251       nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
252       nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
253       // in reality they are 1/3 but leave them as 1/2
254       if(supermodule /2 == 5)
255       nRow = nRow/2;
256       if(supermodule > 11 && supermodule < 18)
257       nCol = nCol*2/3;
258       printf("============== Supermodule %d\n",supermodule+1);
259       for (Int_t column=0; column<nCol; column++){
260         for (Int_t row=0; row<nRow; row++){
261           printf("[c%d,r%d] %2.4f ",column, row,fADCchannelOnline[supermodule][column][row]);
262         }
263         printf("\n");
264       }
265     }
266   }
267   
268   if (strstr(option,"adcdecal") || strstr(option,"all")) {
269     printf("\n  ----    ADC decalibration channel values        ----\n\n");
270     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
271       nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
272       nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
273       // in reality they are 1/3 but leave them as 1/2
274       if(supermodule /2 == 5)
275         nRow = nRow/2;
276       if(supermodule > 11 && supermodule < 18)
277         nCol = nCol*2/3;
278       printf("============== Supermodule %d\n",supermodule+1);
279       for (Int_t column=0; column<nCol; column++){
280         for (Int_t row=0; row<nRow; row++){
281           printf("[c%d,r%d] %2.4f ",column, row,fADCchannelDecal[supermodule][column][row]);
282         }
283         printf("\n");
284       }
285     }   
286   }
287   
288   if (strstr(option,"time") || strstr(option,"all")) {
289     printf("\n  ----    time channel values     ----\n\n");
290     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
291       nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
292       nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
293       // in reality they are 1/3 but leave them as 1/2
294       if(supermodule /2 == 5)
295         nRow = nRow/2;
296       if(supermodule > 11 && supermodule < 18)
297         nCol = nCol*2/3;
298       printf("============== Supermodule %d\n",supermodule+1);
299       for (Int_t column=0; column<nCol; column++){
300         for (Int_t row=0; row<nRow; row++){
301           for(Int_t bc = 0; bc < 4; bc++)
302             printf(" %2.4f ",fTimeChannel[supermodule][column][row][bc]);
303         }
304         printf("\n");
305       }
306     }   
307   }
308   
309   if (strstr(option,"time") || strstr(option,"all")) {
310     printf("\n  ----    time decalibration channel values       ----\n\n");
311     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
312        nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
313        nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
314       // in reality they are 1/3 but leave them as 1/2
315       if(supermodule /2 == 5)
316         nRow = nRow/2;
317       if(supermodule > 11 && supermodule < 18)
318         nCol = nCol*2/3;
319       printf("============== Supermodule %d\n",supermodule+1);
320       for (Int_t column=0; column<nCol; column++){
321         for (Int_t row=0; row<nRow; row++){
322           printf(" %2.4f ",fTimeChannelDecal[supermodule][column][row]);
323         }
324         printf("\n");
325       }
326     }   
327   }
328 }
329
330 //________________________________________________________________
331 Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
332 {
333   // Set ADC channel witdth values
334   // All indexes start from 0!
335   // Supermodule, column,raw should follow the ALICE convention:
336   // supermodule 0:11, column 0:47, row 0:23
337   
338   return fADCchannel[supermodule][column][row];
339 }
340
341 //________________________________________________________________
342 Float_t AliEMCALCalibData::GetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row) const
343 {
344   // Set ADC channel witdth values, first online calibration parameter
345   // All indexes start from 0!
346   // Supermodule, column,raw should follow the ALICE convention:
347   // supermodule 0:11, column 0:47, row 0:23
348   
349   return fADCchannelOnline[supermodule][column][row];
350 }
351
352 //________________________________________________________________
353 Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const
354 {
355   // Set ADC channel decalibration witdth values
356   // All indexes start from 0!
357   // Supermodule, column,raw should follow the ALICE convention:
358   // supermodule 0:11, column 0:47, row 0:23
359   
360   return fADCchannelDecal[supermodule][column][row];
361 }
362
363 //________________________________________________________________
364 Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
365 {
366   // Get ADC pedestal values
367   return fADCpedestal[supermodule][column][row];
368 }
369
370 //________________________________________________________________
371 Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const
372 {
373   // Set channel time witdth values
374   return fTimeChannel[supermodule][column][row][bc];
375 }
376
377 //________________________________________________________________
378 Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const
379 {
380   // Set channel time witdth values
381   return fTimeChannelDecal[supermodule][column][row];
382 }
383
384 //________________________________________________________________
385 void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
386
387   // Set ADC channel width values
388   fADCchannel[supermodule][column][row] = value;
389 }
390
391 //________________________________________________________________
392 void AliEMCALCalibData::SetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row, Float_t value)
393 {
394   // Set ADC channel online width values
395   fADCchannelOnline[supermodule][column][row] = value;
396 }
397
398 //________________________________________________________________
399 void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
400
401   // Set ADC channel width values, decalibration
402   fADCchannelDecal[supermodule][column][row] = value;
403 }
404
405 //________________________________________________________________
406 void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
407 {
408   // Set ADC pedestal values
409   fADCpedestal[supermodule][column][row] = value;
410 }
411
412 //________________________________________________________________
413 void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value)
414 {
415   // Set ADC pedestal values
416   fTimeChannel[supermodule][column][row][bc] = value;
417 }
418
419 //________________________________________________________________
420 void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
421 {
422   // Set ADC pedestal values
423   fTimeChannelDecal[supermodule][column][row] = value;
424 }
425
426
427