From: nick Date: Tue, 19 Mar 2002 11:18:18 +0000 (+0000) Subject: 19-mar-2002 NvE AliVertex::Draw() introduced to enable 3D event display. X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=a37bb40e69afd7b20df42d993c51df25d7f29671 19-mar-2002 NvE AliVertex::Draw() introduced to enable 3D event display. --- diff --git a/RALICE/AliVertex.cxx b/RALICE/AliVertex.cxx index b8d1bc7442e..700dac48d68 100644 --- a/RALICE/AliVertex.cxx +++ b/RALICE/AliVertex.cxx @@ -170,6 +170,7 @@ void AliVertex::Init() fJets=0; fJetTracks=0; fJetCopy=0; + fLines=0; } /////////////////////////////////////////////////////////////////////////// AliVertex::AliVertex(Int_t n) @@ -217,6 +218,11 @@ AliVertex::~AliVertex() delete fJetTracks; fJetTracks=0; } + if (fLines) + { + delete fLines; + fLines=0; + } } /////////////////////////////////////////////////////////////////////////// AliVertex::AliVertex(AliVertex& v) @@ -356,6 +362,12 @@ void AliVertex::Reset() delete fJetTracks; fJetTracks=0; } + + if (fLines) + { + delete fLines; + fLines=0; + } } /////////////////////////////////////////////////////////////////////////// void AliVertex::ResetVertices() @@ -825,3 +837,107 @@ Int_t AliVertex::IsJetTrack(AliTrack* t) return jetflag; } /////////////////////////////////////////////////////////////////////////// +void AliVertex::Draw(Int_t secs,Int_t cons,Int_t jets) +{ +// 3-Dimensional visualisation of an AliVertex with its attributes. +// The displayed tracklength is proportional to the momentum of the track. +// +// Color conventions : +// ------------------- +// positive track : red +// neutral track : green +// negative track : blue +// jet-track : magenta (if explicit marking selected) +// +// secs = 1 --> Draw secondary vertices. +// 0 --> Don't draw secondary vertices. +// +// cons = 1 --> Draw (auto generated) connecting tracks. +// 0 --> Don't draw (auto generated) connecting tracks. +// +// jets = 1 --> Mark tracks belonging to jets. +// 0 --> Don't mark jet-tracks. +// +// Notes : +// ------- +// Auto generated connecting tracks will be drawn as thin lines. +// Tracks belonging to jets will be marked as somewhat thinner magenta lines. +// This memberfunction is used recursively. +// + Double_t vec[3]={0,0,0}; + AliTrack* tx=0; + AliVertex* vx=0; + AliPosition r; + Ali3Vector p; + Int_t charge; + + if (fLines) delete fLines; + fLines=new TObjArray(); + fLines->SetOwner(); + + Int_t ntk=GetNtracks(); + for (Int_t jtk=1; jtk<=ntk; jtk++) + { + tx=GetTrack(jtk); + + if (!tx) continue; + + charge=tx->GetCharge(); + + TPolyLine3D* line=new TPolyLine3D(); + fLines->Add(line); + + if (IsConnectTrack(tx)) + { + if (cons==1) + { + r=tx->GetBeginPoint(); + r.GetPosition(vec,"car"); + line->SetNextPoint(vec[0],vec[1],vec[2]); + r=tx->GetEndPoint(); + r.GetPosition(vec,"car"); + line->SetNextPoint(vec[0],vec[1],vec[2]); + line->SetLineWidth(1); + } + } + else + { + r=tx->GetClosestPoint(); + r.GetPosition(vec,"car"); + line->SetNextPoint(vec[0],vec[1],vec[2]); + p=tx->Get3Momentum(); + p=p+r; + p.GetVector(vec,"car"); + line->SetNextPoint(vec[0],vec[1],vec[2]); + line->SetLineWidth(3); + } + + if (charge>0) line->SetLineColor(kRed); // Positive track + if (!charge) line->SetLineColor(kGreen); // Neutral track + if (charge<0) line->SetLineColor(kBlue); // Negative track + + // Mark tracks belonging to jets + if (IsJetTrack(tx)) + { + if (jets==1) + { + line->SetLineWidth(2); + line->SetLineColor(kMagenta); + } + } + + line->Draw(); + } + + // Go for secondary vertices if selected + if (secs==1) + { + Int_t nvtx=GetNvertices(); + for (Int_t jvtx=1; jvtx<=nvtx; jvtx++) + { + vx=GetVertex(jvtx); + if (vx) vx->Draw(secs,cons,jets); + } + } +} +/////////////////////////////////////////////////////////////////////////// diff --git a/RALICE/AliVertex.h b/RALICE/AliVertex.h index 779882e39a8..f780604d882 100644 --- a/RALICE/AliVertex.h +++ b/RALICE/AliVertex.h @@ -10,6 +10,7 @@ #include "TObject.h" #include "TObjArray.h" +#include "TPolyLine3D.h" #include "AliJet.h" #include "AliPosition.h" @@ -44,6 +45,7 @@ class AliVertex : public AliJet,public AliPosition Int_t GetJetCopy(); // Provide JetCopy flag value Int_t IsConnectTrack(AliTrack* t); // Indicate if track is created by vertex connection Int_t IsJetTrack(AliTrack* t); // Indicate if track is resulting from jet addition + void Draw(Int_t secs=1,Int_t cons=1,Int_t jets=0); // Draw the vertex in an event display protected: void Init(); // Initialisation of pointers etc... @@ -57,10 +59,11 @@ class AliVertex : public AliJet,public AliPosition TObjArray* fJets; // Array to hold the pointers to the jets TObjArray* fJetTracks;// Array to hold the pointers to tracks introduced by jet addition Int_t fJetCopy; // Flag to denote creation of private copies in fJets + TObjArray* fLines; //! Array to (temporarily) store the 3D lines for the event display private: void Dump(AliVertex* v,Int_t n,TString f); // Recursively print all sec. vertices - ClassDef(AliVertex,1) // Creation and investigation of an AliVertex. + ClassDef(AliVertex,2) // Creation and investigation of an AliVertex. }; #endif diff --git a/RALICE/history.txt b/RALICE/history.txt index c621e474ae9..bc1b68cd60c 100644 --- a/RALICE/history.txt +++ b/RALICE/history.txt @@ -302,3 +302,4 @@ correctly for ROOT version 3.02/07 and later. 14-feb-2002 NvE Support for name tag introduced in AliSignal to indicate the kind of signal. Missing comment lines added in SetName() and GetName() of AliCalorimeter and AliSignal. +19-mar-2002 NvE AliVertex::Draw() introduced to enable 3D event display.