ALIROOT-5634 Install all needed files
[u/mrichter/AliRoot.git] / ZDC / AliZDCCalib.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 // -> values for energy calibration and relative sector calibration          //
22 //                                                                           //
23 ///////////////////////////////////////////////////////////////////////////////
24
25 #include "AliZDCCalib.h"
26
27 ClassImp(AliZDCCalib)
28
29 //________________________________________________________________
30 AliZDCCalib::AliZDCCalib():
31 TNamed()
32 {
33   Reset();
34 }
35
36 //________________________________________________________________
37 AliZDCCalib::AliZDCCalib(const char* name):
38 TNamed()
39 {
40   // Constructor
41   TString namst = "Calib_";
42   namst += name;
43   SetName(namst.Data());
44   SetTitle(namst.Data());
45   Reset();
46   for(Int_t i=0; i<6; i++){
47     fEnCalibration[i] = 0.;
48     if(i<5){
49       fZN1EqualCoeff[i] = 0.;
50       fZP1EqualCoeff[i] = 0.;
51       fZN2EqualCoeff[i] = 0.;
52       fZP2EqualCoeff[i] = 0.;
53     }
54   }
55 }
56
57 //________________________________________________________________
58 AliZDCCalib::AliZDCCalib(const AliZDCCalib& calibda) :
59   TNamed(calibda)
60 {
61   // Copy constructor
62   SetName(calibda.GetName());
63   SetTitle(calibda.GetName());
64   Reset();
65   for(int i=0; i<6; i++){
66     fEnCalibration[i] = calibda.GetEnCalib(i);
67     if(i<5){
68       fZN1EqualCoeff[i] =  calibda.GetZN1EqualCoeff(i);
69       fZP1EqualCoeff[i] =  calibda.GetZP1EqualCoeff(i);
70       fZN2EqualCoeff[i] =  calibda.GetZN2EqualCoeff(i);
71       fZP2EqualCoeff[i] =  calibda.GetZP2EqualCoeff(i);
72     }
73   }
74 }
75
76 //________________________________________________________________
77 AliZDCCalib &AliZDCCalib::operator =(const AliZDCCalib& calibda)
78 {
79 // assignment operator
80   SetName(calibda.GetName());
81   SetTitle(calibda.GetName());
82   Reset();
83   for(int i=0; i<6; i++){
84      fEnCalibration[i] = calibda.GetEnCalib(i);
85      if(i<5){
86       fZN1EqualCoeff[i] =  calibda.GetZN1EqualCoeff(i);
87       fZP1EqualCoeff[i] =  calibda.GetZP1EqualCoeff(i);
88       fZN2EqualCoeff[i] =  calibda.GetZN2EqualCoeff(i);
89       fZP2EqualCoeff[i] =  calibda.GetZP2EqualCoeff(i);
90      }
91   }
92   
93   return *this;
94 }
95
96 //________________________________________________________________
97 AliZDCCalib::~AliZDCCalib()
98 {
99 }
100
101 //________________________________________________________________
102 void AliZDCCalib::Reset()
103 {
104   // Reset
105   memset(fEnCalibration,0,6*sizeof(Float_t));
106   memset(fZN1EqualCoeff,0,5*sizeof(Float_t));
107   memset(fZP1EqualCoeff,0,5*sizeof(Float_t));
108   memset(fZN2EqualCoeff,0,5*sizeof(Float_t));
109   memset(fZP2EqualCoeff,0,5*sizeof(Float_t));
110 }                                                                                       
111
112
113 //________________________________________________________________
114 void  AliZDCCalib::Print(Option_t *) const
115 {
116    // Printing of calibration object
117    printf("\n\n ####### Energy calibration coefficients ####### \n");
118    printf("  ZN1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[0]);
119    printf("  ZP1 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[1]);
120    printf("  ZN2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[2]);
121    printf("  ZP2 = %.4f (E[TeV]/ADCch.) \n",fEnCalibration[3]);
122    printf("  ZEM1 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[4]);
123    printf("  ZEM2 = %.2f (E[TeV]/ADCch.) \n",fEnCalibration[5]);
124  
125    printf("\n\n ####### Equalization coefficients ####### \n");
126    printf("  ZN1 -> %1.2f %1.2f %1.2f %1.2f %1.2f  \n",
127     fZN1EqualCoeff[0],fZN1EqualCoeff[1],fZN1EqualCoeff[2],fZN1EqualCoeff[3],fZN1EqualCoeff[4]);
128    printf("  ZP1 -> %1.2f %1.2f %1.2f %1.2f %1.2f  \n",
129     fZP1EqualCoeff[0],fZP1EqualCoeff[1],fZP1EqualCoeff[2],fZP1EqualCoeff[3],fZP1EqualCoeff[4]);
130    printf("  ZN2 -> %1.2f %1.2f %1.2f %1.2f %1.2f  \n",
131     fZN2EqualCoeff[0],fZN2EqualCoeff[1],fZN2EqualCoeff[2],fZN2EqualCoeff[3],fZN2EqualCoeff[4]);
132    printf("  ZP2 -> %1.2f %1.2f %1.2f %1.2f %1.2f  \n",
133     fZP2EqualCoeff[0],fZP2EqualCoeff[1],fZP2EqualCoeff[2],fZP2EqualCoeff[3],fZP2EqualCoeff[4]);
134
135
136
137 //________________________________________________________________
138 void AliZDCCalib::SetEnCalib(Float_t* EnCalib) 
139 {
140   // Set energy calibration coefficients
141   if(EnCalib) for(int t=0; t<6; t++) fEnCalibration[t] = EnCalib[t];
142   else for(int t=0; t<6; t++) fEnCalibration[t] = 0.;
143 }
144
145 //________________________________________________________________
146 void AliZDCCalib::SetZN1EqualCoeff(Float_t* EqualCoeff)
147 {
148   // Set ZN1 equalization coefficients
149   if(EqualCoeff) for(int t=0; t<5; t++) fZN1EqualCoeff[t] = EqualCoeff[t];
150   else for(int t=0; t<5; t++) fZN1EqualCoeff[t] = 1.;
151 }
152  
153 //________________________________________________________________
154 void AliZDCCalib::SetZP1EqualCoeff(Float_t* EqualCoeff)
155 {
156   // Set ZP1 equalization coefficients
157   if(EqualCoeff) for(int t=0; t<5; t++) fZP1EqualCoeff[t] = EqualCoeff[t];
158   else for(int t=0; t<5; t++) fZP1EqualCoeff[t] = 1.;
159 }
160 //________________________________________________________________
161 void AliZDCCalib::SetZN2EqualCoeff(Float_t* EqualCoeff)
162 {
163   // Set ZN2 equalization coefficients
164   if(EqualCoeff) for(int t=0; t<5; t++) fZN2EqualCoeff[t] = EqualCoeff[t];
165   else for(int t=0; t<5; t++) fZN2EqualCoeff[t] = 1.;
166 }
167  
168 //________________________________________________________________
169 void AliZDCCalib::SetZP2EqualCoeff(Float_t* EqualCoeff)
170 {
171   // Set ZN1 equalization coefficients
172   if(EqualCoeff) for(int t=0; t<5; t++) fZP2EqualCoeff[t] = EqualCoeff[t];
173   else for(int t=0; t<5; t++) fZP2EqualCoeff[t] = 1.;
174 }
175