nano config for LHC10hx
[u/mrichter/AliRoot.git] / ZDC / AliZDCPedestals.cxx
CommitLineData
6024ec85 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 -> values for pedestal subtraction //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliZDCPedestals.h"
25
26ClassImp(AliZDCPedestals)
27
28//________________________________________________________________
29AliZDCPedestals::AliZDCPedestals():
30TNamed()
31{
32 Reset();
33}
34
35//________________________________________________________________
36AliZDCPedestals::AliZDCPedestals(const char* name):
37TNamed()
38{
39 // Constructor
40 TString namst = "Calib_";
41 namst += name;
42 SetName(namst.Data());
43 SetTitle(namst.Data());
44 Reset();
45 for(Int_t i=0; i<48; i++){
46 fMeanPedestal[i] = 0.;
47 fMeanPedWidth[i] = 0.;
48 fOOTPedestal[i] = 0.;
49 fOOTPedWidth[i] = 0.;
50 for(Int_t j=0; j<2; j++) fPedCorrCoeff[j][i] = 0.;
51 }
52
53
54}
55
56//________________________________________________________________
57AliZDCPedestals::AliZDCPedestals(const AliZDCPedestals& calibda) :
58 TNamed(calibda)
59{
60 // Copy constructor
61 SetName(calibda.GetName());
62 SetTitle(calibda.GetName());
63 Reset();
64 for(int t=0; t<48; t++){
65 fMeanPedestal[t] = calibda.GetMeanPed(t);
66 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
67 fOOTPedestal[t] = calibda.GetOOTPed(t);
68 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
69 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
70 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
71 }
72}
73
74//________________________________________________________________
75AliZDCPedestals &AliZDCPedestals::operator =(const AliZDCPedestals& calibda)
76{
77// assignment operator
78 SetName(calibda.GetName());
79 SetTitle(calibda.GetName());
80 Reset();
81 for(int t=0; t<48; t++){
82 fMeanPedestal[t] = calibda.GetMeanPed(t);
83 fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
84 fOOTPedestal[t] = calibda.GetOOTPed(t);
85 fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
86 fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
87 fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
88 }
89
90 return *this;
91}
92
93//________________________________________________________________
94AliZDCPedestals::~AliZDCPedestals()
95{
96}
97
98//________________________________________________________________
99void AliZDCPedestals::Reset()
100{
101 // Reset
102 memset(fMeanPedestal,0,48*sizeof(Float_t));
103 memset(fMeanPedWidth,0,48*sizeof(Float_t));
104 memset(fOOTPedestal,0,48*sizeof(Float_t));
105 memset(fOOTPedWidth,0,48*sizeof(Float_t));
106}
107
108
109//________________________________________________________________
110void AliZDCPedestals::Print(Option_t *) const
111{
112 // Printing of calibration object
113 printf("\n ####### In-time pedestal values (mean value, sigma) ####### \n");
114 for(int t=0; t<48; t++)
115 printf("\t ADC%d (%.1f, %.1f)\n",t,fMeanPedestal[t],fMeanPedWidth[t]);
116 //
117 printf("\n\n ####### Out-of-time pedestal values (mean value, sigma) ####### \n");
118 for(int t=0; t<48; t++)
119 printf("\t ADC-OoT%d (%.1f, %.1f)\n",t,fOOTPedestal[t],fOOTPedWidth[t]);
120
121}
122
123//________________________________________________________________
124void AliZDCPedestals::SetMeanPed(Float_t* MeanPed)
125{
126 if(MeanPed) for(int t=0; t<48; t++) fMeanPedestal[t] = MeanPed[t];
127 else for(int t=0; t<48; t++) fMeanPedestal[t] = 0.;
128}
129//________________________________________________________________
130void AliZDCPedestals::SetMeanPedWidth(Float_t* MeanPedWidth)
131{
132 if(MeanPedWidth) for(int t=0; t<48; t++) fMeanPedWidth[t] = MeanPedWidth[t];
133 else for(int t=0; t<48; t++) fMeanPedWidth[t] = 0.;
134}
135
136//________________________________________________________________
137void AliZDCPedestals::SetOOTPed(Float_t* OOTPed)
138{
139 if(OOTPed) for(int t=0; t<48; t++) fOOTPedestal[t] = OOTPed[t];
140 else for(int t=0; t<48; t++) fOOTPedestal[t] = 0.;
141}
142
143//________________________________________________________________
144void AliZDCPedestals::SetOOTPedWidth(Float_t* OOTPedWidth)
145{
146 if(OOTPedWidth) for(int t=0; t<48; t++) fOOTPedWidth[t] = OOTPedWidth[t];
147 else for(int t=0; t<48; t++) fOOTPedWidth[t] = 0.;
148}
149
150//________________________________________________________________
151void AliZDCPedestals:: SetPedCorrCoeff(Float_t* PedCorrCoeff)
152{
153 // Set coefficients for pedestal correlations
154 if(PedCorrCoeff){
155 for(Int_t j=0; j<2; j++){
156 for(int t=0; t<48; t++)
157 fPedCorrCoeff[j][t] = PedCorrCoeff[t];
158 }
159 }
160 else{
161 for(Int_t j=0; j<2; j++){
162 for(int t=0; t<48; t++)
163 fPedCorrCoeff[j][t] = 0.;
164 }
165 }
166
167}
168
169//________________________________________________________________
170void AliZDCPedestals:: SetPedCorrCoeff(Float_t* PedCorrCoeff0, Float_t* PedCorrCoeff1)
171{
172 // Set coefficients for pedestal correlations
173 if(PedCorrCoeff0 && PedCorrCoeff1){
174 for(int t=0; t<48; t++){
175 fPedCorrCoeff[0][t] = PedCorrCoeff0[t];
6e955f8b 176 fPedCorrCoeff[1][t] = PedCorrCoeff1[t];
6024ec85 177 }
178 }
179 else{
180 for(int t=0; t<48; t++){
181 fPedCorrCoeff[0][t] = 0.;
182 fPedCorrCoeff[1][t] = 0.;
183 }
184 }
185
186}