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