Update to new class names
[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{
31 fHistMeanPed=0;
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());
42 fHistMeanPed=0;
43 Reset();
44}
45
8599f95e 46//________________________________________________________________
47AliZDCCalibData::AliZDCCalibData(const AliZDCCalibData& calibda) :
48 TNamed(calibda)
49{
50// copy constructor
51 SetName(calibda.GetName());
52 SetTitle(calibda.GetName());
53 Reset();
72bde173 54 for(int t=0; t<47; t++) fMeanPedestal[t] = calibda.GetMeanPed(t);
55 for(int t=0; t<44; t++) fOOTPedestal[t] = calibda.GetOOTPed(t);
56 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
8599f95e 57 PrepHistos();
58}
59
60//________________________________________________________________
61AliZDCCalibData &AliZDCCalibData::operator =(const AliZDCCalibData& calibda)
62{
63// assignment operator
64 SetName(calibda.GetName());
65 SetTitle(calibda.GetName());
66 Reset();
67 for(int t=0; t<47; t++) fMeanPedestal[t] = calibda.GetMeanPed(t);
72bde173 68 for(int t=0; t<44; t++) fOOTPedestal[t] = calibda.GetOOTPed(t);
69 for(int t=0; t<6; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
8599f95e 70 PrepHistos();
71 return *this;
72}
73
8af17dba 74//________________________________________________________________
75AliZDCCalibData::~AliZDCCalibData()
76{
77 CleanHistos();
78}
79
80//________________________________________________________________
81void AliZDCCalibData::Reset()
82{
83 memset(fMeanPedestal,0,47*sizeof(Float_t));
72bde173 84 memset(fOOTPedestal,0,44*sizeof(Float_t));
85 memset(fEnCalibration,0,6*sizeof(Float_t));
8af17dba 86}
87
88//________________________________________________________________
89void AliZDCCalibData::CleanHistos()
90{
91 if (fHistMeanPed) delete fHistMeanPed; fHistMeanPed = 0;
92}
93
94//________________________________________________________________
95void AliZDCCalibData::PrepHistos()
96{
8599f95e 97// CleanHistos(); // this gives a segm.viol!
98 Int_t kNChannels = 47;
99 Float_t kMaxPedVal = 47.;
8af17dba 100 TString hname = GetName(); hname += "_Pedestals";
78d18275 101 fHistMeanPed = new TH1F(hname.Data(),hname.Data(),kNChannels,0.,kMaxPedVal);
102 for(int i=0; i<47; i++) fHistMeanPed->SetBinContent(i+1,GetMeanPed(i));
8af17dba 103}
104
105//________________________________________________________________
5bc762ca 106void AliZDCCalibData::Print(Option_t *) const
8af17dba 107{
72bde173 108 printf("\n ####### Mean pedestal values ####### \n");
8af17dba 109 for(int t=0; t<47; t++){
72bde173 110 if(t==0 || t==24) printf("\n\t -------- ZN HighRes -------- \n");
111 else if(t==5 || t==29) printf("\n\t -------- ZN LowRes -------- \n");
112 else if(t==10 || t==34) printf("\n\t -------- ZP HighRes -------- \n");
113 else if(t==15 || t==39) printf("\n\t -------- ZP LowRes -------- \n");
114 else if(t==20) printf("\n\t -------- ZEM1 HighRes -------- ");
115 else if(t==21) printf("\n\t -------- ZEM1 LowRes -------- ");
116 else if(t==22) printf("\n\t -------- ZEM2 HighRes -------- ");
117 else if(t==23) printf("\n\t -------- ZEM2 LowRes -------- ");
118 printf(" MeanPed[ADC%d] = %.1f \t",t,fMeanPedestal[t]);
8af17dba 119 }
72bde173 120
121 printf("\n\n\n ####### Out Of Time pedestal values ####### \n");
122 for(int t=0; t<44; t++){
123 if(t==0 || t==24) printf("\n\t -------- ZN HighRes -------- \n");
124 else if(t==5 || t==29) printf("\n\t -------- ZN LowRes -------- \n");
125 else if(t==10 || t==34) printf("\n\t -------- ZP HighRes -------- \n");
126 else if(t==15 || t==39) printf("\n\t -------- ZP LowRes -------- \n");
127 else if(t==20) printf("\n\t -------- ZEM1 HighRes -------- ");
128 else if(t==21) printf("\n\t -------- ZEM1 LowRes -------- ");
129 else if(t==22) printf("\n\t -------- ZEM2 HighRes -------- ");
130 else if(t==23) printf("\n\t -------- ZEM2 LowRes -------- ");
131 printf(" OOTPed[ADC%d] = %.1f \t",t,fOOTPedestal[t]);
8af17dba 132 }
72bde173 133
134 printf("\n\n\n ####### Energy calibration coefficients ####### \n");
135 printf(" ZN1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[0]);
136 printf(" ZP1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[1]);
137 printf(" ZN2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[2]);
138 printf(" ZP2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[3]);
139 printf(" ZEM1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[4]);
140 printf(" ZEM2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[5]);
8af17dba 141}
142
143//________________________________________________________________
144void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
145{
146 if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
72bde173 147 else for(int t=0; t<47; t++) fMeanPedestal[t] = 0.;
148}
149
150//________________________________________________________________
151void AliZDCCalibData::SetOOTPed(Float_t* OOTPed)
152{
153 if(OOTPed) for(int t=0; t<44; t++) fOOTPedestal[t] = OOTPed[t];
154 else for(int t=0; t<44; t++) fOOTPedestal[t] = 0.;
8af17dba 155}
156
157//________________________________________________________________
158void AliZDCCalibData::SetEnCalib(Float_t* EnCalib)
159{
72bde173 160 if(EnCalib) for(int t=0; t<6; t++) fEnCalibration[t] = EnCalib[t];
161 else for(int t=0; t<6; t++) fEnCalibration[t] = 0.;
8af17dba 162}
163