Calibration object updated
[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{
38 TString namst = "Calib_";
39 namst += name;
40 SetName(namst.Data());
41 SetTitle(namst.Data());
8831501a 42// fHistMeanPed=0;
8af17dba 43 Reset();
44}
45
46//________________________________________________________________
8599f95e 47AliZDCCalibData::AliZDCCalibData(const AliZDCCalibData& calibda) :
48 TNamed(calibda)
49{
50// copy constructor
51 SetName(calibda.GetName());
52 SetTitle(calibda.GetName());
53 Reset();
8831501a 54 for(int t=0; t<47; t++){
55 fMeanPedestal[t] = calibda.GetMeanPed(t);
56 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
57 }
58 for(int t=0; t<44; t++){
59 fOOTPedestal[t] = calibda.GetOOTPed(t);
60 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
61 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
62 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
63 }
72bde173 64 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
8831501a 65// PrepHistos();
8599f95e 66}
67
68//________________________________________________________________
69AliZDCCalibData &AliZDCCalibData::operator =(const AliZDCCalibData& calibda)
70{
71// assignment operator
72 SetName(calibda.GetName());
73 SetTitle(calibda.GetName());
74 Reset();
8831501a 75 for(int t=0; t<47; t++){
76 fMeanPedestal[t] = calibda.GetMeanPed(t);
77 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
78 }
79 for(int t=0; t<44; t++){
80 fOOTPedestal[t] = calibda.GetOOTPed(t);
81 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
82 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
83 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
84 }
72bde173 85 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
8831501a 86// PrepHistos();
8599f95e 87 return *this;
88}
89
90//________________________________________________________________
8af17dba 91AliZDCCalibData::~AliZDCCalibData()
92{
8831501a 93// CleanHistos();
8af17dba 94}
95
96//________________________________________________________________
97void AliZDCCalibData::Reset()
98{
99 memset(fMeanPedestal,0,47*sizeof(Float_t));
8831501a 100 memset(fMeanPedWidth,0,47*sizeof(Float_t));
72bde173 101 memset(fOOTPedestal,0,44*sizeof(Float_t));
8831501a 102 memset(fOOTPedWidth,0,44*sizeof(Float_t));
72bde173 103 memset(fEnCalibration,0,6*sizeof(Float_t));
8af17dba 104}
105
8831501a 106/*
8af17dba 107//________________________________________________________________
108void AliZDCCalibData::CleanHistos()
109{
110 if (fHistMeanPed) delete fHistMeanPed; fHistMeanPed = 0;
111}
112
113//________________________________________________________________
114void AliZDCCalibData::PrepHistos()
115{
8599f95e 116// CleanHistos(); // this gives a segm.viol!
117 Int_t kNChannels = 47;
118 Float_t kMaxPedVal = 47.;
8af17dba 119 TString hname = GetName(); hname += "_Pedestals";
78d18275 120 fHistMeanPed = new TH1F(hname.Data(),hname.Data(),kNChannels,0.,kMaxPedVal);
121 for(int i=0; i<47; i++) fHistMeanPed->SetBinContent(i+1,GetMeanPed(i));
8af17dba 122}
8831501a 123*/
8af17dba 124
125//________________________________________________________________
5bc762ca 126void AliZDCCalibData::Print(Option_t *) const
8af17dba 127{
72bde173 128 printf("\n ####### Mean pedestal values ####### \n");
8af17dba 129 for(int t=0; t<47; t++){
72bde173 130 if(t==0 || t==24) printf("\n\t -------- ZN HighRes -------- \n");
131 else if(t==5 || t==29) printf("\n\t -------- ZN LowRes -------- \n");
132 else if(t==10 || t==34) printf("\n\t -------- ZP HighRes -------- \n");
133 else if(t==15 || t==39) printf("\n\t -------- ZP LowRes -------- \n");
134 else if(t==20) printf("\n\t -------- ZEM1 HighRes -------- ");
135 else if(t==21) printf("\n\t -------- ZEM1 LowRes -------- ");
136 else if(t==22) printf("\n\t -------- ZEM2 HighRes -------- ");
137 else if(t==23) printf("\n\t -------- ZEM2 LowRes -------- ");
8831501a 138 printf(" MeanPed[ADC%d] = %.1f ",t,fMeanPedestal[t]);
8af17dba 139 }
72bde173 140
141 printf("\n\n\n ####### Out Of Time pedestal values ####### \n");
142 for(int t=0; t<44; t++){
143 if(t==0 || t==24) printf("\n\t -------- ZN HighRes -------- \n");
144 else if(t==5 || t==29) printf("\n\t -------- ZN LowRes -------- \n");
145 else if(t==10 || t==34) printf("\n\t -------- ZP HighRes -------- \n");
146 else if(t==15 || t==39) printf("\n\t -------- ZP LowRes -------- \n");
147 else if(t==20) printf("\n\t -------- ZEM1 HighRes -------- ");
148 else if(t==21) printf("\n\t -------- ZEM1 LowRes -------- ");
149 else if(t==22) printf("\n\t -------- ZEM2 HighRes -------- ");
150 else if(t==23) printf("\n\t -------- ZEM2 LowRes -------- ");
8831501a 151 printf(" OOTPed[ADC%d] = %.1f ",t,fOOTPedestal[t]);
8af17dba 152 }
72bde173 153
154 printf("\n\n\n ####### Energy calibration coefficients ####### \n");
155 printf(" ZN1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[0]);
156 printf(" ZP1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[1]);
157 printf(" ZN2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[2]);
158 printf(" ZP2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[3]);
159 printf(" ZEM1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[4]);
160 printf(" ZEM2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[5]);
8af17dba 161}
162
163//________________________________________________________________
164void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
165{
166 if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
72bde173 167 else for(int t=0; t<47; t++) fMeanPedestal[t] = 0.;
168}
8831501a 169//________________________________________________________________
170void AliZDCCalibData::SetMeanPedWidth(Float_t* MeanPedWidth)
171{
172 if(MeanPedWidth) for(int t=0; t<47; t++) fMeanPedWidth[t] = MeanPedWidth[t];
173 else for(int t=0; t<47; t++) fMeanPedWidth[t] = 0.;
174}
72bde173 175
176//________________________________________________________________
177void AliZDCCalibData::SetOOTPed(Float_t* OOTPed)
178{
179 if(OOTPed) for(int t=0; t<44; t++) fOOTPedestal[t] = OOTPed[t];
180 else for(int t=0; t<44; t++) fOOTPedestal[t] = 0.;
8af17dba 181}
182
183//________________________________________________________________
8831501a 184void AliZDCCalibData:: SetPedCorrCoeff(Float_t* PedCorrCoeff0,
185 Float_t* PedCorrCoeff1)
186{
187 if(PedCorrCoeff0 && PedCorrCoeff1) for(int t=0; t<44; t++){
188 fPedCorrCoeff[0][t] = PedCorrCoeff0[t];
189 fPedCorrCoeff[1][t] = PedCorrCoeff1[t];
190 }
191 else for(int t=0; t<44; t++){
192 fPedCorrCoeff[0][t] = 0.;
193 fPedCorrCoeff[1][t] = 0.;
194 }
195}
196
197//________________________________________________________________
8af17dba 198void AliZDCCalibData::SetEnCalib(Float_t* EnCalib)
199{
72bde173 200 if(EnCalib) for(int t=0; t<6; t++) fEnCalibration[t] = EnCalib[t];
201 else for(int t=0; t<6; t++) fEnCalibration[t] = 0.;
8af17dba 202}
203