1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliVZEROCalibData.cxx, */
18 /////////////////////////////////////////////////////////////////////////////
20 // class for VZERO calibration //
22 /////////////////////////////////////////////////////////////////////////////
25 #include <TObjString.h>
28 #include "AliDCSValue.h"
29 #include "AliVZEROCalibData.h"
30 #include "AliVZERODataDCS.h"
33 ClassImp(AliVZEROCalibData)
35 //________________________________________________________________
36 AliVZEROCalibData::AliVZEROCalibData()
38 // default constructor
40 for(int t=0; t<64; t++) {
45 fDeadChannel[t]= kFALSE;
48 for(int t=0; t<128; t++) {
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
59 fSearchWindow[i] = 16;
60 fTriggerCountOffset[i] = 3247;
66 //________________________________________________________________
67 void AliVZEROCalibData::Reset()
72 //________________________________________________________________
73 AliVZEROCalibData::AliVZEROCalibData(const char* name)
76 TString namst = "Calib_";
78 SetName(namst.Data());
79 SetTitle(namst.Data());
80 for(int t=0; t<64; t++) {
85 fDeadChannel[t]= kFALSE;
88 for(int t=0; t<128; t++) {
95 for(int i=0; i<kNCIUBoards ;i++) {
96 fTimeResolution[i] = 25./256.; // Default time resolution in ns / channel
97 fWidthResolution[i] = 25./64.; // Default time width resolution in ns / channel
99 fSearchWindow[i] = 16;
100 fTriggerCountOffset[i] = 3247;
106 //________________________________________________________________
107 AliVZEROCalibData::AliVZEROCalibData(const AliVZEROCalibData& calibda) :
112 SetName(calibda.GetName());
113 SetTitle(calibda.GetName());
115 for(int t=0; t<128; t++) {
116 fPedestal[t] = calibda.GetPedestal(t);
117 fSigma[t] = calibda.GetSigma(t);
118 fADCmean[t] = calibda.GetADCmean(t);
119 fADCsigma[t] = calibda.GetADCsigma(t);
120 fGain[t] = calibda.GetGain(t); }
122 for(int t=0; t<64; t++) {
123 fMeanHV[t] = calibda.GetMeanHV(t);
124 fWidthHV[t] = calibda.GetWidthHV(t);
125 fTimeOffset[t] = calibda.GetTimeOffset(t);
126 fTimeGain[t] = calibda.GetTimeGain(t);
127 fDeadChannel[t] = calibda.IsChannelDead(t);
128 fDiscriThr[t] = calibda.GetDiscriThr(t);
131 for(int i=0; i<kNCIUBoards ;i++) {
132 fTimeResolution[i] = calibda.GetTimeResolution(i);
133 fWidthResolution[i] = calibda.GetWidthResolution(i);
134 fMatchWindow[i] = calibda.GetMatchWindow(i);
135 fSearchWindow[i] = calibda.GetSearchWindow(i);
136 fTriggerCountOffset[i] = calibda.GetTriggerCountOffset(i);
137 fRollOver[i] = calibda.GetRollOver(i);
142 //________________________________________________________________
143 AliVZEROCalibData &AliVZEROCalibData::operator =(const AliVZEROCalibData& calibda)
145 // assignment operator
147 SetName(calibda.GetName());
148 SetTitle(calibda.GetName());
150 for(int t=0; t<128; t++) {
151 fPedestal[t] = calibda.GetPedestal(t);
152 fSigma[t] = calibda.GetSigma(t);
153 fADCmean[t] = calibda.GetADCmean(t);
154 fADCsigma[t] = calibda.GetADCsigma(t);
155 fGain[t] = calibda.GetGain(t); }
157 for(int t=0; t<64; t++) {
158 fMeanHV[t] = calibda.GetMeanHV(t);
159 fWidthHV[t] = calibda.GetWidthHV(t);
160 fTimeOffset[t] = calibda.GetTimeOffset(t);
161 fTimeGain[t] = calibda.GetTimeGain(t);
162 fDeadChannel[t] = calibda.IsChannelDead(t);
163 fDiscriThr[t] = calibda.GetDiscriThr(t);
165 for(int i=0; i<kNCIUBoards ;i++) {
166 fTimeResolution[i] = calibda.GetTimeResolution(i);
167 fWidthResolution[i] = calibda.GetWidthResolution(i);
168 fMatchWindow[i] = calibda.GetMatchWindow(i);
169 fSearchWindow[i] = calibda.GetSearchWindow(i);
170 fTriggerCountOffset[i] = calibda.GetTriggerCountOffset(i);
171 fRollOver[i] = calibda.GetRollOver(i);
178 //________________________________________________________________
179 AliVZEROCalibData::~AliVZEROCalibData()
183 //_____________________________________________________________________________
184 void AliVZEROCalibData::FillDCSData(AliVZERODataDCS * data){
185 // Set all parameters from the data get by the shuttle
186 TMap * params = data->GetFEEParameters();
188 TObjString* aliasName;
190 while (( aliasName = (TObjString*) iter.Next() )) {
191 AliDCSValue* aValue = (AliDCSValue*) params->GetValue(aliasName);
194 val = aValue->GetUInt();
195 AliInfo(Form("%s : %d",aliasName->String().Data(), val));
196 SetParameter(aliasName->String(),val);
200 SetMeanHV(data->GetMeanHV());
201 SetWidthHV(data->GetWidthHV());
202 SetDeadMap(data->GetDeadMap());
205 //_____________________________________________________________________________
206 void AliVZEROCalibData::SetParameter(TString name, Int_t val){
207 // Set given parameter
212 TSeqCollection* nameSplit = name.Tokenize("/");
213 TObjString * boardName = (TObjString *)nameSplit->At(2);
214 sscanf(boardName->String().Data(),"CIU%d",&iBoard);
216 TString paramName = ((TObjString *)nameSplit->At(3))->String();
217 Char_t channel[2] ; channel[1] = '\0';
218 channel[0] = paramName[paramName.Sizeof()-2];
219 sscanf(channel,"%d",&iChannel);
221 if(name.Contains("TimeResolution")) SetTimeResolution((UShort_t) val,iBoard);
222 else if(name.Contains("WidthResolution")) SetWidthResolution((UShort_t) val,iBoard);
223 else if(name.Contains("MatchWindow")) SetMatchWindow((UInt_t) val,iBoard);
224 else if(name.Contains("SearchWindow")) SetSearchWindow((UInt_t) val,iBoard);
225 else if(name.Contains("TriggerCountOffset")) SetTriggerCountOffset((UInt_t) val,iBoard);
226 else if(name.Contains("RollOver")) SetRollOver((UInt_t) val,iBoard);
227 else if(name.Contains("DelayHit")) SetTimeOffset(0.01*(Float_t)val,8*iBoard+(iChannel-1));
228 else if(name.Contains("DiscriThr")) SetDiscriThr(((Float_t)val-2040.)/112.,8*iBoard+(iChannel-1));
229 else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));
232 //________________________________________________________________
233 void AliVZEROCalibData::SetPedestal(const Float_t* Pedestal)
235 if(Pedestal) for(int t=0; t<128; t++) fPedestal[t] = Pedestal[t];
236 else for(int t=0; t<128; t++) fPedestal[t] = 0.0;
239 //________________________________________________________________
240 void AliVZEROCalibData::SetSigma(const Float_t* Sigma)
242 if(Sigma) for(int t=0; t<128; t++) fSigma[t] = Sigma[t];
243 else for(int t=0; t<128; t++) fSigma[t] = 0.0;
246 //________________________________________________________________
247 void AliVZEROCalibData::SetADCmean(const Float_t* ADCmean)
249 if(ADCmean) for(int t=0; t<128; t++) fADCmean[t] = ADCmean[t];
250 else for(int t=0; t<128; t++) fADCmean[t] = 0.0;
253 //________________________________________________________________
254 void AliVZEROCalibData::SetADCsigma(const Float_t* ADCsigma)
256 if(ADCsigma) for(int t=0; t<128; t++) fADCsigma[t] = ADCsigma[t];
257 else for(int t=0; t<128; t++) fADCsigma[t] = 0.0;
260 //________________________________________________________________
261 void AliVZEROCalibData::SetMeanHV(const Float_t* MeanHV)
263 if(MeanHV) for(int t=0; t<64; t++) fMeanHV[t] = MeanHV[t];
264 else for(int t=0; t<64; t++) fMeanHV[t] = 0.0;
267 //________________________________________________________________
268 void AliVZEROCalibData::SetWidthHV(const Float_t* WidthHV)
270 if(WidthHV) for(int t=0; t<64; t++) fWidthHV[t] = WidthHV[t];
271 else for(int t=0; t<64; t++) fWidthHV[t] = 0.0;
274 //________________________________________________________________
275 void AliVZEROCalibData::SetDeadMap(const Bool_t* deadMap)
277 if(deadMap) for(int t=0; t<64; t++) fDeadChannel[t] = deadMap[t];
278 else for(int t=0; t<64; t++) fDeadChannel[t] = kFALSE;
281 //________________________________________________________________
282 void AliVZEROCalibData::SetGain(const Float_t* Gain)
284 if(Gain) for(int t=0; t<128; t++) fGain[t] = Gain[t];
285 else for(int t=0; t<128; t++) fGain[t] = 0.0;
288 //________________________________________________________________
289 void AliVZEROCalibData::SetTimeOffset(Float_t val, Int_t channel)
291 if((channel>=0) && (channel<64)){
292 fTimeOffset[channel]=val;
293 AliInfo(Form("Time offset for channel %d set to %f",channel,fTimeOffset[channel]));
296 AliError(Form("Channel %d is not valid",channel));
299 //________________________________________________________________
300 void AliVZEROCalibData::SetTimeOffset(const Float_t* TimeOffset)
302 if(TimeOffset) for(int t=0; t<64; t++) fTimeOffset[t] = TimeOffset[t];
303 else for(int t=0; t<64; t++) fTimeOffset[t] = 5.0;
306 //________________________________________________________________
307 void AliVZEROCalibData::SetTimeGain(const Float_t* TimeGain)
309 if(TimeGain) for(int t=0; t<64; t++) fTimeGain[t] = TimeGain[t];
310 else for(int t=0; t<64; t++) fTimeGain[t] = 0.0;
313 //_____________________________________________________________________________
314 Float_t AliVZEROCalibData::GetMIPperADC(Int_t channel) const {
316 // Computes the MIP conversion factor - MIP per ADC channel -
317 // Argument passed is the PM number (aliroot numbering)
320 7.094891, 7.124938, 7.089708, 7.098169, 7.094482, 7.147250, 7.170978, 7.183392,
321 7.145760, 7.148096, 7.153840, 7.143544, 7.186069, 7.194580, 7.203516, 7.195176,
322 7.188333, 7.198607, 7.209412, 7.226565, 7.221695, 7.205132, 7.191238, 7.227724,
323 7.232810, 7.252655, 7.230309, 7.273518, 7.273518, 7.242969, 7.252859, 7.252655,
324 7.026802, 7.079913, 7.134147, 7.092387, 7.079561, 7.072848, 7.123192, 7.003141,
325 7.024667, 7.124784, 7.123442, 7.129744, 7.110671, 7.143031, 7.139439, 7.178109,
326 7.247803, 7.139396, 7.293809, 7.094454, 6.992198, 7.206448, 7.244765, 7.056197,
327 7.263595, 7.138569, 7.089582, 7.215683, 7.266183, 7.165123, 7.243276, 7.235135 };
329 0.135569, 0.146405, 0.142425, 0.144278, 0.142307, 0.141648, 0.128477, 0.138239,
330 0.144173, 0.143419, 0.143572, 0.144482, 0.138024, 0.136542, 0.135955, 0.138537,
331 0.148521, 0.141999, 0.139627, 0.130014, 0.134970, 0.135635, 0.139094, 0.140634,
332 0.137971, 0.142080, 0.142793, 0.142778, 0.142778, 0.146045, 0.139133, 0.142080,
333 0.144121, 0.142311, 0.136564, 0.142686, 0.138792, 0.166285, 0.136387, 0.155391,
334 0.176082, 0.140408, 0.164738, 0.144270, 0.142766, 0.147486, 0.141951, 0.138012,
335 0.132394, 0.142849, 0.140477, 0.144592, 0.141558, 0.157646, 0.143758, 0.173385,
336 0.146489, 0.143279, 0.145230, 0.147203, 0.147333, 0.144979, 0.148597, 0.138985 };
338 // High Voltage retrieval from Calibration Data Base:
339 Float_t hv = fMeanHV[channel];
342 mip = 0.6/TMath::Exp((TMath::Log(hv) - p0[channel] )/p1[channel]);
346 //________________________________________________________________
347 void AliVZEROCalibData::SetTimeResolution(UShort_t *resols){
348 // Set Time Resolution of the TDC
349 if(resols) for(int t=0; t<kNCIUBoards; t++) SetTimeResolution(resols[t],t);
350 else AliError("Time Resolution not defined.");
353 //________________________________________________________________
354 void AliVZEROCalibData::SetTimeResolution(UShort_t resol, Int_t board)
356 // Set Time Resolution of the TDC
357 if((board>=0) && (board<kNCIUBoards)) {
360 fTimeResolution[board] = 25./256.;
363 fTimeResolution[board] = 25./128.;
366 fTimeResolution[board] = 25./64.;
369 fTimeResolution[board] = 25./32.;
372 fTimeResolution[board] = 25./16.;
375 fTimeResolution[board] = 25./8.;
378 fTimeResolution[board] = 6.25;
381 fTimeResolution[board] = 12.5;
384 AliInfo(Form("Time Resolution of board %d set to %f",board,fTimeResolution[board]));
385 } else AliError(Form("Board %d is not valid",board));
387 //________________________________________________________________
388 void AliVZEROCalibData::SetWidthResolution(UShort_t *resols){
389 // Set Time Width Resolution of the TDC
390 if(resols) for(int t=0; t<kNCIUBoards; t++) SetWidthResolution(resols[t],t);
391 else AliError("Width Resolution not defined.");
394 //________________________________________________________________
395 void AliVZEROCalibData::SetWidthResolution(UShort_t resol, Int_t board)
397 // Set Time Width Resolution of the TDC
398 if((board>=0) && (board<kNCIUBoards)){
401 fWidthResolution[board] = 25./256.;
404 fWidthResolution[board] = 25./128.;
407 fWidthResolution[board] = 25./64.;
410 fWidthResolution[board] = 25./32.;
413 fWidthResolution[board] = 25./16.;
416 fWidthResolution[board] = 25./8.;
419 fWidthResolution[board] = 6.25;
422 fWidthResolution[board] = 12.5;
425 fWidthResolution[board] = 25.;
428 fWidthResolution[board] = 50.;
431 fWidthResolution[board] = 100.;
434 fWidthResolution[board] = 200.;
437 fWidthResolution[board] = 400.;
440 fWidthResolution[board] = 800.;
444 AliInfo(Form("Width Resolution of board %d set to %f",board,fWidthResolution[board]));
445 }else AliError(Form("Board %d is not valid",board));
448 //________________________________________________________________
449 void AliVZEROCalibData::SetMatchWindow(UInt_t *windows)
451 // Set Match window of the HPTDC
452 // The units are 25ns
453 if(windows) for(Int_t b=0; b<kNCIUBoards; b++) SetMatchWindow(windows[b],b);
454 else AliError("Match windows not defined.");
457 //________________________________________________________________
458 void AliVZEROCalibData::SetMatchWindow(UInt_t window, Int_t board)
460 // Set Match window of the HPTDC
461 // The units are 25ns
462 if((board>=0) && (board<kNCIUBoards)){
463 fMatchWindow[board] = window;
464 AliInfo(Form("Match window of board %d set to %d",board,fMatchWindow[board]));
467 AliError(Form("Board %d is not valid",board));
470 //________________________________________________________________
471 void AliVZEROCalibData::SetSearchWindow(UInt_t *windows)
473 // Set Search window of the HPTDC
474 // The units are 25ns
475 if(windows) for(Int_t b=0; b<kNCIUBoards; b++) SetSearchWindow(windows[b],b);
476 else AliError("Search windows not defined.");
479 //________________________________________________________________
480 void AliVZEROCalibData::SetSearchWindow(UInt_t window, Int_t board)
482 // Set Search window of the HPTDC
483 // The units are 25ns
484 if((board>=0) && (board<kNCIUBoards)){
485 fSearchWindow[board] = window;
486 AliInfo(Form("Search window of board %d set to %d",board,fSearchWindow[board]));
489 AliError(Form("Board %d is not valid",board));
492 //________________________________________________________________
493 void AliVZEROCalibData::SetTriggerCountOffset(UInt_t *offsets)
495 // Set trigger-count offset of the HPTDC
496 // The units are 25ns
497 if(offsets) for(Int_t b=0; b<kNCIUBoards; b++) SetTriggerCountOffset(offsets[b],b);
498 else AliError("Trigger count offsets not defined.");
501 //________________________________________________________________
502 void AliVZEROCalibData::SetTriggerCountOffset(UInt_t offset, Int_t board)
504 // Set trigger-count offsets of the HPTDC
505 // The units are 25ns
506 if((board>=0) && (board<kNCIUBoards)){
507 fTriggerCountOffset[board] = offset;
508 AliInfo(Form("Trigger-count offset of board %d set to %d",board,fTriggerCountOffset[board]));
511 AliError(Form("Board %d is not valid",board));
514 //________________________________________________________________
515 void AliVZEROCalibData::SetRollOver(UInt_t *offsets)
517 // Set Roll-over of the HPTDC
518 // The units are 25ns
519 if(offsets) for(Int_t b=0; b<kNCIUBoards; b++) SetRollOver(offsets[b],b);
520 else AliError("Roll-over offsets not defined.");
523 //________________________________________________________________
524 void AliVZEROCalibData::SetRollOver(UInt_t offset, Int_t board)
526 // Set Roll-over of the HPTDC
527 // The units are 25ns
528 if((board>=0) && (board<kNCIUBoards)){
529 fRollOver[board] = offset;
530 AliInfo(Form("Roll-over offset of board %d set to %d",board,fRollOver[board]));
533 AliError(Form("Board %d is not valid",board));
536 //________________________________________________________________
537 void AliVZEROCalibData::SetDiscriThr(Float_t thr, Int_t channel)
539 // Set the TDC discriminator
540 // threshold values expressed in units of ADC
541 if((channel>=0) && (channel<64)){
543 fDiscriThr[channel]=thr;
544 AliInfo(Form("Discriminator threshold for channel %d set to %f",channel,fDiscriThr[channel]));
547 AliWarning(Form("Ignore wrong threshold value (%f) for channel %d !",thr,channel));
551 AliError(Form("Channel %d is not valid",channel));
554 //________________________________________________________________
555 void AliVZEROCalibData::SetDiscriThr(const Float_t* thresholds)
557 // Set the TDC discriminator
558 // threshold values expressed in units of ADC
559 if(thresholds) for(int t=0; t<64; t++) fDiscriThr[t] = thresholds[t];
560 else for(int t=0; t<64; t++) fDiscriThr[t] = 2.5;