]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/hlt-macros/hlt_esd_tracks.C
-Added HLT test clusters to onlineDisplay macro,
[u/mrichter/AliRoot.git] / EVE / hlt-macros / hlt_esd_tracks.C
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
33 AliEveTrack* 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   }
65
66   TEveRecTrack rt;
67   {
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);    
74     rt.fV.Set(vbuf);
75     rt.fP.Set(pbuf);
76     Double_t ep = at->GetP(), mc = at->GetMass();
77     rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
78   }
79
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);
85
86
87   // Set reference points along the trajectory
88   // and the last point
89
90   { 
91     TEvePathMark startPoint(TEvePathMark::kReference);
92     trackParam.GetXYZ(vbuf);
93     trackParam.GetPxPyPz(pbuf);    
94     startPoint.fV.Set(vbuf);
95     startPoint.fP.Set(pbuf);
96     rt.fV.Set(vbuf);
97     rt.fP.Set(pbuf);
98     Double_t ep = at->GetP(), mc = at->GetMass();
99     rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
100
101     track->AddPathMark( startPoint );    
102   }
103
104
105   if( at->GetTPCPoints(2)>80 ){
106   
107     //
108     // use AliHLTTPCCATrackParam propagator 
109     // since AliExternalTrackParam:PropagateTo()
110     // has an offset at big distances
111     //
112     
113     AliHLTTPCCATrackParam t;
114     AliHLTTPCCATrackConvertor::SetExtParam( t, trackParam );
115     
116     Double_t x0 = trackParam.GetX();
117     Double_t dx = at->GetTPCPoints(2) - x0;
118     
119     //
120     // set a reference at the half of trajectory for better drawing
121     //
122     
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 );
132       break;
133     }
134     
135     //
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
138     //
139     
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 );
153       break;
154     }  
155   }
156
157   if (at->IsOn(AliESDtrack::kTPCrefit))
158   {
159     if ( ! innerTaken)
160     {
161       esd_track_add_param(track, at->GetInnerParam());
162     }
163     esd_track_add_param(track, at->GetOuterParam());
164   }
165
166
167   return track;
168 }
169