]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALCalibData.cxx
correcting AliHLTGlobalTriggerDecision::Clear(): using Delete instead of Clear for...
[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
f565d89d 21///////////////////////////////////////////////////////////////////////////////
22// //
23// class for EMCAL calibration //
24// //
25///////////////////////////////////////////////////////////////////////////////
26
090026bf 27#include <TMath.h>
28
f565d89d 29#include "AliEMCALCalibData.h"
30
31ClassImp(AliEMCALCalibData)
32
33//________________________________________________________________
34AliEMCALCalibData::AliEMCALCalibData()
35{
36 // Default constructor
37 Reset();
38}
39
40//________________________________________________________________
41AliEMCALCalibData::AliEMCALCalibData(const char* name)
42{
43 // Constructor
44 TString namst = "Calib_";
45 namst += name;
46 SetName(namst.Data());
47 SetTitle(namst.Data());
48 Reset();
49}
50
51//________________________________________________________________
52AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
53 TNamed(calibda)
54{
55 // copy constructor
56 SetName(calibda.GetName());
57 SetTitle(calibda.GetName());
58 Reset();
59
0c5b726e 60 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
61 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
62 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
63 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows; //12 - Modules 11 and 12 are half modules
f565d89d 64
65 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
9219ceb6 66 if(supermodule >= 10)
beb28b95 67 nRow = nRow2;
f565d89d 68 for(Int_t column=0; column<nCol; column++) {
69 for(Int_t row=0; row<nRow; row++) {
70 fADCchannel[supermodule][column][row] =
71 calibda.GetADCchannel(supermodule,column,row);
72 fADCpedestal[supermodule][column][row] =
73 calibda.GetADCpedestal(supermodule,column,row);
74 }
75 }
76 }
77}
78
79
80//________________________________________________________________
81AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
82{
83 // assignment operator
84 SetName(calibda.GetName());
85 SetTitle(calibda.GetName());
86 Reset();
87
0c5b726e 88 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
89 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
90 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
91 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
f565d89d 92
93 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
9219ceb6 94 if(supermodule >= 10)
beb28b95 95 nRow = nRow2;
f565d89d 96 for(Int_t column=0; column<nCol; column++) {
97 for(Int_t row=0; row<nRow; row++) {
98 fADCchannel[supermodule][column][row] =
99 calibda.GetADCchannel(supermodule,column,row);
100 fADCpedestal[supermodule][column][row] =
101 calibda.GetADCpedestal(supermodule,column,row);
102 }
103 }
104 }
105 return *this;
106}
107
108//________________________________________________________________
109AliEMCALCalibData::~AliEMCALCalibData()
110{
111 // Destructor
112}
113
114//________________________________________________________________
115void AliEMCALCalibData::Reset()
116{
117 // Set all pedestals to 0 and all ADC channels widths to 1
0c5b726e 118 //memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
119 //memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
120 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
121 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
122 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
123 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
124 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
125 if(supermodule >= 10)
126 nRow = nRow2;
127 for (Int_t column=0; column<nCol; column++){
128 for (Int_t row=0; row<nRow; row++){
129 fADCpedestal[supermodule][column][row]=0.;
130 fADCchannel [supermodule][column][row]=1.;
131 }
132 }
133 }
f565d89d 134}
135
136//________________________________________________________________
137void AliEMCALCalibData::Print(Option_t *option) const
138{
139 // Print tables of pedestals and ADC channels widths
140
0c5b726e 141 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
142 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
143 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
144 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
f565d89d 145 if (strstr(option,"ped")) {
146 printf("\n ---- Pedestal values ----\n\n");
147 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
9219ceb6 148 if(supermodule >= 10)
beb28b95 149 nRow = nRow2;
f565d89d 150 printf("============== Supermodule %d\n",supermodule+1);
151 for (Int_t column=0; column<nCol; column++){
152 for (Int_t row=0; row<nRow; row++){
636af9b4 153 printf(" %2.4f ",fADCpedestal[supermodule][column][row]);
f565d89d 154 }
155 printf("\n");
156 }
157 }
158 }
159
160
161 if (strstr(option,"gain")) {
162 printf("\n ---- ADC channel values ----\n\n");
163 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
9219ceb6 164 if(supermodule >= 10)
beb28b95 165 nRow = nRow2;
f565d89d 166 printf("============== Supermodule %d\n",supermodule+1);
167 for (Int_t column=0; column<nCol; column++){
168 for (Int_t row=0; row<nRow; row++){
636af9b4 169 printf(" %2.4f ",fADCchannel[supermodule][column][row]);
f565d89d 170 }
171 printf("\n");
172 }
173 }
174 }
175}
176
177//________________________________________________________________
178Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
179{
180 // Set ADC channel witdth values
63b315c5 181 // All indexes start from 0!
182 // Supermodule, column,raw should follow the ALICE convention:
183 // supermodule 0:11, column 0:47, row 0:23
f565d89d 184
63b315c5 185 return fADCchannel[supermodule][column][row];
f565d89d 186}
187
188//________________________________________________________________
189Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
190{
191 // Get ADC pedestal values
63b315c5 192 return fADCpedestal[supermodule][column][row];
f565d89d 193}
194
195//________________________________________________________________
196void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
197{
198 // Set ADC channel width values
63b315c5 199 fADCchannel[supermodule][column][row] = value;
f565d89d 200}
201
202//________________________________________________________________
203void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
204{
205 // Set ADC pedestal values
63b315c5 206 fADCpedestal[supermodule][column][row] = value;
f565d89d 207}