08-dec-2003 NvE AliTrack derived from TNamed to enhance labeling flexibility and also specific
Clone memberfunction introduced to enable storage of derived objects in AliJet & co.
Also specific Clone memberfunctions introduced for AliJet, AliVertex and AliEvent and
for the already existing specific Clone memberfunctions the default argument was set
to the empty string "".
15-dec-2003 NvE Datamembers fNdec and fNsig removed from AliTrack since these data are now retrieved
directly from the corresponding arrays.
Support for hypothesis probability introduced in AliTrack and old mass hypothesis
machinery extended to provide now full track hypotheses.
18-dec-2003 NvE Support for object references from the various signal slots introduced in AliSignal.
Since this is mainly intended for "backward references" to AliTrack objects,
the AliTrack class has been slightly updated for this to provide pointer consistency
in case the corresponding AliTrack object is deleted.
AliAttribObj(AliAttrib& a); // Constructor
virtual ~AliAttribObj(); // Destructor
AliAttribObj(AliAttribObj& a); // Copy constructor
- virtual TObject* Clone(char* name); // Make a deep copy and provide its pointer
+ virtual TObject* Clone(char* name=""); // Make a deep copy and provide its pointer
ClassDef(AliAttribObj,2) // Generic handling of detector signal (calibration) attributes.
};
virtual ~AliCalmodule(); // Default destructor
AliCalmodule(AliCalmodule& m); // Copy constructor
AliCalmodule(Int_t row,Int_t col,Double_t sig); // Create a module and initialise data
- virtual TObject* Clone(char* name); // Make a deep copy and provide its pointer
+ virtual TObject* Clone(char* name=""); // Make a deep copy and provide its pointer
virtual void SetSignal(Double_t sig,Int_t j=1); // Set or change data for certain module
virtual void AddSignal(Double_t sig,Int_t j=1); // Add signal to a certain module
void SetRow(Int_t i); // Set the row number of the module
AliCalorimeter(Int_t nrow,Int_t ncol); // Create a calorimeter matrix
virtual ~AliCalorimeter(); // Destructor
AliCalorimeter(AliCalorimeter& c); // Copy constructor
- virtual TObject* Clone(char* name); // Make a deep copy and provide pointer of the copy
+ virtual TObject* Clone(char* name=""); // Make a deep copy and provide pointer of the copy
Int_t GetNrows(); // Return number of rows of the matrix
Int_t GetNcolumns(); // Return number of columns of the matrix
void SetSignal(Int_t row,Int_t col,Float_t s); // Set signal for a certain module
* provided "as is" without express or implied warranty. *
**************************************************************************/
-// $Id: AliCollider.cxx,v 1.6 2003/08/29 09:05:11 nick Exp $
+// $Id: AliCollider.cxx,v 1.7 2003/10/26 14:53:44 nick Exp $
///////////////////////////////////////////////////////////////////////////
// Class AliCollider
//
//
//--- Author: Nick van Eijndhoven 22-nov-2002 Utrecht University
-//- Modified: NvE $Date: 2003/08/29 09:05:11 $ Utrecht University
+//- Modified: NvE $Date: 2003/10/26 14:53:44 $ Utrecht University
///////////////////////////////////////////////////////////////////////////
#include "AliCollider.h"
}
}
///////////////////////////////////////////////////////////////////////////
+void AliCollider::SetStable(Int_t id,Int_t mode)
+{
+// Declare whether a particle must be regarded as stable or not.
+// The parameter "id" indicates the Pythia KF particle code, which
+// basically is the PDG particle identifier code.
+// The parameter "mode" indicates the action to be taken.
+//
+// mode = 0 : Particle will be able to decay
+// 1 : Particle will be regarded as stable.
+//
+// In case the user does NOT explicitly invoke this function, the standard
+// Pythia settings for the decay tables are used.
+//
+// When this function is invoked without the "mode" argument, then the
+// default of mode=1 will be used for the specified particle.
+//
+// Notes :
+// -------
+// 1) This function should be invoked after the initialisation call
+// to AliCollider::Init.
+// 2) Due to the internals of Pythia, there is no need to specify particles
+// and their corresponding anti-particles separately as (un)stable.
+// Once a particle has been declared (un)stable, the corresponding
+// anti-particle will be treated in the same way.
+
+ if (mode==0 || mode==1)
+ {
+ Int_t kc=Pycomp(id);
+ Int_t decay=1-mode;
+ if (kc>0)
+ {
+ SetMDCY(kc,1,decay);
+ }
+ else
+ {
+ cout << " *AliCollider::SetStable* Unknown particle code. id = " << id << endl;
+ }
+ }
+ else
+ {
+ cout << " *AliCollider::SetStable* Invalid parameter. mode = " << mode << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-// $Id: AliCollider.h,v 1.4 2003/08/29 09:05:11 nick Exp $
+// $Id: AliCollider.h,v 1.5 2003/10/26 14:53:44 nick Exp $
#include "TPythia6.h"
#include "TString.h"
Int_t GetPrintFreq(); // Provide the print frequency
void Init(char* frame,char* beam,char* target,Float_t win); // Standard Pythia initialisation
void Init(char* frame,Int_t zp,Int_t ap,Int_t zt,Int_t at,Float_t win); // Nucl-Nucl initialisation
+ void SetStable(Int_t id,Int_t mode=1); // Declare a certain particle as stable or not
void MakeEvent(Int_t npt=0,Int_t mlist=-1,Int_t medit=1);// Generate a single event with npt participant nucleons
void EndRun(); // Properly close all buffers and output file
AliEvent* GetEvent(); // Provide pointer to the generated event structure
void GetFractions(Float_t zp,Float_t ap,Float_t zt,Float_t at); // Determine various N-N collision fractions
- ClassDef(AliCollider,4) // Pythia based universal physics event generator
+ ClassDef(AliCollider,5) // Pythia based universal physics event generator
};
#endif
* provided "as is" without express or implied warranty. *
**************************************************************************/
-// $Id: AliEvent.cxx,v 1.15 2003/11/21 14:20:10 nick Exp $
+// $Id: AliEvent.cxx,v 1.16 2003/12/03 14:30:26 nick Exp $
///////////////////////////////////////////////////////////////////////////
// Class AliEvent
// 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: 2003/11/21 14:20:10 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2003/12/03 14:30:26 $ UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////
#include "AliEvent.h"
}
}
///////////////////////////////////////////////////////////////////////////
+TObject* AliEvent::Clone(char* name)
+{
+// 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
+// correct type depending on the object type, a feature which may be very useful
+// for containers when adding objects in case the container owns the objects.
+// This feature allows to store either AliEvent objects or objects derived from
+// AliEvent via some generic AddEvent memberfunction, provided these derived
+// classes also have a proper Clone memberfunction.
+
+ AliEvent* evt=new AliEvent(*this);
+ if (name)
+ {
+ if (strlen(name)) evt->SetName(name);
+ }
+ return evt;
+}
+///////////////////////////////////////////////////////////////////////////
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-// $Id: AliEvent.h,v 1.11 2003/10/26 14:53:44 nick Exp $
+// $Id: AliEvent.h,v 1.12 2003/11/21 14:20:10 nick Exp $
#include <math.h>
AliEvent(Int_t n); // Create an event to hold initially n tracks
virtual ~AliEvent(); // Default destructor
AliEvent(AliEvent& evt); // Copy constructor
+ virtual TObject* Clone(char* name=""); // Make a deep copy and provide its pointer
virtual void SetOwner(Bool_t own=kTRUE);// Set ownership of all added objects
void SetDayTime(TTimeStamp& stamp); // Set the date and time stamp exactly as specified (1 ns accuracy)
void SetDayTime(TDatime& stamp); // Set date and time stamp interpreted as local time (1 s accuracy)
TObjArray* fDevices; // Array to hold the pointers to the various devices
Int_t fDevCopy; // Flag to denote creation of private copies of the devices
- ClassDef(AliEvent,10) // Creation and investigation of an Alice physics event.
+ ClassDef(AliEvent,11) // Creation and investigation of an Alice physics event.
};
#endif
Init();
Reset();
SetNtinit();
- SetName("Unspecified");
- SetTitle("Unspecified");
}
///////////////////////////////////////////////////////////////////////////
void AliJet::Init()
cout << endl;
SetNtinit();
}
- SetName("Unspecified");
- SetTitle("Unspecified");
}
///////////////////////////////////////////////////////////////////////////
AliJet::~AliJet()
AliTrack* tx=j.GetTrack(i);
if (fTrackCopy)
{
- fTracks->Add(new AliTrack(*tx));
+ fTracks->Add(tx->Clone());
}
else
{
// space will be extended to hold an additional amount of tracks as
// was initially reserved.
// See SetTrackCopy() to tailor the functionality of the stored structures.
+//
+// Note :
+// In case a private copy is made, this is performed via the Clone() memberfunction.
+// All AliTrack and derived classes have the default TObject::Clone() memberfunction.
+// However, derived classes generally contain an internal data structure which may
+// include pointers to other objects. Therefore it is recommended to provide
+// for all derived classes a specific copy constructor and override the default Clone()
+// memberfunction using this copy constructor.
+// An example for this may be seen from AliTrack.
+
AddTrack(t,1);
}
///////////////////////////////////////////////////////////////////////////
// of the TrackCopy flag.
// This allows a proper treatment of automatically generated connecting
// tracks between vertices.
+//
+// Note :
+// In case a private copy is made, this is performed via the Clone() memberfunction.
+
if (!fTracks)
{
fTracks=new TObjArray(fNtmax);
fNtrk++;
if (fTrackCopy && copy)
{
- fTracks->Add(new AliTrack(t));
+ fTracks->Add(t.Clone());
}
else
{
void AliJet::Data(TString f)
{
// Provide jet information within the coordinate frame f
- cout << " *AliJet::Data* Name : " << GetName() << " Title : " << GetTitle() << endl;
+ const char* name=GetName();
+ const char* title=GetTitle();
+
+ cout << " *AliJet::Data*";
+ if (strlen(name)) cout << " Name : " << GetName();
+ if (strlen(title)) cout << " Title : " << GetTitle();
+ cout << endl;
cout << " Id : " << fUserId << " Invmass : " << GetInvmass() << " Charge : " << fQ
<< " Momentum : " << GetMomentum() << " Ntracks : " << fNtrk << endl;
return fUserId;
}
///////////////////////////////////////////////////////////////////////////
+TObject* AliJet::Clone(char* name)
+{
+// 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
+// correct type depending on the object type, a feature which may be very useful
+// for containers when adding objects in case the container owns the objects.
+// This feature allows e.g. AliVertex to store either AliJet objects or
+// objects derived from AliJet via the AddJet memberfunction, provided
+// these derived classes also have a proper Clone memberfunction.
+
+ AliJet* jet=new AliJet(*this);
+ if (name)
+ {
+ if (strlen(name)) jet->SetName(name);
+ }
+ return jet;
+}
+///////////////////////////////////////////////////////////////////////////
AliJet(Int_t n); // Create a Jet to hold initially n Tracks
virtual ~AliJet(); // Default destructor
AliJet(AliJet& j); // Copy constructor
+ virtual TObject* Clone(char* name=""); // Make a deep copy and provide its pointer
virtual void SetOwner(Bool_t own=kTRUE); // Set ownership of all added objects
virtual void Reset(); // Reset all values
void AddTrack(AliTrack& t); // Add a track to the jet
Int_t fTrackCopy; // Flag to denote creation of private copies in fTracks
Int_t fUserId; // The user defined identifier
- ClassDef(AliJet,6) // Creation and investigation of a jet of particle tracks.
+ ClassDef(AliJet,7) // Creation and investigation of a jet of particle tracks.
};
#endif
///////////////////////////////////////////////////////////////////////////
#include "AliSignal.h"
+#include "AliTrack.h"
#include "Riostream.h"
ClassImp(AliSignal) // Class implementation to enable ROOT I/O
fSignals=0;
fDsignals=0;
fWaveforms=0;
- SetName("Unspecified");
- SetTitle("Unspecified");
+ fLinks=0;
}
///////////////////////////////////////////////////////////////////////////
AliSignal::~AliSignal()
delete fWaveforms;
fWaveforms=0;
}
+ if (fLinks)
+ {
+ delete fLinks;
+ fLinks=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
AliSignal::AliSignal(AliSignal& s) : TNamed(s),AliPosition(s),AliAttrib(s)
fSignals=0;
fDsignals=0;
fWaveforms=0;
+ fLinks=0;
Int_t n=s.GetNvalues();
Double_t val;
TH1F* hist=s.GetWaveform(k);
if (hist) SetWaveform(hist,k);
}
+
+ n=s.GetNlinks();
+ for (Int_t il=1; il<=n; il++)
+ {
+ TObject* obj=s.GetLink(il);
+ if (obj) SetLink(obj,il);
+ }
}
///////////////////////////////////////////////////////////////////////////
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 cleared
+// and the container itself will be deleted to recover the memory.
+//
// 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)
// in case the various signals always contain the same number of values
DeleteSignals();
DeleteCalibrations();
}
+
+ if (fLinks)
+ {
+ delete fLinks;
+ fLinks=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::ResetSignals(Int_t mode)
{
// Provide all signal information within the coordinate frame f.
- cout << " *" << ClassName() << "::Data* Name : " << GetName()
- << " Title : " << GetTitle() << endl;
+ const char* name=GetName();
+ const char* title=GetTitle();
+
+ cout << " *" << ClassName() << "::Data*";
+ if (strlen(name)) cout << " Name : " << name;
+ if (strlen(title)) cout << " Title : " << title;
+ cout << endl;
cout << " Position";
Ali3Vector::Data(f);
return;
}
- if (j != -1) cout << " *" << ClassName() << "::List* Name : " << GetName()
- << " Title : " << GetTitle() << endl;
+ if (j != -1)
+ {
+ const char* name=GetName();
+ const char* title=GetTitle();
+
+ cout << " *" << ClassName() << "::Data*";
+ if (strlen(name)) cout << " Name : " << name;
+ if (strlen(title)) cout << " Title : " << title;
+ cout << endl;
+ }
Int_t nvalues=GetNvalues();
Int_t nerrors=GetNerrors();
Int_t nwforms=GetNwaveforms();
+ Int_t nlinks=GetNlinks();
Int_t n=nvalues;
if (nerrors>n) n=nerrors;
if (nwforms>n) n=nwforms;
+ if (nlinks>n) n=nlinks;
+
+ TObject* obj=0;
if (j<=0)
{
if (i<=nerrors) cout << " error : " << GetSignalError(i);
AliAttrib::List(i);
cout << endl;
- if (GetWaveform(i)) cout << " Waveform : " << GetWaveform(i)->ClassName()
- << " " << GetWaveform(i)->GetTitle() << 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=GetLink(i);
+ if (obj)
+ {
+ const char* lname=obj->GetName();
+ const char* ltitle=obj->GetTitle();
+ cout << " Link to : " << obj->ClassName();
+ if (strlen(lname)) cout << " Name : " << lname;
+ if (strlen(ltitle)) cout << " Title : " << ltitle;
+ cout << endl;
+ }
}
}
else
if (j<=nerrors) cout << " error : " << GetSignalError(j);
AliAttrib::List(j);
cout << endl;
- if (GetWaveform(j)) cout << " Waveform : " << GetWaveform(j)->ClassName()
- << " " << GetWaveform(j)->GetTitle() << 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=GetLink(j);
+ if (obj)
+ {
+ const char* lnamej=obj->GetName();
+ const char* ltitlej=obj->GetTitle();
+ cout << " Link to : " << obj->ClassName();
+ if (strlen(lnamej)) cout << " Name : " << lnamej;
+ if (strlen(ltitlej)) cout << " Title : " << ltitlej;
+ cout << endl;
+ }
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////
+Int_t AliSignal::GetNlinks()
+{
+// Provide the highest slot number with a specified link for this signal.
+ Int_t n=0;
+ if (fLinks) n=fLinks->GetSize();
+ return n;
+}
+///////////////////////////////////////////////////////////////////////////
+TObject* AliSignal::GetLink(Int_t j)
+{
+// Provide pointer of the object linked to the j-th slot.
+ TObject* obj=0;
+ if (j <= GetNlinks()) obj=fLinks->At(j-1);
+ return obj;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::SetLink(TObject* obj,Int_t j)
+{
+// Introduce a link (=pointer) to an object for the j-th slot.
+// 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.
+//
+// Notes :
+// The link of the first slot is 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 links, the number of reserved slots for the links
+// is increased automatically (unless the pointer argument is zero).
+//
+// In case the pointer argument is zero, indeed a value of zero will be
+// stored for the specified slot (unless j exceeds the current maximum).
+//
+// In principle any object derived from TObject can be referred to by this
+// mechanism.
+// However, this "linking back" facility was introduced to enable AliSignal slots
+// to refer directly to the various AliTracks to which the AliSignal object itself
+// is related (see AliTrack::AddSignal).
+// Therefore, in case the input argument "obj" points to an AliTrack (or derived)
+// object, the current signal is automatically related to this AliTrack
+// (or derived) object.
+//
+// Please also have a look at the docs of the memberfunction ResetLink()
+// to prevent the situation of stored pointers to non-existent object.
+
+ if (!fLinks && obj)
+ {
+ fLinks=new TObjArray(j);
+ }
+
+ if (j>fLinks->GetSize() && obj) fLinks->Expand(j);
+
+ if (j<=fLinks->GetSize())
+ {
+ fLinks->AddAt(obj,j-1);
+ if (obj)
+ {
+ if (obj->InheritsFrom("AliTrack"))
+ {
+ AliTrack* t=(AliTrack*)obj;
+ t->AddSignal(*this);
+ }
+ }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::ResetLink(Int_t j)
+{
+// Reset the link of the j-th (default j=1) slot.
+// Notes : The first link position is at j=1.
+// j=0 ==> All links will be reset and the storage array deleted.
+//
+// In general the user should take care of properly clearing the corresponding
+// pointer here when the referred object is deleted.
+// However, this "linking back" facility was introduced to enable AliSignal slots
+// to refer directly to the various AliTracks to which the AliSignal object itself
+// is related (see AliTrack::AddSignal).
+// As such, the AliTrack destructor already takes care of clearing the corresponding
+// links from the various AliSignal slots for all the AliSignal objects that were
+// related to that AliTrack.
+// So, in case the link introduced via SetLink() is the pointer of an AliTrack object,
+// the user doesn't have to worry about clearing the corresponding AliTrack link from
+// the AliSignal object when the corresponding AliTrack object is deleted.
+
+ if (!fLinks || j<0) return;
+
+ TObject* obj=0;
+
+ if (j)
+ {
+ SetLink(obj,j);
+ }
+ else
+ {
+ delete fLinks;
+ fLinks=0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::ResetLink(TObject* obj)
+{
+// Reset the link of the all the slots referring to the specified object.
+//
+// In general the user should take care of properly clearing the corresponding
+// pointer here when the referred object is deleted.
+// However, this "linking back" facility was introduced to enable AliSignal slots
+// to refer directly to the various AliTracks to which the AliSignal object itself
+// is related (see AliTrack::AddSignal).
+// As such, the AliTrack destructor already takes care of clearing the corresponding
+// links from the various AliSignal slots for all the AliSignal objects that were
+// related to that AliTrack.
+// So, in case the link introduced via SetLink() is the pointer of an AliTrack object,
+// the user doesn't have to worry about clearing the corresponding AliTrack link from
+// the AliSignal object when the corresponding AliTrack object is deleted.
+
+ if (!fLinks || !obj) return;
+
+ Int_t nlinks=GetNlinks();
+ for (Int_t i=1; i<=nlinks; i++)
+ {
+ TObject* obj2=GetLink(i);
+ if (obj2==obj) ResetLink(i);
+ }
+}
+///////////////////////////////////////////////////////////////////////////
TObject* AliSignal::Clone(char* name)
{
// Make a deep copy of the current object and provide the pointer to the copy.
AliSignal(); // Default constructor
virtual ~AliSignal(); // Destructor
AliSignal(AliSignal& s); // Copy constructor
- virtual TObject* Clone(char* name); // Make a deep copy and provide its pointer
+ virtual TObject* Clone(char* name=""); // Make a deep copy and provide its pointer
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,Int_t mode=0); // Provide j-th (corrected) signal value
TH1F* GetWaveform(Int_t j=1); // Provide pointer of the j-th waveform histogram
void ResetWaveform(Int_t j=1); // Reset the j-th waveform histogram
void DeleteWaveform(Int_t j=1); // Delete the j-th waveform histogram
+ Int_t GetNlinks(); // Provide the number of specified linked objects
+ void SetLink(TObject* obj,Int_t j=1); // Link object to the j-th slot
+ TObject* GetLink(Int_t j=1); // Provide pointer of the object linked to the j-th slot
+ void ResetLink(Int_t j=1); // Reset the link of the j-th slot
+ void ResetLink(TObject* obj); // Reset the link to the specified object in all slots
protected:
TArrayF* fSignals; // Signal values
TArrayF* fDsignals; // Errors on signal values
TObjArray* fWaveforms; // The 1D histograms containing the signal waveforms
+ TObjArray* fLinks; // Pointers of objects related to the various slots
ClassDef(AliSignal,9) // Generic handling of (extrapolated) detector signals.
};
ClassImp(AliTrack) // Class implementation to enable ROOT I/O
-AliTrack::AliTrack() : TObject(),Ali4Vector()
+AliTrack::AliTrack() : TNamed(),Ali4Vector()
{
// Default constructor
// All variables initialised to 0
// Initialisation of pointers etc...
fDecays=0;
fSignals=0;
- fMasses=0;
- fDmasses=0;
- fPmasses=0;
+ fHypotheses=0;
fBegin=0;
fEnd=0;
fImpactXY=0;
///////////////////////////////////////////////////////////////////////////
AliTrack::~AliTrack()
{
-// Destructor to delete memory allocated for decay tracks array
+// Destructor to delete memory allocated for decay tracks array.
+// This destructor automatically cleares the pointer of this AliTrack
+// from all the link slots of the related AliSignal objects.
+
+ Int_t nsig=GetNsignals();
+ for (Int_t i=1; i<=nsig; i++)
+ {
+ AliSignal* s=GetSignal(i);
+ if (s) s->ResetLink(this);
+ }
+
if (fDecays)
{
delete fDecays;
delete fSignals;
fSignals=0;
}
- if (fMasses)
- {
- delete fMasses;
- fMasses=0;
- }
- if (fDmasses)
+ if (fHypotheses)
{
- delete fDmasses;
- fDmasses=0;
- }
- if (fPmasses)
- {
- delete fPmasses;
- fPmasses=0;
+ delete fHypotheses;
+ fHypotheses=0;
}
if (fBegin)
{
}
}
///////////////////////////////////////////////////////////////////////////
-AliTrack::AliTrack(AliTrack& t) : TObject(t),Ali4Vector(t)
+AliTrack::AliTrack(AliTrack& t) : TNamed(t),Ali4Vector(t)
{
// Copy constructor
Init();
fQ=t.fQ;
- fNdec=t.fNdec;
- fNsig=t.fNsig;
- fNmasses=t.fNmasses;
- if (fNmasses)
- {
- fMasses=new TArrayD(*(t.fMasses));
- fDmasses=new TArrayD(*(t.fDmasses));
- fPmasses=new TArrayD(*(t.fPmasses));
- }
+ fProb=t.fProb;
if (t.fBegin) fBegin=new AliPositionObj(*(t.fBegin));
if (t.fEnd) fEnd=new AliPositionObj(*(t.fEnd));
if (t.fImpactXY) fImpactXY=new AliPositionObj(*(t.fImpactXY));
fCode=t.fCode;
fParent=t.fParent;
- if (fNdec)
+ Int_t ndec=t.GetNdecay();
+ if (ndec)
{
- fDecays=new TObjArray(fNdec);
+ fDecays=new TObjArray(ndec);
fDecays->SetOwner();
- for (Int_t it=1; it<=fNdec; it++)
+ for (Int_t it=1; it<=ndec; it++)
{
AliTrack* tx=t.GetDecayTrack(it);
fDecays->Add(new AliTrack(*tx));
}
}
- if (fNsig)
+ Int_t nsig=t.GetNsignals();
+ if (nsig)
{
- fSignals=new TObjArray(fNsig);
- for (Int_t is=1; is<=fNsig; is++)
+ fSignals=new TObjArray(nsig);
+ for (Int_t is=1; is<=nsig; is++)
{
AliSignal* sx=t.GetSignal(is);
fSignals->Add(sx);
}
}
+
+ Int_t nhyp=t.GetNhypotheses();
+ if (nhyp)
+ {
+ fHypotheses=new TObjArray(nhyp);
+ fHypotheses->SetOwner();
+ for (Int_t ih=1; ih<=nhyp; ih++)
+ {
+ AliTrack* tx=t.GetTrackHypothesis(ih);
+ fHypotheses->Add(new AliTrack(*tx));
+ }
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::Reset()
fNdf=0;
fUserId=0;
fCode=0;
- fNdec=0;
- fNsig=0;
- fNmasses=0;
+ fProb=0;
Double_t a[4]={0,0,0,0};
SetVector(a,"sph");
fParent=0;
delete fSignals;
fSignals=0;
}
- if (fMasses)
- {
- delete fMasses;
- fMasses=0;
- }
- if (fDmasses)
- {
- delete fDmasses;
- fDmasses=0;
- }
- if (fPmasses)
+ if (fHypotheses)
{
- delete fPmasses;
- fPmasses=0;
+ delete fHypotheses;
+ fHypotheses=0;
}
if (fBegin)
{
// Provide track information within the coordinate frame f
Double_t m=GetMass();
Double_t dm=GetResultError();
- cout << " *AliTrack::Data* Id : " << fUserId << " Code : " << fCode
- << " Mass : " << m << " error : " << dm << " Charge : " << fQ
- << " Momentum : " << GetMomentum() << " Nmass hyp. : " << fNmasses
- << " Ntracks : " << fNdec << " Nsignals : " << fNsig << endl;
- for (Int_t i=0; i<fNmasses; i++)
- {
- cout << " Mass hypothesis " << (i+1) << " Mass : " << fMasses->At(i)
- << " error : " << fDmasses->At(i) << " prob. : " << fPmasses->At(i)
- << endl;
- }
+ const char* name=GetName();
+ const char* title=GetTitle();
+
+ cout << " *" << ClassName() << "::Data*";
+ if (strlen(name)) cout << " Name : " << GetName();
+ if (strlen(title)) cout << " Title : " << GetTitle();
+ cout << endl;
+ cout << " Id : " << fUserId << " Code : " << fCode
+ << " m : " << m << " dm : " << dm << " Charge : " << fQ
+ << " p : " << GetMomentum() << endl;
+ cout << " Nhypotheses : " << GetNhypotheses() << " Ndecay-tracks : " << GetNdecay()
+ << " Nsignals : " << GetNsignals() << endl;
Ali4Vector::Data(f);
}
///////////////////////////////////////////////////////////////////////////
// Decay products of this track
AliTrack* td;
- for (Int_t id=1; id<=fNdec; id++)
+ for (Int_t id=1; id<=GetNdecay(); id++)
{
td=GetDecayTrack(id);
if (td)
}
else
{
- cout << " *AliTrack::List* Error : No decay track present." << endl;
+ cout << " *AliTrack::List* Error : Empty decay track slot." << endl;
}
}
}
Data(f); // Information of the current track
if (fBegin) { cout << " Begin-point :"; fBegin->Data(f); }
if (fEnd) { cout << " End-point :"; fEnd->Data(f); }
- for (Int_t is=1; is<=GetNsignals(); is++)
+
+ Int_t nhyp=GetNhypotheses();
+ if (nhyp)
+ {
+ cout << " List of the " << nhyp << " track hypotheses : " << endl;
+ for (Int_t ih=1; ih<=nhyp; ih++)
+ {
+ AliTrack* tx=GetTrackHypothesis(ih);
+ if (tx) tx->Data(f);
+ }
+ }
+
+ Int_t nsig=GetNsignals();
+ if (nsig)
{
- ((AliSignal*)GetSignal(is))->Data(f);
+ cout << " List of the " << nsig << " related signals : " << endl;
+ for (Int_t is=1; is<=nsig; is++)
+ {
+ AliSignal* sx=GetSignal(is);
+ if (sx) sx->Data(f);
+ }
}
AliTrack* t=this;
{
cout << " ---Level " << n << " sec. track no. " << id << endl;
td->Data(f);
- for (Int_t is=1; is<=td->GetNsignals(); is++)
+
+ Int_t nhyp=td->GetNhypotheses();
+ if (nhyp)
+ {
+ cout << " List of the " << nhyp << " track hypotheses : " << endl;
+ for (Int_t ih=1; ih<=nhyp; ih++)
+ {
+ AliTrack* tx=td->GetTrackHypothesis(ih);
+ if (tx) tx->Data(f);
+ }
+ }
+
+ Int_t nsig=td->GetNsignals();
+ if (nsig)
{
- ((AliSignal*)td->GetSignal(is))->Data(f);
+ cout << " List of the " << nsig << " related signals : " << endl;
+ for (Int_t is=1; is<=nsig; is++)
+ {
+ AliSignal* sx=td->GetSignal(is);
+ if (sx) sx->Data(f);
+ }
}
// Go for next decay level of this decay track recursively
}
else
{
- cout << " *AliTrack::Dumps* Error : No decay track present." << endl;
+ cout << " *AliTrack::Dumps* Error : Empty decay track slot." << endl;
}
}
}
// thcms : cms theta decay angle (in rad.) of m1
// phicms : cms phi decay angle (in rad.) of m1
- fNdec=2; // it's a 2-body decay
-
Double_t M=GetMass();
// Compute the 4-momenta of the decay products in the cms
delete fDecays;
fDecays=0;
}
- fDecays=new TObjArray();
+ fDecays=new TObjArray(2);
fDecays->SetOwner();
fDecays->Add(new AliTrack);
Int_t AliTrack::GetNdecay()
{
// Provide the number of decay produced tracks
- return fNdec;
+ Int_t ndec=0;
+ if (fDecays) ndec=fDecays->GetEntries();
+ return ndec;
}
///////////////////////////////////////////////////////////////////////////
AliTrack* AliTrack::GetDecayTrack(Int_t j)
}
else
{
- if ((j >= 1) && (j <= fNdec))
+ if ((j >= 1) && (j <= GetNdecay()))
{
return (AliTrack*)fDecays->At(j-1);
}
else
{
cout << " *AliTrack* decay track number : " << j << " out of range."
- << " Ndec = " << fNdec << endl;
+ << " Ndec = " << GetNdecay() << endl;
return 0;
}
}
}
///////////////////////////////////////////////////////////////////////////
+void AliTrack::RemoveDecays()
+{
+// Remove all decay tracks from this track.
+ if (fDecays)
+ {
+ delete fDecays;
+ fDecays=0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
void AliTrack::AddSignal(AliSignal& s)
{
// Relate an AliSignal object to this track.
- if (!fSignals) fSignals=new TObjArray();
- fNsig++;
+ if (!fSignals) fSignals=new TObjArray(1);
+
+ // Check if this signal is already stored for this track
+ Int_t nsig=GetNsignals();
+ for (Int_t i=0; i<nsig; i++)
+ {
+ if (&s==fSignals->At(i)) return;
+ }
+
fSignals->Add(&s);
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::RemoveSignal(AliSignal& s)
{
-// Remove related AliSignal object to this track.
+// Remove related AliSignal object from this track.
if (fSignals)
{
AliSignal* test=(AliSignal*)fSignals->Remove(&s);
- if (test)
- {
- fNsig--;
- fSignals->Compress();
- }
+ if (test) fSignals->Compress();
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliTrack::RemoveSignals()
+{
+// Remove all related AliSignal objects from this track.
+ if (fSignals)
+ {
+ fSignals->Clear();
+ delete fSignals;
+ fSignals=0;
}
}
///////////////////////////////////////////////////////////////////////////
Int_t AliTrack::GetNsignals()
{
// Provide the number of related AliSignals.
- return fNsig;
+ Int_t nsig=0;
+ if (fSignals) nsig=fSignals->GetEntries();
+ return nsig;
}
///////////////////////////////////////////////////////////////////////////
AliSignal* AliTrack::GetSignal(Int_t j)
}
else
{
- if ((j >= 1) && (j <= fNsig))
+ if ((j >= 1) && (j <= GetNsignals()))
{
return (AliSignal*)fSignals->At(j-1);
}
else
{
cout << " *AliTrack* signal number : " << j << " out of range."
- << " Nsig = " << fNsig << endl;
+ << " Nsig = " << GetNsignals() << endl;
return 0;
}
}
}
///////////////////////////////////////////////////////////////////////////
-void AliTrack::SetBeginPoint(AliPosition& p)
+void AliTrack::AddTrackHypothesis(AliTrack& t)
{
-// Store the position of the track begin-point.
- if (!fBegin)
- {
- fBegin=new AliPositionObj(p);
- }
- else
+// Relate a track hypothesis to this track.
+// Note : a private copy of the input track will be made via the Clone()
+// facility.
+ if (!fHypotheses)
{
- fBegin->Load(p);
+ fHypotheses=new TObjArray(1);
+ fHypotheses->SetOwner();
}
+ fHypotheses->Add(t.Clone());
}
///////////////////////////////////////////////////////////////////////////
-AliPosition* AliTrack::GetBeginPoint()
+void AliTrack::AddTrackHypothesis(Double_t prob,Double_t m,Double_t dm)
{
-// Provide the position of the track begin-point.
- return fBegin;
+// Add a track hypothesis by explicitly setting the mass and probability.
+// This will affect e.g. the hypothesis track's energy, since the momentum
+// and all other attributes will be copied from the current track.
+//
+// Input arguments :
+// -----------------
+// prob=probalility m=mass value dm=error on the mass value.
+// The default value for the mass error dm is 0.
+
+ AliTrack t(*this);
+ t.RemoveDecays();
+ t.RemoveTrackHypotheses();
+ t.RemoveSignals();
+ t.SetTitle("Mass hypothesis");
+ t.SetMass(m,dm);
+ t.SetProb(prob);
+ AddTrackHypothesis(t);
}
///////////////////////////////////////////////////////////////////////////
-void AliTrack::SetEndPoint(AliPosition& p)
+void AliTrack::RemoveTrackHypothesis(AliTrack& t)
{
-// Store the position of the track end-point.
- if (!fEnd)
+// Remove the specified track hypothesis from this track.
+ if (fHypotheses)
{
- fEnd=new AliPositionObj(p);
- }
- else
- {
- fEnd->Load(p);
+ AliTrack* test=(AliTrack*)fHypotheses->Remove(&t);
+ if (test) fHypotheses->Compress();
}
}
///////////////////////////////////////////////////////////////////////////
-AliPosition* AliTrack::GetEndPoint()
+void AliTrack::RemoveTrackHypotheses()
{
-// Provide the position of the track end-point.
- return fEnd;
-}
-///////////////////////////////////////////////////////////////////////////
-void AliTrack::AddMassHypothesis(Double_t prob,Double_t m,Double_t dm)
-{
-// Add a mass hypothesis for this current track.
-// prob=probalility m=mass value dm=error on the mass value.
-// The default value for the mass error dm is 0.
- if (!fMasses) fMasses=new TArrayD();
- if (!fDmasses) fDmasses=new TArrayD();
- if (!fPmasses) fPmasses=new TArrayD();
-
- fNmasses++;
- fMasses->Set(fNmasses);
- fDmasses->Set(fNmasses);
- fPmasses->Set(fNmasses);
-
- fMasses->AddAt(m,fNmasses-1);
- fDmasses->AddAt(dm,fNmasses-1);
- fPmasses->AddAt(prob,fNmasses-1);
+// Remove all track hypotheses from this track.
+ if (fHypotheses)
+ {
+ delete fHypotheses;
+ fHypotheses=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
-Int_t AliTrack::GetNMassHypotheses()
+Int_t AliTrack::GetNhypotheses()
{
-// Provide the number of mass hypotheses for this track.
- return fNmasses;
+// Provide the number of track hypotheses.
+ Int_t nhyp=0;
+ if (fHypotheses) nhyp=fHypotheses->GetEntries();
+ return nhyp;
}
///////////////////////////////////////////////////////////////////////////
-Double_t AliTrack::GetMassHypothesis(Int_t j)
+AliTrack* AliTrack::GetTrackHypothesis(Int_t j)
{
-// Provide the mass of the jth hypothesis for this track.
-// Note : the first hypothesis is indicated by j=1.
+// Provide the j-th track hypothesis.
+// Note : j=1 denotes the first hypothesis.
// Default : j=0 ==> Hypothesis with highest probability.
-// The error on the mass can be obtained by invoking GetResultError()
-// after invokation of GetMassHypothesis(j).
- Double_t m=0,dm=0,prob=0;
+ if (!fHypotheses) return 0;
+
+ Int_t nhyp=GetNhypotheses();
// Check validity of index j
- if (j<0 || j>fNmasses)
+ if (j<0 || j>nhyp)
{
- cout << " *AliTrack::GetMassHypothesis* Invalid index j : " << j
- << " Number of mass hypotheses : " << fNmasses << endl;
- fDresult=0;
- return 0;
- }
+ cout << " *AliTrack* hypothesis number : " << j << " out of range."
+ << " Nhyp = " << nhyp << endl;
+ return 0;
+ }
- // Select mass hypothesis with highest probability
- if (j==0)
+ AliTrack* t=0;
+
+ if (j==0) // Provide track hypothesis with highest probability
{
- if (fNmasses)
+ Float_t prob=0;
+ t=(AliTrack*)fHypotheses->At(0);
+ if (t) prob=t->GetProb();
+ Float_t probx=0;
+ for (Int_t ih=1; ih<nhyp; ih++)
{
- m=fMasses->At(0);
- dm=fDmasses->At(0);
- prob=fPmasses->At(0);
- for (Int_t i=1; i<fNmasses; i++)
+ AliTrack* tx=(AliTrack*)fHypotheses->At(ih);
+ if (tx)
{
- if (fPmasses->At(i)>prob)
- {
- m=fMasses->At(i);
- dm=fDmasses->At(i);
- }
+ probx=tx->GetProb();
+ if (probx > prob) t=tx;
}
}
- fDresult=dm;
- return m;
+ return t;
+ }
+ else // Provide requested j-th track hypothesis
+ {
+ return (AliTrack*)fHypotheses->At(j-1);
}
-
- // Provide data of requested mass hypothesis
- m=fMasses->At(j-1);
- fDresult=fDmasses->At(j-1);
- return m;
}
///////////////////////////////////////////////////////////////////////////
-Double_t AliTrack::GetMassHypothesisProb(Int_t j)
+void AliTrack::SetBeginPoint(AliPosition& p)
{
-// Provide the probability of the jth hypothesis for this track.
-// Note : the first hypothesis is indicated by j=1.
-// Default : j=0 ==> Hypothesis with highest probability.
-
- Double_t prob=0;
-
- // Check validity of index j
- if (j<0 || j>fNmasses)
+// Store the position of the track begin-point.
+ if (!fBegin)
{
- cout << " *AliTrack::GetMassHypothesisProb* Invalid index j : " << j
- << " Number of mass hypotheses : " << fNmasses << endl;
- return 0;
+ fBegin=new AliPositionObj(p);
}
-
- // Select mass hypothesis with highest probability
- if (j==0)
+ else
{
- if (fNmasses)
- {
- prob=fPmasses->At(0);
- for (Int_t i=1; i<fNmasses; i++)
- {
- if (fPmasses->At(i)>prob) prob=fPmasses->At(i);
- }
- }
- return prob;
+ fBegin->Load(p);
}
-
- // Provide probability of requested mass hypothesis
- prob=fPmasses->At(j-1);
- return prob;
}
///////////////////////////////////////////////////////////////////////////
-void AliTrack::SetMass()
+AliPosition* AliTrack::GetBeginPoint()
{
-// Set the mass and error to the value of the hypothesis with highest prob.
-
- Double_t m=0,dm=0,prob=0;
-
- // Select mass hypothesis with highest probability
- if (fNmasses)
+// Provide the position of the track begin-point.
+ return fBegin;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliTrack::SetEndPoint(AliPosition& p)
+{
+// Store the position of the track end-point.
+ if (!fEnd)
{
- m=fMasses->At(0);
- dm=fDmasses->At(0);
- prob=fPmasses->At(0);
- for (Int_t i=1; i<fNmasses; i++)
- {
- if (fPmasses->At(i)>prob)
- {
- m=fMasses->At(i);
- dm=fDmasses->At(i);
- }
- }
- SetMass(m,dm);
+ fEnd=new AliPositionObj(p);
}
else
{
- cout << " *AliTrack::SetMass()* No hypothesis present => No action." << endl;
+ fEnd->Load(p);
}
}
///////////////////////////////////////////////////////////////////////////
-void AliTrack::RemoveMassHypothesis(Int_t j)
+AliPosition* AliTrack::GetEndPoint()
+{
+// Provide the position of the track end-point.
+ return fEnd;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliTrack::SetMass()
{
-// Remove the jth mass hypothesis for this track.
-// Note : the first hypothesis is indicated by j=1.
+// Set the mass and error to the value of the hypothesis with highest prob.
- if (j<=0 || j>fNmasses) // Check validity of index j
+ Double_t m=0,dm=0;
+
+ // Select mass hypothesis with highest probability
+ AliTrack* t=GetTrackHypothesis(0);
+ if (t)
{
- cout << " *AliTrack::RemoveMassHypothesis* Invalid index j : " << j
- << " Number of mass hypotheses : " << fNmasses << endl;
+ m=t->GetMass();
+ dm=t->GetResultError();
+ SetMass(m,dm);
}
else
{
- if (j != fNmasses)
- {
- fMasses->AddAt(fMasses->At(fNmasses-1),j-1);
- fDmasses->AddAt(fDmasses->At(fNmasses-1),j-1);
- fPmasses->AddAt(fPmasses->At(fNmasses-1),j-1);
- }
- fMasses->AddAt(0,fNmasses-1);
- fDmasses->AddAt(0,fNmasses-1);
- fPmasses->AddAt(0,fNmasses-1);
- fNmasses--;
- fMasses->Set(fNmasses);
- fDmasses->Set(fNmasses);
- fPmasses->Set(fNmasses);
+ cout << " *AliTrack::SetMass()* No hypothesis present => No action." << endl;
}
}
///////////////////////////////////////////////////////////////////////////
return mt;
}
///////////////////////////////////////////////////////////////////////////
-Double_t AliTrack::GetMt(Int_t j)
-{
-// Provide transverse mass value w.r.t. z-axis and jth mass hypothesis.
-// Note : the first hypothesis is indicated by j=1.
-// j=0 ==> Hypothesis with highest probability.
-// The error on the value can be obtained by GetResultError()
-// after invokation of GetMt(j).
- Double_t pt=GetPt();
- Double_t dpt=GetResultError();
- Double_t m=GetMassHypothesis(j);
- Double_t dm=GetResultError();
-
- Double_t mt=sqrt(pt*pt+m*m);
- Double_t dmt2=0;
- if (mt) dmt2=(pow((pt*dpt),2)+pow((m*dm),2))/(mt*mt);
-
- fDresult=sqrt(dmt2);
- return mt;
-}
-///////////////////////////////////////////////////////////////////////////
Double_t AliTrack::GetRapidity()
{
// Provide rapidity value w.r.t. z-axis.
return fParent;
}
///////////////////////////////////////////////////////////////////////////
+void AliTrack::SetProb(Double_t prob)
+{
+// Set hypothesis probability for this track.
+ fProb=prob;
+}
+///////////////////////////////////////////////////////////////////////////
+Float_t AliTrack::GetProb()
+{
+// Provide the hypothesis probability for this track.
+ return fProb;
+}
+///////////////////////////////////////////////////////////////////////////
+TObject* AliTrack::Clone(char* name)
+{
+// 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
+// correct type depending on the object type, a feature which may be very useful
+// for containers when adding objects in case the container owns the objects.
+// This feature allows e.g. AliJet to store either AliTrack objects or
+// objects derived from AliTrack via the AddTrack memberfunction, provided
+// these derived classes also have a proper Clone memberfunction.
+
+ AliTrack* trk=new AliTrack(*this);
+ if (name)
+ {
+ if (strlen(name)) trk->SetName(name);
+ }
+ return trk;
+}
+///////////////////////////////////////////////////////////////////////////
#include "AliBoost.h"
#include "AliPositionObj.h"
-class AliTrack : public TObject,public Ali4Vector
+class AliTrack : public TNamed,public Ali4Vector
{
public:
AliTrack(); // Default constructor
virtual ~AliTrack(); // Destructor
AliTrack(AliTrack& t); // Copy constructor
+ virtual TObject* Clone(char* name="");// Make a deep copy and provide its pointer
virtual void Reset(); // Reset all values to 0
void Set4Momentum(Ali4Vector& p); // Set track 4-momentum
void Set3Momentum(Ali3Vector& p); // Set track 3-momentum
void SetMass(Double_t m,Double_t dm=0); // Set particle mass and error
- void SetMass(); // Set mass and error to mass hypothesis with highest prob.
+ void SetMass(); // Set mass and error to the values of the hypothesis with highest prob.
void SetCharge(Float_t q); // Set particle charge
virtual void Data(TString f="car"); // Print track information for coord. frame f
virtual void List(TString f="car"); // Print track and decay level 1 information for coord. frame f
void Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms); // Perform 2-body decay
Int_t GetNdecay(); // Provide number of decay products
AliTrack* GetDecayTrack(Int_t j); // Access to decay produced track number j
+ void RemoveDecays(); // Remove all the decay products of this track
void AddSignal(AliSignal& s); // Relate an AliSignal to this track
void RemoveSignal(AliSignal& s); // Remove related AliSignal from this track
+ void RemoveSignals(); // Remove all related AliSignals from this track
Int_t GetNsignals(); // Provide number of related AliSignals
AliSignal* GetSignal(Int_t j); // Access to the related AliSignal number j
void SetBeginPoint(AliPosition& p); // Set the track begin-point
AliPosition* GetBeginPoint(); // Provide the track begin-point
void SetEndPoint(AliPosition& p); // Set the track end-point
AliPosition* GetEndPoint(); // Provide the track end-point
- void AddMassHypothesis(Double_t prob,Double_t m,Double_t dm=0); // Add mass hypothesis data
- Int_t GetNMassHypotheses(); // Provide number of mass hypotheses
- Double_t GetMassHypothesis(Int_t j=0); // Provide mass of jth hypothesis
- Double_t GetMassHypothesisProb(Int_t j=0); // Provide prob. of jth mass hypothesis
- void RemoveMassHypothesis(Int_t j); // Remove the jth mass hypothesis
+ void AddTrackHypothesis(AliTrack& t); // Add track hypothesis
+ void AddTrackHypothesis(Double_t prob,Double_t m,Double_t dm=0); // Add track hypothesis with mass data
+ Int_t GetNhypotheses(); // Provide number of track hypotheses
+ AliTrack* GetTrackHypothesis(Int_t j=0); // Provide the j-th track hypothesis
+ void RemoveTrackHypothesis(AliTrack& t); // Remove the specified track hypothesis
+ void RemoveTrackHypotheses(); // Remove all track hypotheses
Double_t GetPt(); // Provide trans. momentum w.r.t. z-axis
Double_t GetPl(); // Provide long. momentum w.r.t. z-axis
Double_t GetEt(); // Provide trans. energy w.r.t. z-axis
Double_t GetEl(); // Provide long. energy w.r.t. z-axis
Double_t GetMt(); // Provide trans. mass w.r.t. z-axis
- Double_t GetMt(Int_t j); // Provide trans. mass w.r.t. z-axis and jth mass hypothesis
Double_t GetRapidity(); // Provide rapidity value w.r.t. z-axis
void SetImpactPoint(AliPosition& p,TString q); // Set the impact-point in plane "q=0"
AliPosition* GetImpactPoint(TString q); // Provide the impact-point in plane "q=0"
Int_t GetParticleCode(); // Provide the user defined particle id code
void SetParentTrack(AliTrack* t); // Set pointer to the parent track
AliTrack* GetParentTrack(); // Provide pointer to the parent track
+ void SetProb(Double_t prob); // Set the hypothesis probability for this track
+ Float_t GetProb(); // Provide the hypothesis probability for this track
protected:
void Init(); // Initialisation of pointers etc...
Float_t fQ; // The charge of the particle
- Int_t fNdec; // The number of decay products
TObjArray* fDecays; // The array of decay produced tracks
- Int_t fNsig; // The number of related AliSignals
TObjArray* fSignals; // The array of related AliSignals
+ TObjArray* fHypotheses; // The array of track hypotheses
AliPositionObj* fBegin; // The begin-point of the track
AliPositionObj* fEnd; // The end-point of the track
- Int_t fNmasses; // The number of mass hypotheses
- TArrayD* fMasses; // The various mass hypotheses
- TArrayD* fDmasses; // The errors on the various masses
- TArrayD* fPmasses; // The probabilities of the various mass hypotheses
AliPositionObj* fImpactXY; // The (extrapolated) impact-point in the plane z=0
AliPositionObj* fImpactXZ; // The (extrapolated) impact-point in the plane y=0
AliPositionObj* fImpactYZ; // The (extrapolated) impact-point in the plane x=0
Int_t fNdf; // The number of degrees of freedom of the track fit
Int_t fCode; // The user defined particle id code
AliTrack* fParent; // Pointer to the parent track
+ Float_t fProb; // Probability for this track as a hypothesis
private:
void Dumps(AliTrack* t,Int_t n,TString f); // Recursively print all decay levels
- ClassDef(AliTrack,7) // Handling of the attributes of a reconstructed particle track.
+ ClassDef(AliTrack,8) // Handling of the attributes of a reconstructed particle track.
};
#endif
// be stored according to the mode specified by SetJetCopy().
// The latter will enable jet studies based on a fixed list of tracks
// as contained e.g. in an AliVertex or AliEvent.
+//
+// In case a private copy is made, this is performed via the Clone() memberfunction.
+// All AliJet and derived classes have the default TObject::Clone() memberfunction.
+// However, derived classes generally contain an internal data structure which may
+// include pointers to other objects. Therefore it is recommended to provide
+// for all derived classes a specific copy constructor and override the default Clone()
+// memberfunction using this copy constructor.
+// An example for this may be seen from AliJet.
+
if (!fJets)
{
fJets=new TObjArray(fNjmax);
// Add the jet to the list
AliJet* jx=&j;
- if (fJetCopy) jx=new AliJet(j);
+ if (fJetCopy) jx=(AliJet*)j.Clone();
if (jx)
{
// has to introduce the connecting track lateron by hand
// explicitly in order to match the kinematics and charge.
//
+// In case a private copy is made, this is performed via the Clone() memberfunction.
+// All AliVertex and derived classes have the default TObject::Clone() memberfunction.
+// However, derived classes generally contain an internal data structure which may
+// include pointers to other objects. Therefore it is recommended to provide
+// for all derived classes a specific copy constructor and override the default Clone()
+// memberfunction using this copy constructor.
+// An example for this may be seen from AliVertex.
+
if (!fVertices)
{
fVertices=new TObjArray(fNvmax);
// Add the linked (secondary) vertex to the list
AliVertex* vx=&v;
- if (fVertexCopy) vx=new AliVertex(v);
+ if (fVertexCopy) vx=(AliVertex*)v.Clone();
if (vx)
{
}
}
///////////////////////////////////////////////////////////////////////////
+TObject* AliVertex::Clone(char* name)
+{
+// 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
+// correct type depending on the object type, a feature which may be very useful
+// for containers when adding objects in case the container owns the objects.
+// This feature allows e.g. AliEvent to store either AliVertex objects or
+// objects derived from AliVertex via the AddVertex memberfunction, provided
+// these derived classes also have a proper Clone memberfunction.
+
+ AliVertex* vtx=new AliVertex(*this);
+ if (name)
+ {
+ if (strlen(name)) vtx->SetName(name);
+ }
+ return vtx;
+}
+///////////////////////////////////////////////////////////////////////////
AliVertex(Int_t n); // Create a vertex to hold initially n tracks
virtual ~AliVertex(); // Default destructor
AliVertex(AliVertex& v); // Copy constructor
+ virtual TObject* Clone(char* name=""); // Make a deep copy and provide its pointer
virtual void SetOwner(Bool_t own=kTRUE);// Set ownership of all added objects
virtual void Reset(); // Reset all values and stored vertex and jet lists
void ResetVertices(); // Reset stored vertex list
private:
void Dumps(AliVertex* v,Int_t n,TString f); // Recursively print all sec. vertices
- ClassDef(AliVertex,6) // Creation and investigation of an AliVertex.
+ ClassDef(AliVertex,7) // Creation and investigation of an AliVertex.
};
#endif
22-nov-2003 NvE Support for various computation modes introduced in AliMath::Prob.
23-nov-2003 NvE New memberfunctions GetBetaVector(), GetBeta() and GetGamma() introduced in Ali4Vector.
03-dec-2003 NvE Message removed from AliEvent::GetDevice in case there are no devices present.
+05-dec-2003 NvE Memberfunction SetStable introduced in AliCollider for the user's convenience.
+08-dec-2003 NvE AliTrack derived from TNamed to enhance labeling flexibility and also specific
+ Clone memberfunction introduced to enable storage of derived objects in AliJet & co.
+ Also specific Clone memberfunctions introduced for AliJet, AliVertex and AliEvent and
+ for the already existing specific Clone memberfunctions the default argument was set
+ to the empty string "".
+15-dec-2003 NvE Datamembers fNdec and fNsig removed from AliTrack since these data are now retrieved
+ directly from the corresponding arrays.
+ Support for hypothesis probability introduced in AliTrack and old mass hypothesis
+ machinery extended to provide now full track hypotheses.
+18-dec-2003 NvE Support for object references from the various signal slots introduced in AliSignal.
+ Since this is mainly intended for "backward references" to AliTrack objects,
+ the AliTrack class has been slightly updated for this to provide pointer consistency
+ in case the corresponding AliTrack object is deleted.