]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALCalibData.cxx
correct compilation warning due to missing initialization of recent data memeber...
[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 ///////////////////////////////////////////////////////////////////////////////
23 //                                                                           //
24 // class for EMCAL calibration                                               //
25 //                                                                           //
26 ///////////////////////////////////////////////////////////////////////////////
27
28 #include <TMath.h>
29
30 #include "AliEMCALCalibData.h"
31
32 ClassImp(AliEMCALCalibData)
33
34 //__________________________________________________________
35   AliEMCALCalibData::AliEMCALCalibData() : fADCchannelRef(0)
36 {
37   // Default constructor
38   Reset();
39 }
40
41 //________________________________________________________________________
42 AliEMCALCalibData::AliEMCALCalibData(const char* name) : fADCchannelRef(0)
43 {
44   // Constructor
45   TString namst = "Calib_";
46   namst += name;
47   SetName (namst.Data());
48   SetTitle(namst.Data());
49   Reset();
50 }
51
52 //______________________________________________________________________
53 AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
54   TNamed(calibda), fADCchannelRef(calibda.fADCchannelRef)
55 {
56   // copy constructor
57   SetName (calibda.GetName());
58   SetTitle(calibda.GetName());
59   Reset();
60
61   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
62   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
63   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
64   Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows;    //12 - Modules 11 and 12 are half modules
65
66   for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
67     
68     if(supermodule >= 10)
69       nRow = nRow2;
70     
71     for(Int_t column = 0; column<nCol; column++) {
72       
73       for(Int_t row = 0; row<nRow; row++) {
74         
75         fADCchannel[supermodule][column][row] = 
76         calibda.GetADCchannel(supermodule,column,row);
77         
78         fADCchannelDecal[supermodule][column][row] = 
79         calibda.GetADCchannelDecal(supermodule,column,row);
80         
81         fADCpedestal[supermodule][column][row] = 
82         calibda.GetADCpedestal(supermodule,column,row);
83         
84         fTimeChannelDecal[supermodule][column][row] = 
85         calibda.GetTimeChannelDecal(supermodule,column,row);
86
87         for(Int_t bc = 0; bc < 4; bc++)
88           fTimeChannel[supermodule][column][row][bc] = 
89             calibda.GetTimeChannel(supermodule,column,row,bc);
90         
91       }
92     }
93   }
94 }
95
96
97 //________________________________________________________________
98 AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
99 {
100   // assignment operator
101   SetName (calibda.GetName());
102   SetTitle(calibda.GetName());
103   Reset();
104
105   fADCchannelRef = calibda.fADCchannelRef ;
106
107   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
108   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
109   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
110   Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2;  //12 - Modules 11 and 12 are half modules
111
112   for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
113     
114     if(supermodule >= 10)
115       nRow = nRow2;
116     
117     for(Int_t column = 0; column<nCol; column++) {
118       
119       for(Int_t row = 0; row<nRow; row++) {
120         
121         fADCchannel[supermodule][column][row] = 
122         calibda.GetADCchannel(supermodule,column,row);
123         
124         fADCchannelDecal[supermodule][column][row] = 
125         calibda.GetADCchannelDecal(supermodule,column,row);
126         
127         fADCpedestal[supermodule][column][row] = 
128         calibda.GetADCpedestal(supermodule,column,row);
129
130         fTimeChannelDecal[supermodule][column][row] = 
131         calibda.GetTimeChannelDecal(supermodule,column,row);
132         
133         for(Int_t bc = 0; bc < 4; bc++)
134           fTimeChannel[supermodule][column][row][bc] = 
135             calibda.GetTimeChannel(supermodule,column,row,bc);
136
137       }
138     }
139   }
140
141   return *this;
142 }
143
144 //_____________________________
145 void AliEMCALCalibData::Reset()
146 {
147   // Set all pedestals to 0 and all ADC channels widths to 1
148
149   fADCchannelRef = 0.0162;      
150
151   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
152   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
153   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
154   Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2;  //12 - Modules 11 and 12 are half modules
155
156   for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
157     if(supermodule >= 10)
158       nRow = nRow2;
159     for (Int_t column=0; column < nCol; column++){
160       
161       for (Int_t row = 0; row < nRow; row++){
162         
163         fADCpedestal     [supermodule][column][row]=0.;
164         
165         fADCchannelDecal [supermodule][column][row]=1.;
166         fADCchannel      [supermodule][column][row]=1.;
167         
168         fTimeChannelDecal[supermodule][column][row]=0.;
169
170         for(Int_t bc = 0; bc < 4; bc++)
171           fTimeChannel[supermodule][column][row][bc]=0;
172         
173       }
174     }
175   }     
176 }
177
178 //________________________________________________________________
179 void  AliEMCALCalibData::Print(Option_t *option) const
180 {
181   // Print tables of pedestals and ADC channels widths
182   // options are: "gain", "ped", "decal", "time", "all"
183   
184   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
185   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
186   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
187   Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2;  //12 - Modules 11 and 12 are half modules
188
189   if (strstr(option,"ped") || strstr(option,"all")) {
190     printf("\n  ----    Pedestal values ----\n\n");
191     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
192       if(supermodule >= 10)
193         nRow = nRow2;
194       printf("============== Supermodule %d\n",supermodule+1);
195       for (Int_t column=0; column<nCol; column++){
196         for (Int_t row=0; row<nRow; row++){
197           printf(" %2.4f ",fADCpedestal[supermodule][column][row]);
198         }
199         printf("\n");
200       }
201     } 
202   }
203   
204   if (strstr(option,"gain") || strstr(option,"all")) {
205     printf("\n  ----    ADC channel values      ----\n\n");
206     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
207       if(supermodule >= 10) 
208         nRow = nRow2;
209       printf("============== Supermodule %d\n",supermodule+1);
210       for (Int_t column=0; column<nCol; column++){
211         for (Int_t row=0; row<nRow; row++){
212           printf(" %2.4f ",fADCchannel[supermodule][column][row]);
213         }
214         printf("\n");
215       }
216     }   
217   }
218   
219   if (strstr(option,"adcdecal") || strstr(option,"all")) {
220     printf("\n  ----    ADC decalibration channel values        ----\n\n");
221     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
222       if(supermodule >= 10) 
223         nRow = nRow2;
224       printf("============== Supermodule %d\n",supermodule+1);
225       for (Int_t column=0; column<nCol; column++){
226         for (Int_t row=0; row<nRow; row++){
227           printf(" %2.4f ",fADCchannelDecal[supermodule][column][row]);
228         }
229         printf("\n");
230       }
231     }   
232   }
233   
234   if (strstr(option,"time") || strstr(option,"all")) {
235     printf("\n  ----    time channel values     ----\n\n");
236     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
237       if(supermodule >= 10) 
238         nRow = nRow2;
239       printf("============== Supermodule %d\n",supermodule+1);
240       for (Int_t column=0; column<nCol; column++){
241         for (Int_t row=0; row<nRow; row++){
242           for(Int_t bc = 0; bc < 4; bc++)
243             printf(" %2.4f ",fTimeChannel[supermodule][column][row][bc]);
244         }
245         printf("\n");
246       }
247     }   
248   }
249   
250   if (strstr(option,"time") || strstr(option,"all")) {
251     printf("\n  ----    time decalibration channel values       ----\n\n");
252     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
253       if(supermodule >= 10) 
254         nRow = nRow2;
255       printf("============== Supermodule %d\n",supermodule+1);
256       for (Int_t column=0; column<nCol; column++){
257         for (Int_t row=0; row<nRow; row++){
258           printf(" %2.4f ",fTimeChannelDecal[supermodule][column][row]);
259         }
260         printf("\n");
261       }
262     }   
263   }
264 }
265
266 //________________________________________________________________
267 Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
268 {
269   // Set ADC channel witdth values
270   // All indexes start from 0!
271   // Supermodule, column,raw should follow the ALICE convention:
272   // supermodule 0:11, column 0:47, row 0:23
273
274   return fADCchannel[supermodule][column][row];
275 }
276
277 //________________________________________________________________
278 Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const
279 {
280   // Set ADC channel decalibration witdth values
281   // All indexes start from 0!
282   // Supermodule, column,raw should follow the ALICE convention:
283   // supermodule 0:11, column 0:47, row 0:23
284   
285   return fADCchannelDecal[supermodule][column][row];
286 }
287
288 //________________________________________________________________
289 Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
290 {
291   // Get ADC pedestal values
292  return fADCpedestal[supermodule][column][row];
293 }
294
295 //________________________________________________________________
296 Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const
297 {
298   // Set channel time witdth values
299   return fTimeChannel[supermodule][column][row][bc];
300 }
301
302 //________________________________________________________________
303 Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const
304 {
305   // Set channel time witdth values
306   return fTimeChannelDecal[supermodule][column][row];
307 }
308
309 //________________________________________________________________
310 void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
311
312   // Set ADC channel width values
313   fADCchannel[supermodule][column][row] = value;
314 }
315
316 //________________________________________________________________
317 void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
318
319   // Set ADC channel width values
320   fADCchannelDecal[supermodule][column][row] = value;
321 }
322
323 //________________________________________________________________
324 void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
325 {
326   // Set ADC pedestal values
327   fADCpedestal[supermodule][column][row] = value;
328 }
329
330 //________________________________________________________________
331 void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value)
332 {
333   // Set ADC pedestal values
334   fTimeChannel[supermodule][column][row][bc] = value;
335 }
336
337 //________________________________________________________________
338 void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
339 {
340   // Set ADC pedestal values
341   fTimeChannelDecal[supermodule][column][row] = value;
342 }
343
344
345