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 | |
503bfbc8 |
17 | TEveGeoShape *gGeomGentle = 0; |
18 | TEveGeoShape *gGeomGentleTRD = 0; |
19 | |
20 | Bool_t gShowTRD = kFALSE; |
e9b9f7d2 |
21 | |
22 | void visscan_init() |
23 | { |
24 | TEveUtil::LoadMacro("alieve_init.C"); |
25 | alieve_init(".", -1); |
26 | |
27 | TEveUtil::LoadMacro("geom_gentle.C"); |
503bfbc8 |
28 | if (gShowTRD) TEveUtil::LoadMacro("geom_gentle_trd.C"); |
e9b9f7d2 |
29 | |
30 | TEveUtil::LoadMacro("primary_vertex.C"); |
3a60982a |
31 | TEveUtil::LoadMacro("esd_V0_points.C"); |
ca8a6926 |
32 | TEveUtil::LoadMacro("esd_V0.C"); |
e9b9f7d2 |
33 | TEveUtil::LoadMacro("esd_tracks.C"); |
34 | TEveUtil::LoadMacro("its_clusters.C+"); |
35 | TEveUtil::LoadMacro("tpc_clusters.C+"); |
503bfbc8 |
36 | TEveUtil::LoadMacro("trd_clusters.C+"); |
a6337352 |
37 | TEveUtil::LoadMacro("tof_clusters.C+"); |
e9b9f7d2 |
38 | |
39 | TEveLine::SetDefaultSmooth(1); |
40 | |
41 | /* |
42 | TEveViewer* nv = gEve->SpawnNewViewer("NLT Projected"); |
43 | TEveScene* ns = gEve->SpawnNewScene("NLT"); |
44 | nv->AddScene(ns); |
45 | TGLViewer* v = nv->GetGLViewer(); |
46 | v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); |
47 | TGLCameraMarkupStyle* mup = v->GetCameraMarkup(); |
48 | if(mup) mup->SetShow(kFALSE); |
49 | */ |
50 | |
51 | AliEveTrackFitter* fitter = new AliEveTrackFitter(); |
52 | gEve->AddToListTree(fitter, 1); |
53 | gEve->AddElement(fitter, gEve->GetEventScene()); |
54 | |
55 | TEveTrackCounter* g_trkcnt = new TEveTrackCounter("Primary Counter"); |
56 | gEve->AddToListTree(g_trkcnt, kFALSE); |
57 | |
58 | |
59 | // geometry |
ca49b003 |
60 | gGeomGentle = geom_gentle(); |
503bfbc8 |
61 | if (gShowTRD) gGeomGentleTRD = geom_gentle_trd(); |
e9b9f7d2 |
62 | |
63 | |
a6337352 |
64 | gROOT->ProcessLine(".L SplitGLView.C+"); |
e9b9f7d2 |
65 | TEveBrowser* browser = gEve->GetBrowser(); |
66 | browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)"); |
67 | |
68 | if (gRPhiMgr) { |
69 | TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr); |
70 | a->SetNumTickMarks(3); |
71 | a->SetText("R-Phi"); |
72 | a->SetFontFile("comicbd"); |
73 | a->SetFontSize(10); |
74 | gEve->GetScenes()->FindChild("R-Phi Projection")->AddElement(a); |
e9b9f7d2 |
75 | } |
76 | if (gRhoZMgr) { |
77 | TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr); |
78 | a->SetNumTickMarks(3); |
79 | a->SetText("Rho-Z"); |
80 | a->SetFontFile("comicbd"); |
81 | a->SetFontSize(10); |
82 | gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a); |
e9b9f7d2 |
83 | } |
84 | |
85 | // event |
86 | gAliEveEvent->AddNewEventCommand("on_new_event();"); |
87 | gAliEveEvent->GotoEvent(0); |
88 | |
ca49b003 |
89 | gEve->EditElement(g_trkcnt); |
90 | |
e9b9f7d2 |
91 | gEve->Redraw3D(kTRUE); |
92 | } |
93 | |
94 | /******************************************************************************/ |
95 | |
96 | void on_new_event() |
97 | { |
98 | try { |
99 | TEvePointSet* itsc = its_clusters(); |
787c89c5 |
100 | if (itsc) { |
101 | itsc->SetMarkerColor(5); |
102 | } |
e9b9f7d2 |
103 | |
104 | TEvePointSet* tpcc = tpc_clusters(); |
787c89c5 |
105 | if (tpcc) { |
106 | tpcc->SetMarkerColor(4); |
107 | } |
503bfbc8 |
108 | |
109 | TEvePointSet* trdc = trd_clusters(); |
787c89c5 |
110 | if (trdc) { |
111 | trdc->SetMarkerColor(7); |
112 | trdc->SetMarkerStyle(4); |
113 | trdc->SetMarkerSize(0.5); |
114 | } |
a6337352 |
115 | |
116 | TEvePointSet* tofc = tof_clusters(); |
117 | if (tofc) { |
118 | tofc->SetMarkerColor(kOrange); |
119 | tofc->SetMarkerStyle(4); |
120 | tofc->SetMarkerSize(0.5); |
121 | } |
e9b9f7d2 |
122 | } |
123 | catch(TEveException& exc) { |
124 | printf("Exception loading ITS/TPC clusters: %s\n", exc.Data()); |
125 | } |
126 | |
127 | primary_vertex(1, 1); |
3a60982a |
128 | esd_V0_points(); |
ca8a6926 |
129 | esd_V0(); |
e9b9f7d2 |
130 | |
131 | TEveElementList* cont = esd_tracks_vertex_cut(); |
132 | |
133 | // Here we expect five TEveTrackList containers. |
134 | // First two have reasonable primaries (sigma-to-prim-vertex < 5). |
135 | // Other three are almost certainly secondaries. |
136 | Int_t count = 1; |
137 | TEveTrackCounter* g_trkcnt = TEveTrackCounter::fgInstance; |
138 | g_trkcnt->Reset(); |
139 | g_trkcnt->SetEventId(gAliEveEvent->GetEventId()); |
140 | TEveElement::List_i i = cont->BeginChildren(); |
141 | while (i != cont->EndChildren()) { |
142 | TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i); |
143 | if (l != 0) { |
144 | // l->SetLineWidth(2); |
145 | g_trkcnt->RegisterTracks(l, (count <= 2)); |
146 | ++count; |
147 | } |
148 | ++i; |
149 | } |
150 | |
151 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
a27140cb |
152 | { |
153 | TTimeStamp ts(esd->GetTimeStamp()); |
154 | TString win_title("Eve Main Window -- Timestamp: "); |
155 | win_title += ts.AsString("s"); |
5858bcbe |
156 | win_title += "; Event # in ESD file: "; |
a27140cb |
157 | win_title += esd->GetEventNumberInFile(); |
158 | gEve->GetBrowser()->SetWindowName(win_title); |
159 | } |
e9b9f7d2 |
160 | Double_t x[3]; |
161 | esd->GetPrimaryVertex()->GetXYZ(x); |
162 | |
163 | TEveElement* top = gEve->GetCurrentEvent(); |
164 | |
165 | if (gRPhiMgr && top) { |
166 | gRPhiMgr->DestroyElements(); |
167 | gRPhiMgr->SetCenter(x[0], x[1], x[2]); |
168 | gRPhiMgr->ImportElements(gGeomGentle); |
503bfbc8 |
169 | if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD); |
e9b9f7d2 |
170 | gRPhiMgr->ImportElements(top); |
171 | } |
172 | if (gRhoZMgr && top) { |
173 | gRhoZMgr->DestroyElements(); |
174 | gRhoZMgr->SetCenter(x[0], x[1], x[2]); |
175 | gRhoZMgr->ImportElements(gGeomGentle); |
503bfbc8 |
176 | if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD); |
e9b9f7d2 |
177 | gRhoZMgr->ImportElements(top); |
178 | } |
179 | |
180 | gROOT->ProcessLine("SplitGLView::UpdateSummary()"); |
181 | } |
182 | |
183 | /******************************************************************************/ |
184 | |
185 | TParticle* id(Int_t label=0, Bool_t showParents=kTRUE) |
186 | { |
187 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); |
188 | rl->LoadKinematics(); |
189 | AliStack* stack = rl->Stack(); |
190 | |
191 | printf("Number primaries %d, all particles %d, label %d\n", |
192 | stack->GetNprimary(), stack->GetNtrack(), label); |
193 | if (label < 0 || label >= stack->GetNtrack()) { |
194 | printf(" Label exceeds available range.\n"); |
195 | return 0; |
196 | } |
197 | |
198 | TParticle* part = stack->Particle(label); |
199 | if (part != 0) { |
200 | part->Print(); |
201 | if (showParents) { |
202 | while (part->GetMother(0) >= 0) { |
203 | part = stack->Particle(part->GetMother(0)); |
204 | part->Print(); |
205 | } |
206 | } |
207 | } |
208 | return stack->Particle(label); |
209 | } |