ATO-98 - function returns also status value
[u/mrichter/AliRoot.git] / PMD / AliPMDCalibData.cxx
CommitLineData
06810de6 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// Author : Z. Ahmed
17//
18#include "TNamed.h"
19#include "AliCDBEntry.h"
20#include "AliPMD.h"
21#include "AliPMDCalibData.h"
22
23
24ClassImp(AliPMDCalibData)
25
26AliPMDCalibData::AliPMDCalibData()
27{
28 // Default constructor
29 Reset();
30}
31// ----------------------------------------------------------------- //
32AliPMDCalibData::AliPMDCalibData(const char* name)
33{
34 //constructor
35 TString namst = "Calib_";
36 namst += name;
37 SetName(namst.Data());
38 SetTitle(namst.Data());
39 Reset();
40
41}
42// ----------------------------------------------------------------- //
43AliPMDCalibData::AliPMDCalibData(const AliPMDCalibData& calibda) :
44 TNamed(calibda)
45{
46 // copy constructor
47 SetName(calibda.GetName());
48 SetTitle(calibda.GetName());
49 Reset();
35535af7 50 for(Int_t det = 0; det < kDet; det++)
51 {
52 for(Int_t smn = 0; smn < kModule; smn++)
53 {
54 for(Int_t row = 0; row < kRow; row++)
55 {
56 for(Int_t col = 0; col < kCol; col++)
57 {
58 fGainFact[det][smn][row][col] =
59 calibda.GetGainFact(det,smn,row,col);
60 }
61 }
06810de6 62 }
06810de6 63 }
64}
65// ----------------------------------------------------------------- //
66AliPMDCalibData &AliPMDCalibData::operator =(const AliPMDCalibData& calibda)
67{
68 //asignment operator
69 SetName(calibda.GetName());
70 SetTitle(calibda.GetName());
71 Reset();
35535af7 72 for(Int_t det = 0; det < kDet; det++)
73 {
74 for(Int_t smn = 0; smn < kModule; smn++)
75 {
76 for(Int_t row = 0; row < kRow; row++)
77 {
78 for(Int_t col = 0; col < kCol; col++)
79 {
80 fGainFact[det][smn][row][col] =
81 calibda.GetGainFact(det,smn,row,col);
82 }
83 }
06810de6 84 }
06810de6 85 }
86 return *this;
87}
88// ----------------------------------------------------------------- //
89AliPMDCalibData::~AliPMDCalibData()
90{
91 //destructor
92}
93// ----------------------------------------------------------------- //
94void AliPMDCalibData::Reset()
95{
35535af7 96 //memset(fgainfact ,1,2*24*48*96*sizeof(Float_t));
97
98 for(Int_t det = 0; det < kDet; det++)
99 {
100 for(Int_t smn = 0; smn < kModule; smn++)
101 {
102 for(Int_t row = 0; row < kRow; row++)
103 {
104 for(Int_t col = 0; col < kCol; col++)
105 {
050c314f 106 fGainFact[det][smn][row][col] = 1.0;
35535af7 107 }
108 }
06810de6 109 }
06810de6 110 }
111}
112// ----------------------------------------------------------------- //
113Float_t AliPMDCalibData:: GetGainFact(Int_t det, Int_t smn, Int_t row, Int_t col) const
114{
115 return fGainFact[det][smn][row][col];
116}
117// ----------------------------------------------------------------- //
118void AliPMDCalibData::SetGainFact(Int_t det, Int_t smn, Int_t row, Int_t col, Float_t gain)
119{
120 fGainFact[det][smn][row][col]= gain;
121}
122
123// ----------------------------------------------------------------- //
124void AliPMDCalibData::Print(Option_t *) const
125{
126 printf("\n ######gain factors for each cells are ####\n");
35535af7 127 for(Int_t det = 0; det < kDet; det++)
06810de6 128 {
35535af7 129 for(Int_t smn = 0; smn < kModule; smn++)
06810de6 130 {
35535af7 131 for(Int_t row = 0; row < kRow; row++)
06810de6 132 {
35535af7 133 for(Int_t col = 0; col < kCol; col++)
06810de6 134 {
35535af7 135 printf("Gain[%d,%d,%d,%d]= %4.1f \n",det,smn,row,col,
136 fGainFact[det][smn][row][col]);
06810de6 137 }
138 printf("\n");
139 }
140 }
141 }
142}