]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALCalibData.cxx
updating misleading comments - incorrect number of supermodules
[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         fADCchannelDecal[supermodule][column][row] = 
82         calibda.GetADCchannelDecal(supermodule,column,row);
83         
84         fADCpedestal[supermodule][column][row] = 
85         calibda.GetADCpedestal(supermodule,column,row);
86         
87         fTimeChannelDecal[supermodule][column][row] = 
88         calibda.GetTimeChannelDecal(supermodule,column,row);
89         
90         for(Int_t bc = 0; bc < 4; bc++)
91           fTimeChannel[supermodule][column][row][bc] = 
92           calibda.GetTimeChannel(supermodule,column,row,bc);
93         
94       }
95     }
96   }
97 }
98
99 //________________________________________________________________
100 AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
101 {
102   // assignment operator
103   SetName (calibda.GetName());
104   SetTitle(calibda.GetName());
105   Reset();
106   
107   fADCchannelRef = calibda.GetADCchannelRef() ;
108   
109   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
110   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
111   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
112
113  for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
114    nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
115    nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
116   // in reality they are 1/3 but leave them as 1/2
117
118     if(supermodule /2 == 5)
119       nRow = nRow/2;
120     if(supermodule > 11 && supermodule < 18)
121       nCol = nCol*2/3;
122     
123     for(Int_t column = 0; column<nCol; column++) {
124       
125       for(Int_t row = 0; row<nRow; row++) {
126         
127         fADCchannel[supermodule][column][row] = 
128         calibda.GetADCchannel(supermodule,column,row);
129         
130         fADCchannelDecal[supermodule][column][row] = 
131         calibda.GetADCchannelDecal(supermodule,column,row);
132         
133         fADCpedestal[supermodule][column][row] = 
134         calibda.GetADCpedestal(supermodule,column,row);
135         
136         fTimeChannelDecal[supermodule][column][row] = 
137         calibda.GetTimeChannelDecal(supermodule,column,row);
138         
139         for(Int_t bc = 0; bc < 4; bc++)
140           fTimeChannel[supermodule][column][row][bc] = 
141           calibda.GetTimeChannel(supermodule,column,row,bc);
142         
143       }
144     }
145   }
146   
147   return *this;
148 }
149
150 //_____________________________
151 void AliEMCALCalibData::Reset()
152 {
153   // Set all pedestals to 0 and all ADC channels widths to 1
154   
155   fADCchannelRef = 0.0162;      
156   
157   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
158   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
159   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
160
161    for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
162    nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
163    nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
164   // in reality they are 1/3 but leave them as 1/2
165     
166     if(supermodule /2 == 5)
167       nRow = nRow/2;
168     if(supermodule > 11 && supermodule < 18)
169       nCol  = nCol*2/3;
170
171     for (Int_t column=0; column < nCol; column++){
172       
173       for (Int_t row = 0; row < nRow; row++){
174         
175         fADCpedestal     [supermodule][column][row]=0.;
176         
177         fADCchannelDecal [supermodule][column][row]=1.;
178         fADCchannel      [supermodule][column][row]=1.;
179         
180         fTimeChannelDecal[supermodule][column][row]=0.;
181         
182         for(Int_t bc = 0; bc < 4; bc++)
183           fTimeChannel[supermodule][column][row][bc]=0;
184         
185       }
186     }
187   }     
188 }
189
190 //____________________________________________________
191 void  AliEMCALCalibData::Print(Option_t *option) const
192 {
193   // Print tables of pedestals and ADC channels widths
194   // options are: "gain", "ped", "decal", "time", "all"
195   
196   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
197   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
198   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
199
200   if (strstr(option,"ped") || strstr(option,"all")) {
201     printf("\n  ----    Pedestal values ----\n\n");
202     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
203        nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
204        nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
205       // in reality they are 1/3 but leave them as 1/2
206       if(supermodule /2 == 5)
207         nRow = nRow/2;
208       if(supermodule > 11 && supermodule < 18)
209          nCol = nCol*2/3;
210       printf("============== Supermodule %d\n",supermodule+1);
211       for (Int_t column=0; column<nCol; column++){
212         for (Int_t row=0; row<nRow; row++){
213           printf(" %2.4f ",fADCpedestal[supermodule][column][row]);
214         }
215         printf("\n");
216       }
217     } 
218   }
219   
220   if (strstr(option,"gain") || strstr(option,"all")) {
221     printf("\n  ----    ADC channel values      ----\n\n");
222     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
223         nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
224         nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
225
226       // in reality they are 1/3 but leave them as 1/2
227       if(supermodule /2 == 5)
228         nRow = nRow/2;
229       if(supermodule > 11 && supermodule < 18)
230         nCol = nCol*2/3;
231       printf("============== Supermodule %d\n",supermodule+1);
232       for (Int_t column=0; column<nCol; column++){
233         for (Int_t row=0; row<nRow; row++){
234           printf(" %2.4f ",fADCchannel[supermodule][column][row]);
235         }
236         printf("\n");
237       }
238     }   
239   }
240   
241   if (strstr(option,"adcdecal") || strstr(option,"all")) {
242     printf("\n  ----    ADC decalibration channel values        ----\n\n");
243     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
244       nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
245       nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
246       // in reality they are 1/3 but leave them as 1/2
247       if(supermodule /2 == 5)
248         nRow = nRow/2;
249       if(supermodule > 11 && supermodule < 18)
250         nCol = nCol*2/3;
251       printf("============== Supermodule %d\n",supermodule+1);
252       for (Int_t column=0; column<nCol; column++){
253         for (Int_t row=0; row<nRow; row++){
254           printf(" %2.4f ",fADCchannelDecal[supermodule][column][row]);
255         }
256         printf("\n");
257       }
258     }   
259   }
260   
261   if (strstr(option,"time") || strstr(option,"all")) {
262     printf("\n  ----    time channel values     ----\n\n");
263     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
264       nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
265       nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
266       // in reality they are 1/3 but leave them as 1/2
267       if(supermodule /2 == 5)
268         nRow = nRow/2;
269       if(supermodule > 11 && supermodule < 18)
270         nCol = nCol*2/3;
271       printf("============== Supermodule %d\n",supermodule+1);
272       for (Int_t column=0; column<nCol; column++){
273         for (Int_t row=0; row<nRow; row++){
274           for(Int_t bc = 0; bc < 4; bc++)
275             printf(" %2.4f ",fTimeChannel[supermodule][column][row][bc]);
276         }
277         printf("\n");
278       }
279     }   
280   }
281   
282   if (strstr(option,"time") || strstr(option,"all")) {
283     printf("\n  ----    time decalibration channel values       ----\n\n");
284     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
285        nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
286        nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
287       // in reality they are 1/3 but leave them as 1/2
288       if(supermodule /2 == 5)
289         nRow = nRow/2;
290       if(supermodule > 11 && supermodule < 18)
291         nCol = nCol*2/3;
292       printf("============== Supermodule %d\n",supermodule+1);
293       for (Int_t column=0; column<nCol; column++){
294         for (Int_t row=0; row<nRow; row++){
295           printf(" %2.4f ",fTimeChannelDecal[supermodule][column][row]);
296         }
297         printf("\n");
298       }
299     }   
300   }
301 }
302
303 //________________________________________________________________
304 Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
305 {
306   // Set ADC channel witdth values
307   // All indexes start from 0!
308   // Supermodule, column,raw should follow the ALICE convention:
309   // supermodule 0:11, column 0:47, row 0:23
310   
311   return fADCchannel[supermodule][column][row];
312 }
313
314 //________________________________________________________________
315 Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const
316 {
317   // Set ADC channel decalibration witdth values
318   // All indexes start from 0!
319   // Supermodule, column,raw should follow the ALICE convention:
320   // supermodule 0:11, column 0:47, row 0:23
321   
322   return fADCchannelDecal[supermodule][column][row];
323 }
324
325 //________________________________________________________________
326 Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
327 {
328   // Get ADC pedestal values
329   return fADCpedestal[supermodule][column][row];
330 }
331
332 //________________________________________________________________
333 Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const
334 {
335   // Set channel time witdth values
336   return fTimeChannel[supermodule][column][row][bc];
337 }
338
339 //________________________________________________________________
340 Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const
341 {
342   // Set channel time witdth values
343   return fTimeChannelDecal[supermodule][column][row];
344 }
345
346 //________________________________________________________________
347 void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
348
349   // Set ADC channel width values
350   fADCchannel[supermodule][column][row] = value;
351 }
352
353 //________________________________________________________________
354 void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
355
356   // Set ADC channel width values
357   fADCchannelDecal[supermodule][column][row] = value;
358 }
359
360 //________________________________________________________________
361 void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
362 {
363   // Set ADC pedestal values
364   fADCpedestal[supermodule][column][row] = value;
365 }
366
367 //________________________________________________________________
368 void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value)
369 {
370   // Set ADC pedestal values
371   fTimeChannel[supermodule][column][row][bc] = value;
372 }
373
374 //________________________________________________________________
375 void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
376 {
377   // Set ADC pedestal values
378   fTimeChannelDecal[supermodule][column][row] = value;
379 }
380
381
382