Fixes for coverity
[u/mrichter/AliRoot.git] / ZDC / AliZDCTowerCalib.cxx
CommitLineData
73bc3a3f 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: AliZDCTowerCalib.cxx 22045 2007-11-08 13:31:24Z coppedis $ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// class for ZDC calibration //
21// -> values for energy calibration and relative sector calibration //
22// //
23///////////////////////////////////////////////////////////////////////////////
24
25#include "AliZDCTowerCalib.h"
26
27ClassImp(AliZDCTowerCalib)
28
29//________________________________________________________________
30AliZDCTowerCalib::AliZDCTowerCalib():
31TNamed()
32{
33 Reset();
34}
35
36//________________________________________________________________
37AliZDCTowerCalib::AliZDCTowerCalib(const char* name):
38TNamed()
39{
40 // Constructor
41 TString namst = "Calib_";
42 namst += name;
43 SetName(namst.Data());
44 SetTitle(namst.Data());
45 Reset();
46 for(Int_t i=0; i<5; i++){
47 fZN1EqualCoeff[i] = 0.;
48 fZP1EqualCoeff[i] = 0.;
49 fZN2EqualCoeff[i] = 0.;
50 fZP2EqualCoeff[i] = 0.;
51 }
52}
53
54//________________________________________________________________
55AliZDCTowerCalib::AliZDCTowerCalib(const AliZDCTowerCalib& calibda) :
56 TNamed(calibda)
57{
58 // Copy constructor
59 SetName(calibda.GetName());
60 SetTitle(calibda.GetName());
61 Reset();
62 for(int i=0; i<5; i++){
63 fZN1EqualCoeff[i] = calibda.GetZN1EqualCoeff(i);
64 fZP1EqualCoeff[i] = calibda.GetZP1EqualCoeff(i);
65 fZN2EqualCoeff[i] = calibda.GetZN2EqualCoeff(i);
66 fZP2EqualCoeff[i] = calibda.GetZP2EqualCoeff(i);
67 }
68}
69
70//________________________________________________________________
71AliZDCTowerCalib &AliZDCTowerCalib::operator =(const AliZDCTowerCalib& calibda)
72{
73// assignment operator
74 SetName(calibda.GetName());
75 SetTitle(calibda.GetName());
76 Reset();
77 for(int i=0; i<5; i++){
78 fZN1EqualCoeff[i] = calibda.GetZN1EqualCoeff(i);
79 fZP1EqualCoeff[i] = calibda.GetZP1EqualCoeff(i);
80 fZN2EqualCoeff[i] = calibda.GetZN2EqualCoeff(i);
81 fZP2EqualCoeff[i] = calibda.GetZP2EqualCoeff(i);
82 }
83
84 return *this;
85}
86
87//________________________________________________________________
88AliZDCTowerCalib::~AliZDCTowerCalib()
89{
90}
91
92//________________________________________________________________
93void AliZDCTowerCalib::Reset()
94{
95 // Reset
96 memset(fZN1EqualCoeff,0,5*sizeof(Float_t));
97 memset(fZP1EqualCoeff,0,5*sizeof(Float_t));
98 memset(fZN2EqualCoeff,0,5*sizeof(Float_t));
99 memset(fZP2EqualCoeff,0,5*sizeof(Float_t));
100}
101
102
103//________________________________________________________________
104void AliZDCTowerCalib::Print(Option_t *) const
105{
106 // Printing of calibration object
107 printf("\n\n ####### Equalization coefficients ####### \n");
108 printf(" ZN1 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
109 fZN1EqualCoeff[0],fZN1EqualCoeff[1],fZN1EqualCoeff[2],fZN1EqualCoeff[3],fZN1EqualCoeff[4]);
110 printf(" ZP1 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
111 fZP1EqualCoeff[0],fZP1EqualCoeff[1],fZP1EqualCoeff[2],fZP1EqualCoeff[3],fZP1EqualCoeff[4]);
112 printf(" ZN2 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
113 fZN2EqualCoeff[0],fZN2EqualCoeff[1],fZN2EqualCoeff[2],fZN2EqualCoeff[3],fZN2EqualCoeff[4]);
114 printf(" ZP2 -> %1.2f %1.2f %1.2f %1.2f %1.2f \n",
115 fZP2EqualCoeff[0],fZP2EqualCoeff[1],fZP2EqualCoeff[2],fZP2EqualCoeff[3],fZP2EqualCoeff[4]);
116
117}
118
119//________________________________________________________________
120void AliZDCTowerCalib::SetZN1EqualCoeff(Float_t* EqualCoeff)
121{
122 // Set ZN1 equalization coefficients
123 if(EqualCoeff) for(int t=0; t<5; t++) fZN1EqualCoeff[t] = EqualCoeff[t];
124 else for(int t=0; t<5; t++) fZN1EqualCoeff[t] = 1.;
125}
126
127//________________________________________________________________
128void AliZDCTowerCalib::SetZP1EqualCoeff(Float_t* EqualCoeff)
129{
130 // Set ZP1 equalization coefficients
131 if(EqualCoeff) for(int t=0; t<5; t++) fZP1EqualCoeff[t] = EqualCoeff[t];
132 else for(int t=0; t<5; t++) fZP1EqualCoeff[t] = 1.;
133}
134//________________________________________________________________
135void AliZDCTowerCalib::SetZN2EqualCoeff(Float_t* EqualCoeff)
136{
137 // Set ZN2 equalization coefficients
138 if(EqualCoeff) for(int t=0; t<5; t++) fZN2EqualCoeff[t] = EqualCoeff[t];
139 else for(int t=0; t<5; t++) fZN2EqualCoeff[t] = 1.;
140}
141
142//________________________________________________________________
143void AliZDCTowerCalib::SetZP2EqualCoeff(Float_t* EqualCoeff)
144{
145 // Set ZN1 equalization coefficients
146 if(EqualCoeff) for(int t=0; t<5; t++) fZP2EqualCoeff[t] = EqualCoeff[t];
147 else for(int t=0; t<5; t++) fZP2EqualCoeff[t] = 1.;
148}
149