C0HWU TRD trigger added to the list of cosmic triggers. Agreed with Federico A.
[u/mrichter/AliRoot.git] / VZERO / AliVZEROCalibData.cxx
CommitLineData
3191f471 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: AliVZEROCalibData.cxx, */
17
18/////////////////////////////////////////////////////////////////////////////
19// //
20// class for VZERO calibration //
21// //
22/////////////////////////////////////////////////////////////////////////////
23
706506da 24#include <TMath.h>
d5deaaa5 25#include <TObjString.h>
26#include <TMap.h>
706506da 27
d5deaaa5 28#include "AliDCSValue.h"
3191f471 29#include "AliVZEROCalibData.h"
30
31ClassImp(AliVZEROCalibData)
32
33//________________________________________________________________
34AliVZEROCalibData::AliVZEROCalibData()
35{
d7a5c700 36 //
d5deaaa5 37 for(int i=0; i<kNCIUBoards ;i++) {
38 fTimeResolution[i] = 25./256.; // Default time resolution
39 fWidthResolution[i] = 25./64.; // Default time width resolution
40 }
41
3191f471 42}
43
a3c86e1f 44//________________________________________________________________
45void AliVZEROCalibData::Reset()
46{
d7a5c700 47 // reset
a3c86e1f 48}
49
3191f471 50//________________________________________________________________
51AliVZEROCalibData::AliVZEROCalibData(const char* name)
52{
53 TString namst = "Calib_";
54 namst += name;
55 SetName(namst.Data());
56 SetTitle(namst.Data());
d5deaaa5 57 for(int i=0; i<kNCIUBoards ;i++) {
58 fTimeResolution[i] = 25./256.; // Default time resolution in ns / channel
59 fWidthResolution[i] = 25./64.; // Default time width resolution in ns / channel
60 }
3191f471 61
62}
63
64//________________________________________________________________
65AliVZEROCalibData::AliVZEROCalibData(const AliVZEROCalibData& calibda) :
66 TNamed(calibda)
67{
68// copy constructor
69
70 SetName(calibda.GetName());
71 SetTitle(calibda.GetName());
72
fae0e0c0 73 for(int t=0; t<128; t++) {
3191f471 74 fPedestal[t] = calibda.GetPedestal(t);
fae0e0c0 75 fSigma[t] = calibda.GetSigma(t);
2a25ea57 76 fADCmean[t] = calibda.GetADCmean(t);
77 fADCsigma[t] = calibda.GetADCsigma(t);
78 fGain[t] = calibda.GetGain(t); }
fae0e0c0 79
80 for(int t=0; t<64; t++) {
d7a5c700 81 fMeanHV[t] = calibda.GetMeanHV(t);
2a25ea57 82 fWidthHV[t] = calibda.GetWidthHV(t);
83 fTimeOffset[t] = calibda.GetTimeOffset(t);
d5deaaa5 84 fTimeGain[t] = calibda.GetTimeGain(t);
85 fDeadChannel[t] = calibda.IsChannelDead(t);
86 }
87
88 for(int i=0; i<kNCIUBoards ;i++) {
89 fTimeResolution[i] = calibda.GetTimeResolution(i);
90 fWidthResolution[i] = calibda.GetWidthResolution(i);
91 }
92
3191f471 93
94}
95
96//________________________________________________________________
97AliVZEROCalibData &AliVZEROCalibData::operator =(const AliVZEROCalibData& calibda)
98{
99// assignment operator
100
101 SetName(calibda.GetName());
102 SetTitle(calibda.GetName());
103
fae0e0c0 104 for(int t=0; t<128; t++) {
3191f471 105 fPedestal[t] = calibda.GetPedestal(t);
fae0e0c0 106 fSigma[t] = calibda.GetSigma(t);
2a25ea57 107 fADCmean[t] = calibda.GetADCmean(t);
40b6a179 108 fADCsigma[t] = calibda.GetADCsigma(t);
2a25ea57 109 fGain[t] = calibda.GetGain(t); }
fae0e0c0 110
2a25ea57 111 for(int t=0; t<64; t++) {
d7a5c700 112 fMeanHV[t] = calibda.GetMeanHV(t);
2a25ea57 113 fWidthHV[t] = calibda.GetWidthHV(t);
114 fTimeOffset[t] = calibda.GetTimeOffset(t);
d5deaaa5 115 fTimeGain[t] = calibda.GetTimeGain(t);
116 fDeadChannel[t] = calibda.IsChannelDead(t);
117 }
118 for(int i=0; i<kNCIUBoards ;i++) {
119 fTimeResolution[i] = calibda.GetTimeResolution(i);
120 fWidthResolution[i] = calibda.GetWidthResolution(i);
121 }
2a25ea57 122
3191f471 123 return *this;
124
125}
126
127//________________________________________________________________
128AliVZEROCalibData::~AliVZEROCalibData()
129{
d7a5c700 130 // destructor
3191f471 131}
d5deaaa5 132//_____________________________________________________________________________
133void AliVZEROCalibData::FillDCSData(AliVZERODataDCS * data){
134 // Set all parameters from the data get by the shuttle
135 TMap * params = data->GetFEEParameters();
136 TIter iter(params);
137 TObjString* aliasName;
138
139 while (( aliasName = (TObjString*) iter.Next() )) {
140 AliDCSValue* aValue = (AliDCSValue*) params->GetValue(aliasName);
141 Float_t val;
142 if(aValue) {
143 val = aValue->GetFloat();
144 //AliInfo(Form("%s : %f",aliasName->String().Data(), val));
145 SetParameter(aliasName->String(),val);
146 }
147 }
148
149 SetMeanHV(data->GetMeanHV());
150 SetWidthHV(data->GetWidthHV());
151 SetDeadMap(data->GetDeadMap());
152
153}
154//_____________________________________________________________________________
155void AliVZEROCalibData::SetParameter(TString name, Float_t val){
156 // Set given parameter
157
158 Int_t iBoard = -1;
159
160 TSeqCollection* nameSplit = name.Tokenize("/");
161 TObjString * boardName = (TObjString *)nameSplit->At(2);
162 sscanf(boardName->String().Data(),"CIU%d",&iBoard);
163
164 if(name.Contains("TimeResolution")) SetTimeResolution((UShort_t) val,iBoard-1);
165 else if(name.Contains("WidthResolution")) SetWidthResolution((UShort_t) val,iBoard-1);
166 else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));
167}
3191f471 168
3191f471 169//________________________________________________________________
170void AliVZEROCalibData::SetPedestal(Float_t* Pedestal)
171{
fae0e0c0 172 if(Pedestal) for(int t=0; t<128; t++) fPedestal[t] = Pedestal[t];
173 else for(int t=0; t<128; t++) fPedestal[t] = 0.0;
174}
175
176//________________________________________________________________
177void AliVZEROCalibData::SetSigma(Float_t* Sigma)
178{
179 if(Sigma) for(int t=0; t<128; t++) fSigma[t] = Sigma[t];
180 else for(int t=0; t<128; t++) fSigma[t] = 0.0;
3191f471 181}
182
183//________________________________________________________________
2a25ea57 184void AliVZEROCalibData::SetADCmean(Float_t* ADCmean)
3191f471 185{
2a25ea57 186 if(ADCmean) for(int t=0; t<128; t++) fADCmean[t] = ADCmean[t];
187 else for(int t=0; t<128; t++) fADCmean[t] = 0.0;
3191f471 188}
189
40b6a179 190//________________________________________________________________
191void AliVZEROCalibData::SetADCsigma(Float_t* ADCsigma)
192{
193 if(ADCsigma) for(int t=0; t<128; t++) fADCsigma[t] = ADCsigma[t];
194 else for(int t=0; t<128; t++) fADCsigma[t] = 0.0;
195}
196
fae0e0c0 197//________________________________________________________________
2a25ea57 198void AliVZEROCalibData::SetMeanHV(Float_t* MeanHV)
fae0e0c0 199{
2a25ea57 200 if(MeanHV) for(int t=0; t<64; t++) fMeanHV[t] = MeanHV[t];
201 else for(int t=0; t<64; t++) fMeanHV[t] = 0.0;
fae0e0c0 202}
203
204//________________________________________________________________
2a25ea57 205void AliVZEROCalibData::SetWidthHV(Float_t* WidthHV)
fae0e0c0 206{
2a25ea57 207 if(WidthHV) for(int t=0; t<64; t++) fWidthHV[t] = WidthHV[t];
208 else for(int t=0; t<64; t++) fWidthHV[t] = 0.0;
fae0e0c0 209}
d7a5c700 210
7495d2be 211//________________________________________________________________
212void AliVZEROCalibData::SetDeadMap(Bool_t* deadMap)
213{
214 if(deadMap) for(int t=0; t<64; t++) fDeadChannel[t] = deadMap[t];
215 else for(int t=0; t<64; t++) fDeadChannel[t] = kFALSE;
216}
217
d7a5c700 218//________________________________________________________________
2a25ea57 219void AliVZEROCalibData::SetGain(Float_t* Gain)
d7a5c700 220{
2a25ea57 221 if(Gain) for(int t=0; t<128; t++) fGain[t] = Gain[t];
222 else for(int t=0; t<128; t++) fGain[t] = 0.0;
d7a5c700 223}
224
225//________________________________________________________________
2a25ea57 226void AliVZEROCalibData::SetTimeOffset(Float_t* TimeOffset)
d7a5c700 227{
2a25ea57 228 if(TimeOffset) for(int t=0; t<64; t++) fTimeOffset[t] = TimeOffset[t];
229 else for(int t=0; t<64; t++) fTimeOffset[t] = 0.0;
d7a5c700 230}
2a25ea57 231
232//________________________________________________________________
233void AliVZEROCalibData::SetTimeGain(Float_t* TimeGain)
234{
235 if(TimeGain) for(int t=0; t<64; t++) fTimeGain[t] = TimeGain[t];
236 else for(int t=0; t<64; t++) fTimeGain[t] = 0.0;
237}
238
706506da 239//_____________________________________________________________________________
240Float_t AliVZEROCalibData::GetMIPperADC(Int_t channel) const {
241
242 // Computes the MIP conversion factor - MIP per ADC channel -
243 // Argument passed is the PM number (aliroot numbering)
244
245 Float_t P0[64] = {
246 7.094891, 7.124938, 7.089708, 7.098169, 7.094482, 7.147250, 7.170978, 7.183392,
247 7.145760, 7.148096, 7.153840, 7.143544, 7.186069, 7.194580, 7.203516, 7.195176,
248 7.188333, 7.198607, 7.209412, 7.226565, 7.221695, 7.205132, 7.191238, 7.227724,
249 7.232810, 7.252655, 7.230309, 7.273518, 7.273518, 7.242969, 7.252859, 7.252655,
250 7.026802, 7.079913, 7.134147, 7.092387, 7.079561, 7.072848, 7.123192, 7.003141,
251 7.024667, 7.124784, 7.123442, 7.129744, 7.110671, 7.143031, 7.139439, 7.178109,
252 7.247803, 7.139396, 7.293809, 7.094454, 6.992198, 7.206448, 7.244765, 7.056197,
253 7.263595, 7.138569, 7.089582, 7.215683, 7.266183, 7.165123, 7.243276, 7.235135 };
254 Float_t P1[64] = {
255 0.135569, 0.146405, 0.142425, 0.144278, 0.142307, 0.141648, 0.128477, 0.138239,
256 0.144173, 0.143419, 0.143572, 0.144482, 0.138024, 0.136542, 0.135955, 0.138537,
257 0.148521, 0.141999, 0.139627, 0.130014, 0.134970, 0.135635, 0.139094, 0.140634,
258 0.137971, 0.142080, 0.142793, 0.142778, 0.142778, 0.146045, 0.139133, 0.142080,
259 0.144121, 0.142311, 0.136564, 0.142686, 0.138792, 0.166285, 0.136387, 0.155391,
260 0.176082, 0.140408, 0.164738, 0.144270, 0.142766, 0.147486, 0.141951, 0.138012,
261 0.132394, 0.142849, 0.140477, 0.144592, 0.141558, 0.157646, 0.143758, 0.173385,
262 0.146489, 0.143279, 0.145230, 0.147203, 0.147333, 0.144979, 0.148597, 0.138985 };
263
264 // High Voltage retrieval from Calibration Data Base:
265 Float_t HV = fMeanHV[channel];
2f52e327 266 Float_t MIP = -1;
267 if (HV>0)
268 MIP = 0.5/TMath::Exp((TMath::Log(HV) - P0[channel] )/P1[channel]);
706506da 269 return MIP;
270
271}
d5deaaa5 272//________________________________________________________________
273void AliVZEROCalibData::SetTimeResolution(UShort_t *resols){
274 // Set Time Resolution of the TDC
275 if(resols) for(int t=0; t<kNCIUBoards; t++) SetTimeResolution(resols[t],t);
276 else AliFatal("Time Resolution not defined.");
277
278}
279//________________________________________________________________
280void AliVZEROCalibData::SetTimeResolution(UShort_t resol, Int_t board)
281{
282 // Set Time Resolution of the TDC
283 if((board<kNCIUBoards)) {
284 switch(resol){
285 case 0:
286 fTimeResolution[board] = 25./256.;
287 break;
288 case 1:
289 fTimeResolution[board] = 25./128.;
290 break;
291 case 2:
292 fTimeResolution[board] = 25./64.;
293 break;
294 case 3:
295 fTimeResolution[board] = 25./32.;
296 break;
297 case 4:
298 fTimeResolution[board] = 25./16.;
299 break;
300 case 5:
301 fTimeResolution[board] = 25./8.;
302 break;
303 case 6:
304 fTimeResolution[board] = 6.25;
305 break;
306 case 7:
307 fTimeResolution[board] = 12.5;
308 break;
309 }
310 } else AliError(Form("Board %d is not valid",board));
311}
312//________________________________________________________________
313void AliVZEROCalibData::SetWidthResolution(UShort_t *resols){
314 // Set Time Width Resolution of the TDC
315 if(resols) for(int t=0; t<kNCIUBoards; t++) SetWidthResolution(resols[t],t);
316 else AliFatal("Width Resolution not defined.");
317
318}
319//________________________________________________________________
320void AliVZEROCalibData::SetWidthResolution(UShort_t resol, Int_t board)
321{
322 // Set Time Width Resolution of the TDC
323 if((board<kNCIUBoards)){
324 switch(resol){
325 case 0:
326 fWidthResolution[board] = 25./256.;
327 break;
328 case 1:
329 fWidthResolution[board] = 25./128.;
330 break;
331 case 2:
332 fWidthResolution[board] = 25./64.;
333 break;
334 case 3:
335 fWidthResolution[board] = 25./32.;
336 break;
337 case 4:
338 fWidthResolution[board] = 25./16.;
339 break;
340 case 5:
341 fWidthResolution[board] = 25./8.;
342 break;
343 case 6:
344 fWidthResolution[board] = 6.25;
345 break;
346 case 7:
347 fWidthResolution[board] = 12.5;
348 break;
349 case 8:
350 fWidthResolution[board] = 25.;
351 break;
352 case 9:
353 fWidthResolution[board] = 50.;
354 break;
355 case 10:
356 fWidthResolution[board] = 100.;
357 break;
358 case 11:
359 fWidthResolution[board] = 200.;
360 break;
361 case 12:
362 fWidthResolution[board] = 400.;
363 break;
364 case 13:
365 fWidthResolution[board] = 800.;
366 break;
367
368 }
369 }else AliError(Form("Board %d is not valid",board));
370}
706506da 371