A simple readme file for all the files stored in this dir.
[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
47//________________________________________________________________
8599f95e 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);
8831501a 66// PrepHistos();
8599f95e 67}
68
69//________________________________________________________________
70AliZDCCalibData &AliZDCCalibData::operator =(const AliZDCCalibData& calibda)
71{
72// assignment operator
73 SetName(calibda.GetName());
74 SetTitle(calibda.GetName());
75 Reset();
8831501a 76 for(int t=0; t<47; t++){
77 fMeanPedestal[t] = calibda.GetMeanPed(t);
78 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
79 }
80 for(int t=0; t<44; t++){
81 fOOTPedestal[t] = calibda.GetOOTPed(t);
82 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
83 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
84 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
85 }
72bde173 86 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
8831501a 87// PrepHistos();
8599f95e 88 return *this;
89}
90
91//________________________________________________________________
8af17dba 92AliZDCCalibData::~AliZDCCalibData()
93{
8831501a 94// CleanHistos();
8af17dba 95}
96
97//________________________________________________________________
98void AliZDCCalibData::Reset()
99{
8a2624cc 100 // Reset
8af17dba 101 memset(fMeanPedestal,0,47*sizeof(Float_t));
8831501a 102 memset(fMeanPedWidth,0,47*sizeof(Float_t));
72bde173 103 memset(fOOTPedestal,0,44*sizeof(Float_t));
8831501a 104 memset(fOOTPedWidth,0,44*sizeof(Float_t));
72bde173 105 memset(fEnCalibration,0,6*sizeof(Float_t));
8af17dba 106}
107
8831501a 108/*
8af17dba 109//________________________________________________________________
110void AliZDCCalibData::CleanHistos()
111{
112 if (fHistMeanPed) delete fHistMeanPed; fHistMeanPed = 0;
113}
114
115//________________________________________________________________
116void AliZDCCalibData::PrepHistos()
117{
8599f95e 118// CleanHistos(); // this gives a segm.viol!
119 Int_t kNChannels = 47;
120 Float_t kMaxPedVal = 47.;
8af17dba 121 TString hname = GetName(); hname += "_Pedestals";
78d18275 122 fHistMeanPed = new TH1F(hname.Data(),hname.Data(),kNChannels,0.,kMaxPedVal);
123 for(int i=0; i<47; i++) fHistMeanPed->SetBinContent(i+1,GetMeanPed(i));
8af17dba 124}
8831501a 125*/
8af17dba 126
127//________________________________________________________________
5bc762ca 128void AliZDCCalibData::Print(Option_t *) const
8af17dba 129{
8a2624cc 130 // Printing of calibration object
72bde173 131 printf("\n ####### Mean pedestal values ####### \n");
8af17dba 132 for(int t=0; t<47; t++){
31af5828 133 if(t==0 || t==24) printf("\n\t ZN HighRes -------- \n");
134 else if(t==5 || t==29) printf("\n\t ZN LowRes -------- \n");
135 else if(t==10 || t==34) printf("\n\t ZP HighRes -------- \n");
136 else if(t==15 || t==39) printf("\n\t ZP LowRes -------- \n");
137 else if(t==20) printf("\n\t ZEM1 HighRes -------- ");
138 else if(t==21) printf("\n\t ZEM1 LowRes -------- ");
139 else if(t==22) printf("\n\t ZEM2 HighRes -------- ");
140 else if(t==23) printf("\n\t ZEM2 LowRes -------- ");
8831501a 141 printf(" MeanPed[ADC%d] = %.1f ",t,fMeanPedestal[t]);
8af17dba 142 }
31af5828 143 printf("\n\n\n ####### Pedestal width values ####### \n");
144 for(int t=0; t<47; t++){
145 if(t==0 || t==24) printf("\n\t ZN HighRes -------- \n");
146 else if(t==5 || t==29) printf("\n\t ZN LowRes -------- \n");
147 else if(t==10 || t==34) printf("\n\t ZP HighRes -------- \n");
148 else if(t==15 || t==39) printf("\n\t ZP LowRes -------- \n");
149 else if(t==20) printf("\n\t ZEM1 HighRes -------- ");
150 else if(t==21) printf("\n\t ZEM1 LowRes -------- ");
151 else if(t==22) printf("\n\t ZEM2 HighRes -------- ");
152 else if(t==23) printf("\n\t ZEM2 LowRes -------- ");
153 printf(" MeanPed[ADC%d] = %.1f ",t,fMeanPedWidth[t]);
154 }
72bde173 155
156 printf("\n\n\n ####### Out Of Time pedestal values ####### \n");
157 for(int t=0; t<44; t++){
31af5828 158 if(t==0 || t==24) printf("\n\t ZN HighRes -------- \n");
159 else if(t==5 || t==29) printf("\n\t ZN LowRes -------- \n");
160 else if(t==10 || t==34) printf("\n\t ZP HighRes -------- \n");
161 else if(t==15 || t==39) printf("\n\t ZP LowRes -------- \n");
162 else if(t==20) printf("\n\t ZEM1 HighRes -------- ");
163 else if(t==21) printf("\n\t ZEM1 LowRes -------- ");
164 else if(t==22) printf("\n\t ZEM2 HighRes -------- ");
165 else if(t==23) printf("\n\t ZEM2 LowRes -------- ");
8831501a 166 printf(" OOTPed[ADC%d] = %.1f ",t,fOOTPedestal[t]);
8af17dba 167 }
72bde173 168
169 printf("\n\n\n ####### Energy calibration coefficients ####### \n");
31af5828 170 printf(" ZN1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[0]);
171 printf(" ZP1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[1]);
172 printf(" ZN2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[2]);
173 printf(" ZP2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[3]);
72bde173 174 printf(" ZEM1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[4]);
175 printf(" ZEM2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[5]);
8af17dba 176}
177
178//________________________________________________________________
179void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
180{
181 if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
72bde173 182 else for(int t=0; t<47; t++) fMeanPedestal[t] = 0.;
183}
8831501a 184//________________________________________________________________
185void AliZDCCalibData::SetMeanPedWidth(Float_t* MeanPedWidth)
186{
187 if(MeanPedWidth) for(int t=0; t<47; t++) fMeanPedWidth[t] = MeanPedWidth[t];
188 else for(int t=0; t<47; t++) fMeanPedWidth[t] = 0.;
189}
72bde173 190
191//________________________________________________________________
192void AliZDCCalibData::SetOOTPed(Float_t* OOTPed)
193{
194 if(OOTPed) for(int t=0; t<44; t++) fOOTPedestal[t] = OOTPed[t];
195 else for(int t=0; t<44; t++) fOOTPedestal[t] = 0.;
8af17dba 196}
197
198//________________________________________________________________
6a03966b 199void AliZDCCalibData::SetOOTPedWidth(Float_t* OOTPedWidth)
200{
201 if(OOTPedWidth) for(int t=0; t<44; t++) fOOTPedWidth[t] = OOTPedWidth[t];
202 else for(int t=0; t<44; t++) fOOTPedWidth[t] = 0.;
203}
204
205//________________________________________________________________
31af5828 206void AliZDCCalibData:: SetPedCorrCoeff(Float_t* PedCorrCoeff)
207{
208 // Set coefficients for pedestal correlations
209 if(PedCorrCoeff){
210 for(Int_t j=0; j<2; j++){
211 for(int t=0; t<44; t++)
212 fPedCorrCoeff[j][t] = PedCorrCoeff[t];
213 }
214 }
215 else{
216 for(Int_t j=0; j<2; j++){
217 for(int t=0; t<44; t++)
218 fPedCorrCoeff[j][t] = 0.;
219 }
220 }
221
222}
223
224//________________________________________________________________
225void AliZDCCalibData:: SetPedCorrCoeff(Float_t* PedCorrCoeff0, Float_t* PedCorrCoeff1)
8831501a 226{
8a2624cc 227 // Set coefficients for pedestal correlations
31af5828 228 if(PedCorrCoeff0 && PedCorrCoeff1){
229 for(int t=0; t<44; t++){
230 fPedCorrCoeff[0][t] = PedCorrCoeff0[t];
231 fPedCorrCoeff[0][t] = PedCorrCoeff1[t];
232 }
8831501a 233 }
31af5828 234 else{
235 for(int t=0; t<44; t++){
236 fPedCorrCoeff[0][t] = 0.;
237 fPedCorrCoeff[1][t] = 0.;
238 }
8831501a 239 }
31af5828 240
8831501a 241}
242
243//________________________________________________________________
8af17dba 244void AliZDCCalibData::SetEnCalib(Float_t* EnCalib)
245{
31af5828 246 // Set energy calibration coefficients
72bde173 247 if(EnCalib) for(int t=0; t<6; t++) fEnCalibration[t] = EnCalib[t];
248 else for(int t=0; t<6; t++) fEnCalibration[t] = 0.;
8af17dba 249}
250
31af5828 251//________________________________________________________________
252void AliZDCCalibData::SetPMTHVVal(Float_t* HVVal)
253{
254 // Set PMTs HV values
255 if(HVVal) for(int t=0; t<22; t++) fPMTHVVal[t] = HVVal[t];
256 else for(int t=0; t<22; t++) fPMTHVVal[t] = 0.;
257}
258
259//________________________________________________________________
260void AliZDCCalibData::SetZDCTablePos(Float_t* ZDCTablePos)
261{
262 // Set ZDC table vertical positions
263 if(ZDCTablePos) for(int t=0; t<4; t++) fZDCTablePos[t] = ZDCTablePos[t];
264 else for(int t=0; t<4; t++) fZDCTablePos[t] = 0.;
265}
266
267//________________________________________________________________
268void AliZDCCalibData::SetDCSCalibData(Float_t* DCSData)
269{
270 // Set all DCS data simultaneously
271 if(DCSData){
272 for(int t=0; t<4; t++) fZDCTablePos[t] = DCSData[t];
273 for(int t=4; t<26; t++) fPMTHVVal[t] = DCSData[t];
274 }
275 else{
276 for(int t=0; t<4; t++) fZDCTablePos[t] = 0.;
277 for(int t=4; t<26; t++) fPMTHVVal[t] = 0.;
278 }
279}