Little changes needed for running with new AliESDEvent
[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{
8831501a 31// fHistMeanPed=0;
8af17dba 32 Reset();
33}
34
35//________________________________________________________________
36AliZDCCalibData::AliZDCCalibData(const char* name)
37{
8a2624cc 38 // Constructor
8af17dba 39 TString namst = "Calib_";
40 namst += name;
41 SetName(namst.Data());
42 SetTitle(namst.Data());
8831501a 43// fHistMeanPed=0;
8af17dba 44 Reset();
45}
46
8599f95e 47//________________________________________________________________
48AliZDCCalibData::AliZDCCalibData(const AliZDCCalibData& calibda) :
49 TNamed(calibda)
50{
51// copy constructor
52 SetName(calibda.GetName());
53 SetTitle(calibda.GetName());
54 Reset();
8831501a 55 for(int t=0; t<47; t++){
56 fMeanPedestal[t] = calibda.GetMeanPed(t);
57 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
58 }
59 for(int t=0; t<44; t++){
60 fOOTPedestal[t] = calibda.GetOOTPed(t);
61 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
62 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
63 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
64 }
72bde173 65 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
ac992fb1 66 //
67 fEZEMEndValue = calibda.GetEZEMEndValue();
68 fEZEMCutFraction = calibda.GetEZEMCutFraction();
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);
ac992fb1 89 fEZEMEndValue = calibda.GetEZEMEndValue();
90 fEZEMCutFraction = calibda.GetEZEMCutFraction();
91
8599f95e 92 return *this;
93}
94
8af17dba 95//________________________________________________________________
96AliZDCCalibData::~AliZDCCalibData()
97{
8831501a 98// CleanHistos();
8af17dba 99}
100
101//________________________________________________________________
102void AliZDCCalibData::Reset()
103{
8a2624cc 104 // Reset
8af17dba 105 memset(fMeanPedestal,0,47*sizeof(Float_t));
8831501a 106 memset(fMeanPedWidth,0,47*sizeof(Float_t));
72bde173 107 memset(fOOTPedestal,0,44*sizeof(Float_t));
8831501a 108 memset(fOOTPedWidth,0,44*sizeof(Float_t));
72bde173 109 memset(fEnCalibration,0,6*sizeof(Float_t));
8af17dba 110}
111
8831501a 112/*
8af17dba 113//________________________________________________________________
114void AliZDCCalibData::CleanHistos()
115{
116 if (fHistMeanPed) delete fHistMeanPed; fHistMeanPed = 0;
117}
118
119//________________________________________________________________
120void AliZDCCalibData::PrepHistos()
121{
8599f95e 122// CleanHistos(); // this gives a segm.viol!
123 Int_t kNChannels = 47;
124 Float_t kMaxPedVal = 47.;
8af17dba 125 TString hname = GetName(); hname += "_Pedestals";
78d18275 126 fHistMeanPed = new TH1F(hname.Data(),hname.Data(),kNChannels,0.,kMaxPedVal);
127 for(int i=0; i<47; i++) fHistMeanPed->SetBinContent(i+1,GetMeanPed(i));
8af17dba 128}
8831501a 129*/
8af17dba 130
131//________________________________________________________________
5bc762ca 132void AliZDCCalibData::Print(Option_t *) const
8af17dba 133{
8a2624cc 134 // Printing of calibration object
e1ea0c63 135 printf("\n ####### In-time pedestal values (mean value, sigma) ####### \n");
136 for(int t=0; t<44; t++){
6cd02eaf 137 if(t==0 || t==24) printf("\n-------- ZN1 HighRes -------- \n");
138 else if(t==5 || t==29) printf("\n-------- ZN1 LowRes -------- \n");
139 else if(t==10 || t==34) printf("\n-------- ZP1 HighRes -------- \n");
140 else if(t==15 || t==39) printf("\n-------- ZP1 LowRes -------- \n");
e1ea0c63 141 else if(t==20) printf("\n-------- ZEM1 HighRes -------- \n");
142 else if(t==21) printf("\n-------- ZEM1 LowRes -------- \n");
143 else if(t==22) printf("\n-------- ZEM2 HighRes -------- \n");
144 else if(t==23) printf("\n-------- ZEM2 LowRes -------- \n");
ac992fb1 145 printf("ADC%d (%.1f, %.1f) ",t,fMeanPedestal[t],fMeanPedWidth[t]);
31af5828 146 }
e1ea0c63 147 //
148 printf("\n\n\n ####### Out-of-time pedestal values (mean value, sigma) ####### \n");
72bde173 149 for(int t=0; t<44; t++){
6cd02eaf 150 if(t==0 || t==24) printf("\n-------- ZN1 HighRes -------- \n");
151 else if(t==5 || t==29) printf("\n-------- ZN1 LowRes -------- \n");
152 else if(t==10 || t==34) printf("\n-------- ZP1 HighRes -------- \n");
153 else if(t==15 || t==39) printf("\n-------- ZP1 LowRes -------- \n");
e1ea0c63 154 else if(t==20) printf("\n-------- ZEM1 HighRes -------- \n");
155 else if(t==21) printf("\n-------- ZEM1 LowRes -------- \n");
156 else if(t==22) printf("\n-------- ZEM2 HighRes -------- \n");
157 else if(t==23) printf("\n-------- ZEM2 LowRes -------- \n");
ac992fb1 158 printf("ADC%d (%.1f, %.1f) ",t,fOOTPedestal[t],fOOTPedWidth[t]);
8af17dba 159 }
72bde173 160
e1ea0c63 161 printf("\n\n\n ####### Energy calibration coefficients ####### \n");
162 printf(" ZN1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[0]);
163 printf(" ZP1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[1]);
164 printf(" ZN2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[2]);
165 printf(" ZP2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[3]);
166 printf(" ZEM1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[4]);
167 printf(" ZEM2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[5]);
ac992fb1 168
dcf60b09 169 printf("\n\n ####### Equalization coefficients ####### \n");
ac992fb1 170 printf(" ZN1 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
171 fZN1EqualCoeff[0],fZN1EqualCoeff[1],fZN1EqualCoeff[2],fZN1EqualCoeff[3],fZN1EqualCoeff[4]);
172 printf(" ZP1 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
173 fZP1EqualCoeff[0],fZP1EqualCoeff[1],fZP1EqualCoeff[2],fZP1EqualCoeff[3],fZP1EqualCoeff[4]);
174 printf(" ZN2 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
175 fZN2EqualCoeff[0],fZN2EqualCoeff[1],fZN2EqualCoeff[2],fZN2EqualCoeff[3],fZN2EqualCoeff[4]);
dcf60b09 176 printf(" ZP2 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
ac992fb1 177 fZP2EqualCoeff[0],fZP2EqualCoeff[1],fZP2EqualCoeff[2],fZP2EqualCoeff[3],fZP2EqualCoeff[4]);
dcf60b09 178
179 printf("\n\n ####### Parameters for centrality selection from ZEM ####### \n");
180 printf(" ZEM spectrum end point -> %1.0f (a.u.)\n",fEZEMEndValue);
181 printf(" ZEM cut value -> %1.2f \n\n\n",fEZEMCutFraction);
8af17dba 182}
183
184//________________________________________________________________
185void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
186{
187 if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
72bde173 188 else for(int t=0; t<47; t++) fMeanPedestal[t] = 0.;
189}
8831501a 190//________________________________________________________________
191void AliZDCCalibData::SetMeanPedWidth(Float_t* MeanPedWidth)
192{
193 if(MeanPedWidth) for(int t=0; t<47; t++) fMeanPedWidth[t] = MeanPedWidth[t];
194 else for(int t=0; t<47; t++) fMeanPedWidth[t] = 0.;
195}
72bde173 196
197//________________________________________________________________
198void AliZDCCalibData::SetOOTPed(Float_t* OOTPed)
199{
200 if(OOTPed) for(int t=0; t<44; t++) fOOTPedestal[t] = OOTPed[t];
201 else for(int t=0; t<44; t++) fOOTPedestal[t] = 0.;
8af17dba 202}
203
6a03966b 204//________________________________________________________________
205void AliZDCCalibData::SetOOTPedWidth(Float_t* OOTPedWidth)
206{
207 if(OOTPedWidth) for(int t=0; t<44; t++) fOOTPedWidth[t] = OOTPedWidth[t];
208 else for(int t=0; t<44; t++) fOOTPedWidth[t] = 0.;
209}
210
8831501a 211//________________________________________________________________
31af5828 212void AliZDCCalibData:: SetPedCorrCoeff(Float_t* PedCorrCoeff)
213{
214 // Set coefficients for pedestal correlations
215 if(PedCorrCoeff){
216 for(Int_t j=0; j<2; j++){
217 for(int t=0; t<44; t++)
218 fPedCorrCoeff[j][t] = PedCorrCoeff[t];
219 }
220 }
221 else{
222 for(Int_t j=0; j<2; j++){
223 for(int t=0; t<44; t++)
224 fPedCorrCoeff[j][t] = 0.;
225 }
226 }
227
228}
229
230//________________________________________________________________
231void AliZDCCalibData:: SetPedCorrCoeff(Float_t* PedCorrCoeff0, Float_t* PedCorrCoeff1)
8831501a 232{
8a2624cc 233 // Set coefficients for pedestal correlations
31af5828 234 if(PedCorrCoeff0 && PedCorrCoeff1){
235 for(int t=0; t<44; t++){
236 fPedCorrCoeff[0][t] = PedCorrCoeff0[t];
237 fPedCorrCoeff[0][t] = PedCorrCoeff1[t];
238 }
8831501a 239 }
31af5828 240 else{
241 for(int t=0; t<44; t++){
242 fPedCorrCoeff[0][t] = 0.;
243 fPedCorrCoeff[1][t] = 0.;
244 }
8831501a 245 }
31af5828 246
8831501a 247}
248
8af17dba 249//________________________________________________________________
250void AliZDCCalibData::SetEnCalib(Float_t* EnCalib)
251{
31af5828 252 // Set energy calibration coefficients
72bde173 253 if(EnCalib) for(int t=0; t<6; t++) fEnCalibration[t] = EnCalib[t];
254 else for(int t=0; t<6; t++) fEnCalibration[t] = 0.;
8af17dba 255}
256
31af5828 257//________________________________________________________________
258void AliZDCCalibData::SetPMTHVVal(Float_t* HVVal)
259{
260 // Set PMTs HV values
261 if(HVVal) for(int t=0; t<22; t++) fPMTHVVal[t] = HVVal[t];
262 else for(int t=0; t<22; t++) fPMTHVVal[t] = 0.;
263}
264
6cd02eaf 265//________________________________________________________________
266void AliZDCCalibData::SetZN1EqualCoeff(Float_t* EqualCoeff)
267{
268 // Set ZN1 equalization coefficients
269 if(EqualCoeff) for(int t=0; t<5; t++) fZN1EqualCoeff[t] = EqualCoeff[t];
270 else for(int t=0; t<5; t++) fZN1EqualCoeff[t] = 1.;
271}
272
273//________________________________________________________________
274void AliZDCCalibData::SetZP1EqualCoeff(Float_t* EqualCoeff)
275{
276 // Set ZP1 equalization coefficients
277 if(EqualCoeff) for(int t=0; t<5; t++) fZP1EqualCoeff[t] = EqualCoeff[t];
278 else for(int t=0; t<5; t++) fZP1EqualCoeff[t] = 1.;
279}
280//________________________________________________________________
281void AliZDCCalibData::SetZN2EqualCoeff(Float_t* EqualCoeff)
282{
283 // Set ZN2 equalization coefficients
284 if(EqualCoeff) for(int t=0; t<5; t++) fZN2EqualCoeff[t] = EqualCoeff[t];
285 else for(int t=0; t<5; t++) fZN2EqualCoeff[t] = 1.;
286}
287
288//________________________________________________________________
289void AliZDCCalibData::SetZP2EqualCoeff(Float_t* EqualCoeff)
290{
291 // Set ZN1 equalization coefficients
292 if(EqualCoeff) for(int t=0; t<5; t++) fZP2EqualCoeff[t] = EqualCoeff[t];
293 else for(int t=0; t<5; t++) fZP2EqualCoeff[t] = 1.;
294}
295