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 | |
5e078eda |
17 | TEveGeoShape *gGeomGentle = 0; |
18 | TEveGeoShape *gGeomGentleRPhi = 0; |
19 | TEveGeoShape *gGeomGentleRhoZ = 0; |
20 | TEveGeoShape *gGeomGentleTRD = 0; |
503bfbc8 |
21 | |
22 | Bool_t gShowTRD = kFALSE; |
e9b9f7d2 |
23 | |
24 | void visscan_init() |
25 | { |
26 | TEveUtil::LoadMacro("alieve_init.C"); |
2142305c |
27 | alieve_init(".", -1, 0, 0, 0, 0, kFALSE, kTRUE, kFALSE, kFALSE); |
e9b9f7d2 |
28 | |
e9b9f7d2 |
29 | AliEveTrackFitter* fitter = new AliEveTrackFitter(); |
30 | gEve->AddToListTree(fitter, 1); |
31 | gEve->AddElement(fitter, gEve->GetEventScene()); |
32 | |
f76c9e9b |
33 | AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter"); |
e9b9f7d2 |
34 | gEve->AddToListTree(g_trkcnt, kFALSE); |
35 | |
68ca2fe7 |
36 | // Geometry |
f6afd0e1 |
37 | TEveUtil::LoadMacro("geom_gentle.C"); |
5e078eda |
38 | gGeomGentle = geom_gentle(); |
39 | gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy(); |
40 | gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy(); |
f6afd0e1 |
41 | if (gShowTRD) { |
42 | TEveUtil::LoadMacro("geom_gentle_trd.C"); |
43 | gGeomGentleTRD = geom_gentle_trd(); |
44 | } |
45 | |
68ca2fe7 |
46 | // Per event data |
f6afd0e1 |
47 | TEveUtil::LoadMacro("primary_vertex.C"); |
48 | TEveUtil::LoadMacro("esd_V0_points.C"); |
49 | TEveUtil::LoadMacro("esd_V0.C"); |
75b17362 |
50 | TEveUtil::LoadMacro("esd_cascade_points.C"); |
73ce6137 |
51 | TEveUtil::LoadMacro("esd_cascade.C"); |
f6afd0e1 |
52 | TEveUtil::LoadMacro("esd_tracks.C"); |
53 | TEveUtil::LoadMacro("its_clusters.C+"); |
54 | TEveUtil::LoadMacro("tpc_clusters.C+"); |
55 | TEveUtil::LoadMacro("trd_clusters.C+"); |
56 | TEveUtil::LoadMacro("tof_clusters.C+"); |
57 | |
df56539f |
58 | // TEveLine::SetDefaultSmooth(1); |
f6afd0e1 |
59 | |
60 | TEveBrowser* browser = gEve->GetBrowser(); |
68ca2fe7 |
61 | browser->ShowCloseTab(kFALSE); |
62 | |
63 | gROOT->ProcessLine(".L SplitGLView.C+"); |
64 | browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)"); |
65 | |
66 | browser->ShowCloseTab(kTRUE); |
f6afd0e1 |
67 | |
68 | browser->StartEmbedding(TRootBrowser::kBottom); |
ba5d58f2 |
69 | new AliEveEventManagerWindow(AliEveEventManager::GetMaster()); |
f6afd0e1 |
70 | browser->StopEmbedding("EventCtrl"); |
71 | |
68ca2fe7 |
72 | // Projections |
73 | if (gRPhiMgr) { |
74 | TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr); |
75 | a->SetMainColor(kWhite); |
76 | a->SetTitle("R-Phi"); |
77 | a->SetTitleSize(0.05); |
78 | a->SetTitleFontName("comicbd"); |
79 | a->SetLabelSize(0.025); |
80 | a->SetLabelFontName("comicbd"); |
81 | gEve->GetScenes()->FindChild("R-Phi Projection")->AddElement(a); |
82 | } |
83 | if (gRhoZMgr) { |
84 | TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr); |
85 | a->SetMainColor(kWhite); |
86 | a->SetTitle("Rho-Z"); |
87 | a->SetTitleSize(0.05); |
88 | a->SetTitleFontName("comicbd"); |
89 | a->SetLabelSize(0.025); |
90 | a->SetLabelFontName("comicbd"); |
91 | gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a); |
92 | } |
93 | |
94 | // Event |
4d62585e |
95 | AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();"); |
96 | AliEveEventManager::GetMaster()->GotoEvent(0); |
e9b9f7d2 |
97 | |
ca49b003 |
98 | gEve->EditElement(g_trkcnt); |
99 | |
e9b9f7d2 |
100 | gEve->Redraw3D(kTRUE); |
101 | } |
102 | |
103 | /******************************************************************************/ |
104 | |
105 | void on_new_event() |
106 | { |
107 | try { |
108 | TEvePointSet* itsc = its_clusters(); |
787c89c5 |
109 | if (itsc) { |
110 | itsc->SetMarkerColor(5); |
111 | } |
e9b9f7d2 |
112 | |
113 | TEvePointSet* tpcc = tpc_clusters(); |
787c89c5 |
114 | if (tpcc) { |
115 | tpcc->SetMarkerColor(4); |
116 | } |
503bfbc8 |
117 | |
118 | TEvePointSet* trdc = trd_clusters(); |
787c89c5 |
119 | if (trdc) { |
120 | trdc->SetMarkerColor(7); |
121 | trdc->SetMarkerStyle(4); |
122 | trdc->SetMarkerSize(0.5); |
123 | } |
a6337352 |
124 | |
125 | TEvePointSet* tofc = tof_clusters(); |
126 | if (tofc) { |
127 | tofc->SetMarkerColor(kOrange); |
128 | tofc->SetMarkerStyle(4); |
129 | tofc->SetMarkerSize(0.5); |
130 | } |
e9b9f7d2 |
131 | } |
132 | catch(TEveException& exc) { |
133 | printf("Exception loading ITS/TPC clusters: %s\n", exc.Data()); |
134 | } |
135 | |
ad5abc55 |
136 | primary_vertex(); |
137 | primary_vertex_ellipse(); |
138 | primary_vertex_spd(); |
139 | primary_vertex_ellipse_spd(); |
140 | |
3a60982a |
141 | esd_V0_points(); |
ca8a6926 |
142 | esd_V0(); |
e9b9f7d2 |
143 | |
75b17362 |
144 | esd_cascade_points(); |
73ce6137 |
145 | esd_cascade(); |
75b17362 |
146 | |
f76c9e9b |
147 | AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance; |
e9b9f7d2 |
148 | g_trkcnt->Reset(); |
4d62585e |
149 | g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId()); |
29207369 |
150 | |
151 | TEveElementList* cont = esd_tracks_by_category(); |
152 | |
153 | // Here we expect several TEveTrackList containers. |
154 | // First two have reasonable primaries (sigma-to-prim-vertex < 5). |
155 | // Others are almost certainly secondaries. |
156 | Int_t count = 1; |
e9b9f7d2 |
157 | TEveElement::List_i i = cont->BeginChildren(); |
df56539f |
158 | while (i != cont->EndChildren()) |
159 | { |
e9b9f7d2 |
160 | TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i); |
29207369 |
161 | if (l != 0) |
162 | { |
e9b9f7d2 |
163 | g_trkcnt->RegisterTracks(l, (count <= 2)); |
164 | ++count; |
165 | } |
166 | ++i; |
167 | } |
168 | |
169 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
a27140cb |
170 | { |
171 | TTimeStamp ts(esd->GetTimeStamp()); |
172 | TString win_title("Eve Main Window -- Timestamp: "); |
173 | win_title += ts.AsString("s"); |
5858bcbe |
174 | win_title += "; Event # in ESD file: "; |
a27140cb |
175 | win_title += esd->GetEventNumberInFile(); |
176 | gEve->GetBrowser()->SetWindowName(win_title); |
177 | } |
e9b9f7d2 |
178 | Double_t x[3]; |
179 | esd->GetPrimaryVertex()->GetXYZ(x); |
180 | |
181 | TEveElement* top = gEve->GetCurrentEvent(); |
182 | |
183 | if (gRPhiMgr && top) { |
184 | gRPhiMgr->DestroyElements(); |
185 | gRPhiMgr->SetCenter(x[0], x[1], x[2]); |
5e078eda |
186 | gRPhiMgr->ImportElements(gGeomGentleRPhi); |
503bfbc8 |
187 | if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD); |
e9b9f7d2 |
188 | gRPhiMgr->ImportElements(top); |
189 | } |
190 | if (gRhoZMgr && top) { |
191 | gRhoZMgr->DestroyElements(); |
192 | gRhoZMgr->SetCenter(x[0], x[1], x[2]); |
5e078eda |
193 | gRhoZMgr->ImportElements(gGeomGentleRhoZ); |
503bfbc8 |
194 | if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD); |
e9b9f7d2 |
195 | gRhoZMgr->ImportElements(top); |
196 | } |
197 | |
198 | gROOT->ProcessLine("SplitGLView::UpdateSummary()"); |
199 | } |