Added forward declaration
[u/mrichter/AliRoot.git] / ZDC / AliZDCCalibData.cxx
CommitLineData
8af17dba 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// //
20// class for ZDC calibration //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliZDCCalibData.h"
25
26ClassImp(AliZDCCalibData)
27
28//________________________________________________________________
29AliZDCCalibData::AliZDCCalibData()
30{
8af17dba 31 Reset();
32}
33
34//________________________________________________________________
35AliZDCCalibData::AliZDCCalibData(const char* name)
36{
8a2624cc 37 // Constructor
8af17dba 38 TString namst = "Calib_";
39 namst += name;
40 SetName(namst.Data());
41 SetTitle(namst.Data());
8af17dba 42 Reset();
43}
44
8599f95e 45//________________________________________________________________
46AliZDCCalibData::AliZDCCalibData(const AliZDCCalibData& calibda) :
47 TNamed(calibda)
48{
49// copy constructor
50 SetName(calibda.GetName());
51 SetTitle(calibda.GetName());
52 Reset();
8831501a 53 for(int t=0; t<47; t++){
54 fMeanPedestal[t] = calibda.GetMeanPed(t);
55 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
56 }
57 for(int t=0; t<44; t++){
58 fOOTPedestal[t] = calibda.GetOOTPed(t);
59 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
60 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
61 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
62 }
72bde173 63 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
ac992fb1 64 //
646f1679 65 fZEMEndValue = calibda.GetZEMEndValue();
66 fZEMCutFraction = calibda.GetZEMCutFraction();
67 fDZEMSup = calibda.GetDZEMSup();
68 fDZEMInf = calibda.GetDZEMInf();
8599f95e 69}
70
71//________________________________________________________________
72AliZDCCalibData &AliZDCCalibData::operator =(const AliZDCCalibData& calibda)
73{
74// assignment operator
75 SetName(calibda.GetName());
76 SetTitle(calibda.GetName());
77 Reset();
8831501a 78 for(int t=0; t<47; t++){
79 fMeanPedestal[t] = calibda.GetMeanPed(t);
80 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
81 }
82 for(int t=0; t<44; t++){
83 fOOTPedestal[t] = calibda.GetOOTPed(t);
84 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
85 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
86 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
87 }
72bde173 88 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
646f1679 89 fZEMEndValue = calibda.GetZEMEndValue();
90 fZEMCutFraction = calibda.GetZEMCutFraction();
ac992fb1 91
8599f95e 92 return *this;
93}
94
8af17dba 95//________________________________________________________________
96AliZDCCalibData::~AliZDCCalibData()
97{
8af17dba 98}
99
100//________________________________________________________________
101void AliZDCCalibData::Reset()
102{
8a2624cc 103 // Reset
8af17dba 104 memset(fMeanPedestal,0,47*sizeof(Float_t));
8831501a 105 memset(fMeanPedWidth,0,47*sizeof(Float_t));
72bde173 106 memset(fOOTPedestal,0,44*sizeof(Float_t));
8831501a 107 memset(fOOTPedWidth,0,44*sizeof(Float_t));
72bde173 108 memset(fEnCalibration,0,6*sizeof(Float_t));
8af17dba 109}
110
8af17dba 111
112//________________________________________________________________
5bc762ca 113void AliZDCCalibData::Print(Option_t *) const
8af17dba 114{
8a2624cc 115 // Printing of calibration object
e1ea0c63 116 printf("\n ####### In-time pedestal values (mean value, sigma) ####### \n");
117 for(int t=0; t<44; t++){
6cd02eaf 118 if(t==0 || t==24) printf("\n-------- ZN1 HighRes -------- \n");
119 else if(t==5 || t==29) printf("\n-------- ZN1 LowRes -------- \n");
120 else if(t==10 || t==34) printf("\n-------- ZP1 HighRes -------- \n");
121 else if(t==15 || t==39) printf("\n-------- ZP1 LowRes -------- \n");
e1ea0c63 122 else if(t==20) printf("\n-------- ZEM1 HighRes -------- \n");
123 else if(t==21) printf("\n-------- ZEM1 LowRes -------- \n");
124 else if(t==22) printf("\n-------- ZEM2 HighRes -------- \n");
125 else if(t==23) printf("\n-------- ZEM2 LowRes -------- \n");
ac992fb1 126 printf("ADC%d (%.1f, %.1f) ",t,fMeanPedestal[t],fMeanPedWidth[t]);
31af5828 127 }
e1ea0c63 128 //
646f1679 129 printf("\n\n ####### Out-of-time pedestal values (mean value, sigma) ####### \n");
72bde173 130 for(int t=0; t<44; t++){
6cd02eaf 131 if(t==0 || t==24) printf("\n-------- ZN1 HighRes -------- \n");
132 else if(t==5 || t==29) printf("\n-------- ZN1 LowRes -------- \n");
133 else if(t==10 || t==34) printf("\n-------- ZP1 HighRes -------- \n");
134 else if(t==15 || t==39) printf("\n-------- ZP1 LowRes -------- \n");
e1ea0c63 135 else if(t==20) printf("\n-------- ZEM1 HighRes -------- \n");
136 else if(t==21) printf("\n-------- ZEM1 LowRes -------- \n");
137 else if(t==22) printf("\n-------- ZEM2 HighRes -------- \n");
138 else if(t==23) printf("\n-------- ZEM2 LowRes -------- \n");
ac992fb1 139 printf("ADC%d (%.1f, %.1f) ",t,fOOTPedestal[t],fOOTPedWidth[t]);
8af17dba 140 }
72bde173 141
646f1679 142 printf("\n\n ####### Energy calibration coefficients ####### \n");
e1ea0c63 143 printf(" ZN1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[0]);
144 printf(" ZP1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[1]);
145 printf(" ZN2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[2]);
146 printf(" ZP2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[3]);
147 printf(" ZEM1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[4]);
148 printf(" ZEM2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[5]);
ac992fb1 149
dcf60b09 150 printf("\n\n ####### Equalization coefficients ####### \n");
ac992fb1 151 printf(" ZN1 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
152 fZN1EqualCoeff[0],fZN1EqualCoeff[1],fZN1EqualCoeff[2],fZN1EqualCoeff[3],fZN1EqualCoeff[4]);
153 printf(" ZP1 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
154 fZP1EqualCoeff[0],fZP1EqualCoeff[1],fZP1EqualCoeff[2],fZP1EqualCoeff[3],fZP1EqualCoeff[4]);
155 printf(" ZN2 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
156 fZN2EqualCoeff[0],fZN2EqualCoeff[1],fZN2EqualCoeff[2],fZN2EqualCoeff[3],fZN2EqualCoeff[4]);
dcf60b09 157 printf(" ZP2 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
ac992fb1 158 fZP2EqualCoeff[0],fZP2EqualCoeff[1],fZP2EqualCoeff[2],fZP2EqualCoeff[3],fZP2EqualCoeff[4]);
dcf60b09 159
646f1679 160 printf("\n\n ####### Parameters from EZDC vs. ZEM correlation ####### \n");
161 printf(" ZEMEndPoint = %1.2f, ZEMCutFraction = %1.2f \n"
162 " DZEMInf = %1.2f, DZEMSup = %1.2f\n",
163 fZEMEndValue, fZEMCutFraction, fDZEMInf, fDZEMSup);
164
165 printf("\n\n ####### Parameters from EZDC vs. Nspec correlation ####### \n");
166 printf(" EZN1MaxValue = %1.2f, EZP1MaxValue = %1.2f, EZDC1MaxValue = %1.2f \n"
167 " EZN2MaxValue = %1.2f, EZP2MaxValue = %1.2f, EZDC2MaxValue = %1.2f \n\n",
168 fEZN1MaxValue, fEZP1MaxValue, fEZDC1MaxValue,
169 fEZN2MaxValue, fEZP2MaxValue, fEZDC2MaxValue);
170
8af17dba 171}
172
173//________________________________________________________________
174void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
175{
176 if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
72bde173 177 else for(int t=0; t<47; t++) fMeanPedestal[t] = 0.;
178}
8831501a 179//________________________________________________________________
180void AliZDCCalibData::SetMeanPedWidth(Float_t* MeanPedWidth)
181{
182 if(MeanPedWidth) for(int t=0; t<47; t++) fMeanPedWidth[t] = MeanPedWidth[t];
183 else for(int t=0; t<47; t++) fMeanPedWidth[t] = 0.;
184}
72bde173 185
186//________________________________________________________________
187void AliZDCCalibData::SetOOTPed(Float_t* OOTPed)
188{
189 if(OOTPed) for(int t=0; t<44; t++) fOOTPedestal[t] = OOTPed[t];
190 else for(int t=0; t<44; t++) fOOTPedestal[t] = 0.;
8af17dba 191}
192
6a03966b 193//________________________________________________________________
194void AliZDCCalibData::SetOOTPedWidth(Float_t* OOTPedWidth)
195{
196 if(OOTPedWidth) for(int t=0; t<44; t++) fOOTPedWidth[t] = OOTPedWidth[t];
197 else for(int t=0; t<44; t++) fOOTPedWidth[t] = 0.;
198}
199
8831501a 200//________________________________________________________________
31af5828 201void AliZDCCalibData:: SetPedCorrCoeff(Float_t* PedCorrCoeff)
202{
203 // Set coefficients for pedestal correlations
204 if(PedCorrCoeff){
205 for(Int_t j=0; j<2; j++){
206 for(int t=0; t<44; t++)
207 fPedCorrCoeff[j][t] = PedCorrCoeff[t];
208 }
209 }
210 else{
211 for(Int_t j=0; j<2; j++){
212 for(int t=0; t<44; t++)
213 fPedCorrCoeff[j][t] = 0.;
214 }
215 }
216
217}
218
219//________________________________________________________________
220void AliZDCCalibData:: SetPedCorrCoeff(Float_t* PedCorrCoeff0, Float_t* PedCorrCoeff1)
8831501a 221{
8a2624cc 222 // Set coefficients for pedestal correlations
31af5828 223 if(PedCorrCoeff0 && PedCorrCoeff1){
224 for(int t=0; t<44; t++){
225 fPedCorrCoeff[0][t] = PedCorrCoeff0[t];
226 fPedCorrCoeff[0][t] = PedCorrCoeff1[t];
227 }
8831501a 228 }
31af5828 229 else{
230 for(int t=0; t<44; t++){
231 fPedCorrCoeff[0][t] = 0.;
232 fPedCorrCoeff[1][t] = 0.;
233 }
8831501a 234 }
31af5828 235
8831501a 236}
237
8af17dba 238//________________________________________________________________
239void AliZDCCalibData::SetEnCalib(Float_t* EnCalib)
240{
31af5828 241 // Set energy calibration coefficients
72bde173 242 if(EnCalib) for(int t=0; t<6; t++) fEnCalibration[t] = EnCalib[t];
243 else for(int t=0; t<6; t++) fEnCalibration[t] = 0.;
8af17dba 244}
245
6cd02eaf 246//________________________________________________________________
247void AliZDCCalibData::SetZN1EqualCoeff(Float_t* EqualCoeff)
248{
249 // Set ZN1 equalization coefficients
250 if(EqualCoeff) for(int t=0; t<5; t++) fZN1EqualCoeff[t] = EqualCoeff[t];
251 else for(int t=0; t<5; t++) fZN1EqualCoeff[t] = 1.;
252}
253
254//________________________________________________________________
255void AliZDCCalibData::SetZP1EqualCoeff(Float_t* EqualCoeff)
256{
257 // Set ZP1 equalization coefficients
258 if(EqualCoeff) for(int t=0; t<5; t++) fZP1EqualCoeff[t] = EqualCoeff[t];
259 else for(int t=0; t<5; t++) fZP1EqualCoeff[t] = 1.;
260}
261//________________________________________________________________
262void AliZDCCalibData::SetZN2EqualCoeff(Float_t* EqualCoeff)
263{
264 // Set ZN2 equalization coefficients
265 if(EqualCoeff) for(int t=0; t<5; t++) fZN2EqualCoeff[t] = EqualCoeff[t];
266 else for(int t=0; t<5; t++) fZN2EqualCoeff[t] = 1.;
267}
268
269//________________________________________________________________
270void AliZDCCalibData::SetZP2EqualCoeff(Float_t* EqualCoeff)
271{
272 // Set ZN1 equalization coefficients
273 if(EqualCoeff) for(int t=0; t<5; t++) fZP2EqualCoeff[t] = EqualCoeff[t];
274 else for(int t=0; t<5; t++) fZP2EqualCoeff[t] = 1.;
275}
276