]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
12-sep-2006 NvE Memberfunctions GetNslots and AddNamedSlot introduced and various
authornick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Sep 2006 12:41:55 +0000 (12:41 +0000)
committernick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Sep 2006 12:41:55 +0000 (12:41 +0000)
                modifications made in AliAttrib and AliSignal to overcome a ROOT
                feature which always sets the size of TArray objects to a default
                of 16 when reading these objects back from a file.
                The modified AliAttrib and AliSignal don't rely on a GetSize()
                anymore, but determine the number of stored values from the
                actual array contents.
13-sep-2006 NvE IceF2k updated for multiple waveforms per OM by making use of the
                new AliAttrib::AddNamedSlot facility.
                Also some calibration constants dropped from OM data words in IceF2k
                and IceCal2Root, since these values are also stored as parameters in
                the corresponding (de)calibration functions.
                Also for TWR data the values stored in the histos are (baseline-amp),
                so that all pulses appear as positive instead of negative and the
                resulting histos are baseline corrected.
14-sep-2006 NvE IceCalibrate.cxx updated to correctly process multiple waveforms and hits per OM.
                Also some calibration constants dropped from OM data words in IceCalibrate,
                since these values are also stored as parameters in the corresponding
                (de)calibration functions.

RALICE/AliAttrib.cxx
RALICE/AliAttrib.h
RALICE/AliSignal.cxx
RALICE/AliSignal.h
RALICE/history.txt
RALICE/icepack/IceCalibrate.cxx
RALICE/icepack/history.txt
RALICE/icepack/iceconvert/IceCal2Root.cxx
RALICE/icepack/iceconvert/IceF2k.cxx
RALICE/icepack/iceconvert/history.txt

index 97f531be757cbd6510a305ba0d63420eda2a7d9e..a87c08500ec795abb7f93ae79aa8a0141911aa5d 100644 (file)
@@ -156,32 +156,60 @@ AliAttrib::AliAttrib(const AliAttrib& a)
 Int_t AliAttrib::GetNgains() const
 {
 // Provide the number of specified gains for this attribute.
+
+ if (!fGains) return 0;
+
  Int_t n=0;
- if (fGains) n=fGains->GetSize();
+ for (Int_t i=1; i<=fGains->GetSize(); i++)
+ {
+  if (GetGainFlag(i)) n=i;
+ }
+
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliAttrib::GetNoffsets() const
 {
 // Provide the number of specified offsets for this attribute.
+
+ if (!fOffsets) return 0;
+
  Int_t n=0;
- if (fOffsets) n=fOffsets->GetSize();
+ for (Int_t i=1; i<=fOffsets->GetSize(); i++)
+ {
+  if (GetOffsetFlag(i)) n=i;
+ }
+
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliAttrib::GetNcalflags() const
 {
 // Provide the number of specified calib. flags for this attribute.
+
+ if (!fCalflags) return 0;
+
  Int_t n=0;
- if (fCalflags) n=fCalflags->GetSize();
+ for (Int_t i=1; i<=fCalflags->GetSize(); i++)
+ {
+  if (fCalflags->At(i-1)) n=i;
+ }
+
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliAttrib::GetNnames() const
 {
 // Provide the maximum number of specified names for this attribute.
+
+ if (!fNames) return 0;
+
  Int_t n=0;
- if (fNames) n=fNames->GetSize();
+ for (Int_t i=1; i<=fNames->GetSize(); i++)
+ {
+  if (fNames->At(i-1)) n=i;
+ }
+
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -410,6 +438,45 @@ Int_t AliAttrib::GetOffsetFlag(TString name) const
  return flag;
 }
 ///////////////////////////////////////////////////////////////////////////
+Int_t AliAttrib::GetCalWord(Int_t j) const
+{
+// Provide calib. word of the j-th (default j=1) attribute slot.
+// The word value stored is : 1000*edge + 100*dead + 10*gainflag + offsetflag.
+//
+// Note : The first attribute slot is at j=1.
+// In case j is invalid, 0 is returned.
+
+ if (j<1) 
+ {
+  cout << " *AliAttrib::GetCalWord* Invalid argument j = " << j << endl;
+  return 0;
+ }
+
+ Int_t word=0;
+ if (fCalflags)
+ {
+  if (j>0 && j<=(fCalflags->GetSize())) word=fCalflags->At(j-1);
+ }
+ return word;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliAttrib::GetCalWord(TString name) const
+{
+// Provide calib. word of the name-specified attribute slot.
+// The word value stored is : 1000*edge + 100*dead + 10*gainflag + offsetflag.
+//
+// This procedure involves a slot-index search based on the specified name
+// at each invokation. This may become slow in case many slots have been
+// defined and/or when this procedure is invoked many times.
+// In such cases it is preferable to use indexed addressing in the user code
+// either directly or via a few invokations of GetSlotIndex().
+
+ Int_t j=GetSlotIndex(name);
+ Int_t word=0;
+ if (j>0) word=GetCalWord(j);
+ return word;
+}
+///////////////////////////////////////////////////////////////////////////
 Float_t AliAttrib::GetGain(Int_t j) const
 {
 // Provide gain value of the j-th (default j=1) attribute slot.
@@ -1038,10 +1105,39 @@ Int_t AliAttrib::GetDeadValue(TString name) const
  return val;
 }
 ///////////////////////////////////////////////////////////////////////////
+Int_t AliAttrib::GetNslots() const
+{
+// Provide the number of existing slots.
+
+  Int_t n=GetNcalflags();
+  Int_t nn=GetNnames();
+  Int_t ncalf=GetNcalfuncs();
+  Int_t ndecalf=GetNdecalfuncs();
+  if (n<nn) n=nn;
+  if (n<ncalf) n=ncalf;
+  if (n<ndecalf) n=ndecalf;
+
+  return n;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliAttrib::AddNamedSlot(TString s)
+{
+// Add a new slot with the specified name.
+// In case a slot with the specified name already exists, no action is taken.
+
+ if (GetSlotIndex(s)) return;
+
+ Int_t n=GetNslots();
+ SetSlotName(s,n+1);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliAttrib::SetSlotName(TString s,Int_t j)
 {
 // Set a user defined name for the j-th (default j=1) slot. 
 // Note : The first attribute slot is at j=1.
+// In case the value of the index j exceeds the maximum number of reserved
+// slots for the names, the number of reserved slots for the names
+// is increased automatically to the corresponding value.
 
  if (j<1) 
  {
@@ -1339,8 +1435,13 @@ Int_t AliAttrib::GetNcalfuncs() const
 {
 // Provide the number of specified calib. functions for this attribute.
 
+ if (!fCalfuncs) return 0;
+
  Int_t n=0;
- if (fCalfuncs) n=fCalfuncs->GetSize();
+ for (Int_t i=1; i<=fCalfuncs->GetSize(); i++)
+ {
+  if (fCalfuncs->At(i-1)) n=i;
+ }
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -1348,8 +1449,13 @@ Int_t AliAttrib::GetNdecalfuncs() const
 {
 // Provide the number of specified de-calib. functions for this attribute.
 
+ if (!fDecalfuncs) return 0;
+
  Int_t n=0;
- if (fDecalfuncs) n=fDecalfuncs->GetSize();
+ for (Int_t i=1; i<=fDecalfuncs->GetSize(); i++)
+ {
+  if (fDecalfuncs->At(i-1)) n=i;
+ }
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
index b18d91206bb9b1c07bbe61324a9e00f5a76a5efe..e93b3d21125bc0ae9ad5396690cc1ef82cc4cec4 100644 (file)
@@ -34,6 +34,8 @@ class AliAttrib
   Int_t GetGainFlag(TString name) const;       // Provide gain flag of the name-specified attribute slot
   Int_t GetOffsetFlag(Int_t j=1) const;        // Provide offset flag of the j-th attribute slot
   Int_t GetOffsetFlag(TString name) const;     // Provide offset flag of the name-specified attribute slot
+  Int_t GetCalWord(Int_t j=1) const;           // Provide calib. word of the j-th attribute slot
+  Int_t GetCalWord(TString name) const;        // Provide calib word of the name-specified attribute slot
   void ResetGain(Int_t j=1);                   // Reset j-th gain value and flag
   void ResetGain(TString name);                // Reset name-specified gain value and flag
   void ResetOffset(Int_t j=1);                 // Reset j-th offset value and flag
@@ -61,6 +63,8 @@ class AliAttrib
   virtual void List(TString name) const;       // Printout of name-specified attribute data
   virtual void Load(AliAttrib& a,Int_t j=0);   // Load j-th slot or all attributes of the input AliAttrib
   virtual void Load(AliAttrib& a,TString name);// Load name-specified slot attributes of the input AliAttrib
+  void AddNamedSlot(TString s);                // Add a new slot with the specified name
+  virtual Int_t GetNslots() const;             // Provide the number of exising slots
   void SetSlotName(TString s,Int_t j=1);       // Set user defined name for the j-th slot
   TString GetSlotName(Int_t j=1) const;        // Provide user defined name for the j-th slot
   Int_t GetSlotIndex(TString name) const;      // Provide the slot index of the matching name
@@ -84,6 +88,6 @@ class AliAttrib
   TObjArray* fCalfuncs;                        // Explicit signal calibration functions
   TObjArray* fDecalfuncs;                      // Explicit signal de-calibration functions
 
- ClassDef(AliAttrib,4) // Generic handling of detector signal (calibration) attributes.
+ ClassDef(AliAttrib,5) // Generic handling of detector signal (calibration) attributes.
 };
 #endif
index f96b192ce6a2773b3cec13fcde23847e2ce83e69..9c4ab08b214e25f83137920a26aa045404bb279f 100644 (file)
@@ -123,6 +123,7 @@ AliSignal::AliSignal() : TNamed(),AliPosition(),AliAttrib()
 // when entering values and/or errors.
  fSignals=0;
  fDsignals=0;
+ fSigflags=0;
  fWaveforms=0;
  fLinks=0;
  fDevice=0;
@@ -142,6 +143,11 @@ AliSignal::~AliSignal()
   delete fDsignals;
   fDsignals=0;
  }
+ if (fSigflags)
+ {
+  delete fSigflags;
+  fSigflags=0;
+ }
  if (fWaveforms)
  {
   delete fWaveforms;
@@ -170,6 +176,7 @@ AliSignal::AliSignal(const AliSignal& s) : TNamed(s),AliPosition(s),AliAttrib(s)
 // Copy constructor
  fSignals=0;
  fDsignals=0;
+ fSigflags=0;
  fWaveforms=0;
  fLinks=0;
  fTracks=0;
@@ -181,15 +188,21 @@ AliSignal::AliSignal(const AliSignal& s) : TNamed(s),AliPosition(s),AliAttrib(s)
  Double_t val;
  for (Int_t i=1; i<=n; i++)
  {
-  val=s.GetSignal(i);
-  SetSignal(val,i);
+  if (s.GetSignalFlag(i))
+  {
+   val=s.GetSignal(i);
+   SetSignal(val,i);
+  }
  } 
 
  n=s.GetNerrors();
  for (Int_t j=1; j<=n; j++)
  {
-  val=s.GetSignalError(j);
-  SetSignalError(val,j);
+  if (s.GetErrorFlag(i))
+  {
+   val=s.GetSignalError(j);
+   SetSignalError(val,j);
+  }
  }
 
  n=s.GetNwaveforms();
@@ -301,19 +314,26 @@ void AliSignal::ResetSignals(Int_t mode)
   mode=0;
  }
 
+ Int_t sflag=0;
+ Int_t eflag=0;
+
  if (fSignals && (mode==0 || mode==1))
  {
-  for (Int_t i=0; i<fSignals->GetSize(); i++)
+  for (Int_t i=1; i<=fSignals->GetSize(); i++)
   {
-   fSignals->AddAt(0,i);
+   fSignals->AddAt(0,i-1);
+   eflag=GetErrorFlag(i);
+   SetSigFlags(0,eflag,i);
   }
  }
 
  if (fDsignals && (mode==0 || mode==2))
  {
-  for (Int_t j=0; j<fDsignals->GetSize(); j++)
+  for (Int_t j=1; j<=fDsignals->GetSize(); j++)
   {
-   fDsignals->AddAt(0,j);
+   fDsignals->AddAt(0,j-1);
+   sflag=GetSignalFlag(j);
+   SetSigFlags(sflag,0,j);
   }
  }
 
@@ -351,6 +371,31 @@ void AliSignal::DeleteSignals(Int_t mode)
   fDsignals=0;
  }
 
+ Int_t sflag=0;
+ Int_t eflag=0;
+
+ if (mode==0)
+ {
+  delete fSigflags;
+  fSigflags=0;
+ }
+ else if (mode==1)
+ {
+  for (Int_t i=1; i<=fSigflags->GetSize(); i++)
+  {
+   eflag=GetErrorFlag(i);
+   SetSigFlags(0,eflag,i);
+  }
+ }
+ else if (mode==2)
+ {
+  for (Int_t j=1; j<=fSigflags->GetSize(); j++)
+  {
+   sflag=GetSignalFlag(j);
+   SetSigFlags(sflag,0,j);
+  }
+ }
+
  DeleteWaveform(0);
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -376,6 +421,9 @@ void AliSignal::SetSignal(Double_t sig,Int_t j)
  }
 
  fSignals->AddAt(float(sig),j-1);
+
+ Int_t eflag=GetErrorFlag(j);
+ SetSigFlags(1,eflag,j);
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliSignal::SetSignal(Double_t sig,TString name)
@@ -415,6 +463,9 @@ void AliSignal::AddSignal(Double_t sig,Int_t j)
 
  Float_t sum=(fSignals->At(j-1))+sig;
  fSignals->AddAt(sum,j-1);
+
+ Int_t eflag=GetErrorFlag(j);
+ SetSigFlags(1,eflag,j);
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliSignal::AddSignal(Double_t sig,TString name)
@@ -637,6 +688,9 @@ void AliSignal::SetSignalError(Double_t dsig,Int_t j)
  }
 
  fDsignals->AddAt(float(dsig),j-1);
+
+ Int_t sflag=GetSignalFlag(j);
+ SetSigFlags(sflag,1,j);
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliSignal::SetSignalError(Double_t dsig,TString name)
@@ -764,23 +818,10 @@ void AliSignal::List(Int_t j) const
   }
  }
 
- Int_t nvalues=GetNvalues();
- Int_t nerrors=GetNerrors();
+ Int_t n=GetNslots();
  Int_t nlinkslots=0;
  if (GetNlinks()) nlinkslots=fLinks->GetMaxColumn();
- Int_t ncalibs=GetNcalflags();
- Int_t ncalfuncs=GetNcalfuncs();
- Int_t ndecalfuncs=GetNdecalfuncs();
-
- Int_t n=nvalues;
- if (nerrors>n) n=nerrors;
  if (nlinkslots>n) n=nlinkslots;
- if (InheritsFrom("AliDevice"))
- {
-  if (ncalibs>n) n=ncalibs;
-  if (ncalfuncs>n) n=ncalfuncs;
-  if (ndecalfuncs>n) n=ndecalfuncs;
- }
  
  TObject* obj=0;
  Int_t nrefs=0;
@@ -791,28 +832,33 @@ void AliSignal::List(Int_t j) const
  {
   for (Int_t i=1; i<=n; i++)
   {
-   cout << "   Slot : " << i;
-   if (i<=nvalues) cout << " Signal value : " << GetSignal(i);
-   if (i<=nerrors) cout << " error : " << GetSignalError(i);
-   AliAttrib::List(i);
-   cout << endl;
    obj=0;
    nrefs=GetIndices(obj,i,posarr);
-   for (Int_t k=0; k<nrefs; k++)
+
+   if (GetSignalFlag(i) || GetErrorFlag(i) || GetCalFunction(i) || GetDecalFunction(i) || GetCalWord(i) || nrefs)
    {
-    pos=posarr.At(k);
-    obj=GetLink(i,pos);
-    if (obj)
+    cout << "   Slot : " << i;
+    if (GetSignalFlag(i)) cout << " Signal value : " << GetSignal(i);
+    if (GetErrorFlag(i))  cout << " error : " << GetSignalError(i);
+    AliAttrib::List(i);
+    cout << endl;
+
+    for (Int_t k=0; k<nrefs; k++)
     {
-     cout << "    Link at position " << pos << " to : " << obj->ClassName();
-     if (obj->InheritsFrom("TNamed"))
+     pos=posarr.At(k);
+     obj=GetLink(i,pos);
+     if (obj)
      {
-      const char* lname=obj->GetName();
-      const char* ltitle=obj->GetTitle();
-      if (strlen(lname))  cout << " Name : " << lname;
-      if (strlen(ltitle)) cout << " Title : " << ltitle;
+      cout << "    Link at position " << pos << " to : " << obj->ClassName();
+      if (obj->InheritsFrom("TNamed"))
+      {
+       const char* lname=obj->GetName();
+       const char* ltitle=obj->GetTitle();
+       if (strlen(lname))  cout << " Name : " << lname;
+       if (strlen(ltitle)) cout << " Title : " << ltitle;
+      }
+      cout << endl;
      }
-     cout << endl;
     }
    }
   }
@@ -821,28 +867,33 @@ void AliSignal::List(Int_t j) const
  {
   if (j<=n)
   {
-   cout << "   Slot : " << j;
-   if (j<=nvalues) cout << " Signal value : " << GetSignal(j);
-   if (j<=nerrors) cout << " error : " << GetSignalError(j);
-   AliAttrib::List(j);
-   cout << endl;
    obj=0;
    nrefs=GetIndices(obj,j,posarr);
-   for (Int_t kj=0; kj<nrefs; kj++)
+
+   if (GetSignalFlag(j) || GetErrorFlag(j) || GetCalFunction(j) || GetDecalFunction(j) || GetCalWord(j) || nrefs)
    {
-    pos=posarr.At(kj);
-    obj=GetLink(j,pos);
-    if (obj)
+    cout << "   Slot : " << j;
+    if (GetSignalFlag(j)) cout << " Signal value : " << GetSignal(j);
+    if (GetErrorFlag(j))  cout << " error : " << GetSignalError(j);
+    AliAttrib::List(j);
+    cout << endl;
+
+    for (Int_t kj=0; kj<nrefs; kj++)
     {
-     cout << "    Link at position " << pos << " to : " << obj->ClassName();
-     if (obj->InheritsFrom("TNamed"))
+     pos=posarr.At(kj);
+     obj=GetLink(j,pos);
+     if (obj)
      {
-      const char* lnamej=obj->GetName();
-      const char* ltitlej=obj->GetTitle();
-      if (strlen(lnamej))  cout << " Name : " << lnamej;
-      if (strlen(ltitlej)) cout << " Title : " << ltitlej;
+      cout << "    Link at position " << pos << " to : " << obj->ClassName();
+      if (obj->InheritsFrom("TNamed"))
+      {
+       const char* lnamej=obj->GetName();
+       const char* ltitlej=obj->GetTitle();
+       if (strlen(lnamej))  cout << " Name : " << lnamej;
+       if (strlen(ltitlej)) cout << " Title : " << ltitlej;
+      }
+      cout << endl;
      }
-     cout << endl;
     }
    }
   }
@@ -1008,16 +1059,175 @@ void AliSignal::ListTrack(Int_t j) const
 Int_t AliSignal::GetNvalues() const
 {
 // Provide the number of values for this signal.
+ if (!fSignals) return 0;
+
  Int_t n=0;
- if (fSignals) n=fSignals->GetSize();
+ for (Int_t i=1; i<=fSigflags->GetSize(); i++)
+ {
+  if (GetSignalFlag(i)) n=i;
+ }
+
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliSignal::GetNerrors() const
 {
 // Provide the number specified errors on the values for this signal.
+ if (!fDsignals) return 0;
+
  Int_t n=0;
- if (fDsignals) n=fDsignals->GetSize();
+ for (Int_t i=1; i<=fSigflags->GetSize(); i++)
+ {
+  if (GetErrorFlag(i)) n=i;
+ }
+
+ return n;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::SetSigFlags(Int_t is,Int_t ie,Int_t j)
+{
+// Store signal and/or error value flags of the j-th (default j=1) slot.
+// Note : The first slot is at j=1.
+// In case the value of the index j exceeds the maximum number of reserved
+// slots for the flags, the number of reserved slots for the flags is
+// increased automatically.
+// The value stored is : 10*signalflag + errorflag.
+
+ if (j<1) 
+ {
+  cout << " *AliSignal::SetSigFlags* Invalid argument j = " << j << endl;
+  return;
+ }
+
+ if (!fSigflags)
+ {
+  fSigflags=new TArrayI(j);
+ }
+
+ Int_t size=fSigflags->GetSize();
+
+ if (j>size)
+ {
+  fSigflags->Set(j);
+ }
+
+ Int_t word=10*is+ie;
+ fSigflags->AddAt(word,j-1);
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetSignalFlag(Int_t j) const
+{
+// Provide signal value flag of the j-th (default j=1) slot.
+//
+// flag = 1 : Signal value was set
+//        0 : Signal value was not set
+//
+// Note : The first attribute slot is at j=1.
+// In case j is invalid, 0 is returned.
+
+ if (j<1) 
+ {
+  cout << " *AliSignal::GetSignalFlag* Invalid argument j = " << j << endl;
+  return 0;
+ }
+ Int_t flag=0;
+ if (fSigflags)
+ {
+  if (j>0 && j<=(fSigflags->GetSize()))
+  {
+   Int_t word=fSigflags->At(j-1);
+   flag=word/10;
+  }
+ }
+ return flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetSignalFlag(TString name) const
+{
+// Provide signal value flag of the name-specified slot.
+//
+// flag = 1 : Signal value was set
+//        0 : Signal value was not set
+//
+//
+// This procedure involves a slot-index search based on the specified name
+// at each invokation. This may become slow in case many slots have been
+// defined and/or when this procedure is invoked many times.
+// In such cases it is preferable to use indexed addressing in the user code
+// either directly or via a few invokations of GetSlotIndex().
+
+ Int_t j=GetSlotIndex(name);
+ Int_t flag=0;
+ if (j>0) flag=GetSignalFlag(j);
+ return flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetErrorFlag(Int_t j) const
+{
+// Provide error value flag of the j-th (default j=1) slot.
+//
+// flag = 1 : Error value was set
+//        0 : Error value was not set
+//
+// Note : The first attribute slot is at j=1.
+// In case j is invalid, 0 is returned.
+
+ if (j<1) 
+ {
+  cout << " *AliSignal::GetErrorFlag* Invalid argument j = " << j << endl;
+  return 0;
+ }
+ Int_t flag=0;
+ if (fSigflags)
+ {
+  if (j>0 && j<=(fSigflags->GetSize()))
+  {
+   Int_t word=fSigflags->At(j-1);
+   flag=word%10;
+  }
+ }
+ return flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetErrorFlag(TString name) const
+{
+// Provide error value flag of the name-specified slot.
+//
+// flag = 1 : Error value was set
+//        0 : Error value was not set
+//
+//
+// This procedure involves a slot-index search based on the specified name
+// at each invokation. This may become slow in case many slots have been
+// defined and/or when this procedure is invoked many times.
+// In such cases it is preferable to use indexed addressing in the user code
+// either directly or via a few invokations of GetSlotIndex().
+
+ Int_t j=GetSlotIndex(name);
+ Int_t flag=0;
+ if (j>0) flag=GetErrorFlag(j);
+ return flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetNslots() const
+{
+// Provide the number of existing slots.
+
+ Int_t n=AliAttrib::GetNslots();
+
+ if (!fSigflags) return n;
+
+ Int_t nflags=0;
+ for (Int_t i=0; i<fSigflags->GetSize(); i++)
+ {
+  if (fSigflags->At(i)) nflags=i+1;
+ }
+
+ if (n<nflags) n=nflags;
+
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
index bfa126ada1a657440e231b443f38504a2bbf4b18..ee6bb9507737cac377958b3730eab476e8b96b6e 100644 (file)
@@ -45,6 +45,7 @@ class AliSignal : public TNamed,public AliPosition,public AliAttrib
   void ListTrack(Int_t j=0) const;                              // Print info for the j-th (all) assoc. track(s)
   Int_t GetNvalues() const;                                     // Provide the number of signal values
   Int_t GetNerrors() const;                                     // Provide the number of specified errors
+  virtual Int_t GetNslots() const;                              // Provide the number of exising slots
   Int_t GetNwaveforms() const;                                  // Provide the number of specified waveforms
   void SetWaveform(TH1F* waveform,Int_t j=1);                   // Set the histogram for the j-th waveform
   TH1F* GetWaveform(Int_t j=1) const;                           // Pointer to the histo of the j-th waveform
@@ -80,15 +81,21 @@ class AliSignal : public TNamed,public AliPosition,public AliAttrib
   Int_t GetNtracks(AliTrack* t=0) const;                        // Provide number of related AliTracks
   AliTrack* GetTrack(Int_t j) const;                            // Access to the related AliTrack number j
   AliTrack* GetIdTrack(Int_t id) const;                         // Access to the related AliTrack with ID=id
+  Int_t GetSignalFlag(Int_t j=1) const;                         // Provide signal value flag of the j-th slot
+  Int_t GetSignalFlag(TString name) const;                      // Provide signal value flag of the name specified slot
+  Int_t GetErrorFlag(Int_t j=1) const;                          // Provide error value flag of the j-th slot
+  Int_t GetErrorFlag(TString name) const;                       // Provide error value flag of the name specified slot
 
  protected:
+  void SetSigFlags(Int_t is,Int_t ie,Int_t j); // Set flags for signal and/or error value settings
   TArrayF* fSignals;                           // Signal values
   TArrayF* fDsignals;                          // Errors on signal values
+  TArrayI* fSigflags;                          // Flags to mark setting of signal and/or error values 
   TObjArray* fWaveforms;                       // The 1D histograms containing the signal waveforms
   AliObjMatrix* fLinks;                        // Pointers of objects related to the various slots
   TObject* fDevice;                            // Pointer to the device that owns this signal
   TObjArray* fTracks;                          // Pointers to associated tracks
 
- ClassDef(AliSignal,15) // Generic handling of (extrapolated) detector signals.
+ ClassDef(AliSignal,16) // Generic handling of (extrapolated) detector signals.
 };
 #endif
index 7e229bd8be6459fa7c19510012c61528127c862b..ddb2598d699730a4a08edd96d955cebf2f3331d2 100644 (file)
                 and fDresult suppressed for I/O streaming. This will reduce the produced
                 output filesize.
 21-jul-2006 NvE AliSample extended for computation of median.
+12-sep-2006 NvE Memberfunctions GetNslots and AddNamedSlot introduced and various
+                modifications made in AliAttrib and AliSignal to overcome a ROOT
+                feature which always sets the size of TArray objects to a default
+                of 16 when reading these objects back from a file.
+                The modified AliAttrib and AliSignal don't rely on a GetSize()
+                anymore, but determine the number of stored values from the
+                actual array contents. 
index 9b9abe068bd00e84e06cecdfa03b961b65b8ba02..a41c0e3dee83e928bcc1c915ce69b0ccac9c87f7 100644 (file)
@@ -108,8 +108,8 @@ void IceCalibrate::Exec(Option_t* opt)
  IceGOM* ome=0; // The event OM pointer
  IceGOM* omd=0; // The database OM pointer
  Int_t id=0;
- Float_t sig=0;
- Float_t sigc=0;
+ Float_t adc=0,le=0,tot=0;    // Uncalibrated values
+ Float_t cadc=0,cle=0,ctot=0; // Calibrated values
  TF1* fcal=0;
  TF1* fdecal=0;
  TString slotname;
@@ -131,23 +131,13 @@ void IceCalibrate::Exec(Option_t* opt)
    for (Int_t ind=1; ind<=omd->GetNnames(); ind++)
    {
     slotname=omd->GetSlotName(ind);
-    ome->SetSlotName(slotname.Data(),ind);
+    ome->AddNamedSlot(slotname);
    }
    for (Int_t isd=1; isd<=omd->GetNvalues(); isd++)
    {
-    ome->SetSignal(omd->GetSignal(isd),isd);
+    ome->SetSignal(omd->GetSignal(isd),omd->GetSlotName(isd));
    }
   }
-  else
-  {
-   for (Int_t ise=8; ise<=ome->GetNvalues(); ise++)
-   {
-    ome->SetSignal(0,ise);
-   }
-   ome->SetSignal(1,8);
-   ome->SetSignal(1,12);
-   ome->SetSignal(1,15);
-  }
 
   // Make signals of bad modules available
   ome->SetAlive("ADC");
@@ -161,7 +151,7 @@ void IceCalibrate::Exec(Option_t* opt)
    if (!sx) continue;
 
    // ADC (de)calibration
-   sig=sx->GetSignal("ADC",-7); // Get uncalibrated signal
+   adc=sx->GetSignal("ADC",-7); // Get uncalibrated signal
    fcal=0;
    fdecal=0;
    if (omd)
@@ -171,20 +161,16 @@ void IceCalibrate::Exec(Option_t* opt)
    }
    if (fcal) // Store calibrated signal
    {
-    sigc=fcal->Eval(sig);
-    sx->SetSignal(sigc,"ADC");
-    ome->SetCalFunction(0,"ADC");
-    ome->SetDecalFunction(fdecal,"ADC");
+    cadc=fcal->Eval(adc);
+    sx->SetSignal(cadc,"ADC");
    }
    else // Store uncalibrated signal
    {
-    sx->SetSignal(sig,"ADC");
-    ome->SetCalFunction(fcal,"ADC");
-    ome->SetDecalFunction(0,"ADC");
+    sx->SetSignal(adc,"ADC");
    }
 
    // LE (TDC) (de)calibration
-   sig=sx->GetSignal("LE",-7); // Get uncalibrated signal
+   le=sx->GetSignal("LE",-7); // Get uncalibrated signal
    fcal=0;
    fdecal=0;
    if (omd)
@@ -192,27 +178,15 @@ void IceCalibrate::Exec(Option_t* opt)
     fcal=omd->GetCalFunction("LE");
     fdecal=omd->GetDecalFunction("LE");
    }
-   // Store the ADC independent (de)calibration function in the OM
-   if (fcal)
-   {
-    ome->SetCalFunction(0,"LE");
-    ome->SetDecalFunction(fdecal,"LE");
-   }
-   else
-   {
-    ome->SetCalFunction(fcal,"LE");
-    ome->SetDecalFunction(0,"LE");
-   }
    // Store the hit-specific ADC dependent (de)calibration function in the hit itself
    sx->SetCalFunction(fcal,"LE");
    sx->SetDecalFunction(fdecal,"LE");
    fcal=sx->GetCalFunction("LE");
    fdecal=sx->GetDecalFunction("LE");
-   sigc=sx->GetSignal("ADC",-7);
-   if (sigc>0)
+   if (adc>0)
    {
-    if (fcal) fcal->SetParameter(3,sigc);
-    if (fdecal) fdecal->SetParameter(3,sigc);
+    if (fcal) fcal->SetParameter(3,adc);
+    if (fdecal) fdecal->SetParameter(3,adc);
    }
    else
    {
@@ -221,20 +195,20 @@ void IceCalibrate::Exec(Option_t* opt)
    }
    if (fcal) // Store calibrated signal
    {
-    sigc=fcal->Eval(sig);
-    sx->SetSignal(sigc,"LE");
+    cle=fcal->Eval(le);
+    sx->SetSignal(cle,"LE");
     sx->SetCalFunction(0,"LE");
     sx->SetDecalFunction(fdecal,"LE");
    }
    else // Store uncalibrated signal
    {
-    sx->SetSignal(sig,"LE");
+    sx->SetSignal(le,"LE");
     sx->SetCalFunction(fcal,"LE");
     sx->SetDecalFunction(0,"LE");
    }
 
    // TOT (de)calibration
-   sig=sx->GetSignal("TOT",-7); // Get uncalibrated signal
+   tot=sx->GetSignal("TOT",-7); // Get uncalibrated signal
    fcal=0;
    fdecal=0;
    if (omd)
@@ -244,25 +218,79 @@ void IceCalibrate::Exec(Option_t* opt)
    }
    if (fcal) // Store calibrated signal
    {
-    sigc=fcal->Eval(sig);
-    sx->SetSignal(sigc,"TOT");
-    ome->SetCalFunction(0,"TOT");
-    ome->SetDecalFunction(fdecal,"TOT");
+    ctot=fcal->Eval(tot);
+    sx->SetSignal(ctot,"TOT");
    }
    else // Store uncalibrated signal
    {
-    sx->SetSignal(sig,"TOT");
-    ome->SetCalFunction(fcal,"TOT");
-    ome->SetDecalFunction(0,"TOT");
+    sx->SetSignal(tot,"TOT");
    }
-  }
+  } // End of loop over hits of the OM
 
+  // Set bad OM flags according to dbase info
   if (omd)
   {  
    if (omd->GetDeadValue("ADC")) ome->SetDead("ADC");
    if (omd->GetDeadValue("LE")) ome->SetDead("LE");
    if (omd->GetDeadValue("TOT")) ome->SetDead("TOT");
   }
- }
+
+  // Store ADC (de)calibration function in this OM according to dbase info
+  fcal=0;
+  fdecal=0;
+  if (omd)
+  {
+   fcal=omd->GetCalFunction("ADC");
+   fdecal=omd->GetDecalFunction("ADC");
+  }
+  if (fcal) // Calibrated ADC signals were stored
+  {
+   ome->SetCalFunction(0,"ADC");
+   ome->SetDecalFunction(fdecal,"ADC");
+  }
+  else // Uncalibrated ADC signals were stored
+  {
+   ome->SetCalFunction(fcal,"ADC");
+   ome->SetDecalFunction(0,"ADC");
+  }
+
+  // Store ADC independent LE (de)calibration function in this OM according to dbase info
+  fcal=0;
+  fdecal=0;
+  if (omd)
+  {
+   fcal=omd->GetCalFunction("LE");
+   fdecal=omd->GetDecalFunction("LE");
+  }
+  if (fcal) // Calibrated LE signals were stored
+  {
+   ome->SetCalFunction(0,"LE");
+   ome->SetDecalFunction(fdecal,"LE");
+  }
+  else // Uncalibrated LE signals were stored
+  {
+   ome->SetCalFunction(fcal,"LE");
+   ome->SetDecalFunction(0,"LE");
+  }
+
+  // Store TOT (de)calibration function in this OM according to dbase info
+  fcal=0;
+  fdecal=0;
+  if (omd)
+  {
+   fcal=omd->GetCalFunction("TOT");
+   fdecal=omd->GetDecalFunction("TOT");
+  }
+  if (fcal) // Calibrated TOT signals were stored
+  {
+   ome->SetCalFunction(0,"TOT");
+   ome->SetDecalFunction(fdecal,"TOT");
+  }
+  else // Uncalibrated TOT signals were stored
+  {
+   ome->SetCalFunction(fcal,"TOT");
+   ome->SetDecalFunction(0,"TOT");
+  }
+ } // End of loop over OM's of the event
 }
 ///////////////////////////////////////////////////////////////////////////
index 2cfe7b1da8f5f8e492c4abda22b67e456275eb3f..02a9d5c16150d00f897a76587aaa7221a849b886 100644 (file)
@@ -71,3 +71,8 @@
 07-jul-2006 NvE Track Id correctly set in IceLinefit.
 28-jul-2006 NvE New class IceChi2 introduced and example macro icechi2.cc added.
                 Also IcePandel updated to use a Convoluted Pandel pdf.
+14-sep-2006 NvE IceCalibrate.cxx updated to correctly process multiple waveforms and hits per OM.
+                Also some calibration constants dropped from OM data words in IceCalibrate,
+                since these values are also stored as parameters in the corresponding
+                (de)calibration functions.                 
+                 
index efc1fafe0c6661f030a48c20d12f5fc984424723..3bd76b50a8198f78f843d4d7d52be40bc74aab87 100644 (file)
@@ -344,23 +344,15 @@ void IceCal2Root::GetCalibData()
  // The basic OM contents
  IceAOM om;
 
+ // Slots to hold the various (de)calibration functions
  om.SetSlotName("ADC",1);
  om.SetSlotName("LE",2);
  om.SetSlotName("TOT",3);
-
+ // Slots with hardware parameters
  om.SetSlotName("TYPE",4);
  om.SetSlotName("ORIENT",5);
  om.SetSlotName("THRESH",6);
  om.SetSlotName("SENSIT",7);
- om.SetSlotName("BETA-TDC",8);
- om.SetSlotName("T0",9);
- om.SetSlotName("ALPHA-TDC",10);
- om.SetSlotName("PED-ADC",11);
- om.SetSlotName("BETA-ADC",12);
- om.SetSlotName("KAPPA-ADC",13);
- om.SetSlotName("PED-TOT",14);
- om.SetSlotName("BETA-TOT",15);
- om.SetSlotName("KAPPA-TOT",16);
 
  fInput.seekg(0); // Position at beginning of file
  fInput >> dec;   // Make sure all integers starting with 0 are taken in decimal format
@@ -429,12 +421,6 @@ void IceCal2Root::GetCalibData()
     omx->SetDecalFunction(0,3);
    }
 
-   omx->SetSignal(beta,8);
-   omx->SetSignal(ped,9);
-   omx->SetSignal(alpha,10);
-   omx->SetSignal(beta,15);
-   omx->SetSignal(0,16);
-
    fcal=omx->GetCalFunction(2);
    fdecal=omx->GetDecalFunction(2);
    if (fcal)
@@ -492,11 +478,6 @@ void IceCal2Root::GetCalibData()
     omx->SetDecalFunction(0,3);
    }
 
-   omx->SetSignal(ped,11);
-   omx->SetSignal(beta,12);
-   omx->SetSignal(0,13);
-   omx->SetSignal(totped,14);
-
    fcal=omx->GetCalFunction(1);
    fdecal=omx->GetDecalFunction(1);
    if (fcal)
index 6e36e2c30807f9a55d667a9e13c1281b30a5d18a..9a845f287fab502e14831b138474a140156f10e8 100644 (file)
@@ -565,24 +565,15 @@ void IceF2k::FillOMdbase()
  {
   dev=new IceAOM();
   dev->SetUniqueID(i+1);
-
+  // Slots to hold the various (de)calibration functions  
   dev->SetSlotName("ADC",1);
   dev->SetSlotName("LE",2);
   dev->SetSlotName("TOT",3);
-
+  // Slots to hold hardware parameters
   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];
@@ -640,15 +631,6 @@ void IceF2k::FillOMdbase()
   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);
  }
@@ -1177,8 +1159,10 @@ void IceF2k::PutHits()
 
   if (!omx) continue;
 
-  omx->SetSlotName("BASELINE",omx->GetNnames()+1);
-  omx->SetSignal(-fEvent.wf[iwf].baseline,"BASELINE");
+  hname="BASELINE-WF";
+  hname+=omx->GetNwaveforms()+1;
+  omx->AddNamedSlot(hname);
+  omx->SetSignal(fEvent.wf[iwf].baseline,hname);
 
   // Fill the waveform histogram
   hname="OM";
@@ -1195,7 +1179,7 @@ void IceF2k::PutHits()
 
   for (Int_t jbin=1; jbin<=fEvent.wf[iwf].ndigi; jbin++)
   {
-   histo.SetBinContent(jbin,-fEvent.wf[iwf].digi[jbin-1]);
+   histo.SetBinContent(jbin,fEvent.wf[iwf].baseline-fEvent.wf[iwf].digi[jbin-1]);
   }
 
   omx->SetWaveform(&histo,omx->GetNwaveforms()+1);
index 1de41de33b4646b550e28854c650f5383385328a..4b5ffe3246633ccfc9949769f6b7c1910fecd8ec 100644 (file)
                 AliSignal::AddTrack facility instead of AddLink in IceF2k. 
                 Also default split level set to 0 in IceF2k to minimise file size and
                 I/O time.
-                 
+13-sep-2006 NvE IceF2k updated for multiple waveforms per OM by making use of the
+                new AliAttrib::AddNamedSlot facility.
+                Also some calibration constants dropped from OM data words in IceF2k
+                and IceCal2Root, since these values are also stored as parameters in
+                the corresponding (de)calibration functions.                 
+                Also for TWR data the values stored in the histos are (baseline-amp),
+                so that all pulses appear as positive instead of negative and the
+                resulting histos are baseline corrected.