]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSEmcCalibData.cxx
- changes to make the clusterisation work for EMCAL
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSEmcCalibData.cxx
1 // $Id$
2
3 /**************************************************************************
4  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Author: The ALICE Off-line Project.                                    *
7  * Contributors are mentioned in the code where appropriate.              *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  * 
16  *                                                                        *
17  * 7/1- 2007                                                              *
18  * Author: Per Thomas Hille                                               *
19  * code modified to include the two differnt gains of each detection      *
20  * channel and also to include the Pedestals loaded into the ALTRO        * 
21  * registers for basline subtraction and zero supression                  * 
22  *                                                                        *
23  *                                                                        * 
24  **************************************************************************/
25
26 ///////////////////////////////////////////////////////////////////////////////
27 //                                                                           //
28 // class for PHOS EmCal calibration                                          //
29 //                                                                           //
30 ///////////////////////////////////////////////////////////////////////////////
31
32 #include "AliHLTPHOSEmcCalibData.h"
33
34 ClassImp(AliHLTPHOSEmcCalibData)
35
36 //________________________________________________________________
37   AliHLTPHOSEmcCalibData::AliHLTPHOSEmcCalibData(): TNamed()
38 {
39   // Default constructor
40   Reset();
41 }
42
43 //________________________________________________________________
44 AliHLTPHOSEmcCalibData::AliHLTPHOSEmcCalibData(const char* name)
45 {
46   // Constructor
47   TString namst = "Calib_";
48   namst += name;
49   SetName(namst.Data());
50   SetTitle(namst.Data());
51   Reset();
52 }
53
54 //________________________________________________________________
55 AliHLTPHOSEmcCalibData::AliHLTPHOSEmcCalibData(const AliHLTPHOSEmcCalibData& calibda) :
56   TNamed(calibda)
57 {
58   // copy constructor
59   SetName(calibda.GetName());
60   SetTitle(calibda.GetName());
61
62
63   //  for(Int_t gain = 0; gain < N_GAINS; gain ++){
64   for(Int_t module=0; module<NMODULES; module++) {
65     for(Int_t column=0; column< NXCOLUMNSMOD; column++) {
66       for(Int_t row=0; row<NZROWSMOD; row++) {
67         for(Int_t gain = 0; gain < NGAINS; gain ++){
68           fADCchannelEnergy[module][column][row][gain] =  calibda.fADCchannelEnergy[module][column][row][gain];
69           fADCpedestalEmcMeasured[module][column][row][gain] = calibda.fADCpedestalEmcMeasured[module][column][row][gain];
70         }
71       }  
72     }
73   }
74 }
75
76 //________________________________________________________________
77 AliHLTPHOSEmcCalibData &AliHLTPHOSEmcCalibData::operator =(const AliHLTPHOSEmcCalibData& calibda)
78 {
79   // assignment operator
80
81   if(this != &calibda) { 
82
83     SetName(calibda.GetName());
84     SetTitle(calibda.GetName());
85     //    for(Int_t gain = 0; gain < N_GAINS; gain ++){
86     for(Int_t module=0; module<NMODULES; module++) {
87       for(Int_t column=0; column< NXCOLUMNSMOD; column++) {
88         for(Int_t row=0; row<NZROWSMOD; row++) {
89           for(Int_t gain = 0; gain < NGAINS; gain ++){
90             fADCchannelEnergy[module][column][row][gain] = calibda.fADCchannelEnergy[module][column][row][gain];
91             fADCpedestalEmcMeasured[module][column][row][gain] = calibda.fADCpedestalEmcMeasured[module][column][row][gain];
92           }
93         }
94       }
95     }
96   }
97   return *this;
98 }
99
100 //________________________________________________________________
101 AliHLTPHOSEmcCalibData::~AliHLTPHOSEmcCalibData()
102 {
103   // Destructor
104 }
105
106 //________________________________________________________________
107 void AliHLTPHOSEmcCalibData::Reset()
108 {
109   // Set all pedestals and all ADC channels to its ideal values = 1.
110
111   //  for(Int_t gain = 0; gain < PHOS_GAINS; gain ++){
112     for (Int_t module=0; module<NMODULES; module++){
113       for (Int_t column=0; column< NXCOLUMNSMOD; column++){
114         for (Int_t row=0; row<NZROWSMOD; row++){
115           for(Int_t gain = 0; gain < NGAINS; gain ++){
116           fADCpedestalEmcMeasured[module][column][row][gain] = 0.;
117           fADCchannelEnergy[module][column][row][gain]  = 1.;
118         }
119       }
120     }
121   }
122 }
123
124 //________________________________________________________________
125 void  AliHLTPHOSEmcCalibData::Print(Option_t *option) const
126 {
127   // Print tables of pedestals and ADC channels
128
129   if (strstr(option,"ped")) {
130     printf("\n  ----    EMC Pedestal values     ----\n\n");
131     //    for(Int_t gain = 0; gain < N_GAINS; gain ++){
132       for (Int_t module=0; module<NMODULES; module++){
133         printf("============== Module %d\n",module+1);
134         for (Int_t column=0; column< NXCOLUMNSMOD; column++){
135           for (Int_t row=0; row<NZROWSMOD; row++){
136             for(Int_t gain = 0; gain < NGAINS; gain ++){
137             printf("%4.1f",fADCpedestalEmcMeasured[module][column][row][gain]);
138           }
139           printf("\n");
140         }
141       }
142     }
143   }
144
145   if (strstr(option,"gain")) {
146     printf("\n  ----    EMC ADC channel values  ----\n\n");
147     //   for(Int_t gain = 0; gain < NGAINS; gain ++){ 
148     for (Int_t module=0; module<NMODULES; module++){
149       printf("============== Module %d\n",module+1);
150       for (Int_t column=0; column< NXCOLUMNSMOD; column++){
151         for (Int_t row=0; row<NZROWSMOD; row++){
152           for(Int_t gain = 0; gain < NGAINS; gain ++){ 
153             printf("%4.1f",fADCchannelEnergy[module][column][row][gain]);
154           }
155           printf("\n");
156         }
157       }
158     }  
159   }
160 }
161
162 //________________________________________________________________
163 void  
164 AliHLTPHOSEmcCalibData::MakeADCpedestalCorrectionTable()
165 {
166   for (Int_t module=0; module<NMODULES; module++){
167     printf("============== Module %d\n",module+1);
168     for (Int_t column=0; column< NXCOLUMNSMOD; column++){
169       for (Int_t row=0; row<NZROWSMOD; row++){
170         for(Int_t gain = 0; gain < NGAINS; gain ++){ 
171           fADCpedestalCorrectionTable[module][column][row][gain] = fADCpedestalEmcMeasured[module][column][row][gain] - fADCpedestalAltroReg[module][column][row][gain];
172           //      printf("%4.1f",fADCchannelEnergy[module][column][row][gain]);
173           //
174         }
175         printf("\n");
176       }
177     }
178   }    
179 }
180
181
182 //________________________________________________________________
183 Float_t AliHLTPHOSEmcCalibData::GetADCchannelEnergy(Int_t module, Int_t column, Int_t row, Int_t gain) const
184 {
185   //Return EMC calibration coefficient
186   //module, column,raw should follow the internal PHOS convention:
187   //module 1:5, column 1:56, row 1:64
188
189   return fADCchannelEnergy[module-1][column-1][row-1][gain];
190 }
191
192 //________________________________________________________________
193 Float_t AliHLTPHOSEmcCalibData::GetADCpedestalEmcMeasured(Int_t module, Int_t column, Int_t row, Int_t gain) const
194 {
195   //Return EMC pedestal
196   //module, column,raw should follow the internal PHOS convention:
197   //module 1:5, column 1:56, row 1:64
198
199
200   return fADCpedestalEmcMeasured[module-1][column-1][row-1][gain];
201 }
202
203 //________________________________________________________________
204 void AliHLTPHOSEmcCalibData::SetADCchannelEnergy(Int_t module, Int_t column, Int_t row, Int_t gain, Float_t value)
205 {
206   //Set EMC calibration coefficient
207   //module, column,raw should follow the internal PHOS convention:
208   //module 1:5, column 1:56, row 1:64
209
210   fADCchannelEnergy[module-1][column-1][row-1][gain] = value;
211 }
212
213 //________________________________________________________________
214 void AliHLTPHOSEmcCalibData::SetADCpedestalEmcMeasured(Int_t module, Int_t column, Int_t row, Int_t gain, Float_t value)
215 {
216   //Set EMC pedestal
217   //module, column,raw should follow the internal PHOS convention:
218   //module 1:5, column 1:56, row 1:64
219   fADCpedestalEmcMeasured[module-1][column-1][row-1][gain] = value;
220 }