25-apr-2002 NvE Projectile and target specifications introduced in AliEvent.
authornick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Jun 2002 09:38:29 +0000 (09:38 +0000)
committernick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Jun 2002 09:38:29 +0000 (09:38 +0000)
26-apr-2002 NvE AddVetoSignal(AliSignal) introduced in AliCalorimeter and AliCalcluster
                to provide more flexibility and allow automatic calculation of
                hit association confidence level based on position uncertainties.
29-apr-2002 NvE Memberfunction GetNvalues() and copy constructor introduced in AliSignal.
25-jun-2002 NvE Memberfunction SetOwner() introduced in AliJet, AliVertex and AliEvent to allow
                to set ownership of "added objects" in the case of reading data from a file.
                In this way possible memory leaks can always be prevented.
                Also automatic extrapolation and confidence level calculation of associated
                veto hits introduced in AliCalorimeter and AliCalcluster.

13 files changed:
RALICE/AliCalcluster.cxx
RALICE/AliCalcluster.h
RALICE/AliCalorimeter.cxx
RALICE/AliCalorimeter.h
RALICE/AliEvent.cxx
RALICE/AliEvent.h
RALICE/AliJet.cxx
RALICE/AliJet.h
RALICE/AliSignal.cxx
RALICE/AliSignal.h
RALICE/AliVertex.cxx
RALICE/AliVertex.h
RALICE/history.txt

index 9bba932a2fd8352b1a034e4db043f0cf46c83ab2..283f93b2d883f38129c3223c839e89ecf051b860 100644 (file)
@@ -99,7 +99,7 @@ AliCalcluster::AliCalcluster(AliCalmodule& m)
   fColdisp=0.;
   fNvetos=0;
   fVetos=0;
-}
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliCalcluster::GetRow()
@@ -248,12 +248,26 @@ void AliCalcluster::Add(AliCalmodule& m)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliCalcluster::AddVetoSignal(Float_t* r,TString f,Float_t s)
+void AliCalcluster::AddVetoSignal(AliSignal& s,Int_t extr)
 {
-// Associate an (extrapolated) AliSignal at location r as veto to the cluster.
-// The signal value s indicates the confidence level of hit association
-// and has to be provided by the user.
-// Note : The default signal value (s) is 0
+// Associate an (extrapolated) AliSignal as veto to the cluster.
+// By default a straight line extrapolation is performed which extrapolates
+// the signal position until the length of its position vector matches that
+// of the position vector of the cluster.
+// In this extrapolation procedure the error propagation is performed 
+// automatically.  
+// Based on the cluster and extrapolated veto signal (x,y) positions and
+// position errors the confidence level of association is calculated
+// and stored as an additional signal value.
+// By means of the GetVetoSignal memberfunction the confidence level of
+// association can always be updated by the user.
+// In case the user wants to invoke a more detailed extrapolation procedure,
+// the automatic extrapolation can be suppressed by setting the argument
+// extr=0. In this case it is assumed that the AliSignal as entered via
+// the argument contains already the extrapolated position vector and
+// corresponding errors. 
+// Note : Three additional values are added to the original AliSignal
+//        to hold the chi2, ndf and confidence level values of the association. 
  if (!fVetos)
  {
   fNvetos=0;
@@ -261,11 +275,61 @@ void AliCalcluster::AddVetoSignal(Float_t* r,TString f,Float_t s)
   fVetos->SetOwner();
  } 
 
- fVetos->Add(new AliSignal(1));
- fNvetos++;
+ Int_t nvalues=s.GetNvalues();
+ AliSignal* sx=new AliSignal(nvalues+3); // Additional value added
+ TString name=s.GetName();
+ name.Append(" + additional chi2, ndf and CL values");
+ sx->SetName(name);
+
+ Double_t vecc[3],vecv[3];
+ if (!extr)
+ {
+  sx->SetPosition((Ali3Vector&)s);
+ }
+ else
+ {
+  // Extrapolate the veto hit position
+  Double_t scale=1;
+  GetPosition(vecc,"sph");
+  s.GetPosition(vecv,"sph"); 
+  if (vecv[0]) scale=vecc[0]/vecv[0];
+  Ali3Vector r=s*scale;
+  sx->SetPosition(r);
+ }
 
- ((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
- ((AliSignal*)fVetos->At(fNvetos-1))->SetSignal(s);
+ Double_t sig,err;
+ for (Int_t i=1; i<=nvalues; i++)
+ {
+  sig=s.GetSignal(i);
+  err=s.GetSignalError(i);
+  sx->SetSignal(sig,i);
+  sx->SetSignalError(err,i);
+ }
+
+ // Calculate the confidence level of association
+ GetPosition(vecc,"car");
+ sx->GetPosition(vecv,"car"); 
+ Double_t dx=vecc[0]-vecv[0];
+ Double_t dy=vecc[1]-vecv[1];
+ GetPositionErrors(vecc,"car");
+ sx->GetPositionErrors(vecv,"car"); 
+ Double_t sxc2=vecc[0]*vecc[0];
+ Double_t syc2=vecc[1]*vecc[1];
+ Double_t sxv2=vecv[0]*vecv[0];
+ Double_t syv2=vecv[1]*vecv[1];
+ Double_t sumx2=sxc2+sxv2;
+ Double_t sumy2=syc2+syv2;
+ Double_t chi2=0;
+ if (sumx2>0 && sumy2>0) chi2=(dx*dx/sumx2)+(dy*dy/sumy2);
+ Int_t ndf=2;
+ AliMath m;
+ Double_t prob=m.Prob(chi2,ndf);
+ if (chi2>0) sx->SetSignal(chi2,nvalues+1);
+ if (ndf>0) sx->SetSignal(ndf,nvalues+2);
+ if (prob>0) sx->SetSignal(prob,nvalues+3);
+
+ fVetos->Add(sx);
+ fNvetos++;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliCalcluster::GetNvetos()
@@ -303,12 +367,19 @@ Float_t AliCalcluster::GetVetoLevel()
 // Provide the confidence level of best associated veto signal.
  Float_t cl=0;
  Float_t clmax=0;
+ AliSignal* s=0;
+ Int_t nvalues=0;
  if (fVetos)
  {
   for (Int_t i=0; i<fNvetos; i++)
   {
-   cl=((AliSignal*)fVetos->At(i))->GetSignal();
-   if (cl>clmax) clmax=cl;
+   s=((AliSignal*)fVetos->At(i));
+   if (s)
+   {
+    nvalues=s->GetNvalues();
+    cl=s->GetSignal(nvalues);
+    if (cl>clmax) clmax=cl;
+   }
   }
  }
  return clmax;
@@ -319,11 +390,18 @@ Int_t AliCalcluster::HasVetoHit(Double_t cl)
 // Investigate if cluster has an associated veto hit with conf. level > cl.
 // Returns 1 if there is such an associated veto hit, otherwise returns 0.
 // Note : This function is faster than GetVetoLevel().
+ AliSignal* s=0;
+ Int_t nvalues=0;
  if (fVetos)
  {
   for (Int_t i=0; i<fNvetos; i++)
   {
-   if (((AliSignal*)fVetos->At(i))->GetSignal() > cl) return 1;
+   s=((AliSignal*)fVetos->At(i));
+   if (s)
+   {
+    nvalues=s->GetNvalues();
+    if (s->GetSignal(nvalues) > cl) return 1;
+   }
   }
  }
  return 0;
index 2d9e026dfc427b6785cf8627ee18250bbe6d0a10..d4fb24676d2260b370da796e6615eb0c3426c93c 100644 (file)
@@ -13,6 +13,7 @@
 #include "TString.h"
  
 #include "AliCalmodule.h"
+#include "AliMath.h"
  
 class AliCalcluster : public TObject,public AliPosition
 {
@@ -28,7 +29,8 @@ class AliCalcluster : public TObject,public AliPosition
   Float_t GetColumnDispersion();     // Return normalised column dispersion of cluster
   void Start(AliCalmodule& m);       // Reset cluster data to start with module m
   void Add(AliCalmodule& m);         // Add module data to cluster
-  void AddVetoSignal(Float_t* r,TString f,Float_t s=0); // Associate (extrapolated) signal
+  void AddVetoSignal(AliSignal& s,Int_t extr=1); // Associate (extrapolated) signal
+  void AddVetoSignal(AliSignal* s,Int_t extr=1) { AddVetoSignal(*s,extr); }
   AliSignal* GetVetoSignal(Int_t j); // Access to veto signal number j
   Int_t GetNvetos();                 // Provide the number of veto signals
   Float_t GetVetoLevel();            // Provide confidence level of best associated veto hit
@@ -46,6 +48,6 @@ class AliCalcluster : public TObject,public AliPosition
   Int_t fNvetos;         // The number of associated veto signals
   TObjArray* fVetos;     // The array of associated veto signals
  
- ClassDef(AliCalcluster,1) // Description of a cluster of calorimeter modules.
+ ClassDef(AliCalcluster,2) // Description of a cluster of calorimeter modules.
 };
 #endif
index 2e7cc048ae38f18f3ea7cad5350dcdbe2fe182f0..964e9d3f83055a8cd111cdc64fc3c0cfda87c37c 100644 (file)
 //   Float_t vec[3]={6,1,20};
 //   cal.SetPosition(2,8,vec,"car");
 //
+//   AliSignal s;
 //   Float_t loc[3]={-1,12,3};
-//   cal.AddVetoSignal(loc,"car"); // Associate (extrapolated) position as a veto
+//   s.SetPosition(loc,"car");
+//   s.SetSignal(328);
+//   cal.AddVetoSignal(s); // Associate (extrapolated) signal as a veto
 //
 //   cal.Group(2);      // Group 'fired' modules into clusters
 //                      // Perform grouping over 2 rings around the center
@@ -80,19 +83,16 @@ AliCalorimeter::~AliCalorimeter()
 // Destructor to delete memory allocated to the various arrays and matrix
  if (fModules)
  {
-  fModules->Delete();
   delete fModules;
   fModules=0;
  }
  if (fClusters)
  {
-  fClusters->Delete();
   delete fClusters;
   fClusters=0;
  }
  if (fVetos)
  {
-  fVetos->Delete();
   delete fVetos;
   fVetos=0;
  }
@@ -145,6 +145,7 @@ AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol)
  fNrows=nrow;
  fNcolumns=ncol;
  fNsignals=0;
+ fModules=0;
  fNclusters=0;
  fClusters=0;
  fAttributes=new TMatrix(nrow,ncol);
@@ -177,9 +178,6 @@ AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol)
   (*fAttributes)(i,ncol-1)=10;
  }
  
- fModules=new TObjArray();  // Default size, expanded automatically
- fModules->SetOwner();
  fHmodules=0;
  fHclusters=0;
 
@@ -212,8 +210,13 @@ void AliCalorimeter::SetSignal(Int_t row,Int_t col,Float_t sig)
   AliCalmodule* m=fMatrix[row-1][col-1];
   if (!m) // only count new modules
   {
+   if (!fModules)
+   {
+    fModules=new TObjArray();  // Default size, expanded automatically
+    fModules->SetOwner();
+   }
    fNsignals++;
-   m=new AliCalmodule;
+   m=new AliCalmodule();
    AliPosition* r=fPositions[row-1][col-1];
    if (r) m->SetPosition(*r);
    fModules->Add(m);
@@ -272,6 +275,11 @@ void AliCalorimeter::AddSignal(AliCalmodule* mod)
   AliCalmodule* m=fMatrix[row-1][col-1];
   if (!m) // No module existed yet at this position
   {
+   if (!fModules)
+   {
+    fModules=new TObjArray();  // Default size, expanded automatically
+    fModules->SetOwner();
+   }
    fNsignals++;
    m=new AliCalmodule;
    fModules->Add(m);
@@ -322,9 +330,13 @@ void AliCalorimeter::Reset()
 // Note : Module gains, edge and dead flags remain unchanged
  
  if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
+
  fNsignals=0;
- if (fModules) fModules->Delete();
+ if (fModules)
+ {
+  delete fModules;
+  fModules=0;
+ }
  for (Int_t i=0; i<fNrows; i++)
  {
   for (Int_t j=0; j<fNcolumns; j++)
@@ -336,7 +348,6 @@ void AliCalorimeter::Reset()
  fNclusters=0;
  if (fClusters)
  {
-  fClusters->Delete();
   delete fClusters;
   fClusters=0;
  }
@@ -344,7 +355,6 @@ void AliCalorimeter::Reset()
  fNvetos=0;
  if (fVetos)
  {
-  fVetos->Delete();
   delete fVetos;
   fVetos=0;
  }
@@ -728,7 +738,6 @@ void AliCalorimeter::Group(Int_t n)
   // Clustering of modules. Start with the highest signal.
   if (fClusters)
   {
-   fClusters->Delete();
    delete fClusters;
    fClusters=0;
   }
@@ -1058,10 +1067,9 @@ void AliCalorimeter::Ungroup()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliCalorimeter::AddVetoSignal(Float_t* r,TString f,Float_t s)
+void AliCalorimeter::AddVetoSignal(AliSignal& s)
 {
-// Associate an (extrapolated) AliSignal at location r as veto to the cal.
-// Note : The default signal value (s) is 0
+// Associate an (extrapolated) AliSignal as veto to the calorimeter.
  if (!fVetos)
  {
   fNvetos=0;
@@ -1069,11 +1077,23 @@ void AliCalorimeter::AddVetoSignal(Float_t* r,TString f,Float_t s)
   fVetos->SetOwner();
  } 
 
- fVetos->Add(new AliSignal);
- fNvetos++;
+ Int_t nvalues=s.GetNvalues();
+ AliSignal* sx=new AliSignal(nvalues);
+ sx->SetName(s.GetName());
+ sx->SetPosition((Ali3Vector&)s);
 
- ((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
- ((AliSignal*)fVetos->At(fNvetos-1))->SetSignal(s);
+ Double_t sig,err;
+ for (Int_t i=1; i<=nvalues; i++)
+ {
+  sig=s.GetSignal(i);
+  err=s.GetSignalError(i);
+  sx->SetSignal(sig,i);
+  sx->SetSignalError(err,i);
+ } 
+
+ fVetos->Add(sx);
+ fNvetos++;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliCalorimeter::GetNvetos()
index 838e143aae4542e56b50cf0a7abb157c7165df23..a6eb49af274df5eac757be33140853b1d0550d13 100644 (file)
@@ -53,7 +53,8 @@ class AliCalorimeter : public TObject
   AliPosition* GetPosition(Int_t row,Int_t col);   // Access to module position
   TH2F* DrawModules();                             // Draw lego plot of module signals
   TH2F* DrawClusters();                            // Draw lego plot of cluster signals
-  void AddVetoSignal(Float_t* r,TString f,Float_t s=0); // Associate (extrapolated) signal
+  void AddVetoSignal(AliSignal& s);                // Associate (extrapolated) signal
+  void AddVetoSignal(AliSignal* s) { AddVetoSignal(*s); }
   AliSignal* GetVetoSignal(Int_t j);               // Access to veto signal number j
   Int_t GetNvetos();                               // Provide the number of veto signals
   void SetName(TString name);                      // Set the name of the calorimeter system
@@ -80,6 +81,6 @@ class AliCalorimeter : public TObject
   AliPosition ***fPositions;                 //! Matrix of module position pointers for internal use
   TString fName;                             // Name of the calorimeter system
  
- ClassDef(AliCalorimeter,1) // Description of a modular calorimeter system.
+ ClassDef(AliCalorimeter,2) // Description of a modular calorimeter system.
 };
 #endif
index 08e645fb7cb1e60a6e0097154c8eb4efd1807e02..8335b9241ba3b89e56499c24af04f77e9677768b 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id: AliEvent.cxx,v 1.5 2002/01/18 08:46:59 nick Exp $
+// $Id: AliEvent.cxx,v 1.6 2002/04/26 11:23:37 nick Exp $
 
 ///////////////////////////////////////////////////////////////////////////
 // Class AliEvent
@@ -52,6 +52,8 @@
 //    creating only one AliCalorimeter instance in the main programme and using the
 //    AliCalorimeter::Reset() and AliCalorimeter parameter setting memberfunctions.
 //
+// See also the documentation provided for the memberfunction SetOwner(). 
+//
 // Coding example to make an event consisting of a primary vertex,
 // 2 secondary vertices and a calorimeter.
 // --------------------------------------------------------------
 // Note : All quantities are in GeV, GeV/c or GeV/c**2
 //
 //--- Author: Nick van Eijndhoven 27-may-2001 UU-SAP Utrecht
-//- Modified: NvE $Date: 2002/01/18 08:46:59 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2002/04/26 11:23:37 $ UU-SAP Utrecht
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliEvent.h"
@@ -216,6 +218,7 @@ AliEvent::AliEvent(Int_t n): AliVertex(n)
 {
 // Create an event to hold initially a maximum of n tracks
 // All variables initialised to default values
+ cout << "AliEvent init with n = " << n << endl;
  fDaytime.Set();
  fRun=0;
  fEvent=0;
@@ -245,6 +248,7 @@ void AliEvent::Reset()
 // Reset all variables to default values
 // The max. number of tracks is set to the initial value again
 // The max. number of vertices is set to the default value again
+// Note : The CalCopy mode is maintained as it was set by the user before.
  fDaytime.Set();
  fRun=0;
  fEvent=0;
@@ -265,6 +269,35 @@ void AliEvent::Reset()
  AliVertex::Reset();
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliEvent::SetOwner(Bool_t own)
+{
+// Set ownership of all added objects. 
+// The default parameter is own=kTRUE.
+//
+// Invokation of this memberfunction also sets all the copy modes
+// (e.g. TrackCopy & co.) according to the value of own.
+//
+// This function (with own=kTRUE) is particularly useful when reading data
+// from a tree/file, since Reset() will then actually remove all the
+// added objects from memory irrespective of the copy mode settings
+// during the tree/file creation process. In this way it provides a nice way
+// of preventing possible memory leaks in the reading/analysis process.
+//
+// In addition this memberfunction can also be used as a shortcut to set all
+// copy modes in one go during a tree/file creation process.
+// However, in this case the user has to take care to only set/change the
+// ownership (and copy mode) for empty objects (e.g. newly created objects
+// or after invokation of the Reset() memberfunction) otherwise it will
+// very likely result in inconsistent destructor behaviour.
+
+ Int_t mode=1;
+ if (!own) mode=0;
+ if (fCalorimeters) fCalorimeters->SetOwner(own);
+ fCalCopy=mode;
+
+ AliVertex::SetOwner(own);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetDayTime(TDatime& stamp)
 {
 // Set the date and time stamp for this event
index 2bc9905856d59c8df80542f40800ced426a0d09b..c1cb56249e1cf0161b6f5074c58c316eb1a04e54 100644 (file)
@@ -3,7 +3,7 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-// $Id: AliEvent.h,v 1.2 2001/07/04 15:59:20 nick Exp $
+// $Id: AliEvent.h,v 1.3 2002/04/26 11:23:37 nick Exp $
 
 #include <iomanip.h>
 #include <math.h>
@@ -21,6 +21,7 @@ class AliEvent : public AliVertex
   AliEvent();                             // Default constructor
   AliEvent(Int_t n);                      // Create an event to hold initially n tracks
   ~AliEvent();                            // Default destructor
+  virtual void SetOwner(Bool_t own=kTRUE);// Set ownership of all added objects
   void SetDayTime(TDatime& stamp);        // Set the date and time stamp
   void SetRunNumber(Int_t run);           // Set the run number
   void SetEventNumber(Int_t evt);         // Set the event number
@@ -60,6 +61,6 @@ class AliEvent : public AliVertex
   TObjArray* fCalorimeters; // Array to hold the pointers to the calorimeter systems
   Int_t fCalCopy;           // Flag to denote creation of private copies in fCalorimeters
 
- ClassDef(AliEvent,2) // Creation and investigation of an Alice physics event.
+ ClassDef(AliEvent,3) // Creation and investigation of an Alice physics event.
 };
 #endif
index a59e90e736f499009eafd50b6d3985d19fe1c8db..a49d10be8d06d71b19515a2b9fec307895adcef6 100644 (file)
@@ -45,6 +45,8 @@
 //    creating only one AliTrack instance in the main programme and using the
 //    AliTrack::Reset() and AliTrack parameter setting memberfunctions.
 //
+// See also the documentation provided for the memberfunction SetOwner(). 
+//
 // Coding example to make 2 jets j1 and j2.
 // ----------------------------------------
 // j1 contains the AliTracks t1 and t2
@@ -140,6 +142,33 @@ AliJet::~AliJet()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliJet::SetOwner(Bool_t own)
+{
+// Set ownership of all added objects. 
+// The default parameter is own=kTRUE.
+//
+// Invokation of this memberfunction also sets all the copy modes
+// (e.g. TrackCopy & co.) according to the value of own.
+//
+// This function (with own=kTRUE) is particularly useful when reading data
+// from a tree/file, since Reset() will then actually remove all the
+// added objects from memory irrespective of the copy mode settings
+// during the tree/file creation process. In this way it provides a nice way
+// of preventing possible memory leaks in the reading/analysis process.
+//
+// In addition this memberfunction can also be used as a shortcut to set all
+// copy modes in one go during a tree/file creation process.
+// However, in this case the user has to take care to only set/change the
+// ownership (and copy mode) for empty objects (e.g. newly created objects
+// or after invokation of the Reset() memberfunction) otherwise it will
+// very likely result in inconsistent destructor behaviour.
+
+ Int_t mode=1;
+ if (!own) mode=0;
+ if (fTracks) fTracks->SetOwner(own);
+ fTrackCopy=mode;
+}
+///////////////////////////////////////////////////////////////////////////
 AliJet::AliJet(AliJet& j)
 {
 // Copy constructor
index a1ff2a96f14c16023b9f1eaf5701932c14483070..2f40b0a33e0598e340981aa1d6b635921d8305ab 100644 (file)
@@ -20,6 +20,7 @@ class AliJet : public TObject,public Ali4Vector
   AliJet();                          // Default constructor
   AliJet(Int_t n);                   // Create a Jet to hold initially n Tracks
   ~AliJet();                         // Default destructor
+  virtual void SetOwner(Bool_t own=kTRUE);// Set ownership of all added objects
   AliJet(AliJet& j);                 // Copy constructor
   void Reset();                      // Reset all values
   void AddTrack(AliTrack& t,Int_t copy=1);// Add a track to the jet
@@ -57,6 +58,6 @@ class AliJet : public TObject,public Ali4Vector
   Int_t fTrackCopy;          // Flag to denote creation of private copies in fTracks
   Int_t fUserId;             // The user defined identifier
  
- ClassDef(AliJet,1) // Creation and investigation of a jet of particle tracks.
+ ClassDef(AliJet,2) // Creation and investigation of a jet of particle tracks.
 };
 #endif
index ce35e9325472be6dfb9bf00179cb29f484373540..3acc80d92b2a29f413e7df9aab46b3c22f0234f3 100644 (file)
@@ -103,6 +103,26 @@ AliSignal::~AliSignal()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+AliSignal::AliSignal(AliSignal& s)
+{
+// Copy constructor
+ fNvalues=s.GetNvalues();
+ fSignal=0;
+ fDsignal=0;
+ fName=s.GetName();
+ SetPosition((Ali3Vector&)s);
+
+ Double_t sig,err;
+ for (Int_t i=1; i<=fNvalues; i++)
+ {
+  sig=s.GetSignal(i);
+  err=s.GetSignalError(i);
+  SetSignal(sig,i);
+  SetSignalError(err,i);
+ } 
+}
+///////////////////////////////////////////////////////////////////////////
 void AliSignal::Reset()
 {
 // Reset all signal and position values and errors to 0.
@@ -259,3 +279,9 @@ TString AliSignal::GetName()
  return fName;
 }
 ///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetNvalues()
+{
+// Provide the number of values for this signal.
+ return fNvalues;
+}
+///////////////////////////////////////////////////////////////////////////
index 7014531271ef58782694dd9d48b1742c5a48f854..62bd7a8bab12b1e63924c08f09c17c45ed8dfbf0 100644 (file)
@@ -15,6 +15,7 @@ class AliSignal : public TObject,public AliPosition
  public:
   AliSignal(Int_t n=1);                                 // Default constructor
   ~AliSignal();                                         // Destructor
+  AliSignal(AliSignal& s);                              // Copy constructor
   virtual void SetSignal(Double_t sig,Int_t j=1);       // Store j-th signal value
   virtual void AddSignal(Double_t sig,Int_t j=1);       // Add value to j-th signal value
   virtual Float_t GetSignal(Int_t j=1);                 // Provide j-th signal value
@@ -26,6 +27,7 @@ class AliSignal : public TObject,public AliPosition
   void Info(TString f="car");                           // Print signal info for coord. frame f
   void SetName(TString name);                           // Set the name tag to indicate the kind of signal
   TString GetName();                                    // Provide the name tag indicating the kind of signal
+  Int_t GetNvalues();                                   // Provide the number of signal values
 
  protected:
   Int_t fNvalues;    // The number of values per signal
@@ -33,6 +35,6 @@ class AliSignal : public TObject,public AliPosition
   TArrayF* fDsignal; // Errors on signal values
   TString fName;     // Name tag to identify the kind of signal
 
- ClassDef(AliSignal,2) // Handling of ALICE (extrapolated) signals.
+ ClassDef(AliSignal,3) // Handling of ALICE (extrapolated) signals.
 };
 #endif
index 700dac48d682a22cc9d7365d57d4b3ed87ac2ae6..996bc7f7aaaea3c6c7c8ee6a1a6e5771e4101ec9 100644 (file)
@@ -48,6 +48,8 @@
 //    creating only one AliVertex instance in the main programme and using the
 //    AliVertex::Reset, AliVertex::AddTrack and parameter setting memberfunctions.
 //
+// See also the documentation provided for the memberfunction SetOwner(). 
+//
 // Coding example to make 3 vertices v1, v2 and v3.
 // ------------------------------------------------
 // v1 contains the tracks 1,2,3 and 4
@@ -225,6 +227,37 @@ AliVertex::~AliVertex()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliVertex::SetOwner(Bool_t own)
+{
+// Set ownership of all added objects. 
+// The default parameter is own=kTRUE.
+//
+// Invokation of this memberfunction also sets all the copy modes
+// (e.g. TrackCopy & co.) according to the value of own.
+//
+// This function (with own=kTRUE) is particularly useful when reading data
+// from a tree/file, since Reset() will then actually remove all the
+// added objects from memory irrespective of the copy mode settings
+// during the tree/file creation process. In this way it provides a nice way
+// of preventing possible memory leaks in the reading/analysis process.
+//
+// In addition this memberfunction can also be used as a shortcut to set all
+// copy modes in one go during a tree/file creation process.
+// However, in this case the user has to take care to only set/change the
+// ownership (and copy mode) for empty objects (e.g. newly created objects
+// or after invokation of the Reset() memberfunction) otherwise it will
+// very likely result in inconsistent destructor behaviour.
+
+ Int_t mode=1;
+ if (!own) mode=0;
+ if (fVertices) fVertices->SetOwner(own);
+ fVertexCopy=mode;
+ if (fJets) fJets->SetOwner(own);
+ fJetCopy=mode;
+
+ AliJet::SetOwner(own);
+}
+///////////////////////////////////////////////////////////////////////////
 AliVertex::AliVertex(AliVertex& v)
 {
 // Copy constructor
index f780604d88235d251ff3840d255028268136735b..48b2351f02e3f50ad4c5e36a2a4a3a9deaeb589e 100644 (file)
@@ -21,6 +21,7 @@ class AliVertex : public AliJet,public AliPosition
   AliVertex();                            // Default constructor
   AliVertex(Int_t n);                     // Create a vertex to hold initially n tracks
   ~AliVertex();                           // Default destructor
+  virtual void SetOwner(Bool_t own=kTRUE);// Set ownership of all added objects
   AliVertex(AliVertex& v);                // Copy constructor
   void Reset();                           // Reset all values and stored vertex and jet lists
   void ResetVertices();                   // Reset stored vertex list
@@ -64,6 +65,6 @@ class AliVertex : public AliJet,public AliPosition
  private:
   void Dump(AliVertex* v,Int_t n,TString f); // Recursively print all sec. vertices
  
- ClassDef(AliVertex,2) // Creation and investigation of an AliVertex.
+ ClassDef(AliVertex,3) // Creation and investigation of an AliVertex.
 };
 #endif
index c2ba15a754faf1bafb4d5651367594d23361d2f9..4698ac4cc13fd669d1bd626bd10d273b972ca1c8 100644 (file)
                 Missing comment lines added in SetName() and GetName() of AliCalorimeter and AliSignal.
 19-mar-2002 NvE AliVertex::Draw() introduced to enable 3D event display. 
 25-apr-2002 NvE Projectile and target specifications introduced in AliEvent.
+26-apr-2002 NvE AddVetoSignal(AliSignal) introduced in AliCalorimeter and AliCalcluster
+                to provide more flexibility and allow automatic calculation of
+                hit association confidence level based on position uncertainties.
+29-apr-2002 NvE Memberfunction GetNvalues() and copy constructor introduced in AliSignal.
+25-jun-2002 NvE Memberfunction SetOwner() introduced in AliJet, AliVertex and AliEvent to allow
+                to set ownership of "added objects" in the case of reading data from a file.
+                In this way possible memory leaks can always be prevented.
+                Also automatic extrapolation and confidence level calculation of associated
+                veto hits introduced in AliCalorimeter and AliCalcluster.