From 64c217000fb030d5aca4cfa83c12194be5e444f8 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 8 Aug 2005 10:50:38 +0000 Subject: [PATCH 1/1] 05-aug-2005 NvE Typos fixed in AliAttrib::GetCalFunction and AliAttrib::GetDecalFunction which erroneously always returned a null pointer. 05-aug-2005 NvE Support for printfreq=0 introduced in IceF2k to allow suppression of the event summary printout. 08-aug-2005 NvE (De)calibration functions introduced in IceF2k::FillOMdbase and IceF2k::PutHits to enable access to either automatically calibrated or de-calibrated data. --- RALICE/AliAttrib.cxx | 4 +- RALICE/AliSignal.cxx | 75 ++++++++++---- RALICE/history.txt | 2 + RALICE/icepack/iceconvert/IceF2k.cxx | 134 +++++++++++++++++++++++--- RALICE/icepack/iceconvert/history.txt | 4 + 5 files changed, 182 insertions(+), 37 deletions(-) diff --git a/RALICE/AliAttrib.cxx b/RALICE/AliAttrib.cxx index dd553320a7d..97f531be757 100644 --- a/RALICE/AliAttrib.cxx +++ b/RALICE/AliAttrib.cxx @@ -1370,7 +1370,7 @@ TF1* AliAttrib::GetCalFunction(TString name) const TF1* f=0; Int_t j=GetSlotIndex(name); - if (j>0) GetCalFunction(j); + if (j>0) f=GetCalFunction(j); return f; } /////////////////////////////////////////////////////////////////////////// @@ -1455,7 +1455,7 @@ TF1* AliAttrib::GetDecalFunction(TString name) const TF1* f=0; Int_t j=GetSlotIndex(name); - if (j>0) GetDecalFunction(j); + if (j>0) f=GetDecalFunction(j); return f; } /////////////////////////////////////////////////////////////////////////// diff --git a/RALICE/AliSignal.cxx b/RALICE/AliSignal.cxx index ef4d7d80b3a..76c1ca2dd96 100644 --- a/RALICE/AliSignal.cxx +++ b/RALICE/AliSignal.cxx @@ -429,6 +429,9 @@ Float_t AliSignal::GetSignal(Int_t j,Int_t mode) const // In case the offset value was not set, offset=0 will be assumed. // 2 : Same as mode=1 but gain, offset dead flag etc... are taken from // the AliDevice which owns this AliSignal object. +// The corresponding AliDevice slot is obtained via matching of +// the slotnames. In case this fails, the slotindex "j" of the +// input argument will be used. // In case this AliSignal object has no parent AliDevice, just // the j-th signal is returned (like with mode=0). // 3 : The j-th signal is corrected using the corresponding calibration @@ -438,10 +441,15 @@ Float_t AliSignal::GetSignal(Int_t j,Int_t mode) const // is returned (like with mode=0). // 4 : Same as mode=3 but the calibration function is taken from // the AliDevice which owns this AliSignal object. +// The corresponding AliDevice slot is obtained via matching of +// the slotnames. In case this fails, the slotindex "j" of the +// input argument will be used. // 5 : Same as mode=2 but in case no parent AliDevice is present // an automatic switch to mode=1 will be made. // 6 : Same as mode=4 but in case no parent AliDevice is present // an automatic switch to mode=3 will be made. +// 7 : Same as mode=3 but in case no calibration function is present +// an automatic switch to mode=4 will be made. // // <0 : The corresponding de-correction or de-calibration is performed // @@ -455,14 +463,51 @@ Float_t AliSignal::GetSignal(Int_t j,Int_t mode) const // // The default is mode=0. - if (abs(mode)>6) return 0; + if (abs(mode)>7) return 0; + Int_t jcal=j; Float_t sig=0; Float_t gain=1; Float_t offset=0; AliSignal* sx=(AliSignal*)this; - if (abs(mode)==2 || abs(mode)>=4) sx=(AliSignal*)GetDevice(); + + TF1* f=0; + if (mode==7) + { + f=sx->GetCalFunction(jcal); + if (f) + { + mode=3; + } + else + { + mode=4; + } + } + if (mode==-7) + { + f=sx->GetDecalFunction(jcal); + if (f) + { + mode=-3; + } + else + { + mode=-4; + } + } + + if (abs(mode)==2 || abs(mode)>=4) + { + sx=(AliSignal*)GetDevice(); + if (sx) + { + TString name=GetSlotName(j); + if (strlen(name.Data())) jcal=sx->GetSlotIndex(name); + if (!jcal) jcal=j; + } + } if (!sx && abs(mode)>=5) sx=(AliSignal*)this; if (mode==5) mode=2; if (mode==-5) mode=-2; @@ -478,13 +523,13 @@ Float_t AliSignal::GetSignal(Int_t j,Int_t mode) const if (mode==0 || !sx) return sig; // Check for the dead flag setting - if (sx->GetDeadValue(j)) return 0; + if (sx->GetDeadValue(jcal)) return 0; // (De)correct the signal for the gain and offset if (abs(mode)==1 || abs(mode)==2) { - if (sx->GetGainFlag(j)) gain=sx->GetGain(j); - if (sx->GetOffsetFlag(j)) offset=sx->GetOffset(j); + if (sx->GetGainFlag(jcal)) gain=sx->GetGain(jcal); + if (sx->GetOffsetFlag(jcal)) offset=sx->GetOffset(jcal); if (fabs(gain)>0.) { @@ -501,8 +546,8 @@ Float_t AliSignal::GetSignal(Int_t j,Int_t mode) const // (De)calibrate the signal with the corresponding (de)calibration function if (abs(mode)==3 || abs(mode)==4) { - TF1* f=sx->GetCalFunction(j); - if (mode<0) f=sx->GetDecalFunction(j); + f=sx->GetCalFunction(jcal); + if (mode<0) f=sx->GetDecalFunction(jcal); if (f) sig=f->Eval(sig); return sig; } @@ -519,18 +564,10 @@ Float_t AliSignal::GetSignal(TString name,Int_t mode) const { // Provide signal value of the name-specified slot. // In case no signal is present, 0 is returned. -// The parameter "mode" allows for automatic gain etc... correction of the signal. -// -// mode = 0 : Just the j-th signal is returned. -// 1 : The j-th signal is corrected for the gain, offset, dead flag etc... -// In case the gain value was not set, gain=1 will be assumed. -// In case the gain value was 0, a signal value of 0 is returned. -// In case the offset value was not set, offset=0 will be assumed. -// In case the j-th slot was marked dead, 0 is returned. -// -// The corrected signal (sigc) is determined as follows : -// -// sigc=(signal/gain)-offset +// The parameter "mode" allows for automatic (de)calibration of the signal +// (e.g. gain etc... correction or via explicit (de)calibration functions). +// For further details about the (de)calibration modes, please refer to the +// corresponding slot-index based memberfunction. // // The default is mode=0. // diff --git a/RALICE/history.txt b/RALICE/history.txt index 2370a5680e2..9d6dca40adf 100644 --- a/RALICE/history.txt +++ b/RALICE/history.txt @@ -632,6 +632,8 @@ 03-aug-2005 NvE AliSignal::GetSignal has been extended to support various (de)calibration facilities. Printout is now also provided in AliSignal::List when only calibration data exist for AliDevice (or derived) objects. +05-aug-2005 NvE Typos fixed in AliAttrib::GetCalFunction and AliAttrib::GetDecalFunction which + erroneously always returned a null pointer. \ No newline at end of file diff --git a/RALICE/icepack/iceconvert/IceF2k.cxx b/RALICE/icepack/iceconvert/IceF2k.cxx index fa35107acd4..e777fd0991f 100644 --- a/RALICE/icepack/iceconvert/IceF2k.cxx +++ b/RALICE/icepack/iceconvert/IceF2k.cxx @@ -156,7 +156,7 @@ void IceF2k::SetPrintFreq(Int_t f) { // Set the printfrequency to produce info every f events. // f=1 is the default initialisation in the constructor. - if (f>0) fPrintfreq=f; + if (f>=0) fPrintfreq=f; } /////////////////////////////////////////////////////////////////////////// void IceF2k::SetSplitLevel(Int_t split) @@ -322,7 +322,10 @@ void IceF2k::Exec(Option_t* opt) // Invoke all available sub-tasks (if any) ExecuteTasks(opt); - if (!(nevt%fPrintfreq)) evt->HeaderData(); + if (fPrintfreq) + { + if (!(nevt%fPrintfreq)) evt->HeaderData(); + } // Write the complete structure to the output Tree if (otree) otree->Fill(); @@ -347,6 +350,19 @@ void IceF2k::FillOMdbase() if (fHeader.nch<=0) return; + Int_t geocal=fHeader.is_calib.geo; + Int_t adccal=fHeader.is_calib.adc; + Int_t tdccal=fHeader.is_calib.tdc; + Int_t totcal=fHeader.is_calib.tot; + Int_t utccal=fHeader.is_calib.utc; + + TF1 fadccal("fadccal","(x-[1])*[0]"); + TF1 fadcdecal("fadcdecal","(x/[0])+[1]"); + TF1 ftdccal("ftdccal","(x*[0])-[1]-([0]-1.)*32767.-[2]/sqrt([3])"); + TF1 ftdcdecal("ftdcdecal","(x+([0]-1.)*32767.+[1]+[2]/sqrt([3]))/[0]"); + TF1 ftotcal("ftotcal","x*[0]"); + TF1 ftotdecal("ftotdecal","x/[0]"); + if (fOmdb) { fOmdb->Reset(); @@ -364,25 +380,91 @@ void IceF2k::FillOMdbase() { dev=new IceAOM(); dev->SetUniqueID(i+1); - dev->SetSlotName("TYPE",1); - dev->SetSlotName("ORIENT",2); - dev->SetSlotName("T0",3); - dev->SetSlotName("ALPHA",4); - dev->SetSlotName("KADC",5); - dev->SetSlotName("KTOT",6); - dev->SetSlotName("KTDC",7); + + dev->SetSlotName("ADC",1); + dev->SetSlotName("LE",2); + dev->SetSlotName("TOT",3); + + dev->SetSlotName("TYPE",4); + dev->SetSlotName("ORIENT",5); + dev->SetSlotName("THRESH",6); + dev->SetSlotName("SENSIT",7); + dev->SetSlotName("BETA-TDC",8); + dev->SetSlotName("T0",9); + dev->SetSlotName("ALPHA-TDC",10); + dev->SetSlotName("PED-ADC",11); + dev->SetSlotName("BETA-ADC",12); + dev->SetSlotName("KAPPA-ADC",13); + dev->SetSlotName("PED-TOT",14); + dev->SetSlotName("BETA-TOT",15); + dev->SetSlotName("KAPPA-TOT",16); pos[0]=fHeader.x[i]; pos[1]=fHeader.y[i]; pos[2]=fHeader.z[i]; dev->SetPosition(pos,"car"); - dev->SetSignal(fHeader.type[i],1); - dev->SetSignal((Float_t)fHeader.costh[i],2); - dev->SetSignal(fHeader.cal[i].t_0,3); - dev->SetSignal(fHeader.cal[i].alpha_t,4); - dev->SetSignal(fHeader.cal[i].beta_a,5); - dev->SetSignal(fHeader.cal[i].beta_tot,6); - dev->SetSignal(fHeader.cal[i].beta_t,7); + + fadccal.SetParameter(0,fHeader.cal[i].beta_a); + fadccal.SetParameter(1,fHeader.cal[i].ped); + fadcdecal.SetParameter(0,fHeader.cal[i].beta_a); + if (!fHeader.cal[i].beta_a) fadcdecal.SetParameter(0,1); + fadcdecal.SetParameter(1,fHeader.cal[i].ped); + + ftdccal.SetParameter(0,fHeader.cal[i].beta_t); + ftdccal.SetParameter(1,fHeader.cal[i].t_0); + ftdccal.SetParameter(2,fHeader.cal[i].alpha_t); + ftdccal.SetParameter(3,1.e20); + ftdcdecal.SetParameter(0,fHeader.cal[i].beta_t); + if (!fHeader.cal[i].beta_t) ftdcdecal.SetParameter(0,1); + ftdcdecal.SetParameter(1,fHeader.cal[i].t_0); + ftdcdecal.SetParameter(2,fHeader.cal[i].alpha_t); + ftdcdecal.SetParameter(3,1.e20); + + ftotcal.SetParameter(0,fHeader.cal[i].beta_tot); + ftotdecal.SetParameter(0,fHeader.cal[i].beta_tot); + if (!fHeader.cal[i].beta_tot) ftotdecal.SetParameter(0,1); + + if (adccal) + { + dev->SetDecalFunction(&fadcdecal,1); + } + else + { + dev->SetCalFunction(&fadccal,1); + } + + if (tdccal) + { + dev->SetDecalFunction(&ftdcdecal,2); + } + else + { + dev->SetCalFunction(&ftdccal,2); + } + + if (totcal) + { + dev->SetDecalFunction(&ftotdecal,3); + } + else + { + dev->SetCalFunction(&ftotcal,3); + } + + dev->SetSignal(fHeader.type[i],4); + dev->SetSignal((Float_t)fHeader.costh[i],5); + dev->SetSignal(fHeader.thresh[i],6); + dev->SetSignal(fHeader.sensit[i],7); + dev->SetSignal(fHeader.cal[i].beta_t,8); + dev->SetSignal(fHeader.cal[i].t_0,9); + dev->SetSignal(fHeader.cal[i].alpha_t,10); + dev->SetSignal(fHeader.cal[i].ped,11); + dev->SetSignal(fHeader.cal[i].beta_a,12); + dev->SetSignal(fHeader.cal[i].kappa,13); + dev->SetSignal(fHeader.cal[i].ped_tot,14); + dev->SetSignal(fHeader.cal[i].beta_tot,15); + dev->SetSignal(fHeader.cal[i].kappa_tot,16); + fOmdb->EnterObject(i+1,1,dev); } } @@ -688,6 +770,7 @@ void IceF2k::PutHits() AliSignal* sx=0; Int_t tid=0; AliTrack* tx=0; + Float_t adc=0; for (Int_t i=0; iGetHit(omx->GetNhits()); if (!sx) continue; + // ADC dependent TDC (de)calibration function for this hit + TF1* fcal=omx->GetCalFunction("LE"); + TF1* fdecal=omx->GetDecalFunction("LE"); + if (fcal) sx->SetCalFunction(fcal,2); + if (fdecal) sx->SetDecalFunction(fdecal,2); + fcal=sx->GetCalFunction(2); + fdecal=sx->GetDecalFunction(2); + adc=sx->GetSignal(1,-4); + if (adc>0) + { + if (fcal) fcal->SetParameter(3,adc); + if (fdecal) fdecal->SetParameter(3,adc); + } + else + { + if (fcal) fcal->SetParameter(3,0); + if (fdecal) fdecal->SetParameter(3,0); + } + // Bi-directional link between this hit and the track that caused the ADC value. // This F2K info is probably only present for MC tracks. tid=fEvent.h[i].ma; diff --git a/RALICE/icepack/iceconvert/history.txt b/RALICE/icepack/iceconvert/history.txt index 8f6f4adf66c..2d9d513ddea 100644 --- a/RALICE/icepack/iceconvert/history.txt +++ b/RALICE/icepack/iceconvert/history.txt @@ -21,4 +21,8 @@ data tree when the macro is run in an interactive ROOT/CINT session. 20-jul-2005 NvE RDMC index "off by one" problem fixed in IceF2k.cxx when setting the bin contents for a waveform histogram. +05-aug-2005 NvE Support for printfreq=0 introduced in IceF2k to allow suppression of + the event summary printout. +08-aug-2005 NvE (De)calibration functions introduced in IceF2k::FillOMdbase and IceF2k::PutHits + to enable access to either automatically calibrated or de-calibrated data. -- 2.43.0