]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
05-aug-2005 NvE Typos fixed in AliAttrib::GetCalFunction and AliAttrib::GetDecalFunct...
authornick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Aug 2005 10:50:38 +0000 (10:50 +0000)
committernick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Aug 2005 10:50:38 +0000 (10:50 +0000)
                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
RALICE/AliSignal.cxx
RALICE/history.txt
RALICE/icepack/iceconvert/IceF2k.cxx
RALICE/icepack/iceconvert/history.txt

index dd553320a7d392648691237c0df1cc6de7a54844..97f531be757cbd6510a305ba0d63420eda2a7d9e 100644 (file)
@@ -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;
 }
 ///////////////////////////////////////////////////////////////////////////
index ef4d7d80b3a34d8f64e3c62ee1043e2321960eda..76c1ca2dd96585a7f407b4ea37d9da6223886c49 100644 (file)
@@ -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.
 //
index 2370a5680e23830bfabee35c9f3d0e52cc15c5f2..9d6dca40adf1ff14b012df86ed8b329b37ea197b 100644 (file)
 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
index fa35107acd43c07360ccf0af85a4a242dc71f3bf..e777fd0991fa7205e99ada100fdf74d6cdf2a960 100644 (file)
@@ -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; i<fEvent.nhits; i++)
  {
   chan=fEvent.h[i].ch+1;
@@ -724,6 +807,25 @@ void IceF2k::PutHits()
   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;
index 8f6f4adf66cb8a14d12318cbe2438a81a7560acd..2d9d513ddea3a1eeaddfe21dda6db27cf149249a 100644 (file)
@@ -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.