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