]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCCalibData.cxx
Update of calibration procedures
[u/mrichter/AliRoot.git] / ZDC / AliZDCCalibData.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 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include "AliZDCCalibData.h"
25
26 ClassImp(AliZDCCalibData)
27
28 //________________________________________________________________
29 AliZDCCalibData::AliZDCCalibData()
30 {
31   fHistMeanPed=0;
32   Reset();
33 }
34
35 //________________________________________________________________
36 AliZDCCalibData::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 //________________________________________________________________
47 AliZDCCalibData::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 //________________________________________________________________
60 AliZDCCalibData &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
72 //________________________________________________________________
73 AliZDCCalibData::~AliZDCCalibData()
74 {
75   CleanHistos();
76 }
77
78 //________________________________________________________________
79 void AliZDCCalibData::Reset()
80 {
81   memset(fMeanPedestal,0,47*sizeof(Float_t));
82   memset(fEnCalibration,0,4*sizeof(Float_t));
83 }                                                                                       
84
85 //________________________________________________________________
86 void AliZDCCalibData::CleanHistos()
87 {
88   if (fHistMeanPed) delete fHistMeanPed; fHistMeanPed = 0;
89 }
90
91 //________________________________________________________________
92 void AliZDCCalibData::PrepHistos()
93 {
94 //  CleanHistos(); // this gives a segm.viol!
95   Int_t   kNChannels = 47;
96   Float_t kMaxPedVal = 47.;
97   TString hname = GetName();  hname += "_Pedestals";
98   fHistMeanPed = new TH1F(hname.Data(),hname.Data(),kNChannels,0.,kMaxPedVal);
99   for(int i=0; i<47; i++)  fHistMeanPed->SetBinContent(i+1,GetMeanPed(i));
100 }
101
102 //________________________________________________________________
103 void  AliZDCCalibData::Print(Option_t *) const
104 {
105    printf("\n   ----    Mean pedestal values    ----\n\n");
106    for(int t=0; t<47; t++){
107      if(t==0 || t==24) printf("\t ZN HighRes -------- ");
108      else if(t==5 || t==29) printf("\t ZN LowRes -------- ");
109      else if(t==10 || t==34) printf("\t ZP HighRes -------- ");
110      else if(t==15 || t==39) printf("\t ZP LowRes -------- ");
111      else if(t==20) printf("\t ZEM1 HighRes -------- ");
112      else if(t==21) printf("\t ZEM1 LowRes -------- ");
113      else if(t==22) printf("\t ZEM2 HighRes -------- ");
114      else if(t==23) printf("\t ZEM2 LowRes -------- ");
115      printf("\t MeanPed[ADC%d] = %.1f\n",t,fMeanPedestal[t]);
116    }
117  
118    printf("\n   ----    Energy calibration coefficients         ----\n\n");
119    for(int t=0; t<3; t++){
120       printf("  En Calib Coeff. [ZDC%d] = %f\n",t,fEnCalibration[t]);
121    }
122
123
124 //________________________________________________________________
125 void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
126 {
127   if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
128   else for(int t=0; t<43; t++) fMeanPedestal[t] = 0.;
129 }
130
131 //________________________________________________________________
132 void AliZDCCalibData::SetEnCalib(Float_t* EnCalib) 
133 {
134   if(EnCalib) for(int t=0; t<4; t++) fEnCalibration[t] = EnCalib[t];
135   else for(int t=0; t<4; t++) fEnCalibration[t] = 0.;
136 }
137