2 // Author: Matevz Tadel 2009
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 #include "AliEveTrack.h"
12 #include "AliESDtrack.h"
13 #include "AliAODTrack.h"
17 //______________________________________________________________________________
18 // Full description of AliEveTrack
23 //______________________________________________________________________________
24 AliEveTrack::AliEveTrack() :
30 //______________________________________________________________________________
31 AliEveTrack::AliEveTrack(TParticle* t, Int_t label, TEveTrackPropagator* prop) :
32 TEveTrack(t, label, prop)
37 //______________________________________________________________________________
38 AliEveTrack::AliEveTrack(TEveMCTrack* t, TEveTrackPropagator* prop) :
44 //______________________________________________________________________________
45 AliEveTrack::AliEveTrack(TEveRecTrack* t, TEveTrackPropagator* prop) :
51 //______________________________________________________________________________
52 AliEveTrack::AliEveTrack(AliESDtrack* t, TEveTrackPropagator* prop) :
58 t->GetXYZ(buf); fV.Set(buf);
59 t->GetPxPyPz(buf); fP.Set(buf);
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();
66 fLabel = t->GetLabel();
68 // fStatus = (Int_t) t->GetStatus(); // RRRR Uncomment for root-5.26.
73 //______________________________________________________________________________
74 AliEveTrack::AliEveTrack(AliAODTrack* t, TEveTrackPropagator* prop) :
81 t->GetXYZ(buf); fV.Set(buf);
82 t->PxPyPz(buf); fP.Set(buf);
84 // fBeta = 0; // Unknown, no mass function
85 // fPdg = 0; // ??? Use PID ?
88 fLabel = t->GetLabel();
90 // fStatus = (Int_t) t->GetStatus(); // RRRR Uncomment for root-5.26.
95 //______________________________________________________________________________
96 AliEveTrack::AliEveTrack(const AliEveTrack& t) :
102 //______________________________________________________________________________
103 AliEveTrack::~AliEveTrack()
108 /******************************************************************************/
110 //______________________________________________________________________________
111 void AliEveTrack::ImportHits()
113 // Import hits with same label as the track.
114 // Uses macro "hits_from_label.C".
116 TEveUtil::LoadMacro("hits_from_label.C");
117 gROOT->ProcessLine(Form("hits_from_label(%d, (TEveElement*)%p);",
121 //______________________________________________________________________________
122 void AliEveTrack::ImportClusters()
124 // Import clusters with same label as the track.
125 // Uses macro "clusters_from_label.C".
127 TEveUtil::LoadMacro("clusters_from_label.C");
128 gROOT->ProcessLine(Form("clusters_from_label(%d, (TEveElement*)%p);",
132 //______________________________________________________________________________
133 void AliEveTrack::ImportClustersFromIndex()
135 // Import clusters marked with same reconstructed track index as the track.
136 // Uses macro "clusters_from_index.C".
138 static const TEveException kEH("AliEveTrack::ImportClustersFromIndex ");
140 if (fIndex == kMinInt)
141 throw(kEH + "index not set.");
143 TEveUtil::LoadMacro("clusters_from_index.C");
144 gROOT->ProcessLine(Form("clusters_from_index(%d, (TEveElement*)%p);",
148 /******************************************************************************/
150 //______________________________________________________________________________
151 void AliEveTrack::ImportKine()
153 // Import kinematics of the track's label recursively.
154 // Uses macro "kine_tracks.C".
156 static const TEveException kEH("AliEveTrack::ImportKine ");
158 if (fLabel == kMinInt)
159 throw(kEH + "label not set.");
163 Warning(kEH, "label negative, taking absolute value.");
169 TEveUtil::LoadMacro("kine_tracks.C");
170 gROOT->ProcessLine(Form("kine_track(%d, kTRUE, kTRUE, kTRUE, kTRUE, (TEveElement*)%p);",
175 //______________________________________________________________________________
176 void AliEveTrack::ImportKineWithArgs(Bool_t importMother, Bool_t importDaugters,
177 Bool_t colorPdg, Bool_t recurse)
179 // Import kinematics of the track's label. Arguments steer the
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".
187 static const TEveException kEH("AliEveTrack::ImportKineWithArgs ");
189 if (fLabel == kMinInt)
190 throw(kEH + "label not set.");
194 Warning(kEH, "label negative, taking absolute value.");
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));
205 //______________________________________________________________________________
206 void AliEveTrack::PrintKineStack()
208 // Print kinematics pertaining to track's label.
209 // Uses macro "print_kine_from_label.C".
211 static const TEveException kEH("AliEveTrack::PrintKineStack ");
213 if (fLabel == kMinInt)
214 throw(kEH + "label not set.");
218 Warning(kEH, "label negative, taking absolute value.");
224 TEveUtil::LoadMacro("print_kine_from_label.C");
225 gROOT->ProcessLine(Form("print_kine_from_label(%d);", label));
228 //______________________________________________________________________________
229 void AliEveTrack::SecSelected(TEveTrack* track)
231 // Emits "SecSelected(TEveTrack*)" signal.
232 // Called from TEveTrackGL on secondary-selection.
234 Emit("SecSelected(TEveTrack*)", (Long_t)track);
235 SecSelectedTrack((AliEveTrack*) track);
238 //______________________________________________________________________________
239 void AliEveTrack::SecSelectedTrack(AliEveTrack* track)
241 // Emits "SecSelectedTrack(AliEveTrack*)" signal.
243 Emit("SecSelectedTrack(AliEveTrack*)", (Long_t)track);
246 //______________________________________________________________________________
247 AliESDtrack* AliEveTrack::GetESDTrack() const
249 // Return source object dyn-casted to AliESDtrack.
251 return dynamic_cast<AliESDtrack*>(GetSourceObject());
254 //______________________________________________________________________________
255 AliAODTrack* AliEveTrack::GetAODTrack() const
257 // Return source object dyn-casted to AliAODTrack.
259 return dynamic_cast<AliAODTrack*>(GetSourceObject());