]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCCalibData.cxx
Deuteron production included in nuclear fragmentation
[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
8599f95e 46//________________________________________________________________
47AliZDCCalibData::AliZDCCalibData(const AliZDCCalibData& calibda) :
48 TNamed(calibda)
49{
50// copy constructor
51 SetName(calibda.GetName());
52 SetTitle(calibda.GetName());
53 Reset();
54 for(int t=0; t<47; t++) fMeanPedestal[t] = calibda.GetMeanPed(t);
55 for(int t=0; t<4; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
56 PrepHistos();
57}
58
59//________________________________________________________________
60AliZDCCalibData &AliZDCCalibData::operator =(const AliZDCCalibData& calibda)
61{
62// assignment operator
63 SetName(calibda.GetName());
64 SetTitle(calibda.GetName());
65 Reset();
66 for(int t=0; t<47; t++) fMeanPedestal[t] = calibda.GetMeanPed(t);
67 for(int t=0; t<4; t++) fEnCalibration[t] = calibda.GetEnCalib(t);
68 PrepHistos();
69 return *this;
70}
71
8af17dba 72//________________________________________________________________
73AliZDCCalibData::~AliZDCCalibData()
74{
75 CleanHistos();
76}
77
78//________________________________________________________________
79void AliZDCCalibData::Reset()
80{
81 memset(fMeanPedestal,0,47*sizeof(Float_t));
82 memset(fEnCalibration,0,4*sizeof(Float_t));
83}
84
85//________________________________________________________________
86void AliZDCCalibData::CleanHistos()
87{
88 if (fHistMeanPed) delete fHistMeanPed; fHistMeanPed = 0;
89}
90
91//________________________________________________________________
92void AliZDCCalibData::PrepHistos()
93{
8599f95e 94// CleanHistos(); // this gives a segm.viol!
95 Int_t kNChannels = 47;
96 Float_t kMaxPedVal = 47.;
8af17dba 97 TString hname = GetName(); hname += "_Pedestals";
98 fHistMeanPed = new TH1F(hname.Data(),hname.Data(),kNChannels,0.,kMaxPedVal);
8599f95e 99 for (int i=0; i<47; i++) {
8af17dba 100 fHistMeanPed->SetBinContent(i+1,GetMeanPed(i));
101 }
102}
103
104//________________________________________________________________
105void AliZDCCalibData::Print() const
106{
107 printf("\n ---- Mean pedestal values ----\n\n");
108 for(int t=0; t<47; t++){
109 printf(" MeanPed Value[ADC%d] = %f\n",t,fMeanPedestal[t]);
110 }
111
112 printf("\n ---- Energy calibration coefficients ----\n\n");
113 for(int t=0; t<4; t++){
114 printf(" En Calib Coeff. [ZDC%d] = %f\n",t,fEnCalibration[t]);
115 }
116}
117
118//________________________________________________________________
119void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
120{
121 if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
122 else for(int t=0; t<43; t++) fMeanPedestal[t] = 0.;
123}
124
125//________________________________________________________________
126void AliZDCCalibData::SetEnCalib(Float_t* EnCalib)
127{
128 if(EnCalib) for(int t=0; t<4; t++) fEnCalibration[t] = EnCalib[t];
129 else for(int t=0; t<4; t++) fEnCalibration[t] = 0.;
130}
131