// 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
// 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
//
//
// 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;
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.)
{
// (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;
}
{
// 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.
//
{
// 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)
// 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();
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();
{
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);
}
}
AliSignal* sx=0;
Int_t tid=0;
AliTrack* tx=0;
+ Float_t adc=0;
for (Int_t i=0; i<fEvent.nhits; i++)
{
chan=fEvent.h[i].ch+1;
sx=omx->GetHit(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;