]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALCalibData.cxx
Minor change for LHC11e
[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)
f565d89d 22///////////////////////////////////////////////////////////////////////////////
23// //
24// class for EMCAL calibration //
25// //
26///////////////////////////////////////////////////////////////////////////////
27
090026bf 28#include <TMath.h>
29
f565d89d 30#include "AliEMCALCalibData.h"
31
32ClassImp(AliEMCALCalibData)
33
34//________________________________________________________________
35AliEMCALCalibData::AliEMCALCalibData()
36{
37 // Default constructor
38 Reset();
39}
40
41//________________________________________________________________
42AliEMCALCalibData::AliEMCALCalibData(const char* name)
43{
44 // Constructor
45 TString namst = "Calib_";
46 namst += name;
47 SetName(namst.Data());
48 SetTitle(namst.Data());
49 Reset();
50}
51
52//________________________________________________________________
53AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
54 TNamed(calibda)
55{
56 // copy constructor
57 SetName(calibda.GetName());
58 SetTitle(calibda.GetName());
59 Reset();
60
0c5b726e 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
f565d89d 65
df5cea6b 66 for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
67
9219ceb6 68 if(supermodule >= 10)
beb28b95 69 nRow = nRow2;
df5cea6b 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 fTimeChannel[supermodule][column][row] =
85 calibda.GetTimeChannel(supermodule,column,row);
86
87 fTimeChannelDecal[supermodule][column][row] =
88 calibda.GetTimeChannelDecal(supermodule,column,row);
89
90
f565d89d 91 }
92 }
93 }
94}
95
96
97//________________________________________________________________
98AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
99{
100 // assignment operator
101 SetName(calibda.GetName());
102 SetTitle(calibda.GetName());
103 Reset();
104
0c5b726e 105 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
106 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
107 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
108 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
f565d89d 109
df5cea6b 110 for(Int_t supermodule = 0; supermodule < nSMod; supermodule++) {
111
9219ceb6 112 if(supermodule >= 10)
beb28b95 113 nRow = nRow2;
df5cea6b 114
115 for(Int_t column = 0; column<nCol; column++) {
116
117 for(Int_t row = 0; row<nRow; row++) {
118
119 fADCchannel[supermodule][column][row] =
120 calibda.GetADCchannel(supermodule,column,row);
121
122 fADCchannelDecal[supermodule][column][row] =
123 calibda.GetADCchannelDecal(supermodule,column,row);
124
125 fADCpedestal[supermodule][column][row] =
126 calibda.GetADCpedestal(supermodule,column,row);
127
128 fTimeChannel[supermodule][column][row] =
129 calibda.GetTimeChannel(supermodule,column,row);
130
131 fTimeChannelDecal[supermodule][column][row] =
132 calibda.GetTimeChannelDecal(supermodule,column,row);
133
f565d89d 134 }
135 }
136 }
137 return *this;
138}
139
140//________________________________________________________________
141AliEMCALCalibData::~AliEMCALCalibData()
142{
143 // Destructor
144}
145
146//________________________________________________________________
147void AliEMCALCalibData::Reset()
148{
149 // Set all pedestals to 0 and all ADC channels widths to 1
0c5b726e 150 //memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
151 //memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
0e76a7bf 152
153 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
154 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
155 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
156 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
157 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
158 if(supermodule >= 10)
159 nRow = nRow2;
df5cea6b 160 for (Int_t column=0; column < nCol; column++){
161
162 for (Int_t row = 0; row < nRow; row++){
163
164 fADCpedestal [supermodule][column][row]=0.;
165
166 fADCchannelDecal [supermodule][column][row]=1.;
167 fADCchannel [supermodule][column][row]=1.;
168
169 fTimeChannel [supermodule][column][row]=0.;
170 fTimeChannelDecal[supermodule][column][row]=0.;
171
0e76a7bf 172 }
173 }
174 }
f565d89d 175}
176
177//________________________________________________________________
178void AliEMCALCalibData::Print(Option_t *option) const
179{
180 // Print tables of pedestals and ADC channels widths
df5cea6b 181 // options are: "gain", "ped", "decal", "time", "all"
182
0c5b726e 183 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
184 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
185 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
186 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
df5cea6b 187 if (strstr(option,"ped") || strstr(option,"all")) {
f565d89d 188 printf("\n ---- Pedestal values ----\n\n");
189 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
9219ceb6 190 if(supermodule >= 10)
df5cea6b 191 nRow = nRow2;
f565d89d 192 printf("============== Supermodule %d\n",supermodule+1);
193 for (Int_t column=0; column<nCol; column++){
df5cea6b 194 for (Int_t row=0; row<nRow; row++){
195 printf(" %2.4f ",fADCpedestal[supermodule][column][row]);
196 }
197 printf("\n");
f565d89d 198 }
199 }
200 }
df5cea6b 201
202 if (strstr(option,"gain") || strstr(option,"all")) {
f565d89d 203 printf("\n ---- ADC channel values ----\n\n");
204 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
9219ceb6 205 if(supermodule >= 10)
df5cea6b 206 nRow = nRow2;
f565d89d 207 printf("============== Supermodule %d\n",supermodule+1);
208 for (Int_t column=0; column<nCol; column++){
df5cea6b 209 for (Int_t row=0; row<nRow; row++){
210 printf(" %2.4f ",fADCchannel[supermodule][column][row]);
211 }
212 printf("\n");
f565d89d 213 }
214 }
215 }
df5cea6b 216
217 if (strstr(option,"adcdecal") || strstr(option,"all")) {
218 printf("\n ---- ADC decalibration channel values ----\n\n");
219 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
220 if(supermodule >= 10)
221 nRow = nRow2;
222 printf("============== Supermodule %d\n",supermodule+1);
223 for (Int_t column=0; column<nCol; column++){
224 for (Int_t row=0; row<nRow; row++){
225 printf(" %2.4f ",fADCchannelDecal[supermodule][column][row]);
226 }
227 printf("\n");
228 }
229 }
230 }
231
232 if (strstr(option,"time") || strstr(option,"all")) {
233 printf("\n ---- time channel values ----\n\n");
234 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
235 if(supermodule >= 10)
236 nRow = nRow2;
237 printf("============== Supermodule %d\n",supermodule+1);
238 for (Int_t column=0; column<nCol; column++){
239 for (Int_t row=0; row<nRow; row++){
240 printf(" %2.4f ",fTimeChannel[supermodule][column][row]);
241 }
242 printf("\n");
243 }
244 }
245 }
246
247
248 if (strstr(option,"time") || strstr(option,"all")) {
249 printf("\n ---- time decalibration channel values ----\n\n");
250 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
251 if(supermodule >= 10)
252 nRow = nRow2;
253 printf("============== Supermodule %d\n",supermodule+1);
254 for (Int_t column=0; column<nCol; column++){
255 for (Int_t row=0; row<nRow; row++){
256 printf(" %2.4f ",fTimeChannelDecal[supermodule][column][row]);
257 }
258 printf("\n");
259 }
260 }
261 }
262
263
f565d89d 264}
265
266//________________________________________________________________
267Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
268{
269 // Set ADC channel witdth values
63b315c5 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
f565d89d 273
63b315c5 274 return fADCchannel[supermodule][column][row];
f565d89d 275}
276
df5cea6b 277//________________________________________________________________
278Float_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
f565d89d 288//________________________________________________________________
289Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
290{
291 // Get ADC pedestal values
63b315c5 292 return fADCpedestal[supermodule][column][row];
f565d89d 293}
294
df5cea6b 295//________________________________________________________________
296Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row) const
297{
298 // Set channel time witdth values
299 return fTimeChannel[supermodule][column][row];
300}
301
302//________________________________________________________________
303Float_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
f565d89d 309//________________________________________________________________
310void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
311{
312 // Set ADC channel width values
63b315c5 313 fADCchannel[supermodule][column][row] = value;
f565d89d 314}
315
df5cea6b 316//________________________________________________________________
317void 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
f565d89d 323//________________________________________________________________
324void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
325{
326 // Set ADC pedestal values
63b315c5 327 fADCpedestal[supermodule][column][row] = value;
f565d89d 328}
0e76a7bf 329
df5cea6b 330//________________________________________________________________
331void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
332{
333 // Set ADC pedestal values
334 fTimeChannel[supermodule][column][row] = value;
335}
336
337//________________________________________________________________
338void 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
0e76a7bf 345//________________________________________________________________
346void AliEMCALCalibData::Fill(const AliEMCALCalibData *cd1, const AliEMCALCalibData *cd2, Bool_t print)
347{
348 // Fill for (relative) recalibration to undo calibration
349 // from 1 and apply calibration from 2.
350
351 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
352 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
353 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
354 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
355 for (Int_t supermodule=0; supermodule<nSMod; supermodule++) {
356 if(supermodule >= 10)
357 nRow = nRow2;
358 for (Int_t column=0; column<nCol; column++) {
359 for (Int_t row=0; row<nRow; row++){
360 Double_t adc1 = cd1->GetADCchannel(supermodule, column, row);
361 Double_t ped1 = cd1->GetADCpedestal(supermodule, column, row);
362 Double_t adc2 = cd2->GetADCchannel(supermodule, column, row);
363 Double_t ped2 = cd2->GetADCpedestal(supermodule, column, row);
364 Double_t adc = adc2/adc1;
365 Double_t ped = ped2-adc*ped1;
366 if (print)
367 printf("%d %d %d: %f %f %f %f -> %f %f\n",supermodule,column,row,adc1,ped1,adc2,ped2,adc,ped);
368 fADCchannel [supermodule][column][row]=adc;
369 fADCpedestal[supermodule][column][row]=ped;
370 }
371 }
372 }
373}
374