1 // $Id: esd_tracks.C 35148 2009-10-01 11:21:06Z mtadel $
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #if !defined(__CINT__) || defined(__MAKECINT__)
14 #include "TGListTree.h"
15 #include "TEveVSDStructs.h"
16 #include "TEveManager.h"
17 #include "TEveTrackPropagator.h"
19 #include "AliESDEvent.h"
20 #include "AliESDtrackCuts.h"
21 #include "AliESDtrack.h"
22 #include "AliExternalTrackParam.h"
24 #include "EVE/EveBase/AliEveTrack.h"
25 #include "EVE/EveBase/AliEveMagField.h"
26 #include "EVE/EveBase/AliEveEventManager.h"
28 #include "AliHLTTPCCATrackParam.h"
29 #include "AliHLTTPCCATrackConvertor.h"
33 AliEveTrack* hlt_esd_make_track(AliESDtrack *at, TEveTrackList* cont)
35 // Make a standard track representation and put it into given container.
37 // Choose which parameters to use a track's starting point.
38 // If gkFixFailedITSExtr is TRUE (FALSE by default) and
39 // if ITS refit failed, take track parameters at inner TPC radius.
41 const double kCLight = 0.000299792458;
42 double bz = - kCLight*10.*( cont->GetPropagator()->GetMagField(0,0,0).fZ);
44 Bool_t innerTaken = kFALSE;
45 if ( ! at->IsOn(AliESDtrack::kITSrefit) && g_esd_tracks_use_ip_on_failed_its_refit)
47 //tp = at->GetInnerParam();
51 // Add inner/outer track parameters as path-marks.
53 Double_t pbuf[3], vbuf[3];
55 AliExternalTrackParam trackParam = *at;
57 // take parameters constrained to vertex (if they are)
59 if( at->GetConstrainedParam() ){
60 trackParam = *at->GetConstrainedParam();
62 else if( at->GetInnerParam() ){
63 trackParam = *(at->GetInnerParam());
68 rt.fLabel = at->GetLabel();
69 rt.fIndex = (Int_t) at->GetID();
70 rt.fStatus = (Int_t) at->GetStatus();
71 rt.fSign = (Int_t) trackParam.GetSign();
72 trackParam.GetXYZ(vbuf);
73 trackParam.GetPxPyPz(pbuf);
76 Double_t ep = at->GetP(), mc = at->GetMass();
77 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
80 AliEveTrack* track = new AliEveTrack(&rt, cont->GetPropagator());
81 track->SetAttLineAttMarker(cont);
82 track->SetName(Form("AliEveTrack %d", at->GetID()));
83 track->SetElementTitle(esd_track_title(at));
84 track->SetSourceObject(at);
87 // Set reference points along the trajectory
91 TEvePathMark startPoint(TEvePathMark::kReference);
92 trackParam.GetXYZ(vbuf);
93 trackParam.GetPxPyPz(pbuf);
94 startPoint.fV.Set(vbuf);
95 startPoint.fP.Set(pbuf);
98 Double_t ep = at->GetP(), mc = at->GetMass();
99 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
101 track->AddPathMark( startPoint );
105 if( at->GetTPCPoints(2)>80 ){
108 // use AliHLTTPCCATrackParam propagator
109 // since AliExternalTrackParam:PropagateTo()
110 // has an offset at big distances
113 AliHLTTPCCATrackParam t;
114 AliHLTTPCCATrackConvertor::SetExtParam( t, trackParam );
116 Double_t x0 = trackParam.GetX();
117 Double_t dx = at->GetTPCPoints(2) - x0;
120 // set a reference at the half of trajectory for better drawing
123 for( double dxx=dx/2; TMath::Abs(dxx)>=1.; dxx*=.9 ){
124 if( !t.TransportToX(x0+dxx, bz, .99 ) ) continue;
125 AliHLTTPCCATrackConvertor::GetExtParam( t, trackParam, trackParam.GetAlpha() );
126 trackParam.GetXYZ(vbuf);
127 trackParam.GetPxPyPz(pbuf);
128 TEvePathMark midPoint(TEvePathMark::kReference);
129 midPoint.fV.Set(vbuf);
130 midPoint.fP.Set(pbuf);
131 track->AddPathMark( midPoint );
136 // Set a reference at the end of the trajectory
137 // and a "decay point", to let the event display know where the track ends
140 for( ; TMath::Abs(dx)>=1.; dx*=.9 ){
141 if( !t.TransportToX(x0+dx, bz, .99 ) ) continue;
142 AliHLTTPCCATrackConvertor::GetExtParam( t, trackParam, trackParam.GetAlpha() );
143 trackParam.GetXYZ(vbuf);
144 trackParam.GetPxPyPz(pbuf);
145 TEvePathMark endPoint(TEvePathMark::kReference);
146 TEvePathMark decPoint(TEvePathMark::kDecay);
147 endPoint.fV.Set(vbuf);
148 endPoint.fP.Set(pbuf);
149 decPoint.fV.Set(vbuf);
150 decPoint.fP.Set(pbuf);
151 track->AddPathMark( endPoint );
152 track->AddPathMark( decPoint );
157 if (at->IsOn(AliESDtrack::kTPCrefit))
161 esd_track_add_param(track, at->GetInnerParam());
163 esd_track_add_param(track, at->GetOuterParam());