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