e9b9f7d2 |
1 | // $Id: NLT_trackcount_init.C 24927 2008-04-04 13:46:04Z 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 | class TEveProjectionManager; |
11 | class TEveGeoShape; |
12 | class TEveUtil; |
13 | |
14 | R__EXTERN TEveProjectionManager *gRPhiMgr; |
15 | R__EXTERN TEveProjectionManager *gRhoZMgr; |
16 | |
17 | TEveGeoShape *gGeomGentle = 0; |
18 | |
19 | void visscan_init() |
20 | { |
21 | TEveUtil::LoadMacro("alieve_init.C"); |
22 | alieve_init(".", -1); |
23 | |
24 | TEveUtil::LoadMacro("geom_gentle.C"); |
25 | |
26 | TEveUtil::LoadMacro("primary_vertex.C"); |
27 | TEveUtil::LoadMacro("esd_tracks.C"); |
28 | TEveUtil::LoadMacro("its_clusters.C+"); |
29 | TEveUtil::LoadMacro("tpc_clusters.C+"); |
30 | |
31 | TEveLine::SetDefaultSmooth(1); |
32 | |
33 | /* |
34 | TEveViewer* nv = gEve->SpawnNewViewer("NLT Projected"); |
35 | TEveScene* ns = gEve->SpawnNewScene("NLT"); |
36 | nv->AddScene(ns); |
37 | TGLViewer* v = nv->GetGLViewer(); |
38 | v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); |
39 | TGLCameraMarkupStyle* mup = v->GetCameraMarkup(); |
40 | if(mup) mup->SetShow(kFALSE); |
41 | */ |
42 | |
43 | AliEveTrackFitter* fitter = new AliEveTrackFitter(); |
44 | gEve->AddToListTree(fitter, 1); |
45 | gEve->AddElement(fitter, gEve->GetEventScene()); |
46 | |
47 | TEveTrackCounter* g_trkcnt = new TEveTrackCounter("Primary Counter"); |
48 | gEve->AddToListTree(g_trkcnt, kFALSE); |
49 | |
50 | |
51 | // geometry |
52 | gGeomGentle = geom_gentle(); |
53 | |
54 | |
55 | gROOT->ProcessLine(".L SplitGLView.C+g"); // !!!! debug-mode |
56 | TEveBrowser* browser = gEve->GetBrowser(); |
57 | browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)"); |
58 | |
59 | if (gRPhiMgr) { |
60 | TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr); |
61 | a->SetNumTickMarks(3); |
62 | a->SetText("R-Phi"); |
63 | a->SetFontFile("comicbd"); |
64 | a->SetFontSize(10); |
65 | gEve->GetScenes()->FindChild("R-Phi Projection")->AddElement(a); |
66 | gRPhiMgr->ImportElements(gGeomGentle); |
67 | } |
68 | if (gRhoZMgr) { |
69 | TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr); |
70 | a->SetNumTickMarks(3); |
71 | a->SetText("Rho-Z"); |
72 | a->SetFontFile("comicbd"); |
73 | a->SetFontSize(10); |
74 | gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a); |
75 | gRhoZMgr->ImportElements(gGeomGentle); |
76 | } |
77 | |
78 | // event |
79 | gAliEveEvent->AddNewEventCommand("on_new_event();"); |
80 | gAliEveEvent->GotoEvent(0); |
81 | |
82 | gEve->Redraw3D(kTRUE); |
83 | } |
84 | |
85 | /******************************************************************************/ |
86 | |
87 | void on_new_event() |
88 | { |
89 | try { |
90 | TEvePointSet* itsc = its_clusters(); |
91 | itsc->SetMarkerColor(5); |
92 | |
93 | TEvePointSet* tpcc = tpc_clusters(); |
94 | tpcc->SetMarkerColor(4); |
95 | } |
96 | catch(TEveException& exc) { |
97 | printf("Exception loading ITS/TPC clusters: %s\n", exc.Data()); |
98 | } |
99 | |
100 | primary_vertex(1, 1); |
101 | |
102 | TEveElementList* cont = esd_tracks_vertex_cut(); |
103 | |
104 | // Here we expect five TEveTrackList containers. |
105 | // First two have reasonable primaries (sigma-to-prim-vertex < 5). |
106 | // Other three are almost certainly secondaries. |
107 | Int_t count = 1; |
108 | TEveTrackCounter* g_trkcnt = TEveTrackCounter::fgInstance; |
109 | g_trkcnt->Reset(); |
110 | g_trkcnt->SetEventId(gAliEveEvent->GetEventId()); |
111 | TEveElement::List_i i = cont->BeginChildren(); |
112 | while (i != cont->EndChildren()) { |
113 | TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i); |
114 | if (l != 0) { |
115 | // l->SetLineWidth(2); |
116 | g_trkcnt->RegisterTracks(l, (count <= 2)); |
117 | ++count; |
118 | } |
119 | ++i; |
120 | } |
121 | |
122 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
123 | Double_t x[3]; |
124 | esd->GetPrimaryVertex()->GetXYZ(x); |
125 | |
126 | TEveElement* top = gEve->GetCurrentEvent(); |
127 | |
128 | if (gRPhiMgr && top) { |
129 | gRPhiMgr->DestroyElements(); |
130 | gRPhiMgr->SetCenter(x[0], x[1], x[2]); |
131 | gRPhiMgr->ImportElements(gGeomGentle); |
132 | gRPhiMgr->ImportElements(top); |
133 | } |
134 | if (gRhoZMgr && top) { |
135 | gRhoZMgr->DestroyElements(); |
136 | gRhoZMgr->SetCenter(x[0], x[1], x[2]); |
137 | gRhoZMgr->ImportElements(gGeomGentle); |
138 | gRhoZMgr->ImportElements(top); |
139 | } |
140 | |
141 | gROOT->ProcessLine("SplitGLView::UpdateSummary()"); |
142 | } |
143 | |
144 | /******************************************************************************/ |
145 | |
146 | TParticle* id(Int_t label=0, Bool_t showParents=kTRUE) |
147 | { |
148 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); |
149 | rl->LoadKinematics(); |
150 | AliStack* stack = rl->Stack(); |
151 | |
152 | printf("Number primaries %d, all particles %d, label %d\n", |
153 | stack->GetNprimary(), stack->GetNtrack(), label); |
154 | if (label < 0 || label >= stack->GetNtrack()) { |
155 | printf(" Label exceeds available range.\n"); |
156 | return 0; |
157 | } |
158 | |
159 | TParticle* part = stack->Particle(label); |
160 | if (part != 0) { |
161 | part->Print(); |
162 | if (showParents) { |
163 | while (part->GetMother(0) >= 0) { |
164 | part = stack->Particle(part->GetMother(0)); |
165 | part->Print(); |
166 | } |
167 | } |
168 | } |
169 | return stack->Particle(label); |
170 | } |