]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliHelix.cxx
Remving, the info moved to READMEtrigger
[u/mrichter/AliRoot.git] / RALICE / AliHelix.cxx
index 5b49121db24a04acc3f2fd2c3f28c0cece06ebe5..e0069838a064b6c2fba959afbc84f98e90871c10 100644 (file)
 // 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. 
@@ -161,6 +167,9 @@ AliHelix::AliHelix() : THelix()
  fMsize=0;
  fMcol=0;
  fEnduse=1;
+
+ fLineWidth=2;
+ fLineColor=-1;
 }
 ///////////////////////////////////////////////////////////////////////////
 AliHelix::~AliHelix()
@@ -183,6 +192,11 @@ AliHelix::AliHelix(const AliHelix& h) : THelix(h)
 // 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)
@@ -257,12 +271,12 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
 // In case one wants to display or extrapolate an AliTrack it is preferable
 // to use the Display() or Extrapolate() memberfunctions.
 // It is assumed that the track charge is stored in elementary units
-// (i.e. charge=1 for a proton) and that the track energy is stored in GeV.
+// (i.e. charge=1 for a proton).
 // The input argument "scale" specifies the unit scale for the various
 // locations where scale=0.01 indicates unit scales in cm etc...
 // In case scale<=0, the unit scale for locations is determined from the
 // begin, reference or endpoint of the track. If neither of these
-// positions is present, all locations are assumed to be given in cm.
+// positions is present, all locations are assumed to be given in meter.
 // The lower and upper bounds for the range are specified by range[0] and
 // range[1] and the argument "iaxis" indicates along which axis this range
 // is specified.
@@ -291,7 +305,7 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
 
  if (!t || (range && !iaxis)) return;
 
- Double_t energy=t->GetEnergy();
+ Double_t energy=t->GetEnergy(1); // Track energy in GeV
  Double_t betanorm=t->GetBeta();
 
  if (energy<=0 || betanorm<=0) return;
@@ -308,7 +322,7 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
  // The unit scale for locations if not specified by the user
  if (scale<=0)
  {
-  scale=0.01; // Set default to cm
+  scale=1; // Set default to meter
   if (rbeg)
   {
    scale=rbeg->GetUnitScale();
@@ -351,29 +365,26 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
 
  // The LAB location in which the velocity of the particle is defined
  Double_t loc[3]={0,0,0};
- Ali3Vector* rx=0;
- Double_t scalex=0;
+ Ali3Vector rx;
+ Double_t scalex=-1;
  if (rref)
  {
-  rx=(Ali3Vector*)rref;
+  rx=(Ali3Vector)(*rref);
   scalex=rref->GetUnitScale();
  }
  else if (rbeg)
  {
-  rx=(Ali3Vector*)rbeg;
+  rx=(Ali3Vector)(*rbeg);
   scalex=rbeg->GetUnitScale();
  }
  else if (rend)
  {
-  rx=(Ali3Vector*)rend;
+  rx=(Ali3Vector)(*rend);
   scalex=rend->GetUnitScale();
  }
 
- if (rx)
- {
-  if (scalex/scale>1.1 || scale/scalex>1.1) (*rx)*=scalex/scale;
-  rx->GetVector(loc,"car");
- }
+ if (scalex>0 && (scalex/scale>1.1 || scale/scalex>1.1)) rx*=scalex/scale;
+ rx.GetVector(loc,"car");
 
  // Initialisation of Helix kinematics
  SetHelix(loc,vel,w,0,kUnchanged,bvec);
@@ -394,8 +405,8 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
  Double_t vec2[3]={0,0,0};
  Ali3Vector r1;
  Ali3Vector r2;
- Double_t scale1=0.01;
- Double_t scale2=0.01;
+ Double_t scale1=1;
+ Double_t scale2=1;
 
  if (!bend)
  {
@@ -431,7 +442,7 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
    // generated in view of accuracy in the case of extrapolations.
    tof=tmax-tmin;
    v=beta*c;
-   if (rx) r1=(*rx);
+   r1=rx;
    r=v*tmin;
    r1=r1+r;
    r1.GetVector(vec1,"car");
@@ -454,7 +465,7 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
    tmin=0;
    if (fabs(fVz)>0) tmin=-fZ0/fVz;
    v=beta*c;
-   if (rx) r1=(*rx);
+   r1=rx;
    r=v*tmin;
    r1=r1+r;
 
@@ -512,8 +523,8 @@ void AliHelix::MakeCurve(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
 
   if (!range) // Automatic range determination
   {
-   scale1=0.01;
-   scale2=0.01;
+   scale1=1;
+   scale2=1;
    if (rbeg)
    {
     r1=rbeg->GetPrimed(fRotMat);
@@ -626,12 +637,12 @@ void AliHelix::Display(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
 // Various curves can be displayed together or individually; please refer to
 // the memberfunction Refresh() for further details.
 // It is assumed that the track charge is stored in elementary units
-// (i.e. charge=1 for a proton) and that the track energy is stored in GeV.
+// (i.e. charge=1 for a proton).
 // The input argument "scale" specifies the unit scale for the various
 // locations where scale=0.01 indicates unit scales in cm etc...
 // In case scale<=0, the unit scale for locations is determined from the
 // begin, reference or endpoint of the track. If neither of these
-// positions is present, all locations are assumed to be given in cm.
+// positions is present, all locations are assumed to be given in meter.
 // The lower and upper bounds for the range are specified by range[0] and
 // range[1] and the argument "iaxis" indicates along which axis this range
 // is specified.
@@ -665,6 +676,9 @@ void AliHelix::Display(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
 // TView* view=new TView(1);
 // view->SetRange(-1000,-1000,-1000,1000,1000,1000);
 // view->ShowAxis();
+//
+// The user can also use the 3D viewing facilities from the TCanvas menu
+// to open an appropriate view. 
 
  if (!t || (range && !iaxis)) return;
 
@@ -672,17 +686,24 @@ void AliHelix::Display(AliTrack* t,Double_t* range,Int_t iaxis,Double_t scale)
 
  if (fRefresh>0) Refresh(fRefresh);
 
- Int_t np=GetN();
+ Int_t np=GetLastPoint()+1;
  if (!np) return;
 
  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)
@@ -742,6 +763,9 @@ void AliHelix::Display(AliEvent* evt,Double_t* range,Int_t iaxis,Double_t scale)
 // TView* view=new TView(1);
 // view->SetRange(-1000,-1000,-1000,1000,1000,1000);
 // view->ShowAxis();
+//
+// The user can also use the 3D viewing facilities from the TCanvas menu
+// to open an appropriate view. 
 
  if (!evt) return;
 
@@ -755,6 +779,44 @@ void AliHelix::Display(AliEvent* evt,Double_t* range,Int_t iaxis,Double_t scale)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+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();
+//
+// The user can also use the 3D viewing facilities from the TCanvas menu
+// to open an appropriate view. 
+
+ 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
@@ -764,12 +826,12 @@ AliPosition* AliHelix::Extrapolate(AliTrack* t,Double_t* pars,Double_t scale)
 // Detailed information of all the helix points used in the extrapolation
 // can be obtained via the GetN() and GetP() memberfunctions of TPolyLine3D.
 // It is assumed that the track charge is stored in elementary units
-// (i.e. charge=1 for a proton) and that the track energy is stored in GeV.
+// (i.e. charge=1 for a proton).
 // The input argument "scale" specifies the unit scale for the various
 // locations where scale=0.01 indicates unit scales in cm etc...
 // In case scale<=0, the unit scale for locations is determined from the
 // begin, reference or endpoint of the track. If neither of these
-// positions is present, all locations are assumed to be given in cm.
+// positions is present, all locations are assumed to be given in meter.
 // The extrapolation parameters for the impact plane and required accuracy
 // are specified by pars[0], pars[1] and pars[2], respectively.
 // pars[0] = coordinate value of the plane for the impact point
@@ -810,7 +872,7 @@ AliPosition* AliHelix::Extrapolate(AliTrack* t,Double_t* pars,Double_t scale)
  // The unit scale for locations if not specified by the user
  if (scale<=0)
  {
-  scale=0.01; // Set default to cm
+  scale=1; // Set default to meter
   if (rbeg)
   {
    scale=rbeg->GetUnitScale();
@@ -833,7 +895,7 @@ AliPosition* AliHelix::Extrapolate(AliTrack* t,Double_t* pars,Double_t scale)
 
  MakeCurve(t,range,iaxis,scale);
 
- Int_t np=GetN();
+ Int_t np=GetLastPoint()+1;
  if (!np) return fExt;
 
  Float_t* points=GetP();
@@ -843,7 +905,7 @@ AliPosition* AliHelix::Extrapolate(AliTrack* t,Double_t* pars,Double_t scale)
  Float_t first[3]={points[3*ip],points[3*ip+1],points[3*ip+2]};
 
  // Last point of the curve around the impact
- ip=np-1;
+ ip=GetLastPoint();
  Float_t last[3]={points[3*ip],points[3*ip+1],points[3*ip+2]};
 
  // The accuracy on the impact point