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