// This class is meant to provide a means to display and extrapolate
// AliTrack objects in the presence of a constant homogeneous magnetic field.
//
+// For track/event displays the line width, colour etc... can be set using the
+// standard facilities (see TAttLine).
+// By default the linewith is set to 2 and the colour set to -1 in the constructor.
+// The latter results in an automatic colour coding according to the track charge
+// with the convention positive=red neutral=green negative=blue.
+//
+// To indicate the track starting point, the memberfunction SetMarker()
+// may be used.
+// By default no marker will be displayed.
+//
// Examples :
// ==========
//
fCurves=0;
fExt=0;
fTofmax=1e-8;
+ fMstyle=-1;
+ fMsize=0;
+ fMcol=0;
+ fEnduse=1;
+
+ fLineWidth=2;
+ fLineColor=-1;
}
///////////////////////////////////////////////////////////////////////////
AliHelix::~AliHelix()
// Copy constructor
fB=h.fB;
fRefresh=h.fRefresh;
+ fTofmax=h.fTofmax;
+ fMstyle=h.fMstyle;
+ fMsize=h.fMsize;
+ fMcol=h.fMcol;
+ fEnduse=h.fEnduse;
}
///////////////////////////////////////////////////////////////////////////
void AliHelix::SetB(Ali3Vector& b)
return fTofmax;
}
///////////////////////////////////////////////////////////////////////////
+void AliHelix::SetMarker(Int_t style,Float_t size,Int_t col)
+{
+// Specify the marker (style, size and colour) to indicate the starting point
+// of a track in a display.
+// In case col<0 the marker will have the same color as the track itself.
+//
+// Defaults are style=8, size=0.2 and col=-1.
+
+ fMstyle=style;
+ fMsize=size;
+ fMcol=col;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliHelix::UseEndPoint(Int_t mode)
+{
+// Select usage of track endpoint in drawing and extrapolation.
+// This allows correct event displays even for very long tracks.
+//
+// mode = 0 : Do not use the track endpoint
+// 1 : Use the track endpoint
+//
+// The default value is mode=1 (which is also set in the constructor).
+
+ if (mode==0 || mode==1) fEnduse=mode;
+}
+///////////////////////////////////////////////////////////////////////////
void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
{
// Make the helix curve for the specified AliTrack.
if (energy<=0 || betanorm<=0) return;
AliPosition* rbeg=t->GetBeginPoint();
- AliPosition* rend=t->GetEndPoint();
+ AliPosition* rend=0;
+ if (fEnduse) rend=t->GetEndPoint();
AliPosition* rref=t->GetReferencePoint();
// Magnetic field vector or default Z-direction
if (scale1/scale>1.1 || scale/scale1>1.1) r1*=scale1/scale;
// Re-calculate the tmin for this new starting point
r1.GetVector(vec1,"car");
- if (abs(fVz)>0) tmin=(vec1[2]-fZ0)/fVz;
+ if (fabs(fVz)>0) tmin=(vec1[2]-fZ0)/fVz;
tmax=tmin+fTofmax;
}
if (rend)
// All coordinates in the selected unit scale
if (scale2/scale>1.1 || scale/scale2>1.1) r2*=scale2/scale;
r2.GetVector(vec2,"car");
- if (abs(fVz)>0) tmax=(vec2[2]-fZ0)/fVz;
+ if (fabs(fVz)>0) tmax=(vec2[2]-fZ0)/fVz;
}
// Make the curve on basis of the flight time boundaries and exit
if (tmax<tmin)
Float_t* points=GetP();
TPolyLine3D* curve=new TPolyLine3D(np,points);
- curve->SetLineWidth(2);
- Float_t q=t->GetCharge();
- curve->SetLineColor(kGreen);
- if (q>0) curve->SetLineColor(kRed);
- if (q<0) curve->SetLineColor(kBlue);
+ curve->SetLineWidth(fLineWidth);
+ if (fLineColor<0)
+ {
+ Float_t q=t->GetCharge();
+ curve->SetLineColor(kGreen);
+ if (q>0) curve->SetLineColor(kRed);
+ if (q<0) curve->SetLineColor(kBlue);
+ }
+ else
+ {
+ curve->SetLineColor(fLineColor);
+ }
curve->Draw();
if (!fCurves)
fCurves->SetOwner();
}
fCurves->Add(curve);
+
+ // Display the marker for the track starting point
+ if (fMstyle>0)
+ {
+ TPolyMarker3D* m=new TPolyMarker3D();
+ m->SetPoint(0,points[0],points[1],points[2]);
+ m->SetMarkerStyle(fMstyle);
+ m->SetMarkerSize(fMsize);
+ Int_t col=curve->GetLineColor();
+ if (fMcol>0) col=fMcol;
+ m->SetMarkerColor(col);
+ m->Draw();
+ fCurves->Add(m);
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliHelix::Refresh(Int_t mode)
}
}
///////////////////////////////////////////////////////////////////////////
+void AliHelix::Display(TObjArray* arr,Double_t* range,Int_t iaxis,Double_t scale)
+{
+// Display the helix curves of all tracks in the specified array.
+// A convenient way to obtain an array with selected tracks from e.g. an AliEvent
+// is to make use of its GetTracks() selection facility.
+// Various arrays can be displayed together or individually; please refer to
+// the memberfunction Refresh() for further details.
+// Please refer to the track display memberfunction for further details
+// on the input arguments.
+//
+// The default values are range=0, iaxis=3 and scale=-1.
+//
+// Note :
+// ------
+// Before any display activity, a TCanvas and a TView have to be initiated
+// first by the user like for instance
+//
+// TCanvas* c1=new TCanvas("c1","c1");
+// TView* view=new TView(1);
+// view->SetRange(-1000,-1000,-1000,1000,1000,1000);
+// view->ShowAxis();
+
+ if (!arr) return;
+
+ Int_t ntk=arr->GetEntries();
+ for (Int_t jtk=0; jtk<ntk; jtk++)
+ {
+ TObject* obj=arr->At(jtk);
+ if (!obj) continue;
+ if (!(obj->InheritsFrom("AliTrack"))) continue;
+ AliTrack* tx=(AliTrack*)obj;
+ Display(tx,range,iaxis,scale);
+ }
+}
+///////////////////////////////////////////////////////////////////////////
AliPosition* AliHelix::Extrapolate(AliTrack* t,Double_t* pars,Double_t scale)
{
// Extrapolate an AliTrack according to the corresponding helix curve