From ea0b5b7fa605d46132220093598845caf0dea5db Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 18 Apr 2005 09:43:53 +0000 Subject: [PATCH] 04-mar-2005 NvE Installation scripts named amdgcclib.sh introduced in all /scripts directories to enable shared library creation on AMD 64 (Athlon and Opteron) machines. 31-mar-2005 NvE AliObjMatrix derived from TNamed instead of from TObject to allow specification of a name and title for this class. 13-apr-2005 NvE New memberfunctions SetFitDetails and GetFitDetails introduced in AliTrack to enable a versatile facility to store details of various fit procedures for a certain track. This new facility is based on the original idea of Adam Bouchta. Destructor of AliSignal modified to remove the corresponding AliSignal instance first from all related tracks before deleting the link matrix area. Documentation of IceEvent updated w.r.t. the labeling of MC and Reco tracks. 14-apr-2005 NvE Functionality of ShowDevices extended in AliEvent. Also memberfunction HeaderData() modified to prevent long output lists when many devices (and/or tracks) are present. New memberfunction ShowTracks introduced in AliJet and memberfunction Data() updated. 18-apr-2005 NvE New memberfunction GetTracks introduced in AliJet to provide various track selections. --- RALICE/AliEvent.cxx | 44 +++++++---- RALICE/AliEvent.h | 6 +- RALICE/AliJet.cxx | 151 ++++++++++++++++++++++++++++++++---- RALICE/AliJet.h | 5 +- RALICE/AliObjMatrix.cxx | 2 +- RALICE/AliObjMatrix.h | 7 +- RALICE/AliSignal.cxx | 11 +++ RALICE/AliTrack.cxx | 74 +++++++++++++++++- RALICE/AliTrack.h | 6 +- RALICE/history.txt | 11 +++ RALICE/icepack/IceEvent.cxx | 11 +++ RALICE/icepack/history.txt | 1 + 12 files changed, 288 insertions(+), 41 deletions(-) diff --git a/RALICE/AliEvent.cxx b/RALICE/AliEvent.cxx index f444991aa9f..6cdae540716 100644 --- a/RALICE/AliEvent.cxx +++ b/RALICE/AliEvent.cxx @@ -579,16 +579,14 @@ void AliEvent::HeaderData() // Provide event header information const char* name=GetName(); const char* title=GetTitle(); - Int_t ndevs=GetNdevices(); cout << " *" << ClassName() << "::Data*"; if (strlen(name)) cout << " Name : " << GetName(); if (strlen(title)) cout << " Title : " << GetTitle(); cout << endl; Date(1); - cout << " Run : " << fRun << " Event : " << fEvent - << " Number of devices : " << ndevs << endl; - - if (ndevs) ShowDevices(); + cout << " Run : " << fRun << " Event : " << fEvent << endl; + ShowDevices(0); + ShowTracks(0); } /////////////////////////////////////////////////////////////////////////// void AliEvent::Data(TString f) @@ -764,24 +762,38 @@ TObject* AliEvent::GetIdDevice(Int_t id) const return 0; // No matching id found } /////////////////////////////////////////////////////////////////////////// -void AliEvent::ShowDevices() const +void AliEvent::ShowDevices(Int_t mode) const { // Provide an overview of the available devices. +// The argument mode determines the amount of information as follows : +// mode = 0 ==> Only printout of the number of devices +// 1 ==> Provide a listing with 1 line of info for each device +// +// The default is mode=1. +// Int_t ndevs=GetNdevices(); if (ndevs) { - cout << " The following " << ndevs << " devices are available :" << endl; - for (Int_t i=1; i<=ndevs; i++) + if (!mode) { - TObject* dev=GetDevice(i); - if (dev) + cout << " There are " << ndevs << " devices available." << endl; + } + else + { + cout << " The following " << ndevs << " devices are available :" << endl; + for (Int_t i=1; i<=ndevs; i++) { - const char* name=dev->GetName(); - cout << " Device number : " << i; - cout << " Class : " << dev->ClassName() << " Id : " << dev->GetUniqueID(); - if (strlen(name)) cout << " Name : " << name; - if (dev->InheritsFrom("AliDevice")) cout << " Nhits : " << ((AliDevice*)dev)->GetNhits(); - cout << endl; + TObject* dev=GetDevice(i); + if (dev) + { + const char* name=dev->GetName(); + cout << " Device number : " << i; + cout << " Class : " << dev->ClassName() << " Id : " << dev->GetUniqueID(); + if (strlen(name)) cout << " Name : " << name; + if (dev->InheritsFrom("AliDevice")) cout << " Nhits : " << ((AliDevice*)dev)->GetNhits(); + if (dev->InheritsFrom("AliSignal")) cout << " Nwaveforms : " << ((AliSignal*)dev)->GetNwaveforms(); + cout << endl; + } } } } diff --git a/RALICE/AliEvent.h b/RALICE/AliEvent.h index b039c82ac2e..c488b1949a9 100644 --- a/RALICE/AliEvent.h +++ b/RALICE/AliEvent.h @@ -47,9 +47,9 @@ class AliEvent : public AliVertex,public AliTimestamp void SetDevCopy(Int_t j); // (De)activate creation of private copies of the devices Int_t GetDevCopy() const; // Provide DevCopy flag value void AddDevice(TObject& d); // Add a device to the event - void AddDevice(TObject* d) { AddDevice(*d); } + void AddDevice(TObject* d) { if (d) AddDevice(*d); } Int_t GetNdevices() const; // Provide the number of devices - void ShowDevices() const; // Provide on overview of the available devices + void ShowDevices(Int_t mode=1) const; // Provide on overview of the available devices TObject* GetDevice(Int_t i) const; // Provide i-th device of the event TObject* GetDevice(TString name) const; // Provide the device with name "name" TObject* GetIdDevice(Int_t id) const; // Provide the device with unique identifier "id" @@ -85,6 +85,6 @@ class AliEvent : public AliVertex,public AliTimestamp TObjArray* fOrdered; //! Temp. array to hold references to various ordered objects TObject* fDisplay; //! Temp. pointer to hold objects which serve event displays - ClassDef(AliEvent,18) // Creation and investigation of an Alice physics event. + ClassDef(AliEvent,19) // Creation and investigation of an Alice physics event. }; #endif diff --git a/RALICE/AliJet.cxx b/RALICE/AliJet.cxx index 95195241a24..5596c7158fe 100644 --- a/RALICE/AliJet.cxx +++ b/RALICE/AliJet.cxx @@ -111,6 +111,7 @@ void AliJet::Init() fTracks=0; fNtinit=0; fTrackCopy=0; + fSelected=0; } /////////////////////////////////////////////////////////////////////////// AliJet::AliJet(Int_t n) : TNamed(),Ali4Vector() @@ -141,6 +142,11 @@ AliJet::~AliJet() delete fTracks; fTracks=0; } + if (fSelected) + { + delete fSelected; + fSelected=0; + } } /////////////////////////////////////////////////////////////////////////// void AliJet::SetOwner(Bool_t own) @@ -180,6 +186,8 @@ AliJet::AliJet(const AliJet& j) : TNamed(j),Ali4Vector(j) fTrackCopy=j.fTrackCopy; fUserId=j.fUserId; + fSelected=0; + fTracks=0; if (fNtrk) { @@ -298,7 +306,9 @@ void AliJet::Data(TString f) if (strlen(title)) cout << " Title : " << GetTitle(); cout << endl; cout << " Id : " << fUserId << " Invmass : " << GetInvmass() << " Charge : " << fQ - << " Momentum : " << GetMomentum() << " Ntracks : " << fNtrk << endl; + << " Momentum : " << GetMomentum() << endl; + + ShowTracks(0); Ali4Vector::Data(f); } @@ -403,23 +413,18 @@ Float_t AliJet::GetCharge() const AliTrack* AliJet::GetTrack(Int_t i) const { // Return the i-th track of this jet - if (!fTracks) + + if (!fTracks) return 0; + + if (i<=0 || i>fNtrk) { - cout << " *AliJet*::GetTrack* No tracks present." << endl; + cout << " *AliJet*::GetTrack* Invalid argument i : " << i + << " Ntrk = " << fNtrk << endl; return 0; } else { - if (i<=0 || i>fNtrk) - { - cout << " *AliJet*::GetTrack* Invalid argument i : " << i - << " Ntrk = " << fNtrk << endl; - return 0; - } - else - { - return (AliTrack*)fTracks->At(i-1); - } + return (AliTrack*)fTracks->At(i-1); } } /////////////////////////////////////////////////////////////////////////// @@ -437,6 +442,126 @@ AliTrack* AliJet::GetIdTrack(Int_t id) const return 0; // No matching id found } /////////////////////////////////////////////////////////////////////////// +TObjArray* AliJet::GetTracks(Int_t idmode,Int_t chmode,Int_t pcode) +{ +// Provide references to user selected tracks based on the idmode, chmode +// and pcode selections as specified by the user. +// +// The following selection combinations are available : +// ---------------------------------------------------- +// idmode = -1 ==> Select tracks with negative user identifier "id" +// 0 ==> No selection on user identifier +// 1 ==> Select tracks with positive user identifier "id" +// +// chmode = -1 ==> Select tracks with negative charge +// 0 ==> Select neutral tracks +// 1 ==> Select tracks with positive charge +// 2 ==> No selection on charge +// +// pcode = 0 ==> No selection on particle code +// X ==> Select tracks with particle code +X or -X +// This allows selection of both particles and anti-particles +// in case of PDG particle codes. +// Selection of either particles or anti-particles can be +// obtained in combination with the "chmode" selector. +// +// Examples : +// ---------- +// idmode=-1 chmode=0 pcode=0 : Selection of all neutral tracks with negative id. +// idmode=0 chmode=2 pcode=211 : Selection of all charged pions (PDG convention). +// idmode=0 chmode=1 pcode=321 : Selection of all positive kaons (PDG convention). +// +// The default values are idmode=0 chmode=2 pcode=0 (i.e. no selections applied). +// +// Notes : +// ------- +// 1) In case the user has labeled simulated tracks with negative id and +// reconstructed tracks with positive id, this memberfunction provides +// easy access to either all simulated or reconstructed tracks. +// 2) Subsequent invokations of this memberfunction with e.g. chmode=-1 and chmode=1 +// provides a convenient way to investigate particle pairs with opposite charge +// (e.g. for invariant mass analysis). + + if (fSelected) + { + fSelected->Clear(); + } + else + { + fSelected=new TObjArray(); + } + + if (!fTracks) return fSelected; + + AliTrack* tx=0; + Int_t code=0; + Int_t id=0; + Float_t q=0; + for (Int_t i=0; iAt(i); + if (!tx) continue; + + code=tx->GetParticleCode(); + if (pcode && abs(pcode)!=abs(code)) continue; + + id=tx->GetId(); + if (idmode==-1 && id>=0) continue; + if (idmode==1 && id<=0) continue; + + q=tx->GetCharge(); + if (chmode==-1 && q>=0) continue; + if (chmode==0 && fabs(q)>1e-10) continue; + if (chmode==1 && q<=0) continue; + + fSelected->Add(tx); + } + + return fSelected; +} +/////////////////////////////////////////////////////////////////////////// +void AliJet::ShowTracks(Int_t mode) const +{ +// Provide an overview of the available tracks. +// The argument mode determines the amount of information as follows : +// mode = 0 ==> Only printout of the number of tracks +// 1 ==> Provide a listing with 1 line of info for each track +// +// The default is mode=1. +// + Int_t ntk=GetNtracks(); + if (ntk) + { + if (!mode) + { + cout << " There are " << ntk << " tracks available." << endl; + } + else + { + cout << " The following " << ntk << " tracks are available :" << endl; + for (Int_t i=1; i<=ntk; i++) + { + AliTrack* tx=GetTrack(i); + if (tx) + { + const char* name=tx->GetName(); + const char* title=tx->GetTitle(); + cout << " Track : " << i; + cout << " Id : " << tx->GetId(); + cout << " Q : " << tx->GetCharge() << " m : " << tx->GetMass() << " p : " << tx->GetMomentum(); + if (strlen(name)) cout << " Name : " << name; + if (strlen(title)) cout << " Title : " << title; + cout << endl; + } + } + } + } + else + { + cout << " No tracks are present." << endl; + } +} +/////////////////////////////////////////////////////////////////////////// Double_t AliJet::GetPt() { // Provide trans. momentum value w.r.t. z-axis. diff --git a/RALICE/AliJet.h b/RALICE/AliJet.h index 3b5bec2e806..731c5452afa 100644 --- a/RALICE/AliJet.h +++ b/RALICE/AliJet.h @@ -36,6 +36,8 @@ class AliJet : public TNamed,public Ali4Vector Int_t GetNtracks() const; // Return the number of tracks in the jet AliTrack* GetTrack(Int_t i) const; // Provide i-th track of the jet (1=first track) AliTrack* GetIdTrack(Int_t id) const; // Provide the track with user identifier "id" + TObjArray* GetTracks(Int_t idmode=0,Int_t chmode=2,Int_t pcode=0); // Provide references to selected tracks + void ShowTracks(Int_t mode=1) const; // Provide on overview of the available tracks 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 @@ -59,7 +61,8 @@ class AliJet : public TNamed,public Ali4Vector TObjArray* fTracks; // Array to hold the pointers to the tracks of the jet Int_t fTrackCopy; // Flag to denote creation of private copies in fTracks Int_t fUserId; // The user defined identifier + TObjArray* fSelected; //! Temp. array to hold user selected objects - ClassDef(AliJet,9) // Creation and investigation of a jet of particle tracks. + ClassDef(AliJet,10) // Creation and investigation of a jet of particle tracks. }; #endif diff --git a/RALICE/AliObjMatrix.cxx b/RALICE/AliObjMatrix.cxx index 8a5332dcdaf..1aae18fe415 100644 --- a/RALICE/AliObjMatrix.cxx +++ b/RALICE/AliObjMatrix.cxx @@ -81,7 +81,7 @@ ClassImp(AliObjMatrix) // Class implementation to enable ROOT I/O -AliObjMatrix::AliObjMatrix() : TObject() +AliObjMatrix::AliObjMatrix() : TNamed() { // Default constructor. // Note : The owner and swap mode flags will be initialised to 0. diff --git a/RALICE/AliObjMatrix.h b/RALICE/AliObjMatrix.h index b60e37e4448..412898d1d8c 100644 --- a/RALICE/AliObjMatrix.h +++ b/RALICE/AliObjMatrix.h @@ -5,12 +5,11 @@ // $Id$ -#include "TObject.h" +#include "TNamed.h" #include "TObjArray.h" -#include "TRefArray.h" #include "TArrayI.h" -class AliObjMatrix : public TObject +class AliObjMatrix : public TNamed { public: AliObjMatrix(); // Default constructor @@ -42,6 +41,6 @@ class AliObjMatrix : public TObject Int_t fMaxcol; // The maximum column number index TObjArray* fObjects; // Linear reference array for fast looping over the stored objects - ClassDef(AliObjMatrix,5) // Handling of a matrix structure of objects. + ClassDef(AliObjMatrix,6) // Handling of a matrix structure of objects. }; #endif diff --git a/RALICE/AliSignal.cxx b/RALICE/AliSignal.cxx index a74153cbaf9..5caa22d6f15 100644 --- a/RALICE/AliSignal.cxx +++ b/RALICE/AliSignal.cxx @@ -130,6 +130,17 @@ 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; } diff --git a/RALICE/AliTrack.cxx b/RALICE/AliTrack.cxx index 2e4ebe16185..7ba7a349a34 100644 --- a/RALICE/AliTrack.cxx +++ b/RALICE/AliTrack.cxx @@ -116,6 +116,7 @@ void AliTrack::Init() fImpactYZ=0; fClosest=0; fParent=0; + fFit=0; } /////////////////////////////////////////////////////////////////////////// AliTrack::~AliTrack() @@ -182,6 +183,11 @@ AliTrack::~AliTrack() delete fClosest; fClosest=0; } + if (fFit) + { + delete fFit; + fFit=0; + } } /////////////////////////////////////////////////////////////////////////// AliTrack::AliTrack(const AliTrack& t) : TNamed(t),Ali4Vector(t) @@ -198,6 +204,7 @@ AliTrack::AliTrack(const AliTrack& t) : TNamed(t),Ali4Vector(t) if (t.fImpactXZ) fImpactXZ=new AliPositionObj(*(t.fImpactXZ)); if (t.fImpactYZ) fImpactYZ=new AliPositionObj(*(t.fImpactYZ)); if (t.fClosest) fClosest=new AliPositionObj(*(t.fClosest)); + if (t.fFit) fFit=t.fFit->Clone(); fUserId=t.fUserId; fChi2=t.fChi2; fNdf=t.fNdf; @@ -303,6 +310,11 @@ void AliTrack::Reset() delete fClosest; fClosest=0; } + if (fFit) + { + delete fFit; + fFit=0; + } } /////////////////////////////////////////////////////////////////////////// void AliTrack::Set3Momentum(Ali3Vector& p) @@ -348,14 +360,30 @@ void AliTrack::Data(TString f) const char* title=GetTitle(); cout << " *" << ClassName() << "::Data*"; - if (strlen(name)) cout << " Name : " << GetName(); - if (strlen(title)) cout << " Title : " << GetTitle(); + if (strlen(name)) cout << " Name : " << name; + if (strlen(title)) cout << " Title : " << title; 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; + if (fParent) + { + cout << " Parent track Id : " << fParent->GetId() << " Code : " << fParent->GetParticleCode() + << " m : " << fParent->GetMass() << " Q : " << fParent->GetCharge() + << " p : " << fParent->GetMomentum(); + const char* pname=fParent->GetName(); + const char* ptitle=fParent->GetTitle(); + if (strlen(pname)) cout << " Name : " << pname; + if (strlen(ptitle)) cout << " Title : " << ptitle; + cout << endl; + } + if (fFit) + { + cout << " Fit details present in object of class " << fFit->ClassName() << endl; + if (fFit->InheritsFrom("AliSignal")) ((AliSignal*)fFit)->List(-1); + } Ali4Vector::Data(f); } /////////////////////////////////////////////////////////////////////////// @@ -1192,6 +1220,48 @@ Float_t AliTrack::GetProb() const return fProb; } /////////////////////////////////////////////////////////////////////////// +void AliTrack::SetFitDetails(TObject* obj) +{ +// Enter the object containing the fit details. +// In case an object to hold fit details was already present, this +// will be deleted first before the new one is stored. +// This means that SetFitDetails(0) can be used to just remove the +// existing object with the fit details. +// All objects derived from TObject can be entered in this way. +// Obvious candidates for objects containing detailed fit information +// are functions (e.g. TF1) and histograms (e.g. TH1F). +// However, using an AliDevice object provides a very versatile facility +// to store the parameters of various fit procedures. +// In such a case the AliDevice can be used to provide the various fit +// definitions and the corresponding fit parameters can be entered as +// separate AliSignal objects which are stored as hits to the AliDevice. +// In addition various functions and histograms can be linked to the +// various AliSignal instances +// The latter procedure is based on the original idea of Adam Bouchta. +// +// Note : The entered object is owned by this AliTrack instance. +// As such, a private copy of obj will be stored using the Clone() +// memberfunction. +// In case the entered object contains pointers to other objects, +// the user has to provide the appropriate Clone() memberfunction +// for the class to which the entered object belongs. +// An example can be seen from AliTrack::Clone(). +// + if (fFit) + { + delete fFit; + fFit=0; + } + + if (obj) fFit=obj->Clone(); +} +/////////////////////////////////////////////////////////////////////////// +TObject* AliTrack::GetFitDetails() +{ +// Provide the pointer to the object containing the fit details. + return fFit; +} +/////////////////////////////////////////////////////////////////////////// TObject* AliTrack::Clone(const char* name) const { // Make a deep copy of the current object and provide the pointer to the copy. diff --git a/RALICE/AliTrack.h b/RALICE/AliTrack.h index 0f9ed41733e..9cb401bab0d 100644 --- a/RALICE/AliTrack.h +++ b/RALICE/AliTrack.h @@ -80,6 +80,9 @@ class AliTrack : public TNamed,public Ali4Vector AliTrack* GetParentTrack(); // Provide pointer to the parent track void SetProb(Double_t prob); // Set the hypothesis probability for this track Float_t GetProb() const; // Provide the hypothesis probability for this track + void SetFitDetails(TObject* obj); // Enter the object containing the fit details + void SetFitDetails(TObject& obj) { SetFitDetails(&obj); } + TObject* GetFitDetails(); // Provide pointer to the object containing the fit details protected: @@ -101,10 +104,11 @@ class AliTrack : public TNamed,public Ali4Vector 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 + TObject* fFit; // Object containing details of the fit private: void Dumps(AliTrack* t,Int_t n,TString f); // Recursively print all decay levels - ClassDef(AliTrack,12) // Handling of the attributes of a reconstructed particle track. + ClassDef(AliTrack,13) // Handling of the attributes of a reconstructed particle track. }; #endif diff --git a/RALICE/history.txt b/RALICE/history.txt index 59b49a695e1..f8d8ddd463d 100644 --- a/RALICE/history.txt +++ b/RALICE/history.txt @@ -576,3 +576,14 @@ effort of eliminating the TTimeStamp restrictions. 04-mar-2005 NvE Installation scripts named amdgcclib.sh introduced in all /scripts directories to enable shared library creation on AMD 64 (Athlon and Opteron) machines. +31-mar-2005 NvE AliObjMatrix derived from TNamed instead of from TObject to allow specification of + a name and title for this class. +13-apr-2005 NvE New memberfunctions SetFitDetails and GetFitDetails introduced in AliTrack + to enable a versatile facility to store details of various fit procedures + for a certain track. This new facility is based on the original idea of Adam Bouchta. + Destructor of AliSignal modified to remove the corresponding AliSignal instance + first from all related tracks before deleting the link matrix area. +14-apr-2005 NvE Functionality of ShowDevices extended in AliEvent. Also memberfunction HeaderData() modified + to prevent long output lists when many devices (and/or tracks) are present. + New memberfunction ShowTracks introduced in AliJet and memberfunction Data() updated. +18-apr-2005 NvE New memberfunction GetTracks introduced in AliJet to provide various track selections. diff --git a/RALICE/icepack/IceEvent.cxx b/RALICE/icepack/IceEvent.cxx index 79e2f0a6328..a66e609b06a 100644 --- a/RALICE/icepack/IceEvent.cxx +++ b/RALICE/icepack/IceEvent.cxx @@ -21,6 +21,17 @@ // Basically this class provides an IceCube tailored user interface // to the functionality of the class AliEvent. // +// Notes : +// ------ +// * In the event structure MC tracks are labeled with a negative track ID, +// whereas reconstructed tracks are labeled with a positive track ID. +// This allows for a direct selection of either MC or Reco tracks via the +// GetIdTrack() facility. +// * The particle codes used for the various tracks are the PDG ones. +// For IceCube specific "particle" types (e.g. deltae) the PDG database +// has been extended, as can be seen in the IceF2k class which provides +// a conversion facility from the F2K into the Ralice/IcePack format. +// // Examples : // ========== // diff --git a/RALICE/icepack/history.txt b/RALICE/icepack/history.txt index 2301bd77b40..e07bb82b700 100644 --- a/RALICE/icepack/history.txt +++ b/RALICE/icepack/history.txt @@ -4,3 +4,4 @@ 01-dec-2004 NvE First release of the package as a subdirectory of Ralice. 18-feb-2005 NvE Copyright format modified in all .cxx source files in line with Ralice such that the text shows up correctly in the auto-generated html docs. +13-apr-2005 NvE Documentation of IceEvent updated w.r.t. the labeling of MC and Reco tracks. -- 2.43.0