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