New file: visualize tracks from kinematics tree; minimal implementation.
[u/mrichter/AliRoot.git] / EVE / alice-macros / kine_tracks.C
CommitLineData
1b337638 1// Import tracks from kinematics-tree / particle-stack.
2// Preliminary/minimal solution.
3
4Reve::TrackList* kine_tracks(Double_t min_pt=0.5, Double_t max_pt=100)
5{
6 AliRunLoader* rl = Alieve::Event::AssertRunLoader();
7 rl->LoadKinematics();
8 AliStack* stack = rl->Stack();
9 if (!stack) {
10 Error("kine_tracks.C", "can not get kinematics.");
11 return 0;
12 }
13
14 Reve::TrackList* cont = new Reve::TrackList("Kine Tracks");
15 cont->SetMainColor(Color_t(6));
16 Reve::TrackRnrStyle* rnrStyle = cont->GetRnrStyle();
17 rnrStyle->fColor = 8;
18 // !!! Watch the '-', apparently different sign convention then for ESD.
19 rnrStyle->SetMagField( - gAlice->Field()->SolenoidField() )
20
21 gReve->AddRenderElement(cont);
22
23 Int_t count = 0;
24 Int_t N = stack->GetNtrack();
25 for (Int_t i=0; i<N; ++i) {
26 TParticle* p = stack->Particle(i);
27 Double_t pT = p->Pt();
28 if (pT<min_pt || pT>max_pt) continue;
29
30 ++count;
31 Reve::Track* track = new Reve::Track(p, i, rnrStyle);
32 track->SetName(Form("%s [%d]", p->GetName(), i));
33 gReve->AddRenderElement(cont, track);
34 }
35
36 const Text_t* tooltip = Form("pT ~ (%.2lf, %.2lf), N=%d", min_pt, max_pt, count);
37 cont->SetTitle(tooltip); // Not broadcasted automatically ...
38 cont->UpdateItems();
39
40 cont->MakeTracks();
41 cont->MakeMarkers();
42 gReve->Redraw3D();
43
44 return cont;
45}