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