1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 ///*-- Author: Yves Schutz (SUBATECH)
20 // : Aleksei Pavlinov (WSU); Jun 30, 2006 - ALICE numbering scheme
21 ///////////////////////////////////////////////////////////////////////////////
23 // class for EMCAL calibration //
25 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliEMCALCalibData.h"
31 ClassImp(AliEMCALCalibData)
33 //________________________________________________________________
34 AliEMCALCalibData::AliEMCALCalibData()
36 // Default constructor
40 //________________________________________________________________
41 AliEMCALCalibData::AliEMCALCalibData(const char* name)
44 TString namst = "Calib_";
46 SetName(namst.Data());
47 SetTitle(namst.Data());
51 //________________________________________________________________
52 AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
56 SetName(calibda.GetName());
57 SetTitle(calibda.GetName());
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
65 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
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);
80 //________________________________________________________________
81 AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
83 // assignment operator
84 SetName(calibda.GetName());
85 SetTitle(calibda.GetName());
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
93 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
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);
108 //________________________________________________________________
109 AliEMCALCalibData::~AliEMCALCalibData()
114 //________________________________________________________________
115 void AliEMCALCalibData::Reset()
117 // Set all pedestals to 0 and all ADC channels widths to 1
118 //memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
119 //memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
121 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
122 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
123 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
124 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
125 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
126 if(supermodule >= 10)
128 for (Int_t column=0; column<nCol; column++){
129 for (Int_t row=0; row<nRow; row++){
130 fADCpedestal[supermodule][column][row]=0.;
131 fADCchannel [supermodule][column][row]=1.;
137 //________________________________________________________________
138 void AliEMCALCalibData::Print(Option_t *option) const
140 // Print tables of pedestals and ADC channels widths
142 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
143 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
144 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
145 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
146 if (strstr(option,"ped")) {
147 printf("\n ---- Pedestal values ----\n\n");
148 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
149 if(supermodule >= 10)
151 printf("============== Supermodule %d\n",supermodule+1);
152 for (Int_t column=0; column<nCol; column++){
153 for (Int_t row=0; row<nRow; row++){
154 printf(" %2.4f ",fADCpedestal[supermodule][column][row]);
162 if (strstr(option,"gain")) {
163 printf("\n ---- ADC channel values ----\n\n");
164 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
165 if(supermodule >= 10)
167 printf("============== Supermodule %d\n",supermodule+1);
168 for (Int_t column=0; column<nCol; column++){
169 for (Int_t row=0; row<nRow; row++){
170 printf(" %2.4f ",fADCchannel[supermodule][column][row]);
178 //________________________________________________________________
179 Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
181 // Set ADC channel witdth values
182 // All indexes start from 0!
183 // Supermodule, column,raw should follow the ALICE convention:
184 // supermodule 0:11, column 0:47, row 0:23
186 return fADCchannel[supermodule][column][row];
189 //________________________________________________________________
190 Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
192 // Get ADC pedestal values
193 return fADCpedestal[supermodule][column][row];
196 //________________________________________________________________
197 void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
199 // Set ADC channel width values
200 fADCchannel[supermodule][column][row] = value;
203 //________________________________________________________________
204 void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
206 // Set ADC pedestal values
207 fADCpedestal[supermodule][column][row] = value;
210 //________________________________________________________________
211 void AliEMCALCalibData::Fill(const AliEMCALCalibData *cd1, const AliEMCALCalibData *cd2, Bool_t print)
213 // Fill for (relative) recalibration to undo calibration
214 // from 1 and apply calibration from 2.
216 Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
217 Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
218 Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
219 Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
220 for (Int_t supermodule=0; supermodule<nSMod; supermodule++) {
221 if(supermodule >= 10)
223 for (Int_t column=0; column<nCol; column++) {
224 for (Int_t row=0; row<nRow; row++){
225 Double_t adc1 = cd1->GetADCchannel(supermodule, column, row);
226 Double_t ped1 = cd1->GetADCpedestal(supermodule, column, row);
227 Double_t adc2 = cd2->GetADCchannel(supermodule, column, row);
228 Double_t ped2 = cd2->GetADCpedestal(supermodule, column, row);
229 Double_t adc = adc2/adc1;
230 Double_t ped = ped2-adc*ped1;
232 printf("%d %d %d: %f %f %f %f -> %f %f\n",supermodule,column,row,adc1,ped1,adc2,ped2,adc,ped);
233 fADCchannel [supermodule][column][row]=adc;
234 fADCpedestal[supermodule][column][row]=ped;