Remove obsolete comments about TTree::Refresh() not working.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveTrack.cxx
CommitLineData
0e33c639 1// $Id$
2// Author: Matevz Tadel 2009
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#include "AliEveTrack.h"
11
50ac85c6 12#include "AliESDtrack.h"
13#include "AliAODTrack.h"
14
0e33c639 15#include <TROOT.h>
16
17//______________________________________________________________________________
18// Full description of AliEveTrack
19//
20
21ClassImp(AliEveTrack)
22
23//______________________________________________________________________________
24AliEveTrack::AliEveTrack() :
25 TEveTrack()
26{
27 // Constructor.
28}
29
30//______________________________________________________________________________
50ac85c6 31AliEveTrack::AliEveTrack(TParticle* t, Int_t label, TEveTrackPropagator* prop) :
32 TEveTrack(t, label, prop)
33{
34 // Constructor.
35}
36
37//______________________________________________________________________________
38AliEveTrack::AliEveTrack(TEveMCTrack* t, TEveTrackPropagator* prop) :
39 TEveTrack(t, prop)
40{
41 // Constructor.
42}
43
44//______________________________________________________________________________
45AliEveTrack::AliEveTrack(TEveRecTrack* t, TEveTrackPropagator* prop) :
46 TEveTrack(t, prop)
0e33c639 47{
48 // Constructor.
49}
50
51//______________________________________________________________________________
50ac85c6 52AliEveTrack::AliEveTrack(AliESDtrack* t, TEveTrackPropagator* prop) :
53 TEveTrack()
0e33c639 54{
55 // Constructor.
50ac85c6 56
57 Double_t buf[3];
58 t->GetXYZ(buf); fV.Set(buf);
59 t->GetPxPyPz(buf); fP.Set(buf);
60
61 Double_t ep = t->GetP(), mc = t->GetMass();
62 fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
63 // fPdg = 0; // ??? Use PID ?
64 fCharge= t->GetSign();
65
66 fLabel = t->GetLabel();
67 fIndex = t->GetID();
68 // fStatus = (Int_t) t->GetStatus(); // RRRR Uncomment for root-5.26.
69
70 SetPropagator(prop);
0e33c639 71}
72
73//______________________________________________________________________________
50ac85c6 74AliEveTrack::AliEveTrack(AliAODTrack* t, TEveTrackPropagator* prop) :
75 TEveTrack()
0e33c639 76{
77 // Constructor.
50ac85c6 78
79 Double_t buf[3];
80
81 t->GetXYZ(buf); fV.Set(buf);
82 t->PxPyPz(buf); fP.Set(buf);
83
84 // fBeta = 0; // Unknown, no mass function
85 // fPdg = 0; // ??? Use PID ?
86 fCharge= t->Charge();
87
88 fLabel = t->GetLabel();
89 fIndex = t->GetID();
90 // fStatus = (Int_t) t->GetStatus(); // RRRR Uncomment for root-5.26.
91
92 SetPropagator(prop);
0e33c639 93}
94
95//______________________________________________________________________________
96AliEveTrack::AliEveTrack(const AliEveTrack& t) :
97 TEveTrack(t)
98{
99 // Copy constructor.
100}
101
102//______________________________________________________________________________
103AliEveTrack::~AliEveTrack()
104{
105 // Destructor.
106}
107
108/******************************************************************************/
109
110//______________________________________________________________________________
111void AliEveTrack::ImportHits()
112{
113 // Import hits with same label as the track.
114 // Uses macro "hits_from_label.C".
115
116 TEveUtil::LoadMacro("hits_from_label.C");
117 gROOT->ProcessLine(Form("hits_from_label(%d, (TEveElement*)%p);",
118 fLabel, this));
119}
120
121//______________________________________________________________________________
4267948f 122void AliEveTrack::ImportClustersFromLabel()
0e33c639 123{
124 // Import clusters with same label as the track.
125 // Uses macro "clusters_from_label.C".
126
127 TEveUtil::LoadMacro("clusters_from_label.C");
128 gROOT->ProcessLine(Form("clusters_from_label(%d, (TEveElement*)%p);",
129 fLabel, this));
130}
131
132//______________________________________________________________________________
133void AliEveTrack::ImportClustersFromIndex()
134{
135 // Import clusters marked with same reconstructed track index as the track.
136 // Uses macro "clusters_from_index.C".
137
138 static const TEveException kEH("AliEveTrack::ImportClustersFromIndex ");
139
140 if (fIndex == kMinInt)
141 throw(kEH + "index not set.");
142
143 TEveUtil::LoadMacro("clusters_from_index.C");
144 gROOT->ProcessLine(Form("clusters_from_index(%d, (TEveElement*)%p);",
145 fIndex, this));
146}
147
148/******************************************************************************/
149
150//______________________________________________________________________________
151void AliEveTrack::ImportKine()
152{
153 // Import kinematics of the track's label recursively.
154 // Uses macro "kine_tracks.C".
155
156 static const TEveException kEH("AliEveTrack::ImportKine ");
157
158 if (fLabel == kMinInt)
159 throw(kEH + "label not set.");
160
161 Int_t label;
162 if (fLabel < 0) {
163 Warning(kEH, "label negative, taking absolute value.");
164 label = -fLabel;
165 } else {
166 label = fLabel;
167 }
168
169 TEveUtil::LoadMacro("kine_tracks.C");
170 gROOT->ProcessLine(Form("kine_track(%d, kTRUE, kTRUE, kTRUE, kTRUE, (TEveElement*)%p);",
171 label, this));
172
173}
174
175//______________________________________________________________________________
176void AliEveTrack::ImportKineWithArgs(Bool_t importMother, Bool_t importDaugters,
177 Bool_t colorPdg, Bool_t recurse)
178{
179 // Import kinematics of the track's label. Arguments steer the
180 // import process:
181 // importMother import particle with track's label
182 // importDaugters import direct daughters of label
183 // colorPdg color kinematics by PDG code
184 // recurse recursive import of daughters' daughters
185 // Uses macro "kine_tracks.C".
186
187 static const TEveException kEH("AliEveTrack::ImportKineWithArgs ");
188
189 if (fLabel == kMinInt)
190 throw(kEH + "label not set.");
191
192 Int_t label;
193 if (fLabel < 0) {
194 Warning(kEH, "label negative, taking absolute value.");
195 label = -fLabel;
196 } else {
197 label = fLabel;
198 }
199
200 TEveUtil::LoadMacro("kine_tracks.C");
201 gROOT->ProcessLine(Form("kine_track(%d, %d, %d, %d, %d, (TEveElement*)%p);",
202 label, importMother, importDaugters, colorPdg, recurse, this));
203}
204
205//______________________________________________________________________________
206void AliEveTrack::PrintKineStack()
207{
208 // Print kinematics pertaining to track's label.
209 // Uses macro "print_kine_from_label.C".
210
211 static const TEveException kEH("AliEveTrack::PrintKineStack ");
212
213 if (fLabel == kMinInt)
214 throw(kEH + "label not set.");
215
216 Int_t label;
217 if (fLabel < 0) {
218 Warning(kEH, "label negative, taking absolute value.");
219 label = -fLabel;
220 } else {
221 label = fLabel;
222 }
223
224 TEveUtil::LoadMacro("print_kine_from_label.C");
225 gROOT->ProcessLine(Form("print_kine_from_label(%d);", label));
226}
3a20f984 227
228//______________________________________________________________________________
229void AliEveTrack::SecSelected(TEveTrack* track)
230{
231 // Emits "SecSelected(TEveTrack*)" signal.
232 // Called from TEveTrackGL on secondary-selection.
233
234 Emit("SecSelected(TEveTrack*)", (Long_t)track);
235 SecSelectedTrack((AliEveTrack*) track);
236}
237
238//______________________________________________________________________________
239void AliEveTrack::SecSelectedTrack(AliEveTrack* track)
240{
241 // Emits "SecSelectedTrack(AliEveTrack*)" signal.
242
243 Emit("SecSelectedTrack(AliEveTrack*)", (Long_t)track);
244}
bccc8088 245
246//______________________________________________________________________________
247AliESDtrack* AliEveTrack::GetESDTrack() const
248{
249 // Return source object dyn-casted to AliESDtrack.
250
251 return dynamic_cast<AliESDtrack*>(GetSourceObject());
252}
253
254//______________________________________________________________________________
255AliAODTrack* AliEveTrack::GetAODTrack() const
256{
257 // Return source object dyn-casted to AliAODTrack.
258
259 return dynamic_cast<AliAODTrack*>(GetSourceObject());
260}