]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliSignal.cxx
10-may-2005 NvE Support for timestamps introduced in AliTrack and AliPosition.
[u/mrichter/AliRoot.git] / RALICE / AliSignal.cxx
index f412cbc77abb40398aec2f0780d097e75c9a0694..a53f2d4e584b3e12910366c6386aacda25ab9f78 100644 (file)
 //
 // AliSignal q;    // In the example below a signal contains the
 //                 // following data : timing, ADC and dE/dx
-// q.SetName("TOF hit");
+// q.SetNameTitle("Hybrid","Test for multiple signal data");
 // q.SetPosition(pos,"car");
 // q.SetPositionErrors(err,"car");
 // signal=82.5; // e.g. signal time in ns
 // error=2.01;
 // offset=0.003;
+// q.SetSlotName("TOF");
 // q.SetSignal(signal,1);
 // q.SetSignalError(error,1);
 // q.SetOffset(offset,1);
 // signal=268.1; // e.g. ADC value of signal
 // error=3.75;
 // gain=120.78;
-// q.SetSignal(signal,2);
-// q.SetSignalError(error,2);
-// q.SetGain(gain,2);
+// // Addressing via name specification instead of index 
+// q.SetSlotName("ADC");
+// q.SetSignal(signal,"ADC");
+// q.SetSignalError(error,"ADC");
+// q.SetGain(gain,"ADC");
 // signal=23.7; // e.g. corresponding dE/dx value
 // error=0.48;
 // offset=0.2;
 // gain=150;
+// q.SetSlotName("dE/dx");
 // q.SetSignal(signal,3);
 // q.SetSignalError(error,3);
 // q.SetOffset(offset,3);
 // q.SetGain(gain,3);
 //
+// Float_t dedx=q.GetSignal("dE/dx");
+//
 //--- Author: Nick van Eijndhoven 23-jan-1999 UU-SAP Utrecht
 //- Modified: NvE $Date$ UU-SAP Utrecht
 ///////////////////////////////////////////////////////////////////////////
@@ -101,6 +107,7 @@ AliSignal::AliSignal() : TNamed(),AliPosition(),AliAttrib()
  fDsignals=0;
  fWaveforms=0;
  fLinks=0;
+ fDevice=0;
 }
 ///////////////////////////////////////////////////////////////////////////
 AliSignal::~AliSignal()
@@ -123,12 +130,23 @@ AliSignal::~AliSignal()
  }
  if (fLinks)
  {
+  // Remove this signal from all related tracks
+  for (Int_t i=1; i<=fLinks->GetNobjects(); i++)
+  {
+   TObject* obj=fLinks->GetObject(i);
+   if (!obj) continue;
+   if (obj->InheritsFrom("AliTrack"))
+   {
+    AliTrack* tx=(AliTrack*)obj;
+    tx->RemoveSignal(*this);
+   }
+  }
   delete fLinks;
   fLinks=0;
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-AliSignal::AliSignal(AliSignal& s) : TNamed(s),AliPosition(s),AliAttrib(s)
+AliSignal::AliSignal(const AliSignal& s) : TNamed(s),AliPosition(s),AliAttrib(s)
 {
 // Copy constructor
  fSignals=0;
@@ -136,6 +154,9 @@ AliSignal::AliSignal(AliSignal& s) : TNamed(s),AliPosition(s),AliAttrib(s)
  fWaveforms=0;
  fLinks=0;
 
+ // Don't copy the owning device pointer for the copy
+ fDevice=0;
+
  Int_t n=s.GetNvalues();
  Double_t val;
  for (Int_t i=1; i<=n; i++)
@@ -185,6 +206,9 @@ void AliSignal::Reset(Int_t mode)
 // The default when invoking Reset() corresponds to mode=0.
 //
 // Note : In all cases the storage of the various links will be reset.
+//        The UniqueID, name and title will NOT be reset.
+//        In case the user wants to reset these attributes, this has to
+//        be done explicitly via the SET facilities. 
 //
 // The usage of mode=0 allows to re-use the allocated memory for new
 // signal (and error) values. This behaviour is preferable (i.e. faster)
@@ -218,6 +242,7 @@ void AliSignal::Reset(Int_t mode)
  }
 
  if (fLinks) fLinks->Reset();
+ fDevice=0;
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliSignal::ResetSignals(Int_t mode)
@@ -294,7 +319,7 @@ void AliSignal::DeleteSignals(Int_t mode)
 ///////////////////////////////////////////////////////////////////////////
 void AliSignal::SetSignal(Double_t sig,Int_t j)
 {
-// Store value in the j-th (default j=1) signal slot.
+// Store signal value for the j-th (default j=1) slot.
 // Note : The first signal slot is at j=1.
 // In case the value of the index j exceeds the maximum number of reserved
 // slots for signal values, the number of reserved slots for the
@@ -316,9 +341,23 @@ void AliSignal::SetSignal(Double_t sig,Int_t j)
  fSignals->AddAt(float(sig),j-1);
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliSignal::SetSignal(Double_t sig,TString name)
+{
+// Store signal value for the name-specified slot.
+//
+// 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);
+ if (j>0) SetSignal(sig,j);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::AddSignal(Double_t sig,Int_t j)
 {
-// Add value to the j-th (default j=1) signal slot.
+// Add value to the signal of the j-th (default j=1) slot.
 // Note : The first signal slot is at j=1.
 // In case the value of the index j exceeds the maximum number of reserved
 // slots for signal values, the number of reserved slots for the
@@ -341,9 +380,23 @@ void AliSignal::AddSignal(Double_t sig,Int_t j)
  fSignals->AddAt(sum,j-1);
 }
 ///////////////////////////////////////////////////////////////////////////
-Float_t AliSignal::GetSignal(Int_t j,Int_t mode)
+void AliSignal::AddSignal(Double_t sig,TString name)
 {
-// Provide value of the j-th (default j=1) signal slot.
+// Add value to the signal of the name-specified slot.
+//
+// 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);
+ if (j>0) AddSignal(sig,j);
+}
+///////////////////////////////////////////////////////////////////////////
+Float_t AliSignal::GetSignal(Int_t j,Int_t mode) const
+{
+// Provide signal value of the j-th (default j=1) slot.
 // Note : The first signal slot is at j=1.
 // In case no signal is present or the argument j is invalid, 0 is returned.
 // The parameter "mode" allows for automatic gain etc... correction of the signal.
@@ -395,9 +448,40 @@ Float_t AliSignal::GetSignal(Int_t j,Int_t mode)
  return sig;
 }
 ///////////////////////////////////////////////////////////////////////////
+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 default is mode=0.
+//
+// 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);
+ Float_t val=0;
+ if (j>0) val=GetSignal(j,mode);
+ return val;
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::SetSignalError(Double_t dsig,Int_t j)
 {
-// Store error for the j-th (default j=1) signal slot.
+// Store error on the signal for the j-th (default j=1) slot.
 // Note : The first signal slot is at j=1.
 // In case the value of the index j exceeds the maximum number of reserved
 // slots for signal error values, the number of reserved slots for the
@@ -419,9 +503,23 @@ void AliSignal::SetSignalError(Double_t dsig,Int_t j)
  fDsignals->AddAt(float(dsig),j-1);
 }
 ///////////////////////////////////////////////////////////////////////////
-Float_t AliSignal::GetSignalError(Int_t j)
+void AliSignal::SetSignalError(Double_t dsig,TString name)
 {
-// Provide error of the j-th (default j=1) signal slot.
+// Store error on the signal for the name-specified slot.
+//
+// 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);
+ if (j>0) SetSignalError(dsig,j);
+}
+///////////////////////////////////////////////////////////////////////////
+Float_t AliSignal::GetSignalError(Int_t j) const
+{
+// Provide error on the signal of the j-th (default j=1) slot.
 // Note : The first signal slot is at j=1.
 // In case no signal is present or the argument j is invalid, 0 is returned.
  Float_t err=0;
@@ -439,24 +537,54 @@ Float_t AliSignal::GetSignalError(Int_t j)
  return err;
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliSignal::Data(TString f)
+Float_t AliSignal::GetSignalError(TString name) const
+{
+// Provide error on the signal of the name-specified slot.
+//
+// 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);
+ Float_t val=0;
+ if (j>0) val=GetSignalError(j);
+ return val;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::Data(TString f) const
 {
 // Provide all signal information within the coordinate frame f.
 
  const char* name=GetName();
  const char* title=GetTitle();
 
- cout << " *" << ClassName() << "::Data*";
+ cout << " *" << ClassName() << "::Data* Id : " << GetUniqueID();
  if (strlen(name))  cout << " Name : " << name;
  if (strlen(title)) cout << " Title : " << title;
  cout << endl;
  cout << "   Position";
- Ali3Vector::Data(f);
+ AliPosition::Data(f);
+ if (fDevice)
+ {
+  const char* devname=fDevice->GetName();
+  const char* devtitle=fDevice->GetTitle();
+  cout << "   Owned by device : " << fDevice->ClassName()
+       << " Id : " << fDevice->GetUniqueID();
+  if (strlen(devname))  cout << " Name : " << devname;
+  if (strlen(devtitle)) cout << " Title : " << devtitle;
+  cout << endl;
+ }
 
+ // Provide an overview of the stored waveforms
+ ListWaveform(-1);
+
+ // Provide an overview of all the data and attribute slots
  List(-1);
 } 
 ///////////////////////////////////////////////////////////////////////////
-void AliSignal::List(Int_t j)
+void AliSignal::List(Int_t j) const
 {
 // Provide signal information for the j-th slot.
 // The first slot is at j=1.
@@ -475,20 +603,27 @@ void AliSignal::List(Int_t j)
   const char* name=GetName();
   const char* title=GetTitle();
 
-  cout << " *" << ClassName() << "::Data*";
+  cout << " *" << ClassName() << "::Data* Id :" << GetUniqueID();
   if (strlen(name))  cout << " Name : " << name;
   if (strlen(title)) cout << " Title : " << title;
   cout << endl;
+  if (fDevice)
+  {
+   const char* devname=fDevice->GetName();
+   const char* devtitle=fDevice->GetTitle();
+   cout << "   Owned by device : " << fDevice->ClassName();
+   if (strlen(devname))  cout << " Name : " << devname;
+   if (strlen(devtitle)) cout << " Title : " << devtitle;
+   cout << endl;
+  }
  }
 
  Int_t nvalues=GetNvalues();
  Int_t nerrors=GetNerrors();
- Int_t nwforms=GetNwaveforms();
  Int_t nlinkslots=0;
  if (fLinks) nlinkslots=fLinks->GetMaxColumn();
  Int_t n=nvalues;
  if (nerrors>n) n=nerrors;
- if (nwforms>n) n=nwforms;
  if (nlinkslots>n) n=nlinkslots;
 
  TObject* obj=0;
@@ -505,16 +640,6 @@ void AliSignal::List(Int_t j)
    if (i<=nerrors) cout << " error : " << GetSignalError(i);
    AliAttrib::List(i);
    cout << endl;
-   obj=GetWaveform(i);
-   if (obj)
-   {
-    const char* wfname=obj->GetName();
-    const char* wftitle=obj->GetTitle();
-    cout << "    Waveform : " << obj->ClassName();
-    if (strlen(wfname))  cout << " Name : " << wfname;
-    if (strlen(wftitle)) cout << " Title : " << wftitle;
-    cout << endl;
-   }
    obj=0;
    nrefs=GetIndices(obj,i,posarr);
    for (Int_t k=0; k<nrefs; k++)
@@ -545,16 +670,6 @@ void AliSignal::List(Int_t j)
    if (j<=nerrors) cout << " error : " << GetSignalError(j);
    AliAttrib::List(j);
    cout << endl;
-   obj=GetWaveform(j);
-   if (obj)
-   {
-    const char* wfnamej=obj->GetName();
-    const char* wftitlej=obj->GetTitle();
-    cout << "    Waveform : " << obj->ClassName();
-    if (strlen(wfnamej))  cout << " Name : " << wfnamej;
-    if (strlen(wftitlej)) cout << " Title : " << wftitlej;
-    cout << endl;
-   }
    obj=0;
    nrefs=GetIndices(obj,j,posarr);
    for (Int_t kj=0; kj<nrefs; kj++)
@@ -578,7 +693,92 @@ void AliSignal::List(Int_t j)
  }
 } 
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetNvalues()
+void AliSignal::List(TString name) const
+{
+// Provide signal information for the name-specified slot.
+//
+// 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);
+ if (j>0) List(j);
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::ListWaveform(Int_t j) const
+{
+// Provide information for the j-th waveform.
+// The first waveform is at j=1.
+// In case j=0 (default) the info of all waveforms will be listed.
+// In case j=-1 the info of all waveforms will be listed, but the header
+// information will be suppressed.
+
+ if (j<-1) 
+ {
+  cout << " *AliSignal::ListWaveform* Invalid argument j = " << j << endl;
+  return;
+ }
+
+ if (j != -1)
+ {
+  const char* name=GetName();
+  const char* title=GetTitle();
+
+  cout << " *" << ClassName() << "::Data* Id :" << GetUniqueID();
+  if (strlen(name))  cout << " Name : " << name;
+  if (strlen(title)) cout << " Title : " << title;
+  cout << endl;
+  if (fDevice)
+  {
+   const char* devname=fDevice->GetName();
+   const char* devtitle=fDevice->GetTitle();
+   cout << "   Owned by device : " << fDevice->ClassName();
+   if (strlen(devname))  cout << " Name : " << devname;
+   if (strlen(devtitle)) cout << " Title : " << devtitle;
+   cout << endl;
+  }
+ }
+
+ Int_t n=GetNwaveforms();
+ TObject* obj=0;
+
+ if (j<=0)
+ {
+  for (Int_t i=1; i<=n; i++)
+  {
+   obj=GetWaveform(i);
+   if (obj)
+   {
+    const char* wfname=obj->GetName();
+    const char* wftitle=obj->GetTitle();
+    cout << "    Waveform " << i << " : " << obj->ClassName();
+    if (strlen(wfname))  cout << " Name : " << wfname;
+    if (strlen(wftitle)) cout << " Title : " << wftitle;
+    cout << endl;
+   }
+  }
+ }
+ else
+ {
+  if (j<=n)
+  {
+   obj=GetWaveform(j);
+   if (obj)
+   {
+    const char* wfnamej=obj->GetName();
+    const char* wftitlej=obj->GetTitle();
+    cout << "    Waveform " << j << " : " << obj->ClassName();
+    if (strlen(wfnamej))  cout << " Name : " << wfnamej;
+    if (strlen(wftitlej)) cout << " Title : " << wftitlej;
+    cout << endl;
+   }
+  }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetNvalues() const
 {
 // Provide the number of values for this signal.
  Int_t n=0;
@@ -586,7 +786,7 @@ Int_t AliSignal::GetNvalues()
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetNerrors()
+Int_t AliSignal::GetNerrors() const
 {
 // Provide the number specified errors on the values for this signal.
  Int_t n=0;
@@ -594,15 +794,26 @@ Int_t AliSignal::GetNerrors()
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetNwaveforms()
+Int_t AliSignal::GetNwaveforms() const
 {
-// Provide the number specified waveforms for this signal.
- Int_t n=0;
- if (fWaveforms) n=fWaveforms->GetSize();
- return n;
+// Provide the number of specified waveforms for this signal.
+// Actually the return value is the highest index of the stored waveforms.
+// This allows an index dependent meaning of waveform info (e.g. waveforms
+// with various gain values).
+// So, when all waveforms are stored in consequetive positions (e.g. 1,2,3),
+// this memberfunction returns 3, being both the highest filled position
+// and the actual number of waveforms.
+// In case only waveforms are stored at positions 1,2,5,7 this memberfunction
+// returns a value 7 whereas only 4 actual waveforms are present.
+// This implies that when looping over the various waveform slots, one
+// always has to check whether the returned pointer value is non-zero
+// (which is a good practice anyhow).
+ Int_t n=-1;
+ if (fWaveforms) n=fWaveforms->GetLast();
+ return (n+1);
 }
 ///////////////////////////////////////////////////////////////////////////
-TH1F* AliSignal::GetWaveform(Int_t j)
+TH1F* AliSignal::GetWaveform(Int_t j) const
 {
 // Provide pointer to the j-th waveform histogram.
  TH1F* waveform=0;
@@ -610,16 +821,52 @@ TH1F* AliSignal::GetWaveform(Int_t j)
  return waveform;
 }
 ///////////////////////////////////////////////////////////////////////////
+TH1F* AliSignal::GetWaveform(TString name) const
+{
+// Provide pointer to the waveform histogram with the specified name.
+// In case no match is found, zero is returned.
+ Int_t n=GetNwaveforms();
+ TString str;
+ for (Int_t i=1; i<=n; i++)
+ {
+  TH1F* waveform=GetWaveform(i);
+  if (waveform)
+  {
+   str=waveform->GetName();
+   if (str == name) return waveform;
+  }
+ }
+ return 0; // No match found
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetWaveformIndex(TString name) const
+{
+// Provide index to the waveform histogram with the specified name.
+// In case no match is found, zero is returned.
+ Int_t n=GetNwaveforms();
+ TString str;
+ for (Int_t i=1; i<=n; i++)
+ {
+  TH1F* waveform=GetWaveform(i);
+  if (waveform)
+  {
+   str=waveform->GetName();
+   if (str == name) return i;
+  }
+ }
+ return 0; // No match found
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::SetWaveform(TH1F* waveform,Int_t j)
 {
-// Set the 1D waveform histogram corresponding to the j-th signal value.
+// Set the 1D waveform histogram for the j-th waveform.
 //
 // Notes :
-//  The waveform of the first signal value is at j=1.
+//  The first waveform position at j=1.
 //  j=1 is the default value.
 //
 // In case the value of the index j exceeds the maximum number of reserved
-// slots for the waveforms, the number of reserved slots for the waveforms
+// positions for the waveforms, the number of reserved positions for the waveforms
 // is increased automatically.
 //
 // In case the histo pointer argument has the same value as the current waveform
@@ -633,6 +880,8 @@ void AliSignal::SetWaveform(TH1F* waveform,Int_t j)
 // copy of the input histogram is created which becomes the current waveform
 // histogram.
 
+ if (j<1) return;
+
  if (!fWaveforms)
  {
   fWaveforms=new TObjArray(j);
@@ -660,10 +909,10 @@ void AliSignal::SetWaveform(TH1F* waveform,Int_t j)
 ///////////////////////////////////////////////////////////////////////////
 void AliSignal::ResetWaveform(Int_t j)
 {
-// Reset the waveform of the j-th (default j=1) signal value.
+// Reset the histogram of the j-th (default j=1) waveform.
 // This memberfunction invokes TH1F::Reset() for the corresponding waveform(s).
 // To actually delete the histograms from memory, use DeleteWaveform().
-// Notes : The first signal value is at j=1.
+// Notes : The first position is at j=1.
 //         j=0 ==> All waveforms will be reset.
  
  if (!fWaveforms) return;
@@ -693,10 +942,17 @@ void AliSignal::ResetWaveform(Int_t j)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliSignal::ResetWaveform(TString name)
+{
+// Reset the waveform with the specified name.
+ Int_t j=GetWaveformIndex(name);
+ if (j>0) ResetWaveform(j);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::DeleteWaveform(Int_t j)
 {
-// Delete the waveform of the j-th (default j=1) signal value.
-// Notes : The first signal value is at j=1.
+// Delete the histogram of the j-th (default j=1) waveform.
+// Notes : The first position is at j=1.
 //         j=0 ==> All waveforms will be deleted.
  
  if (!fWaveforms) return;
@@ -727,7 +983,14 @@ void AliSignal::DeleteWaveform(Int_t j)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetNlinks(TObject* obj,Int_t j)
+void AliSignal::DeleteWaveform(TString name)
+{
+// Delete the waveform with the specified name.
+ Int_t j=GetWaveformIndex(name);
+ if (j>0) DeleteWaveform(j);
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetNlinks(TObject* obj,Int_t j) const
 {
 // Provide the number of links to the specified object for the j-th slot.
 // If j=0 (default) all slots will be scanned for the specified object.
@@ -743,7 +1006,7 @@ Int_t AliSignal::GetNlinks(TObject* obj,Int_t j)
  Int_t n=0;
  if (!j)
  {
-  n=fLinks->GetNrefs(obj);
+  if (fLinks) n=fLinks->GetNrefs(obj);
  }
  else
  {
@@ -753,7 +1016,24 @@ Int_t AliSignal::GetNlinks(TObject* obj,Int_t j)
  return n;
 }
 ///////////////////////////////////////////////////////////////////////////
-TObject* AliSignal::GetLink(Int_t j,Int_t k)
+Int_t AliSignal::GetNlinks(TObject* obj,TString name) const
+{
+// Provide the number of links to the specified object for the name-spec. slot.
+// If obj=0 all encountered objects for the specified slot will be counted.
+//
+// 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 n=0;
+ if (j>0) n=GetNlinks(obj,j);
+ return n;
+}
+///////////////////////////////////////////////////////////////////////////
+TObject* AliSignal::GetLink(Int_t j,Int_t k) const
 {
 // Provide pointer of the object linked to the j-th slot at position k.
 
@@ -763,6 +1043,22 @@ TObject* AliSignal::GetLink(Int_t j,Int_t k)
  return obj;
 }
 ///////////////////////////////////////////////////////////////////////////
+TObject* AliSignal::GetLink(TString name,Int_t k) const
+{
+// Provide pointer of the object linked to the name-spec. slot at position k.
+//
+// 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);
+ TObject* obj=0;
+ if (j>0) obj=GetLink(j,k);
+ return obj;
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::SetLink(TObject* obj,Int_t j,Int_t k)
 {
 // Introduce a link (=pointer) to an object for the j-th slot at position k.
@@ -807,6 +1103,23 @@ void AliSignal::SetLink(TObject* obj,Int_t j,Int_t k)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliSignal::SetLink(TObject* obj,TString name,Int_t k)
+{
+// Introduce a link (=pointer) to an object for the name-spec. slot at position k.
+// Only the pointer values are stored for (backward) reference, meaning
+// that the objects of which the pointers are stored are NOT owned
+// by the AliSignal object.
+//
+// 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);
+ if (j>0) SetLink(obj,j,k);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::AddLink(TObject* obj,Int_t j)
 {
 // Introduce a link (=pointer) to an object for the j-th slot at the first
@@ -852,6 +1165,24 @@ void AliSignal::AddLink(TObject* obj,Int_t j)
  SetLink(obj,j,pos);
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliSignal::AddLink(TObject* obj,TString name)
+{
+// Introduce a link (=pointer) to an object for the name-spec slot at the first
+// free position.
+// Only the pointer values are stored for (backward) reference, meaning
+// that the objects of which the pointers are stored are NOT owned
+// by the AliSignal object.
+//
+// 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);
+ if (j>0) AddLink(obj,j);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::ResetLink(Int_t j,Int_t k)
 {
 // Reset the link of the j-th slot at position k.
@@ -879,6 +1210,23 @@ void AliSignal::ResetLink(Int_t j,Int_t k)
  if (fLinks) fLinks->RemoveObject(k,j);
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliSignal::ResetLink(TString name,Int_t k)
+{
+// Reset the link of the name-specified slot at position k.
+//
+// This memberfunction is intended to reset only 1 specified link location.
+// For extended functionality, please refer to the memberfuction ResetLinks().
+//
+// 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);
+ if (j>0) ResetLink(j,k);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::ResetLinks(TObject* obj,Int_t j,Int_t k)
 {
 // Reset single or multiple link(s) according to user specified selections.
@@ -935,7 +1283,30 @@ void AliSignal::ResetLinks(TObject* obj,Int_t j,Int_t k)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetIndices(TObject* obj,TArrayI& js,TArrayI& ks)
+void AliSignal::ResetLinks(TObject* obj,TString name,Int_t k)
+{
+// Reset single or multiple link(s) according to user specified selections.
+//
+// A link is only reset if the stored reference matches the argument "obj".
+// In case obj=0 no check on the matching of the stored reference is performed
+// and the stored link is always reset in accordance with the other
+// selection criteria.
+//
+// In case the position argument "k" is specified, only the links from that
+// specified position will be deleted.
+// In case k=0 (default) no checking on the position index is performed.
+//
+// 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);
+ if (j>0) ResetLinks(obj,j,k);
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetIndices(TObject* obj,TArrayI& js,TArrayI& ks) const
 {
 // Provide the slot and position indices of all the storage locations
 // of the specified object.
@@ -969,7 +1340,7 @@ Int_t AliSignal::GetIndices(TObject* obj,TArrayI& js,TArrayI& ks)
  return nrefs;
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetIndices(TObject* obj,Int_t j,TArrayI& ks)
+Int_t AliSignal::GetIndices(TObject* obj,Int_t j,TArrayI& ks) const
 {
 // Provide the position indices of all the storage locations of the
 // specified object in the j-th slot of this AliSignal.
@@ -1005,7 +1376,30 @@ Int_t AliSignal::GetIndices(TObject* obj,Int_t j,TArrayI& ks)
  return nrefs;
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetIndices(TObject* obj,TArrayI& js,Int_t k)
+Int_t AliSignal::GetIndices(TObject* obj,TString name,TArrayI& ks) const
+{
+// Provide the position indices of all the storage locations of the
+// specified object in the name-specified slot of this AliSignal.
+// The position indices are returned in the TArrayI array.
+// The integer return argument represents the number of storage locations which
+// were encountered for the specified object in the j-th slot.
+//
+// If obj=0 no object selection is performed and all position indices
+// of the stored references for all objects of the j-th slot are returned.
+//
+// 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 n=0;
+ if (j>0) n=GetIndices(obj,j,ks);
+ return n;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetIndices(TObject* obj,TArrayI& js,Int_t k) const
 {
 // Provide the slot indices of all the storage locations of the
 // specified object for the k-th position in this AliSignal.
@@ -1060,7 +1454,7 @@ void AliSignal::SetSwapMode(Int_t swap)
  fLinks->SetSwapMode(swap);
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliSignal::GetSwapMode()
+Int_t AliSignal::GetSwapMode() const
 {
 // Provide swapmode flag of the link storage.
  Int_t swap=0; 
@@ -1068,7 +1462,20 @@ Int_t AliSignal::GetSwapMode()
  return swap;
 }
 ///////////////////////////////////////////////////////////////////////////
-TObject* AliSignal::Clone(const char* name)
+void AliSignal::SetDevice(TObject* dev)
+{
+// Store the pointer to the device which owns this AliSignal object.
+// This memberfunction is meant for internal use in AliDevice.
+ fDevice=dev;
+}
+///////////////////////////////////////////////////////////////////////////
+AliDevice* AliSignal::GetDevice() const
+{
+// Provide the pointer to the device which owns this AliSignal object.
+ return (AliDevice*)fDevice;
+}
+///////////////////////////////////////////////////////////////////////////
+TObject* AliSignal::Clone(const char* name) const
 {
 // Make a deep copy of the current object and provide the pointer to the copy.
 // This memberfunction enables automatic creation of new objects of the