Coverity fix
[u/mrichter/AliRoot.git] / PHOS / AliPHOSCpvCalibData.cxx
CommitLineData
fc6706cb 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
17///////////////////////////////////////////////////////////////////////////////
18// //
19// class for CPV calibration. //
20// Author: Boris Polichtchouk (Boris.Polichtchouk@cern.ch). //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliPHOSCpvCalibData.h"
25
26ClassImp(AliPHOSCpvCalibData)
27
28//________________________________________________________________
29 AliPHOSCpvCalibData::AliPHOSCpvCalibData() : TNamed()
30{
31 // Default constructor
32 Reset();
33}
34
35//________________________________________________________________
36AliPHOSCpvCalibData::AliPHOSCpvCalibData(const char* name)
37{
38 // Constructor
39 TString namst = "CalibCPV_";
40 namst += name;
41 SetName(namst.Data());
42 SetTitle(namst.Data());
43 Reset();
44}
45
46//________________________________________________________________
47AliPHOSCpvCalibData::AliPHOSCpvCalibData(const AliPHOSCpvCalibData& calibda) :
48 TNamed(calibda)
49{
50 // copy constructor
51 SetName(calibda.GetName());
52 SetTitle(calibda.GetName());
53 Reset();
54 for(Int_t module=0; module<5; module++) {
1fdb1c5e 55 for(Int_t column=0; column<56; column++) {
fc6706cb 56 for(Int_t row=0; row<128; row++) {
57 fADCchannelCpv[module][column][row] = calibda.GetADCchannelCpv(module,column,row);
58 fADCpedestalCpv[module][column][row] = calibda.GetADCpedestalCpv(module,column,row);
59 }
60 }
61 }
62}
63
64//________________________________________________________________
65AliPHOSCpvCalibData &AliPHOSCpvCalibData::operator =(const AliPHOSCpvCalibData& calibda)
66{
67 // assignment operator
68 SetName(calibda.GetName());
69 SetTitle(calibda.GetName());
70 Reset();
71 for(Int_t module=0; module<5; module++) {
1fdb1c5e 72 for(Int_t column=0; column<56; column++) {
fc6706cb 73 for(Int_t row=0; row<128; row++) {
74 fADCchannelCpv[module][column][row] = calibda.GetADCchannelCpv(module,column,row);
75 fADCpedestalCpv[module][column][row] = calibda.GetADCpedestalCpv(module,column,row);
76 }
77 }
78 }
79 return *this;
80}
81
82//________________________________________________________________
83AliPHOSCpvCalibData::~AliPHOSCpvCalibData()
84{
85 // Destructor
86}
87
88//________________________________________________________________
89void AliPHOSCpvCalibData::Reset()
90{
1fdb1c5e 91 // Set all pedestals and all ADC channels to its default (ideal) values.
fc6706cb 92
93 for (Int_t module=0; module<5; module++){
1fdb1c5e 94 for (Int_t column=0; column<56; column++){
fc6706cb 95 for (Int_t row=0; row<128; row++){
96 fADCpedestalCpv[module][column][row] = 0.012;
97 fADCchannelCpv[module][column][row] = 0.0012;
98 }
99 }
100 }
101
102}
103
104//________________________________________________________________
105void AliPHOSCpvCalibData::Print(Option_t *option) const
106{
107 // Print tables of pedestals and ADC channels
108
109 if (strstr(option,"ped")) {
110 printf("\n ---- Pedestal values ----\n\n");
111 for (Int_t module=0; module<5; module++){
112 printf("============== Module %d\n",module+1);
1fdb1c5e 113 for (Int_t column=0; column<56; column++){
fc6706cb 114 for (Int_t row=0; row<128; row++){
115 printf("%4.1f",fADCpedestalCpv[module][column][row]);
116 }
117 printf("\n");
118 }
119 }
120 }
121
122 if (strstr(option,"gain")) {
123 printf("\n ---- ADC channel values ----\n\n");
124 for (Int_t module=0; module<5; module++){
125 printf("============== Module %d\n",module+1);
1fdb1c5e 126 for (Int_t column=0; column<56; column++){
fc6706cb 127 for (Int_t row=0; row<128; row++){
128 printf("%4.1f",fADCchannelCpv[module][column][row]);
129 }
130 printf("\n");
131 }
132 }
133 }
134}
135
1fdb1c5e 136//________________________________________________________________
fc6706cb 137Float_t AliPHOSCpvCalibData::GetADCchannelCpv(Int_t module, Int_t column, Int_t row) const
138{
1fdb1c5e 139 //Return CPV calibration coefficient
fc6706cb 140 //module, column,raw should follow the internal PHOS convention:
1fdb1c5e 141 //module 1:5, column 1:56, row 1:128.
fc6706cb 142
143 return fADCchannelCpv[module-1][column-1][row-1];
144}
145
1fdb1c5e 146//________________________________________________________________
fc6706cb 147Float_t AliPHOSCpvCalibData::GetADCpedestalCpv(Int_t module, Int_t column, Int_t row) const
148{
1fdb1c5e 149 //Return CPV pedestal
150 //module, column,raw should follow the internal PHOS convention:
151 //module 1:5, column 1:56, row 1:128.
fc6706cb 152 return fADCpedestalCpv[module-1][column-1][row-1];
153}
154
1fdb1c5e 155//________________________________________________________________
fc6706cb 156void AliPHOSCpvCalibData::SetADCchannelCpv(Int_t module, Int_t column, Int_t row, Float_t value)
157{
1fdb1c5e 158 //Set CPV calibration coefficient
159 //module, column,raw should follow the internal PHOS convention:
160 //module 1:5, column 1:56, row 1:128.
fc6706cb 161 fADCchannelCpv[module-1][column-1][row-1] = value;
162}
163
1fdb1c5e 164//________________________________________________________________
fc6706cb 165void AliPHOSCpvCalibData::SetADCpedestalCpv(Int_t module, Int_t column, Int_t row, Float_t value)
166{
1fdb1c5e 167 //Set CPV pedestal
168 //module, column,raw should follow the internal PHOS convention:
169 //module 1:5, column 1:56, row 1:128.
fc6706cb 170 fADCpedestalCpv[module-1][column-1][row-1] = value;
171}