change definition of TRU fitter, remove unneeded class dependencies
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibData.cxx
CommitLineData
f565d89d 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
63b315c5 18//_________________________________________________________________________
19///*-- Author: Yves Schutz (SUBATECH)
20// : Aleksei Pavlinov (WSU); Jun 30, 2006 - ALICE numbering scheme
df5cea6b 21// : Add decalibration and time calibration arrays: Jul 21, 2011 (GCB)
8cc543cb 22// : adapted for DCAL by M.L. Wang CCNU & Subatech Oct-18-2012
f565d89d 23///////////////////////////////////////////////////////////////////////////////
24// //
25// class for EMCAL calibration //
26// //
27///////////////////////////////////////////////////////////////////////////////
28
090026bf 29#include <TMath.h>
30
f565d89d 31#include "AliEMCALCalibData.h"
32
33ClassImp(AliEMCALCalibData)
34
aaa41982 35//__________________________________________________________
aae41db5 36AliEMCALCalibData::AliEMCALCalibData() :
37TNamed(), fADCchannelRef(0)
f565d89d 38{
39 // Default constructor
40 Reset();
41}
42
aaa41982 43//________________________________________________________________________
aae41db5 44AliEMCALCalibData::AliEMCALCalibData(const char* name) :
45TNamed(name,name),fADCchannelRef(0)
f565d89d 46{
47 // Constructor
f565d89d 48 Reset();
49}
50
aaa41982 51//______________________________________________________________________
f565d89d 52AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
aae41db5 53TNamed(calibda), fADCchannelRef(calibda.fADCchannelRef)
f565d89d 54{
55 // copy constructor
aaa41982 56 SetName (calibda.GetName());
f565d89d 57 SetTitle(calibda.GetName());
58 Reset();
aae41db5 59
56d10452 60 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 61 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
62 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
56d10452 63
64 for(Int_t supermodule = 0; supermodule < nSMod; supermodule++)
65 {
8cc543cb 66 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
67 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
df5cea6b 68
56d10452 69 //Init all SM equally, even the channels known to not exist.
70
71 for(Int_t column = 0; column<nCol; column++)
72 {
73 for(Int_t row = 0; row<nRow; row++)
74 {
75 SetADCchannel (supermodule,column,row, calibda.GetADCchannel (supermodule,column,row));
76 SetADCchannelOnline(supermodule,column,row, calibda.GetADCchannelOnline(supermodule,column,row));
77 SetADCchannelDecal (supermodule,column,row, calibda.GetADCchannelDecal (supermodule,column,row));
78 SetADCpedestal (supermodule,column,row, calibda.GetADCpedestal (supermodule,column,row));
79 SetTimeChannelDecal(supermodule,column,row, calibda.GetTimeChannelDecal(supermodule,column,row));
aae41db5 80 for(Int_t bc = 0; bc < 4; bc++)
56d10452 81 SetTimeChannel(supermodule,column,row,bc,calibda.GetTimeChannel(supermodule,column,row,bc));
82 } // col
83 } // row
84 } // SM
f565d89d 85}
86
f565d89d 87//________________________________________________________________
88AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
89{
90 // assignment operator
aaa41982 91 SetName (calibda.GetName());
f565d89d 92 SetTitle(calibda.GetName());
93 Reset();
aae41db5 94
c7e54b0e 95 fADCchannelRef = calibda.GetADCchannelRef() ;
aae41db5 96
56d10452 97 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 98 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
99 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
56d10452 100
101 for(Int_t supermodule = 0; supermodule < nSMod; supermodule++)
102 {
103 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
104 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 105
56d10452 106 //Init all SM equally, even the channels known to not exist.
df5cea6b 107
56d10452 108 for(Int_t column = 0; column<nCol; column++)
109 {
110 for(Int_t row = 0; row<nRow; row++)
111 {
112 SetADCchannel (supermodule,column,row, calibda.GetADCchannel (supermodule,column,row));
113 SetADCchannelOnline(supermodule,column,row, calibda.GetADCchannelOnline(supermodule,column,row));
114 SetADCchannelDecal (supermodule,column,row, calibda.GetADCchannelDecal (supermodule,column,row));
115 SetADCpedestal (supermodule,column,row, calibda.GetADCpedestal (supermodule,column,row));
116 SetTimeChannelDecal(supermodule,column,row, calibda.GetTimeChannelDecal(supermodule,column,row));
aae41db5 117 for(Int_t bc = 0; bc < 4; bc++)
56d10452 118 SetTimeChannel(supermodule,column,row,bc,calibda.GetTimeChannel(supermodule,column,row,bc));
119 } // col
120 } // row
121 } // col
aae41db5 122
aaa41982 123 return *this;
f565d89d 124}
125
aaa41982 126//_____________________________
f565d89d 127void AliEMCALCalibData::Reset()
128{
129 // Set all pedestals to 0 and all ADC channels widths to 1
aae41db5 130
aaa41982 131 fADCchannelRef = 0.0162;
aae41db5 132
76d23fc0 133 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0e76a7bf 134 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
135 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 136
56d10452 137 for (Int_t supermodule=0; supermodule<nSMod; supermodule++)
138 {
8cc543cb 139 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
140 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
8cc543cb 141
56d10452 142 //Init all SM equally, even the channels known to not exist.
143
144 for (Int_t column=0; column < nCol; column++)
145 {
146 for (Int_t row = 0; row < nRow; row++)
147 {
148
149 SetADCchannel (supermodule,column,row, fADCchannelRef);
150 SetADCchannelOnline(supermodule,column,row, fADCchannelRef);
151 SetADCchannelDecal (supermodule,column,row, 1);
152 SetADCpedestal (supermodule,column,row, 0);
153 SetTimeChannelDecal(supermodule,column,row, 0);
aae41db5 154 for(Int_t bc = 0; bc < 4; bc++)
56d10452 155 SetTimeChannel(supermodule,column,row, bc, 0);
156
0e76a7bf 157 }
158 }
aaa41982 159 }
f565d89d 160}
161
aae41db5 162//____________________________________________________
f565d89d 163void AliEMCALCalibData::Print(Option_t *option) const
164{
165 // Print tables of pedestals and ADC channels widths
56d10452 166 // options are: "gain", "ped", "online", "decal", "time", "timdecal", "all"
df5cea6b 167
56d10452 168 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
0c5b726e 169 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
170 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
df5cea6b 171
56d10452 172 for (Int_t supermodule = 0; supermodule < nSMod; supermodule++)
173 {
174 nCol = AliEMCALGeoParams::fgkEMCALCols; //48
175 nRow = AliEMCALGeoParams::fgkEMCALRows; //24
176
177 //Init all SM equally, even the channels known to not exist.
178
179 printf("============== Supermodule %d\n",supermodule+1);
180 for (Int_t column = 0; column < nCol; column++)
181 {
182 for (Int_t row = 0; row < nRow; row++)
183 {
184 printf("[col %d,row %d] ",column, row);
185 if (strstr(option,"gain") || strstr(option,"all"))
186 printf("calib=%2.4f ",GetADCchannel(supermodule,column,row));
187
188 if (strstr(option,"online") || strstr(option,"all"))
189 printf("calib0=%2.4f ", GetADCchannelOnline(supermodule,column,row));
190
191 if (strstr(option,"decal") || strstr(option,"all"))
192 printf("calibDecal=%2.4f ",GetADCchannelDecal(supermodule,column,row));
193
194 if (strstr(option,"ped") || strstr(option,"all"))
195 printf("ped=%2.4f ", GetADCpedestal(supermodule,column,row));
196
197 if (strstr(option,"time") || strstr(option,"all"))
198 printf("time::bc0 =%2.4f, bc1=%2.4f, bc2=%2.4f, bc3=%2.4f ",
199 GetTimeChannel(supermodule,column,row,0), GetTimeChannel(supermodule,column,row,1), GetTimeChannel(supermodule,column,row,2), GetTimeChannel(supermodule,column,row,3));
200
201 if (strstr(option,"timdecal") || strstr(option,"all"))
202 printf("timeDecal=%2.4f ", GetTimeChannelDecal(supermodule,column,row));
203
204 if (strstr(option,"all") || (row%4==3) ) printf("\n");
3730689d 205 }
206 }
207 }
f565d89d 208}
209
210//________________________________________________________________
211Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
212{
213 // Set ADC channel witdth values
63b315c5 214 // All indexes start from 0!
215 // Supermodule, column,raw should follow the ALICE convention:
216 // supermodule 0:11, column 0:47, row 0:23
56d10452 217 // DCal has its own array, starting from SM 12, index 0, same col-row size
aae41db5 218
56d10452 219 if(supermodule < 12) return fADCchannel [supermodule] [column][row];
220 else return fADCchannelDCAL[supermodule-12][column][row];
f565d89d 221}
222
223//________________________________________________________________
3730689d 224Float_t AliEMCALCalibData::GetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row) const
225{
226 // Set ADC channel witdth values, first online calibration parameter
227 // All indexes start from 0!
228 // Supermodule, column,raw should follow the ALICE convention:
229 // supermodule 0:11, column 0:47, row 0:23
56d10452 230 // DCal has its own array, starting from SM 12, index 0, same col-row size
3730689d 231
56d10452 232 if(supermodule < 12) return fADCchannelOnline [supermodule] [column][row];
233 else return fADCchannelOnlineDCAL[supermodule-12][column][row];
3730689d 234}
235
236//________________________________________________________________
df5cea6b 237Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const
238{
239 // Set ADC channel decalibration witdth values
240 // All indexes start from 0!
241 // Supermodule, column,raw should follow the ALICE convention:
242 // supermodule 0:11, column 0:47, row 0:23
56d10452 243 // DCal has its own array, starting from SM 12, index 0, same col-row size
df5cea6b 244
56d10452 245 if(supermodule < 12) return fADCchannelDecal [supermodule] [column][row];
246 else return fADCchannelDecalDCAL[supermodule-12][column][row];
df5cea6b 247}
248
249//________________________________________________________________
f565d89d 250Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
251{
252 // Get ADC pedestal values
56d10452 253 // DCal has its own array, starting from SM 12, index 0, same col-row size
254
255 if(supermodule < 12) return fADCpedestal [supermodule] [column][row];
256 else return fADCpedestalDCAL[supermodule-12][column][row];
f565d89d 257}
258
259//________________________________________________________________
aaa41982 260Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const
df5cea6b 261{
56d10452 262 // Set channel time values
263 // DCal has its own array, starting from SM 12, index 0, same col-row size
264
265 if(supermodule < 12) return fTimeChannel [supermodule] [column][row][bc];
266 else return fTimeChannelDCAL[supermodule-12][column][row][bc];
df5cea6b 267}
268
269//________________________________________________________________
270Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const
271{
56d10452 272 // Set channel time decalibrated values
273 // DCal has its own array, starting from SM 12, index 0, same col-row size
274
275 if(supermodule < 12) return fTimeChannelDecal [supermodule] [column][row];
276 else return fTimeChannelDecalDCAL[supermodule-12][column][row];
df5cea6b 277}
278
279//________________________________________________________________
f565d89d 280void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
281{
282 // Set ADC channel width values
56d10452 283 // DCal has its own array, starting from SM 12, index 0, same col-row size
284
285 if(supermodule < 12) fADCchannel [supermodule] [column][row] = value;
286 else fADCchannelDCAL[supermodule-12][column][row] = value;
f565d89d 287}
288
289//________________________________________________________________
3730689d 290void AliEMCALCalibData::SetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row, Float_t value)
291{
292 // Set ADC channel online width values
56d10452 293 // DCal has its own array, starting from SM 12, index 0, same col-row size
294
295 if(supermodule < 12) fADCchannelOnline [supermodule] [column][row] = value;
296 else fADCchannelOnlineDCAL[supermodule-12][column][row] = value;
3730689d 297}
298
299//________________________________________________________________
df5cea6b 300void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
301{
3730689d 302 // Set ADC channel width values, decalibration
56d10452 303 // DCal has its own array, starting from SM 12, index 0, same col-row size
304
305 if(supermodule < 12) fADCchannelDecal [supermodule] [column][row] = value;
306 else fADCchannelDecalDCAL[supermodule-12][column][row] = value;
df5cea6b 307}
308
309//________________________________________________________________
f565d89d 310void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
311{
312 // Set ADC pedestal values
56d10452 313 // DCal has its own array, starting from SM 12, index 0, same col-row size
314
315 if(supermodule < 12) fADCpedestal [supermodule] [column][row] = value;
316 else fADCpedestalDCAL[supermodule-12][column][row] = value;
f565d89d 317}
0e76a7bf 318
319//________________________________________________________________
aaa41982 320void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value)
df5cea6b 321{
56d10452 322 // Set time per channel and bunch crossing values
323 // DCal has its own array, starting from SM 12, index 0, same col-row size
324
325 if(supermodule < 12) fTimeChannel [supermodule] [column][row][bc] = value;
326 else fTimeChannelDCAL[supermodule-12][column][row][bc] = value;
df5cea6b 327}
328
329//________________________________________________________________
330void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
331{
56d10452 332 // Set decalibrated time per channel values
333 // DCal has its own array, starting from SM 12, index 0, same col-row size
334
335 if(supermodule < 12) fTimeChannelDecal [supermodule] [column][row] = value;
336 else fTimeChannelDecalDCAL[supermodule-12][column][row] = value;
df5cea6b 337}
338
339
0e76a7bf 340