RAWDATA closer to reality
[u/mrichter/AliRoot.git] / ZDC / AliZDCCalibData.cxx
CommitLineData
8af17dba 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
26ClassImp(AliZDCCalibData)
27
28//________________________________________________________________
29AliZDCCalibData::AliZDCCalibData()
30{
31 fHistMeanPed=0;
32 Reset();
33}
34
35//________________________________________________________________
36AliZDCCalibData::AliZDCCalibData(const char* name)
37{
38 TString namst = "Calib_";
39 namst += name;
40 SetName(namst.Data());
41 SetTitle(namst.Data());
42 fHistMeanPed=0;
43 Reset();
44}
45
46//________________________________________________________________
47AliZDCCalibData::~AliZDCCalibData()
48{
49 CleanHistos();
50}
51
52//________________________________________________________________
53void AliZDCCalibData::Reset()
54{
55 memset(fMeanPedestal,0,47*sizeof(Float_t));
56 memset(fEnCalibration,0,4*sizeof(Float_t));
57}
58
59//________________________________________________________________
60void AliZDCCalibData::CleanHistos()
61{
62 if (fHistMeanPed) delete fHistMeanPed; fHistMeanPed = 0;
63}
64
65//________________________________________________________________
66void AliZDCCalibData::PrepHistos()
67{
68 CleanHistos();
69 Int_t kNChannels = 100;
70 Float_t kMaxPedVal = 400.;
71 TString hname = GetName(); hname += "_Pedestals";
72 fHistMeanPed = new TH1F(hname.Data(),hname.Data(),kNChannels,0.,kMaxPedVal);
73 for (int i=0; i<64; i++) {
74 fHistMeanPed->SetBinContent(i+1,GetMeanPed(i));
75 }
76}
77
78//________________________________________________________________
79void AliZDCCalibData::Print() const
80{
81 printf("\n ---- Mean pedestal values ----\n\n");
82 for(int t=0; t<47; t++){
83 printf(" MeanPed Value[ADC%d] = %f\n",t,fMeanPedestal[t]);
84 }
85
86 printf("\n ---- Energy calibration coefficients ----\n\n");
87 for(int t=0; t<4; t++){
88 printf(" En Calib Coeff. [ZDC%d] = %f\n",t,fEnCalibration[t]);
89 }
90}
91
92//________________________________________________________________
93void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
94{
95 if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
96 else for(int t=0; t<43; t++) fMeanPedestal[t] = 0.;
97}
98
99//________________________________________________________________
100void AliZDCCalibData::SetEnCalib(Float_t* EnCalib)
101{
102 if(EnCalib) for(int t=0; t<4; t++) fEnCalibration[t] = EnCalib[t];
103 else for(int t=0; t<4; t++) fEnCalibration[t] = 0.;
104}
105