Added function demonstrating use of per-quad object-ref.
[u/mrichter/AliRoot.git] / EVE / macros / trackcount_init.C
CommitLineData
6f2dc95a 1Reve::TrackCounter* g_trkcnt = 0;
2
3void trackcount_init()
4{
5 Reve::LoadMacro("alieve_init.C");
6 alieve_init(".", -1);
7
8 {
9 TGLViewer* glv = dynamic_cast<TGLViewer*>(gReve->GetGLCanvas()->GetViewer3D());
10 glv->SetIgnoreSizesOnUpdate(kTRUE);
11 // The size of ortho cameras can not be set in advance.
12 // glv->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, -0.1, 0.1, 0.1, -0.1);
13 // glv->SetOrthoCamera(TGLViewer::kCameraOrthoZOY, -22, 22, 22, -22);
14 }
15
16 g_trkcnt = new Reve::TrackCounter("Primary Counter");
17 gReve->AddGlobalRenderElement(g_trkcnt);
18
19 Alieve::gEvent->AddNewEventCommand("on_new_event();");
20 Alieve::gEvent->GotoEvent(0);
21}
22
23void on_new_event()
24{
25 Reve::LoadMacro("primary_vertex.C");
26 Reve::LoadMacro("esd_tracks.C");
27 Reve::LoadMacro("its_hits.C");
28 Reve::LoadMacro("tpc_hits.C");
29
30 Reve::PointSet* p = its_hits();
31 p->SetMarkerStyle(4);
32
33 primary_vertex(1, 1);
34
35 Reve::RenderElementList* cont = esd_tracks_vertex_cut();
36 TGListTree* lt = gReve->GetListTree();
37 TGListTreeItem* ti = cont->FindListTreeItem(lt);
38 lt->OpenItem(ti);
39
40 // Here we expect five TrackList containers.
41 // First two have reasonable primaries (sigma-to-prim-vertex < 5).
42 // Other three are almost certainly secondaries.
43 Int_t count = 1;
44 g_trkcnt->Reset();
ae4998fc 45 Reve::RenderElement::List_i i = cont->BeginChildren();
6f2dc95a 46 while (i != cont->EndChildren()) {
47 Reve::TrackList* l = dynamic_cast<Reve::TrackList*>(*i);
48 if (l != 0) {
49 l->SetWidth(2);
50 g_trkcnt->RegisterTracks(l, (count <= 2));
51 ++count;
52 }
53 ++i;
54 }
55}
56
57void id(Int_t label=0, Bool_t showParents=kFALSE)
58{
59 AliRunLoader* rl = Alieve::Event::AssertRunLoader();
60 rl->LoadKinematics();
61 AliStack* stack = rl->Stack();
62
63 printf("Number primaries %d %d\n", stack->GetNprimary(), stack->GetNtrack());
64
65 TParticle* part = stack->Particle(label);
66 if(part != 0) {
67 part->Print();
68 if(showParents) {
69 while(part->GetMother(0) >= 0) {
70 part = stack->Particle(part->GetMother(0));
71 part->Print();
72 }
73 }
74 }
75}