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());
65 if( at->GetStatus()&AliESDtrack::kTRDin ){
66 // transport to TRD in
68 trackParam.PropagateTo( 290.45, -10.*( cont->GetPropagator()->GetMagField(0,0,0).fZ) );
73 rt.fLabel = at->GetLabel();
74 rt.fIndex = (Int_t) at->GetID();
75 rt.fStatus = (Int_t) at->GetStatus();
76 rt.fSign = (Int_t) trackParam.GetSign();
77 trackParam.GetXYZ(vbuf);
78 trackParam.GetPxPyPz(pbuf);
81 Double_t ep = at->GetP(), mc = at->GetMass();
82 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
85 AliEveTrack* track = new AliEveTrack(&rt, cont->GetPropagator());
86 track->SetAttLineAttMarker(cont);
87 track->SetName(Form("AliEveTrack %d", at->GetID()));
88 track->SetElementTitle(esd_track_title(at));
89 track->SetSourceObject(at);
92 // Set reference points along the trajectory
96 TEvePathMark startPoint(TEvePathMark::kReference);
97 trackParam.GetXYZ(vbuf);
98 trackParam.GetPxPyPz(pbuf);
99 startPoint.fV.Set(vbuf);
100 startPoint.fP.Set(pbuf);
103 Double_t ep = at->GetP(), mc = at->GetMass();
104 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
106 track->AddPathMark( startPoint );
110 if( at->GetTPCPoints(2)>80 ){
113 // use AliHLTTPCCATrackParam propagator
114 // since AliExternalTrackParam:PropagateTo()
115 // has an offset at big distances
118 AliHLTTPCCATrackParam t;
119 AliHLTTPCCATrackConvertor::SetExtParam( t, trackParam );
121 Double_t x0 = trackParam.GetX();
122 Double_t dx = at->GetTPCPoints(2) - x0;
125 // set a reference at the half of trajectory for better drawing
128 for( double dxx=dx/2; TMath::Abs(dxx)>=1.; dxx*=.9 ){
129 if( !t.TransportToX(x0+dxx, bz, .99 ) ) continue;
130 AliHLTTPCCATrackConvertor::GetExtParam( t, trackParam, trackParam.GetAlpha() );
131 trackParam.GetXYZ(vbuf);
132 trackParam.GetPxPyPz(pbuf);
133 TEvePathMark midPoint(TEvePathMark::kReference);
134 midPoint.fV.Set(vbuf);
135 midPoint.fP.Set(pbuf);
136 track->AddPathMark( midPoint );
141 // Set a reference at the end of the trajectory
142 // and a "decay point", to let the event display know where the track ends
145 for( ; TMath::Abs(dx)>=1.; dx*=.9 ){
146 if( !t.TransportToX(x0+dx, bz, .99 ) ) continue;
147 AliHLTTPCCATrackConvertor::GetExtParam( t, trackParam, trackParam.GetAlpha() );
148 trackParam.GetXYZ(vbuf);
149 trackParam.GetPxPyPz(pbuf);
150 TEvePathMark endPoint(TEvePathMark::kReference);
151 TEvePathMark decPoint(TEvePathMark::kDecay);
152 endPoint.fV.Set(vbuf);
153 endPoint.fP.Set(pbuf);
154 decPoint.fV.Set(vbuf);
155 decPoint.fP.Set(pbuf);
156 track->AddPathMark( endPoint );
157 track->AddPathMark( decPoint );
162 if (at->IsOn(AliESDtrack::kTPCrefit))
166 esd_track_add_param(track, at->GetInnerParam());
168 esd_track_add_param(track, at->GetOuterParam());