]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/hlt-macros/hlt_esd_tracks.C
Changes in order to modify also ITSonly tracks
[u/mrichter/AliRoot.git] / EVE / hlt-macros / hlt_esd_tracks.C
CommitLineData
cfa641b1 1// $Id: esd_tracks.C 35148 2009-10-01 11:21:06Z mtadel $
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
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 **************************************************************************/
9
10#if !defined(__CINT__) || defined(__MAKECINT__)
11
12#include "TString.h"
13#include "TMath.h"
14#include "TGListTree.h"
15#include "TEveVSDStructs.h"
16#include "TEveManager.h"
17#include "TEveTrackPropagator.h"
18
19#include "AliESDEvent.h"
20#include "AliESDtrackCuts.h"
21#include "AliESDtrack.h"
22#include "AliExternalTrackParam.h"
23
24#include "EVE/EveBase/AliEveTrack.h"
25#include "EVE/EveBase/AliEveMagField.h"
26#include "EVE/EveBase/AliEveEventManager.h"
27
28#include "AliHLTTPCCATrackParam.h"
29#include "AliHLTTPCCATrackConvertor.h"
30
31#endif
32
33AliEveTrack* hlt_esd_make_track(AliESDtrack *at, TEveTrackList* cont)
34{
35 // Make a standard track representation and put it into given container.
36
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.
40
41 const double kCLight = 0.000299792458;
42 double bz = - kCLight*10.*( cont->GetPropagator()->GetMagField(0,0,0).fZ);
43
44 Bool_t innerTaken = kFALSE;
45 if ( ! at->IsOn(AliESDtrack::kITSrefit) && g_esd_tracks_use_ip_on_failed_its_refit)
46 {
47 //tp = at->GetInnerParam();
48 innerTaken = kTRUE;
49 }
50
51 // Add inner/outer track parameters as path-marks.
52
53 Double_t pbuf[3], vbuf[3];
54
55 AliExternalTrackParam trackParam = *at;
56
57 // take parameters constrained to vertex (if they are)
58
59 if( at->GetConstrainedParam() ){
60 trackParam = *at->GetConstrainedParam();
61 }
62 else if( at->GetInnerParam() ){
63 trackParam = *(at->GetInnerParam());
64 }
b9f243f4 65 if( at->GetStatus()&AliESDtrack::kTRDin ){
66 // transport to TRD in
67 trackParam = *at;
68 trackParam.PropagateTo( 290.45, -10.*( cont->GetPropagator()->GetMagField(0,0,0).fZ) );
69 }
cfa641b1 70
71 TEveRecTrack rt;
72 {
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);
79 rt.fV.Set(vbuf);
80 rt.fP.Set(pbuf);
81 Double_t ep = at->GetP(), mc = at->GetMass();
82 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
83 }
84
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);
90
91
92 // Set reference points along the trajectory
93 // and the last point
94
95 {
96 TEvePathMark startPoint(TEvePathMark::kReference);
97 trackParam.GetXYZ(vbuf);
98 trackParam.GetPxPyPz(pbuf);
99 startPoint.fV.Set(vbuf);
100 startPoint.fP.Set(pbuf);
101 rt.fV.Set(vbuf);
102 rt.fP.Set(pbuf);
103 Double_t ep = at->GetP(), mc = at->GetMass();
104 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
105
106 track->AddPathMark( startPoint );
107 }
108
109
110 if( at->GetTPCPoints(2)>80 ){
111
112 //
113 // use AliHLTTPCCATrackParam propagator
114 // since AliExternalTrackParam:PropagateTo()
115 // has an offset at big distances
116 //
117
118 AliHLTTPCCATrackParam t;
119 AliHLTTPCCATrackConvertor::SetExtParam( t, trackParam );
120
121 Double_t x0 = trackParam.GetX();
122 Double_t dx = at->GetTPCPoints(2) - x0;
123
124 //
125 // set a reference at the half of trajectory for better drawing
126 //
127
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 );
137 break;
138 }
139
140 //
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
143 //
144
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 );
158 break;
159 }
160 }
161
162 if (at->IsOn(AliESDtrack::kTPCrefit))
163 {
164 if ( ! innerTaken)
165 {
166 esd_track_add_param(track, at->GetInnerParam());
167 }
168 esd_track_add_param(track, at->GetOuterParam());
169 }
170
171
172 return track;
173}
174