Updating eta storing
[u/mrichter/AliRoot.git] / ZDC / AliZDCTDCCalib.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: AliZDCTDCCalib.cxx 46092 2010-12-16 13:18:21Z coppedis $ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 // class for ZDC calibration  -> values for TDC offset calibration           //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include "AliZDCTDCCalib.h"
25
26 ClassImp(AliZDCTDCCalib)
27
28 //________________________________________________________________
29 AliZDCTDCCalib::AliZDCTDCCalib():
30 TNamed()
31 {
32   Reset();
33 }
34
35 //________________________________________________________________
36 AliZDCTDCCalib::AliZDCTDCCalib(const char* name):
37 TNamed()
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<6; i++){
46     fMeanTDC[i] = 0.;
47     fWidthTDC[i] = 0.;
48   }
49   
50   
51 }
52
53 //________________________________________________________________
54 AliZDCTDCCalib::AliZDCTDCCalib(const AliZDCTDCCalib& calibda) :
55   TNamed(calibda)
56 {
57   // Copy constructor
58   SetName(calibda.GetName());
59   SetTitle(calibda.GetName());
60   Reset();
61   for(int t=0; t<6; t++){
62      fMeanTDC[t] = calibda.GetMeanTDC(t);
63      fWidthTDC[t] = calibda.GetWidthTDC(t);
64   }
65 }
66
67 //________________________________________________________________
68 AliZDCTDCCalib &AliZDCTDCCalib::operator =(const AliZDCTDCCalib& calibda)
69 {
70 // assignment operator
71   SetName(calibda.GetName());
72   SetTitle(calibda.GetName());
73   Reset();
74   for(int t=0; t<6; t++){
75      fMeanTDC[t] = calibda.GetMeanTDC(t);
76      fWidthTDC[t] = calibda.GetWidthTDC(t);
77   }
78
79   return *this;
80 }
81
82 //________________________________________________________________
83 AliZDCTDCCalib::~AliZDCTDCCalib()
84 {
85 }
86
87 //________________________________________________________________
88 void AliZDCTDCCalib::Reset()
89 {
90   // Reset
91   memset(fMeanTDC,0,6*sizeof(Float_t));
92   memset(fWidthTDC,0,6*sizeof(Float_t));
93 }                                                                                       
94
95
96 //________________________________________________________________
97 void  AliZDCTDCCalib::Print(Option_t *) const
98 {
99    // Printing of calibration object
100    printf("\n ####### TDC calibration values ####### \n");
101    for(int t=0; t<6; t++) 
102       printf("\t ch.%d (%f, %f)\n",t,fMeanTDC[t],fWidthTDC[t]);
103  
104
105
106 //________________________________________________________________
107 void AliZDCTDCCalib::SetMeanTDC(Float_t* mean)
108 {
109   if(mean) for(int t=0; t<6; t++) fMeanTDC[t] = mean[t];
110   else for(int t=0; t<6; t++) fMeanTDC[t] = 0.;
111 }
112 //________________________________________________________________
113 void AliZDCTDCCalib::SetWidthTDC(Float_t* width)
114 {
115   if(width) for(int t=0; t<6; t++) fWidthTDC[t] = width[t];
116   else for(int t=0; t<6; t++) fWidthTDC[t] = 0.;
117 }