]>
Commit | Line | Data |
---|---|---|
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> | |
3772afd5 | 27 | #include <TH1F.h> |
28 | #include <TH2F.h> | |
706506da | 29 | |
d5deaaa5 | 30 | #include "AliDCSValue.h" |
3772afd5 | 31 | #include "AliCDBManager.h" |
32 | #include "AliCDBEntry.h" | |
3191f471 | 33 | #include "AliVZEROCalibData.h" |
32c24147 | 34 | #include "AliVZERODataDCS.h" |
3772afd5 | 35 | #include "AliVZEROConst.h" |
32c24147 | 36 | #include "AliLog.h" |
3191f471 | 37 | |
38 | ClassImp(AliVZEROCalibData) | |
39 | ||
40 | //________________________________________________________________ | |
3772afd5 | 41 | AliVZEROCalibData::AliVZEROCalibData(): |
42 | fLightYields(NULL), | |
43 | fPMGainsA(NULL), | |
44 | fPMGainsB(NULL) | |
3191f471 | 45 | { |
2f09013f | 46 | // default constructor |
47 | ||
48 | for(int t=0; t<64; t++) { | |
49 | fMeanHV[t] = 100.0; | |
50 | fWidthHV[t] = 0.0; | |
992e9cba | 51 | fTimeOffset[t] = 5.0; |
2f09013f | 52 | fTimeGain[t] = 1.0; |
53 | fDeadChannel[t]= kFALSE; | |
6e2c3e87 | 54 | fDiscriThr[t] = 2.5; |
2f09013f | 55 | } |
56 | for(int t=0; t<128; t++) { | |
57 | fPedestal[t] = 0.0; | |
58 | fSigma[t] = 0.0; | |
59 | fADCmean[t] = 0.0; | |
60 | fADCsigma[t] = 0.0; | |
2f09013f | 61 | } |
62 | for(int i=0; i<kNCIUBoards ;i++) { | |
63 | fTimeResolution[i] = 25./256.; // Default time resolution | |
64 | fWidthResolution[i] = 25./64.; // Default time width resolution | |
32cd3fdc | 65 | fMatchWindow[i] = 4; |
66 | fSearchWindow[i] = 16; | |
67 | fTriggerCountOffset[i] = 3247; | |
68 | fRollOver[i] = 3563; | |
2f09013f | 69 | } |
d5deaaa5 | 70 | |
3191f471 | 71 | } |
72 | ||
a3c86e1f | 73 | //________________________________________________________________ |
74 | void AliVZEROCalibData::Reset() | |
75 | { | |
d7a5c700 | 76 | // reset |
a3c86e1f | 77 | } |
78 | ||
3191f471 | 79 | //________________________________________________________________ |
3772afd5 | 80 | AliVZEROCalibData::AliVZEROCalibData(const char* name): |
81 | fLightYields(NULL), | |
82 | fPMGainsA(NULL), | |
83 | fPMGainsB(NULL) | |
3191f471 | 84 | { |
32c24147 | 85 | // Constructor |
2f09013f | 86 | TString namst = "Calib_"; |
87 | namst += name; | |
88 | SetName(namst.Data()); | |
89 | SetTitle(namst.Data()); | |
90 | for(int t=0; t<64; t++) { | |
91 | fMeanHV[t] = 100.0; | |
92 | fWidthHV[t] = 0.0; | |
992e9cba | 93 | fTimeOffset[t] = 5.0; |
2f09013f | 94 | fTimeGain[t] = 1.0; |
95 | fDeadChannel[t]= kFALSE; | |
6e2c3e87 | 96 | fDiscriThr[t] = 2.5; |
2f09013f | 97 | } |
98 | for(int t=0; t<128; t++) { | |
99 | fPedestal[t] = 0.0; | |
100 | fSigma[t] = 0.0; | |
101 | fADCmean[t] = 0.0; | |
102 | fADCsigma[t] = 0.0; | |
2f09013f | 103 | } |
104 | for(int i=0; i<kNCIUBoards ;i++) { | |
105 | fTimeResolution[i] = 25./256.; // Default time resolution in ns / channel | |
106 | fWidthResolution[i] = 25./64.; // Default time width resolution in ns / channel | |
32cd3fdc | 107 | fMatchWindow[i] = 4; |
108 | fSearchWindow[i] = 16; | |
109 | fTriggerCountOffset[i] = 3247; | |
110 | fRollOver[i] = 3563; | |
2f09013f | 111 | } |
3191f471 | 112 | |
113 | } | |
114 | ||
115 | //________________________________________________________________ | |
116 | AliVZEROCalibData::AliVZEROCalibData(const AliVZEROCalibData& calibda) : | |
3772afd5 | 117 | TNamed(calibda), |
118 | fLightYields(NULL), | |
119 | fPMGainsA(NULL), | |
120 | fPMGainsB(NULL) | |
3191f471 | 121 | { |
122 | // copy constructor | |
123 | ||
124 | SetName(calibda.GetName()); | |
125 | SetTitle(calibda.GetName()); | |
126 | ||
fae0e0c0 | 127 | for(int t=0; t<128; t++) { |
3191f471 | 128 | fPedestal[t] = calibda.GetPedestal(t); |
fae0e0c0 | 129 | fSigma[t] = calibda.GetSigma(t); |
2a25ea57 | 130 | fADCmean[t] = calibda.GetADCmean(t); |
4e2652e8 | 131 | fADCsigma[t] = calibda.GetADCsigma(t); } |
fae0e0c0 | 132 | |
133 | for(int t=0; t<64; t++) { | |
d7a5c700 | 134 | fMeanHV[t] = calibda.GetMeanHV(t); |
2a25ea57 | 135 | fWidthHV[t] = calibda.GetWidthHV(t); |
136 | fTimeOffset[t] = calibda.GetTimeOffset(t); | |
d5deaaa5 | 137 | fTimeGain[t] = calibda.GetTimeGain(t); |
2f09013f | 138 | fDeadChannel[t] = calibda.IsChannelDead(t); |
6e2c3e87 | 139 | fDiscriThr[t] = calibda.GetDiscriThr(t); |
d5deaaa5 | 140 | } |
141 | ||
2f09013f | 142 | for(int i=0; i<kNCIUBoards ;i++) { |
143 | fTimeResolution[i] = calibda.GetTimeResolution(i); | |
144 | fWidthResolution[i] = calibda.GetWidthResolution(i); | |
32cd3fdc | 145 | fMatchWindow[i] = calibda.GetMatchWindow(i); |
146 | fSearchWindow[i] = calibda.GetSearchWindow(i); | |
147 | fTriggerCountOffset[i] = calibda.GetTriggerCountOffset(i); | |
148 | fRollOver[i] = calibda.GetRollOver(i); | |
2f09013f | 149 | } |
3191f471 | 150 | |
151 | } | |
152 | ||
153 | //________________________________________________________________ | |
154 | AliVZEROCalibData &AliVZEROCalibData::operator =(const AliVZEROCalibData& calibda) | |
155 | { | |
156 | // assignment operator | |
157 | ||
158 | SetName(calibda.GetName()); | |
159 | SetTitle(calibda.GetName()); | |
160 | ||
fae0e0c0 | 161 | for(int t=0; t<128; t++) { |
3191f471 | 162 | fPedestal[t] = calibda.GetPedestal(t); |
fae0e0c0 | 163 | fSigma[t] = calibda.GetSigma(t); |
2a25ea57 | 164 | fADCmean[t] = calibda.GetADCmean(t); |
4e2652e8 | 165 | fADCsigma[t] = calibda.GetADCsigma(t); } |
fae0e0c0 | 166 | |
2a25ea57 | 167 | for(int t=0; t<64; t++) { |
d7a5c700 | 168 | fMeanHV[t] = calibda.GetMeanHV(t); |
2a25ea57 | 169 | fWidthHV[t] = calibda.GetWidthHV(t); |
170 | fTimeOffset[t] = calibda.GetTimeOffset(t); | |
d5deaaa5 | 171 | fTimeGain[t] = calibda.GetTimeGain(t); |
2f09013f | 172 | fDeadChannel[t] = calibda.IsChannelDead(t); |
6e2c3e87 | 173 | fDiscriThr[t] = calibda.GetDiscriThr(t); |
d5deaaa5 | 174 | } |
2f09013f | 175 | for(int i=0; i<kNCIUBoards ;i++) { |
176 | fTimeResolution[i] = calibda.GetTimeResolution(i); | |
177 | fWidthResolution[i] = calibda.GetWidthResolution(i); | |
32cd3fdc | 178 | fMatchWindow[i] = calibda.GetMatchWindow(i); |
179 | fSearchWindow[i] = calibda.GetSearchWindow(i); | |
180 | fTriggerCountOffset[i] = calibda.GetTriggerCountOffset(i); | |
181 | fRollOver[i] = calibda.GetRollOver(i); | |
2f09013f | 182 | } |
2a25ea57 | 183 | |
3191f471 | 184 | return *this; |
185 | ||
186 | } | |
187 | ||
188 | //________________________________________________________________ | |
189 | AliVZEROCalibData::~AliVZEROCalibData() | |
190 | { | |
d7a5c700 | 191 | // destructor |
3772afd5 | 192 | if (fLightYields) |
193 | delete [] fLightYields; | |
194 | if (fPMGainsA) | |
195 | delete [] fPMGainsA; | |
196 | if (fPMGainsB) | |
197 | delete [] fPMGainsB; | |
3191f471 | 198 | } |
d5deaaa5 | 199 | //_____________________________________________________________________________ |
200 | void AliVZEROCalibData::FillDCSData(AliVZERODataDCS * data){ | |
201 | // Set all parameters from the data get by the shuttle | |
202 | TMap * params = data->GetFEEParameters(); | |
203 | TIter iter(params); | |
204 | TObjString* aliasName; | |
205 | ||
206 | while (( aliasName = (TObjString*) iter.Next() )) { | |
207 | AliDCSValue* aValue = (AliDCSValue*) params->GetValue(aliasName); | |
5978520a | 208 | Int_t val; |
d5deaaa5 | 209 | if(aValue) { |
692e31a4 | 210 | val = aValue->GetUInt(); |
5978520a | 211 | AliInfo(Form("%s : %d",aliasName->String().Data(), val)); |
d5deaaa5 | 212 | SetParameter(aliasName->String(),val); |
213 | } | |
214 | } | |
215 | ||
216 | SetMeanHV(data->GetMeanHV()); | |
217 | SetWidthHV(data->GetWidthHV()); | |
218 | SetDeadMap(data->GetDeadMap()); | |
219 | ||
220 | } | |
221 | //_____________________________________________________________________________ | |
5978520a | 222 | void AliVZEROCalibData::SetParameter(TString name, Int_t val){ |
d5deaaa5 | 223 | // Set given parameter |
224 | ||
225 | Int_t iBoard = -1; | |
57c7500a | 226 | Int_t iChannel = -1; |
d5deaaa5 | 227 | |
228 | TSeqCollection* nameSplit = name.Tokenize("/"); | |
229 | TObjString * boardName = (TObjString *)nameSplit->At(2); | |
230 | sscanf(boardName->String().Data(),"CIU%d",&iBoard); | |
57c7500a | 231 | |
232 | TString paramName = ((TObjString *)nameSplit->At(3))->String(); | |
233 | Char_t channel[2] ; channel[1] = '\0'; | |
234 | channel[0] = paramName[paramName.Sizeof()-2]; | |
235 | sscanf(channel,"%d",&iChannel); | |
d5deaaa5 | 236 | |
4bc15c46 | 237 | if(name.Contains("TimeResolution")) SetTimeResolution((UShort_t) val,iBoard); |
238 | else if(name.Contains("WidthResolution")) SetWidthResolution((UShort_t) val,iBoard); | |
32cd3fdc | 239 | else if(name.Contains("MatchWindow")) SetMatchWindow((UInt_t) val,iBoard); |
240 | else if(name.Contains("SearchWindow")) SetSearchWindow((UInt_t) val,iBoard); | |
241 | else if(name.Contains("TriggerCountOffset")) SetTriggerCountOffset((UInt_t) val,iBoard); | |
242 | else if(name.Contains("RollOver")) SetRollOver((UInt_t) val,iBoard); | |
51980118 | 243 | else if(name.Contains("DelayHit")) SetTimeOffset(0.01*(Float_t)val,iBoard,(iChannel-1)); |
244 | else if(name.Contains("DiscriThr")) SetDiscriThr(((Float_t)val-2040.)/112.,iBoard,(iChannel-1)); | |
d5deaaa5 | 245 | else AliError(Form("No Setter found for FEE parameter : %s",name.Data())); |
246 | } | |
3191f471 | 247 | |
3191f471 | 248 | //________________________________________________________________ |
32c24147 | 249 | void AliVZEROCalibData::SetPedestal(const Float_t* Pedestal) |
3191f471 | 250 | { |
fae0e0c0 | 251 | if(Pedestal) for(int t=0; t<128; t++) fPedestal[t] = Pedestal[t]; |
252 | else for(int t=0; t<128; t++) fPedestal[t] = 0.0; | |
253 | } | |
254 | ||
255 | //________________________________________________________________ | |
32c24147 | 256 | void AliVZEROCalibData::SetSigma(const Float_t* Sigma) |
fae0e0c0 | 257 | { |
258 | if(Sigma) for(int t=0; t<128; t++) fSigma[t] = Sigma[t]; | |
259 | else for(int t=0; t<128; t++) fSigma[t] = 0.0; | |
3191f471 | 260 | } |
261 | ||
262 | //________________________________________________________________ | |
32c24147 | 263 | void AliVZEROCalibData::SetADCmean(const Float_t* ADCmean) |
3191f471 | 264 | { |
2a25ea57 | 265 | if(ADCmean) for(int t=0; t<128; t++) fADCmean[t] = ADCmean[t]; |
266 | else for(int t=0; t<128; t++) fADCmean[t] = 0.0; | |
3191f471 | 267 | } |
268 | ||
40b6a179 | 269 | //________________________________________________________________ |
32c24147 | 270 | void AliVZEROCalibData::SetADCsigma(const Float_t* ADCsigma) |
40b6a179 | 271 | { |
272 | if(ADCsigma) for(int t=0; t<128; t++) fADCsigma[t] = ADCsigma[t]; | |
273 | else for(int t=0; t<128; t++) fADCsigma[t] = 0.0; | |
274 | } | |
275 | ||
fae0e0c0 | 276 | //________________________________________________________________ |
32c24147 | 277 | void AliVZEROCalibData::SetMeanHV(const Float_t* MeanHV) |
fae0e0c0 | 278 | { |
2a25ea57 | 279 | if(MeanHV) for(int t=0; t<64; t++) fMeanHV[t] = MeanHV[t]; |
280 | else for(int t=0; t<64; t++) fMeanHV[t] = 0.0; | |
fae0e0c0 | 281 | } |
282 | ||
283 | //________________________________________________________________ | |
32c24147 | 284 | void AliVZEROCalibData::SetWidthHV(const Float_t* WidthHV) |
fae0e0c0 | 285 | { |
2a25ea57 | 286 | if(WidthHV) for(int t=0; t<64; t++) fWidthHV[t] = WidthHV[t]; |
287 | else for(int t=0; t<64; t++) fWidthHV[t] = 0.0; | |
fae0e0c0 | 288 | } |
d7a5c700 | 289 | |
7495d2be | 290 | //________________________________________________________________ |
32c24147 | 291 | void AliVZEROCalibData::SetDeadMap(const Bool_t* deadMap) |
7495d2be | 292 | { |
293 | if(deadMap) for(int t=0; t<64; t++) fDeadChannel[t] = deadMap[t]; | |
294 | else for(int t=0; t<64; t++) fDeadChannel[t] = kFALSE; | |
295 | } | |
296 | ||
57c7500a | 297 | //________________________________________________________________ |
51980118 | 298 | void AliVZEROCalibData::SetTimeOffset(Float_t val, Int_t board, Int_t channel) |
57c7500a | 299 | { |
51980118 | 300 | Int_t ch = AliVZEROCalibData::GetOfflineChannelNumber(board,channel); |
301 | if(ch >= 0){ | |
302 | fTimeOffset[ch]=val; | |
303 | AliInfo(Form("Time offset for channel %d set to %f",ch,fTimeOffset[ch])); | |
57c7500a | 304 | } |
305 | else | |
51980118 | 306 | AliError("Board/Channel numbers are not valid"); |
57c7500a | 307 | } |
308 | ||
d7a5c700 | 309 | //________________________________________________________________ |
32c24147 | 310 | void AliVZEROCalibData::SetTimeOffset(const Float_t* TimeOffset) |
d7a5c700 | 311 | { |
2a25ea57 | 312 | if(TimeOffset) for(int t=0; t<64; t++) fTimeOffset[t] = TimeOffset[t]; |
992e9cba | 313 | else for(int t=0; t<64; t++) fTimeOffset[t] = 5.0; |
d7a5c700 | 314 | } |
2a25ea57 | 315 | |
316 | //________________________________________________________________ | |
32c24147 | 317 | void AliVZEROCalibData::SetTimeGain(const Float_t* TimeGain) |
2a25ea57 | 318 | { |
319 | if(TimeGain) for(int t=0; t<64; t++) fTimeGain[t] = TimeGain[t]; | |
320 | else for(int t=0; t<64; t++) fTimeGain[t] = 0.0; | |
321 | } | |
322 | ||
706506da | 323 | //_____________________________________________________________________________ |
3772afd5 | 324 | Float_t AliVZEROCalibData::GetMIPperADC(Int_t channel) { |
706506da | 325 | |
326 | // Computes the MIP conversion factor - MIP per ADC channel - | |
327 | // Argument passed is the PM number (aliroot numbering) | |
328 | ||
3772afd5 | 329 | Float_t nPhPerMIP = (channel < 32) ? 6950 : 33690; |
330 | return 1./(nPhPerMIP*GetLightYields(channel)*0.18*TMath::Qe()*GetGain(channel)/kChargePerADC); | |
706506da | 331 | |
332 | } | |
4e2652e8 | 333 | |
373bede4 | 334 | //_____________________________________________________________________________ |
335 | Float_t AliVZEROCalibData::GetHV(Int_t channel, Float_t adcPerMip) { | |
336 | ||
337 | // Computes the HV value for certain ADC per MIP value | |
338 | // Arguments passed is the PM number (aliroot numbering) and | |
339 | // required value of ADC per MIP | |
340 | if (!fPMGainsA) InitPMGains(); | |
341 | ||
342 | if (adcPerMip <= 0) return 0; | |
343 | Float_t nPhPerMIP = (channel < 32) ? 6950 : 33690; | |
344 | Float_t gain = adcPerMip/(nPhPerMIP*GetLightYields(channel)*0.18*TMath::Qe())*kChargePerADC; | |
345 | return TMath::Exp((TMath::Log(gain)-fPMGainsA[channel])/fPMGainsB[channel]); | |
346 | } | |
347 | ||
4e2652e8 | 348 | //________________________________________________________________ |
3772afd5 | 349 | Float_t AliVZEROCalibData::GetGain(Int_t channel) |
4e2652e8 | 350 | { |
3772afd5 | 351 | // Computes the PM gains |
4e2652e8 | 352 | // Argument passed is the PM number (aliroot numbering) |
3772afd5 | 353 | if (!fPMGainsA) InitPMGains(); |
4e2652e8 | 354 | |
355 | // High Voltage retrieval from Calibration Data Base: | |
356 | Float_t hv = fMeanHV[channel]; | |
357 | Float_t gain = 0; | |
358 | if (hv>0) | |
3772afd5 | 359 | gain = TMath::Exp(fPMGainsA[channel]+fPMGainsB[channel]*TMath::Log(hv)); |
4e2652e8 | 360 | return gain; |
361 | } | |
362 | ||
d5deaaa5 | 363 | //________________________________________________________________ |
364 | void AliVZEROCalibData::SetTimeResolution(UShort_t *resols){ | |
365 | // Set Time Resolution of the TDC | |
366 | if(resols) for(int t=0; t<kNCIUBoards; t++) SetTimeResolution(resols[t],t); | |
4bc15c46 | 367 | else AliError("Time Resolution not defined."); |
d5deaaa5 | 368 | |
369 | } | |
370 | //________________________________________________________________ | |
371 | void AliVZEROCalibData::SetTimeResolution(UShort_t resol, Int_t board) | |
372 | { | |
373 | // Set Time Resolution of the TDC | |
4bc15c46 | 374 | if((board>=0) && (board<kNCIUBoards)) { |
d5deaaa5 | 375 | switch(resol){ |
376 | case 0: | |
377 | fTimeResolution[board] = 25./256.; | |
378 | break; | |
379 | case 1: | |
380 | fTimeResolution[board] = 25./128.; | |
381 | break; | |
382 | case 2: | |
383 | fTimeResolution[board] = 25./64.; | |
384 | break; | |
385 | case 3: | |
386 | fTimeResolution[board] = 25./32.; | |
387 | break; | |
388 | case 4: | |
389 | fTimeResolution[board] = 25./16.; | |
390 | break; | |
391 | case 5: | |
392 | fTimeResolution[board] = 25./8.; | |
393 | break; | |
394 | case 6: | |
395 | fTimeResolution[board] = 6.25; | |
396 | break; | |
397 | case 7: | |
398 | fTimeResolution[board] = 12.5; | |
399 | break; | |
400 | } | |
4bc15c46 | 401 | AliInfo(Form("Time Resolution of board %d set to %f",board,fTimeResolution[board])); |
d5deaaa5 | 402 | } else AliError(Form("Board %d is not valid",board)); |
403 | } | |
404 | //________________________________________________________________ | |
405 | void AliVZEROCalibData::SetWidthResolution(UShort_t *resols){ | |
406 | // Set Time Width Resolution of the TDC | |
407 | if(resols) for(int t=0; t<kNCIUBoards; t++) SetWidthResolution(resols[t],t); | |
4bc15c46 | 408 | else AliError("Width Resolution not defined."); |
d5deaaa5 | 409 | |
410 | } | |
411 | //________________________________________________________________ | |
412 | void AliVZEROCalibData::SetWidthResolution(UShort_t resol, Int_t board) | |
413 | { | |
414 | // Set Time Width Resolution of the TDC | |
4bc15c46 | 415 | if((board>=0) && (board<kNCIUBoards)){ |
d5deaaa5 | 416 | switch(resol){ |
417 | case 0: | |
418 | fWidthResolution[board] = 25./256.; | |
419 | break; | |
420 | case 1: | |
421 | fWidthResolution[board] = 25./128.; | |
422 | break; | |
423 | case 2: | |
424 | fWidthResolution[board] = 25./64.; | |
425 | break; | |
426 | case 3: | |
427 | fWidthResolution[board] = 25./32.; | |
428 | break; | |
429 | case 4: | |
430 | fWidthResolution[board] = 25./16.; | |
431 | break; | |
432 | case 5: | |
433 | fWidthResolution[board] = 25./8.; | |
434 | break; | |
435 | case 6: | |
436 | fWidthResolution[board] = 6.25; | |
437 | break; | |
438 | case 7: | |
439 | fWidthResolution[board] = 12.5; | |
440 | break; | |
441 | case 8: | |
442 | fWidthResolution[board] = 25.; | |
443 | break; | |
444 | case 9: | |
445 | fWidthResolution[board] = 50.; | |
446 | break; | |
447 | case 10: | |
448 | fWidthResolution[board] = 100.; | |
449 | break; | |
450 | case 11: | |
451 | fWidthResolution[board] = 200.; | |
452 | break; | |
453 | case 12: | |
454 | fWidthResolution[board] = 400.; | |
455 | break; | |
456 | case 13: | |
457 | fWidthResolution[board] = 800.; | |
458 | break; | |
459 | ||
460 | } | |
4bc15c46 | 461 | AliInfo(Form("Width Resolution of board %d set to %f",board,fWidthResolution[board])); |
d5deaaa5 | 462 | }else AliError(Form("Board %d is not valid",board)); |
463 | } | |
706506da | 464 | |
32cd3fdc | 465 | //________________________________________________________________ |
466 | void AliVZEROCalibData::SetMatchWindow(UInt_t *windows) | |
467 | { | |
468 | // Set Match window of the HPTDC | |
469 | // The units are 25ns | |
470 | if(windows) for(Int_t b=0; b<kNCIUBoards; b++) SetMatchWindow(windows[b],b); | |
471 | else AliError("Match windows not defined."); | |
472 | } | |
473 | ||
474 | //________________________________________________________________ | |
475 | void AliVZEROCalibData::SetMatchWindow(UInt_t window, Int_t board) | |
476 | { | |
477 | // Set Match window of the HPTDC | |
478 | // The units are 25ns | |
479 | if((board>=0) && (board<kNCIUBoards)){ | |
480 | fMatchWindow[board] = window; | |
481 | AliInfo(Form("Match window of board %d set to %d",board,fMatchWindow[board])); | |
482 | } | |
483 | else | |
484 | AliError(Form("Board %d is not valid",board)); | |
485 | } | |
486 | ||
487 | //________________________________________________________________ | |
488 | void AliVZEROCalibData::SetSearchWindow(UInt_t *windows) | |
489 | { | |
490 | // Set Search window of the HPTDC | |
491 | // The units are 25ns | |
492 | if(windows) for(Int_t b=0; b<kNCIUBoards; b++) SetSearchWindow(windows[b],b); | |
493 | else AliError("Search windows not defined."); | |
494 | } | |
495 | ||
496 | //________________________________________________________________ | |
497 | void AliVZEROCalibData::SetSearchWindow(UInt_t window, Int_t board) | |
498 | { | |
499 | // Set Search window of the HPTDC | |
500 | // The units are 25ns | |
501 | if((board>=0) && (board<kNCIUBoards)){ | |
502 | fSearchWindow[board] = window; | |
503 | AliInfo(Form("Search window of board %d set to %d",board,fSearchWindow[board])); | |
504 | } | |
505 | else | |
506 | AliError(Form("Board %d is not valid",board)); | |
507 | } | |
508 | ||
509 | //________________________________________________________________ | |
510 | void AliVZEROCalibData::SetTriggerCountOffset(UInt_t *offsets) | |
511 | { | |
512 | // Set trigger-count offset of the HPTDC | |
513 | // The units are 25ns | |
514 | if(offsets) for(Int_t b=0; b<kNCIUBoards; b++) SetTriggerCountOffset(offsets[b],b); | |
515 | else AliError("Trigger count offsets not defined."); | |
516 | } | |
517 | ||
518 | //________________________________________________________________ | |
519 | void AliVZEROCalibData::SetTriggerCountOffset(UInt_t offset, Int_t board) | |
520 | { | |
521 | // Set trigger-count offsets of the HPTDC | |
522 | // The units are 25ns | |
523 | if((board>=0) && (board<kNCIUBoards)){ | |
524 | fTriggerCountOffset[board] = offset; | |
525 | AliInfo(Form("Trigger-count offset of board %d set to %d",board,fTriggerCountOffset[board])); | |
526 | } | |
527 | else | |
528 | AliError(Form("Board %d is not valid",board)); | |
529 | } | |
530 | ||
531 | //________________________________________________________________ | |
532 | void AliVZEROCalibData::SetRollOver(UInt_t *offsets) | |
533 | { | |
534 | // Set Roll-over of the HPTDC | |
535 | // The units are 25ns | |
536 | if(offsets) for(Int_t b=0; b<kNCIUBoards; b++) SetRollOver(offsets[b],b); | |
537 | else AliError("Roll-over offsets not defined."); | |
538 | } | |
539 | ||
540 | //________________________________________________________________ | |
541 | void AliVZEROCalibData::SetRollOver(UInt_t offset, Int_t board) | |
542 | { | |
543 | // Set Roll-over of the HPTDC | |
544 | // The units are 25ns | |
545 | if((board>=0) && (board<kNCIUBoards)){ | |
546 | fRollOver[board] = offset; | |
547 | AliInfo(Form("Roll-over offset of board %d set to %d",board,fRollOver[board])); | |
548 | } | |
549 | else | |
550 | AliError(Form("Board %d is not valid",board)); | |
551 | } | |
6e2c3e87 | 552 | |
553 | //________________________________________________________________ | |
51980118 | 554 | void AliVZEROCalibData::SetDiscriThr(Float_t thr, Int_t board, Int_t channel) |
6e2c3e87 | 555 | { |
556 | // Set the TDC discriminator | |
557 | // threshold values expressed in units of ADC | |
51980118 | 558 | Int_t ch = AliVZEROCalibData::GetOfflineChannelNumber(board,channel); |
559 | if(ch >= 0){ | |
6e2c3e87 | 560 | if (thr > 0) { |
51980118 | 561 | fDiscriThr[ch]=thr; |
562 | AliInfo(Form("Discriminator threshold for channel %d set to %f",ch,fDiscriThr[ch])); | |
6e2c3e87 | 563 | } |
564 | else { | |
51980118 | 565 | AliWarning(Form("Ignore wrong threshold value (%f) for channel %d !",thr,ch)); |
6e2c3e87 | 566 | } |
567 | } | |
568 | else | |
51980118 | 569 | AliError("Board/Channel numbers are not valid"); |
6e2c3e87 | 570 | } |
571 | ||
572 | //________________________________________________________________ | |
573 | void AliVZEROCalibData::SetDiscriThr(const Float_t* thresholds) | |
574 | { | |
575 | // Set the TDC discriminator | |
576 | // threshold values expressed in units of ADC | |
577 | if(thresholds) for(int t=0; t<64; t++) fDiscriThr[t] = thresholds[t]; | |
578 | else for(int t=0; t<64; t++) fDiscriThr[t] = 2.5; | |
579 | } | |
51980118 | 580 | |
581 | Int_t AliVZEROCalibData::GetOfflineChannelNumber(Int_t board, Int_t channel) | |
582 | { | |
583 | // Get the offline channel number from | |
584 | // the FEE board and channel indexes | |
585 | ||
586 | if (board < 0 || board >= 8) { | |
587 | AliErrorClass(Form("Wrong FEE board number: %d",board)); | |
588 | return -1; | |
589 | } | |
590 | if (channel < 0 || channel >= 8) { | |
591 | AliErrorClass(Form("Wrong FEE channel number: %d",channel)); | |
592 | return -1; | |
593 | } | |
594 | ||
595 | Int_t offCh = (board < 4) ? (8 * board + 32) : (8 * board -32); | |
596 | offCh += (7 - channel); | |
597 | ||
598 | return offCh; | |
599 | } | |
600 | ||
601 | Int_t AliVZEROCalibData::GetBoardNumber(Int_t channel) | |
602 | { | |
603 | // Get FEE board number | |
604 | // from offline channel index | |
605 | if (channel >= 0 && channel < 32) return (channel / 8 + 4); | |
606 | if (channel >=32 && channel < 64) return (channel / 8 - 4); | |
607 | ||
608 | AliErrorClass(Form("Wrong channel index: %d",channel)); | |
609 | return -1; | |
610 | } | |
d0ff6548 | 611 | |
612 | Int_t AliVZEROCalibData::GetFEEChannelNumber(Int_t channel) | |
613 | { | |
614 | // Get FEE channel number | |
615 | // from offline channel index | |
616 | if (channel >= 0 && channel < 64) return (7 - (channel % 8)); | |
617 | ||
618 | AliErrorClass(Form("Wrong channel index: %d",channel)); | |
619 | return -1; | |
620 | } | |
3772afd5 | 621 | |
622 | Float_t AliVZEROCalibData::GetLightYields(Int_t channel) | |
623 | { | |
624 | // Get the light yield efficiency | |
625 | // for a given channel | |
626 | if (!fLightYields) InitLightYields(); | |
627 | ||
628 | if (channel >= 0 && channel < 64) { | |
629 | return fLightYields[channel]; | |
630 | } | |
631 | ||
632 | AliError(Form("Wrong channel index: %d",channel)); | |
633 | return 0; | |
634 | } | |
635 | ||
636 | void AliVZEROCalibData::InitLightYields() | |
637 | { | |
638 | // Initialize the light yield factors | |
639 | // Read from a separate OCDB entry | |
640 | if (fLightYields) return; | |
641 | ||
642 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("VZERO/Calib/LightYields"); | |
643 | if (!entry) AliFatal("VZERO light yields are not found in OCDB !"); | |
644 | TH1F *yields = (TH1F*)entry->GetObject(); | |
645 | ||
646 | fLightYields = new Float_t[64]; | |
647 | for(Int_t i = 0 ; i < 64; ++i) { | |
648 | fLightYields[i] = yields->GetBinContent(i+1); | |
649 | } | |
650 | } | |
651 | ||
652 | void AliVZEROCalibData::InitPMGains() | |
653 | { | |
654 | // Initialize the PM gain factors | |
655 | // Read from a separate OCDB entry | |
656 | if (fPMGainsA) return; | |
657 | ||
658 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("VZERO/Calib/PMGains"); | |
659 | if (!entry) AliFatal("VZERO PM gains are not found in OCDB !"); | |
660 | TH2F *gains = (TH2F*)entry->GetObject(); | |
661 | ||
662 | fPMGainsA = new Float_t[64]; | |
663 | fPMGainsB = new Float_t[64]; | |
664 | for(Int_t i = 0 ; i < 64; ++i) { | |
665 | fPMGainsA[i] = gains->GetBinContent(i+1,1); | |
666 | fPMGainsB[i] = gains->GetBinContent(i+1,2); | |
667 | } | |
668 | } | |
ed1ea59f | 669 | |
670 | Float_t AliVZEROCalibData::GetCalibDiscriThr(Int_t channel, Bool_t scaled) | |
671 | { | |
672 | // The method returns actual TDC discri threshold | |
673 | // extracted from the data. | |
674 | // | |
675 | // In case scaled flag is set the threshold is scaled | |
676 | // so that to get 4.0 for a FEE threshold of 4.0. | |
677 | // In this way we avoid a change in the slewing correction | |
678 | // for the entire 2010 p-p data. | |
679 | // | |
680 | // The method is to be moved to OCDB object. | |
681 | ||
682 | Float_t thr = GetDiscriThr(channel); | |
683 | ||
684 | Float_t calThr = 0; | |
685 | if (thr <= 1.) | |
686 | calThr = 3.1; | |
687 | else if (thr >= 2.) | |
688 | calThr = (3.1+1.15*thr-1.7); | |
689 | else | |
690 | calThr = (3.1-0.3*thr+0.3*thr*thr); | |
691 | ||
692 | if (scaled) calThr *= 4./(3.1+1.15*4.-1.7); | |
693 | ||
694 | return calThr; | |
695 | } |