]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSEmcCalibData.cxx
Adding flexibility to submission macros
[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   TNamed(),
29   fSampleTimeStep(0)
30 {
31   // Default constructor
32   Reset();
33 }
34
35 //________________________________________________________________
36 AliPHOSEmcCalibData::AliPHOSEmcCalibData(const char* name):
37   TNamed(),
38   fSampleTimeStep(0)
39 {
40   // Constructor
41   TString namst = "Calib_";
42   namst += name;
43   SetName(namst.Data());
44   SetTitle(namst.Data());
45   Reset();
46 }
47
48 //________________________________________________________________
49 AliPHOSEmcCalibData::AliPHOSEmcCalibData(const AliPHOSEmcCalibData& calibda) :
50   TNamed(calibda),
51   fSampleTimeStep(calibda.fSampleTimeStep)
52 {
53   // copy constructor
54   SetName(calibda.GetName());
55   SetTitle(calibda.GetName());
56
57   for(Int_t module=0; module<5; module++) {
58     for(Int_t column=0; column<56; column++) {
59       for(Int_t row=0; row<64; row++) {
60         fADCchannelEmc[module][column][row] = calibda.fADCchannelEmc[module][column][row];
61         fADCpedestalEmc[module][column][row] = calibda.fADCpedestalEmc[module][column][row];
62         fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
63         fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
64         fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row];
65       }
66     }
67   }
68 }
69
70 //________________________________________________________________
71 AliPHOSEmcCalibData &AliPHOSEmcCalibData::operator =(const AliPHOSEmcCalibData& calibda)
72 {
73   // assignment operator
74
75   if(this != &calibda) { 
76
77     SetName(calibda.GetName());
78     SetTitle(calibda.GetName());
79
80     for(Int_t module=0; module<5; module++) {
81       for(Int_t column=0; column<56; column++) {
82         for(Int_t row=0; row<64; row++) {
83           fADCchannelEmc[module][column][row] = calibda.fADCchannelEmc[module][column][row];
84           fADCpedestalEmc[module][column][row] = calibda.fADCpedestalEmc[module][column][row];
85           fHighLowRatioEmc[module][column][row] = calibda.fHighLowRatioEmc[module][column][row];
86           fTimeShiftEmc[module][column][row] = calibda.fTimeShiftEmc[module][column][row];
87           fAltroOffsets[module][column][row] = calibda.fAltroOffsets[module][column][row]; 
88         }
89       }
90     }
91   }
92
93   return *this;
94 }
95
96 //________________________________________________________________
97 AliPHOSEmcCalibData::~AliPHOSEmcCalibData()
98 {
99   // Destructor
100 }
101
102 //________________________________________________________________
103 void AliPHOSEmcCalibData::Reset()
104 {
105   // Set all pedestals and all ADC channels to its ideal values = 5. (MeV/ADC)
106
107   for (Int_t module=0; module<5; module++){
108     for (Int_t column=0; column<56; column++){
109       for (Int_t row=0; row<64; row++){
110         fADCpedestalEmc[module][column][row] = 0.;
111         fADCchannelEmc[module][column][row]  = 0.005;
112         fHighLowRatioEmc[module][column][row] = 16. ;
113         fTimeShiftEmc[module][column][row] = 0. ;
114         fAltroOffsets[module][column][row] = 0 ;
115       }
116     }
117   }
118   fSampleTimeStep=100.e-9 ; //100 ns
119 }
120
121 //________________________________________________________________
122 void  AliPHOSEmcCalibData::Print(Option_t *option) const
123 {
124   // Print tables of pedestals and ADC channels
125
126   if (strstr(option,"ped")) {
127     printf("\n  ----    EMC Pedestal values     ----\n\n");
128     for (Int_t module=0; module<5; module++){
129       printf("============== Module %d\n",module+1);
130       for (Int_t column=0; column<56; column++){
131         for (Int_t row=0; row<64; row++){
132           printf("%4.1f",fADCpedestalEmc[module][column][row]);
133         }
134         printf("\n");
135       }
136     }
137   }
138
139   if (strstr(option,"gain")) {
140     printf("\n  ----    EMC ADC channel values  ----\n\n");
141     for (Int_t module=0; module<5; module++){
142       printf("============== Module %d\n",module+1);
143       for (Int_t column=0; column<56; column++){
144         for (Int_t row=0; row<64; row++){
145           printf("%4.1f",fADCchannelEmc[module][column][row]);
146         }
147         printf("\n");
148       }
149     }
150   }
151
152   if (strstr(option,"hilo")) {
153     printf("\n  ----    EMC High/Low ratio      ----\n\n");
154     for (Int_t module=0; module<5; module++){
155       printf("============== Module %d\n",module+1);
156       for (Int_t column=0; column<56; column++){
157         for (Int_t row=0; row<64; row++){
158           printf("%4.1f",fHighLowRatioEmc[module][column][row]);
159         }
160         printf("\n");
161       }
162     }
163   }
164   if (strstr(option,"time")) {
165     printf("\n  ----    EMC t0 shifts   ----\n\n");
166     for (Int_t module=0; module<5; module++){
167       printf("============== Module %d\n",module+1);
168       for (Int_t column=0; column<56; column++){
169         for (Int_t row=0; row<64; row++){
170           printf("%6.3e",fTimeShiftEmc[module][column][row]);
171         }
172         printf("\n");
173       }
174     }
175   }
176   if (strstr(option,"altro")) {
177     printf("\n  ----    EMC altro offsets   ----\n\n");
178     for (Int_t module=0; module<5; module++){
179       printf("============== Module %d\n",module+1);
180       for (Int_t column=0; column<56; column++){
181         for (Int_t row=0; row<64; row++){
182           printf("%5d",fAltroOffsets[module][column][row]);
183         }
184         printf("\n");
185       }
186     }
187   }
188 }
189
190 //________________________________________________________________
191 Float_t AliPHOSEmcCalibData::GetADCchannelEmc(Int_t module, Int_t column, Int_t row) const
192 {
193   //Return EMC calibration coefficient
194   //module, column,raw should follow the internal PHOS convention:
195   //module 1:5, column 1:56, row 1:64
196
197   return fADCchannelEmc[module-1][column-1][row-1];
198 }
199
200 //________________________________________________________________
201 Float_t AliPHOSEmcCalibData::GetADCpedestalEmc(Int_t module, Int_t column, Int_t row) const
202 {
203   //Return EMC pedestal
204   //module, column,raw should follow the internal PHOS convention:
205   //module 1:5, column 1:56, row 1:64
206
207   return fADCpedestalEmc[module-1][column-1][row-1];
208 }
209
210 //________________________________________________________________
211 Float_t AliPHOSEmcCalibData::GetHighLowRatioEmc(Int_t module, Int_t column, Int_t row) const
212 {
213   //Return EMC pedestal
214   //module, column,raw should follow the internal PHOS convention:
215   //module 1:5, column 1:56, row 1:64
216
217   return fHighLowRatioEmc[module-1][column-1][row-1];
218 }
219
220 //________________________________________________________________
221 Float_t AliPHOSEmcCalibData::GetTimeShiftEmc(Int_t module, Int_t column, Int_t row) const
222 {
223   //Return EMC pedestal
224   //module, column,raw should follow the internal PHOS convention:
225   //module 1:5, column 1:56, row 1:64
226
227   return fTimeShiftEmc[module-1][column-1][row-1];
228 }
229 //________________________________________________________________
230 Float_t AliPHOSEmcCalibData::GetSampleTimeStep()const
231 {
232    //Returns conversion coefficient from ALTRO smaple time step and secods
233    //Negative value not used in reconstruction (conversion taken from TRU trailer)
234    //and only in raw simulation
235    return fSampleTimeStep ;
236 }
237 //________________________________________________________________
238 Int_t AliPHOSEmcCalibData::GetAltroOffsetEmc(Int_t module, Int_t column, Int_t row) const
239 {
240   //Return EMC altro offsets
241   //module, column,raw should follow the internal PHOS convention:
242   //module 1:5, column 1:56, row 1:64
243  
244   return fAltroOffsets[module-1][column-1][row-1];
245 }
246 //________________________________________________________________
247 void AliPHOSEmcCalibData::SetADCchannelEmc(Int_t module, Int_t column, Int_t row, Float_t value)
248 {
249   //Set EMC calibration coefficient
250   //module, column,raw should follow the internal PHOS convention:
251   //module 1:5, column 1:56, row 1:64
252
253   fADCchannelEmc[module-1][column-1][row-1] = value;
254 }
255
256 //________________________________________________________________
257 void AliPHOSEmcCalibData::SetADCpedestalEmc(Int_t module, Int_t column, Int_t row, Float_t value)
258 {
259   //Set EMC pedestal
260   //module, column,raw should follow the internal PHOS convention:
261   //module 1:5, column 1:56, row 1:64
262   fADCpedestalEmc[module-1][column-1][row-1] = value;
263 }
264
265 //________________________________________________________________
266 void AliPHOSEmcCalibData::SetHighLowRatioEmc(Int_t module, Int_t column, Int_t row, Float_t value)
267 {
268   //Set EMC pedestal
269   //module, column,raw should follow the internal PHOS convention:
270   //module 1:5, column 1:56, row 1:64
271   fHighLowRatioEmc[module-1][column-1][row-1] = value;
272 }
273 //________________________________________________________________
274 void AliPHOSEmcCalibData::SetTimeShiftEmc(Int_t module, Int_t column, Int_t row, Float_t value)
275 {
276   //Set EMC pedestal
277   //module, column,raw should follow the internal PHOS convention:
278   //module 1:5, column 1:56, row 1:64
279   fTimeShiftEmc[module-1][column-1][row-1] = value;
280 }
281 //________________________________________________________________
282 void AliPHOSEmcCalibData::SetAltroOffsetEmc(Int_t module, Int_t column, Int_t row, Int_t value)
283 {
284   //Set EMC pedestal
285   //module, column,raw should follow the internal PHOS convention:
286   //module 1:5, column 1:56, row 1:64
287   fAltroOffsets[module-1][column-1][row-1] = value;
288 }
289 //________________________________________________________________
290 void AliPHOSEmcCalibData::SetSampleTimeStep(Float_t step)
291 {
292    //Sets conversion coefficient from ALTRO smaple time step and secods
293    //Negative value not used in reconstruction (conversion taken from TRU trailer)
294    //and only in raw simulation
295    fSampleTimeStep = step ;
296 }
297