]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSEmcCalibData.cxx
New on per RCU data containers
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSEmcCalibData.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  * 7/1- 2007                                                              *
16  * Author: Per Thomas Hille                                               *
17  * code modified to include the two differnt gains of each detection      *
18  * channel and also to include the Pedestals loaded into the ALTRO        * 
19  * registers for basline subtraction and zero supression                  * 
20  *                                                                        *
21  *                                                                        * 
22  **************************************************************************/
23
24 ///////////////////////////////////////////////////////////////////////////////
25 //                                                                           //
26 // class for PHOS EmCal calibration                                          //
27 //                                                                           //
28 ///////////////////////////////////////////////////////////////////////////////
29
30 #include "AliHLTPHOSEmcCalibData.h"
31
32 ClassImp(AliHLTPHOSEmcCalibData)
33
34 //________________________________________________________________
35   AliHLTPHOSEmcCalibData::AliHLTPHOSEmcCalibData(): TNamed()
36 {
37   // Default constructor
38   Reset();
39 }
40
41 //________________________________________________________________
42 AliHLTPHOSEmcCalibData::AliHLTPHOSEmcCalibData(const char* name)
43 {
44   // Constructor
45   TString namst = "Calib_";
46   namst += name;
47   SetName(namst.Data());
48   SetTitle(namst.Data());
49   Reset();
50 }
51
52 //________________________________________________________________
53 AliHLTPHOSEmcCalibData::AliHLTPHOSEmcCalibData(const AliHLTPHOSEmcCalibData& calibda) :
54   TNamed(calibda)
55 {
56   // copy constructor
57   SetName(calibda.GetName());
58   SetTitle(calibda.GetName());
59
60
61   //  for(Int_t gain = 0; gain < N_GAINS; gain ++){
62   for(Int_t module=0; module<N_MODULES; module++) {
63     for(Int_t column=0; column< N_COLUMNS_MOD; column++) {
64       for(Int_t row=0; row<N_ROWS_MOD; row++) {
65         for(Int_t gain = 0; gain < N_GAINS; gain ++){
66           fADCchannelEnergy[module][column][row][gain] =  calibda.fADCchannelEnergy[module][column][row][gain];
67           fADCpedestalEmcMeasured[module][column][row][gain] = calibda.fADCpedestalEmcMeasured[module][column][row][gain];
68         }
69       }  
70     }
71   }
72 }
73
74 //________________________________________________________________
75 AliHLTPHOSEmcCalibData &AliHLTPHOSEmcCalibData::operator =(const AliHLTPHOSEmcCalibData& calibda)
76 {
77   // assignment operator
78
79   if(this != &calibda) { 
80
81     SetName(calibda.GetName());
82     SetTitle(calibda.GetName());
83     //    for(Int_t gain = 0; gain < N_GAINS; gain ++){
84     for(Int_t module=0; module<N_MODULES; module++) {
85       for(Int_t column=0; column< N_COLUMNS_MOD; column++) {
86         for(Int_t row=0; row<N_ROWS_MOD; row++) {
87           for(Int_t gain = 0; gain < N_GAINS; gain ++){
88             fADCchannelEnergy[module][column][row][gain] = calibda.fADCchannelEnergy[module][column][row][gain];
89             fADCpedestalEmcMeasured[module][column][row][gain] = calibda.fADCpedestalEmcMeasured[module][column][row][gain];
90           }
91         }
92       }
93     }
94   }
95   return *this;
96 }
97
98 //________________________________________________________________
99 AliHLTPHOSEmcCalibData::~AliHLTPHOSEmcCalibData()
100 {
101   // Destructor
102 }
103
104 //________________________________________________________________
105 void AliHLTPHOSEmcCalibData::Reset()
106 {
107   // Set all pedestals and all ADC channels to its ideal values = 1.
108
109   //  for(Int_t gain = 0; gain < PHOS_GAINS; gain ++){
110     for (Int_t module=0; module<N_MODULES; module++){
111       for (Int_t column=0; column< N_COLUMNS_MOD; column++){
112         for (Int_t row=0; row<N_ROWS_MOD; row++){
113           for(Int_t gain = 0; gain < N_GAINS; gain ++){
114           fADCpedestalEmcMeasured[module][column][row][gain] = 0.;
115           fADCchannelEnergy[module][column][row][gain]  = 1.;
116         }
117       }
118     }
119   }
120 }
121
122 //________________________________________________________________
123 void  AliHLTPHOSEmcCalibData::Print(Option_t *option) const
124 {
125   // Print tables of pedestals and ADC channels
126
127   if (strstr(option,"ped")) {
128     printf("\n  ----    EMC Pedestal values     ----\n\n");
129     //    for(Int_t gain = 0; gain < N_GAINS; gain ++){
130       for (Int_t module=0; module<N_MODULES; module++){
131         printf("============== Module %d\n",module+1);
132         for (Int_t column=0; column< N_COLUMNS_MOD; column++){
133           for (Int_t row=0; row<N_ROWS_MOD; row++){
134             for(Int_t gain = 0; gain < N_GAINS; gain ++){
135             printf("%4.1f",fADCpedestalEmcMeasured[module][column][row][gain]);
136           }
137           printf("\n");
138         }
139       }
140     }
141   }
142
143   if (strstr(option,"gain")) {
144     printf("\n  ----    EMC ADC channel values  ----\n\n");
145     //   for(Int_t gain = 0; gain < N_GAINS; gain ++){ 
146     for (Int_t module=0; module<N_MODULES; module++){
147       printf("============== Module %d\n",module+1);
148       for (Int_t column=0; column< N_COLUMNS_MOD; column++){
149         for (Int_t row=0; row<N_ROWS_MOD; row++){
150           for(Int_t gain = 0; gain < N_GAINS; gain ++){ 
151             printf("%4.1f",fADCchannelEnergy[module][column][row][gain]);
152           }
153           printf("\n");
154         }
155       }
156     }  
157   }
158 }
159
160
161 void  
162 AliHLTPHOSEmcCalibData::MakeADCpedestalCorrectionTable()
163 {
164   for (Int_t module=0; module<N_MODULES; module++){
165     printf("============== Module %d\n",module+1);
166     for (Int_t column=0; column< N_COLUMNS_MOD; column++){
167       for (Int_t row=0; row<N_ROWS_MOD; row++){
168         for(Int_t gain = 0; gain < N_GAINS; gain ++){ 
169           fADCpedestalCorrectionTable[module][column][row][gain] = fADCpedestalEmcMeasured[module][column][row][gain] - fADCpedestalAltroReg[module][column][row][gain];
170           //      printf("%4.1f",fADCchannelEnergy[module][column][row][gain]);
171           //
172         }
173         printf("\n");
174       }
175     }
176   }    
177 }
178
179
180 //________________________________________________________________
181 Float_t AliHLTPHOSEmcCalibData::GetADCchannelEnergy(Int_t module, Int_t column, Int_t row, Int_t gain) const
182 {
183   //Return EMC calibration coefficient
184   //module, column,raw should follow the internal PHOS convention:
185   //module 1:5, column 1:56, row 1:64
186
187   return fADCchannelEnergy[module-1][column-1][row-1][gain];
188 }
189
190 //________________________________________________________________
191 Float_t AliHLTPHOSEmcCalibData::GetADCpedestalEmcMeasured(Int_t module, Int_t column, Int_t row, Int_t gain) const
192 {
193   //Return EMC pedestal
194   //module, column,raw should follow the internal PHOS convention:
195   //module 1:5, column 1:56, row 1:64
196
197
198   return fADCpedestalEmcMeasured[module-1][column-1][row-1][gain];
199 }
200
201 //________________________________________________________________
202 void AliHLTPHOSEmcCalibData::SetADCchannelEnergy(Int_t module, Int_t column, Int_t row, Int_t gain, Float_t value)
203 {
204   //Set EMC calibration coefficient
205   //module, column,raw should follow the internal PHOS convention:
206   //module 1:5, column 1:56, row 1:64
207
208   fADCchannelEnergy[module-1][column-1][row-1][gain] = value;
209 }
210
211 //________________________________________________________________
212 void AliHLTPHOSEmcCalibData::SetADCpedestalEmcMeasured(Int_t module, Int_t column, Int_t row, Int_t gain, Float_t value)
213 {
214   //Set EMC pedestal
215   //module, column,raw should follow the internal PHOS convention:
216   //module 1:5, column 1:56, row 1:64
217   fADCpedestalEmcMeasured[module-1][column-1][row-1][gain] = value;
218 }