]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSCalibData.cxx
Including TFile.h
[u/mrichter/AliRoot.git] / PHOS / AliPHOSCalibData.cxx
CommitLineData
52783dbc 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 PHOS calibration //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliPHOSCalibData.h"
25
26ClassImp(AliPHOSCalibData)
27
28//________________________________________________________________
29AliPHOSCalibData::AliPHOSCalibData()
30{
31 // Default constructor
32 Reset();
33}
34
35//________________________________________________________________
36AliPHOSCalibData::AliPHOSCalibData(const char* name)
37{
38 // Constructor
39 TString namst = "Calib_";
40 namst += name;
41 SetName(namst.Data());
42 SetTitle(namst.Data());
43 Reset();
44}
45
46//________________________________________________________________
47AliPHOSCalibData::AliPHOSCalibData(const AliPHOSCalibData& 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++) {
072de3a8 55 for(Int_t column=0; column<56; column++) {
52783dbc 56 for(Int_t row=0; row<64; row++) {
57 fADCchannelEmc[module][column][row] = calibda.GetADCchannelEmc(module,column,row);
58 fADCpedestalEmc[module][column][row] = calibda.GetADCpedestalEmc(module,column,row);
59 }
60 }
61 }
62}
63
64//________________________________________________________________
65AliPHOSCalibData &AliPHOSCalibData::operator =(const AliPHOSCalibData& calibda)
66{
67 // assignment operator
68 SetName(calibda.GetName());
69 SetTitle(calibda.GetName());
70 Reset();
71 for(Int_t module=0; module<5; module++) {
072de3a8 72 for(Int_t column=0; column<56; column++) {
52783dbc 73 for(Int_t row=0; row<64; row++) {
74 fADCchannelEmc[module][column][row] = calibda.GetADCchannelEmc(module,column,row);
75 fADCpedestalEmc[module][column][row] = calibda.GetADCpedestalEmc(module,column,row);
76 }
77 }
78 }
79 return *this;
80}
81
82//________________________________________________________________
83AliPHOSCalibData::~AliPHOSCalibData()
84{
85 // Destructor
86}
87
88//________________________________________________________________
89void AliPHOSCalibData::Reset()
90{
91 // Set all pedestals to 0 and all ADC channels to 1
072de3a8 92 memset(fADCchannelEmc ,1,5*64*56*sizeof(Float_t));
93 memset(fADCpedestalEmc,0,5*64*56*sizeof(Float_t));
52783dbc 94}
95
96//________________________________________________________________
97void AliPHOSCalibData::Print(Option_t *option) const
98{
99 // Print tables of pedestals and ADC channels
100
13a9232b 101 if (strstr(option,"ped")) {
52783dbc 102 printf("\n ---- Pedestal values ----\n\n");
103 for (Int_t module=0; module<5; module++){
104 printf("============== Module %d\n",module+1);
072de3a8 105 for (Int_t column=0; column<56; column++){
52783dbc 106 for (Int_t row=0; row<64; row++){
107 printf("%4.1f",fADCpedestalEmc[module][column][row]);
108 }
109 printf("\n");
110 }
111 }
112 }
113
13a9232b 114 if (strstr(option,"gain")) {
52783dbc 115 printf("\n ---- ADC channel values ----\n\n");
116 for (Int_t module=0; module<5; module++){
117 printf("============== Module %d\n",module+1);
072de3a8 118 for (Int_t column=0; column<56; column++){
52783dbc 119 for (Int_t row=0; row<64; row++){
120 printf("%4.1f",fADCchannelEmc[module][column][row]);
121 }
122 printf("\n");
123 }
124 }
125 }
126}
072de3a8 127
128Float_t AliPHOSCalibData::GetADCchannelEmc(Int_t module, Int_t column, Int_t row) const
129{
130 //module, column,raw should follow the internal PHOS convention:
131 //module 1:5, column 1:56, row 1:64
132
133 return fADCchannelEmc[module-1][column-1][row-1];
134}
135
136Float_t AliPHOSCalibData::GetADCpedestalEmc(Int_t module, Int_t column, Int_t row) const
137{
138 return fADCpedestalEmc[module-1][column-1][row-1];
139}
140
141void AliPHOSCalibData::SetADCchannelEmc(Int_t module, Int_t column, Int_t row, Float_t value)
142{
143 fADCchannelEmc[module-1][column-1][row-1] = value;
144}
145
146void AliPHOSCalibData::SetADCpedestalEmc(Int_t module, Int_t column, Int_t row, Float_t value)
147{
148 fADCpedestalEmc[module-1][column-1][row-1] = value;
149}