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 |
503bfbc8 |
60 | gGeomGentle = geom_gentle(); |
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 | |
89 | gEve->Redraw3D(kTRUE); |
90 | } |
91 | |
92 | /******************************************************************************/ |
93 | |
94 | void on_new_event() |
95 | { |
96 | try { |
97 | TEvePointSet* itsc = its_clusters(); |
787c89c5 |
98 | if (itsc) { |
99 | itsc->SetMarkerColor(5); |
100 | } |
e9b9f7d2 |
101 | |
102 | TEvePointSet* tpcc = tpc_clusters(); |
787c89c5 |
103 | if (tpcc) { |
104 | tpcc->SetMarkerColor(4); |
105 | } |
503bfbc8 |
106 | |
107 | TEvePointSet* trdc = trd_clusters(); |
787c89c5 |
108 | if (trdc) { |
109 | trdc->SetMarkerColor(7); |
110 | trdc->SetMarkerStyle(4); |
111 | trdc->SetMarkerSize(0.5); |
112 | } |
a6337352 |
113 | |
114 | TEvePointSet* tofc = tof_clusters(); |
115 | if (tofc) { |
116 | tofc->SetMarkerColor(kOrange); |
117 | tofc->SetMarkerStyle(4); |
118 | tofc->SetMarkerSize(0.5); |
119 | } |
e9b9f7d2 |
120 | } |
121 | catch(TEveException& exc) { |
122 | printf("Exception loading ITS/TPC clusters: %s\n", exc.Data()); |
123 | } |
124 | |
125 | primary_vertex(1, 1); |
3a60982a |
126 | esd_V0_points(); |
ca8a6926 |
127 | esd_V0(); |
e9b9f7d2 |
128 | |
129 | TEveElementList* cont = esd_tracks_vertex_cut(); |
130 | |
131 | // Here we expect five TEveTrackList containers. |
132 | // First two have reasonable primaries (sigma-to-prim-vertex < 5). |
133 | // Other three are almost certainly secondaries. |
134 | Int_t count = 1; |
135 | TEveTrackCounter* g_trkcnt = TEveTrackCounter::fgInstance; |
136 | g_trkcnt->Reset(); |
137 | g_trkcnt->SetEventId(gAliEveEvent->GetEventId()); |
138 | TEveElement::List_i i = cont->BeginChildren(); |
139 | while (i != cont->EndChildren()) { |
140 | TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i); |
141 | if (l != 0) { |
142 | // l->SetLineWidth(2); |
143 | g_trkcnt->RegisterTracks(l, (count <= 2)); |
144 | ++count; |
145 | } |
146 | ++i; |
147 | } |
148 | |
149 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
150 | Double_t x[3]; |
151 | esd->GetPrimaryVertex()->GetXYZ(x); |
152 | |
153 | TEveElement* top = gEve->GetCurrentEvent(); |
154 | |
155 | if (gRPhiMgr && top) { |
156 | gRPhiMgr->DestroyElements(); |
157 | gRPhiMgr->SetCenter(x[0], x[1], x[2]); |
158 | gRPhiMgr->ImportElements(gGeomGentle); |
503bfbc8 |
159 | if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD); |
e9b9f7d2 |
160 | gRPhiMgr->ImportElements(top); |
161 | } |
162 | if (gRhoZMgr && top) { |
163 | gRhoZMgr->DestroyElements(); |
164 | gRhoZMgr->SetCenter(x[0], x[1], x[2]); |
165 | gRhoZMgr->ImportElements(gGeomGentle); |
503bfbc8 |
166 | if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD); |
e9b9f7d2 |
167 | gRhoZMgr->ImportElements(top); |
168 | } |
169 | |
170 | gROOT->ProcessLine("SplitGLView::UpdateSummary()"); |
171 | } |
172 | |
173 | /******************************************************************************/ |
174 | |
175 | TParticle* id(Int_t label=0, Bool_t showParents=kTRUE) |
176 | { |
177 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); |
178 | rl->LoadKinematics(); |
179 | AliStack* stack = rl->Stack(); |
180 | |
181 | printf("Number primaries %d, all particles %d, label %d\n", |
182 | stack->GetNprimary(), stack->GetNtrack(), label); |
183 | if (label < 0 || label >= stack->GetNtrack()) { |
184 | printf(" Label exceeds available range.\n"); |
185 | return 0; |
186 | } |
187 | |
188 | TParticle* part = stack->Particle(label); |
189 | if (part != 0) { |
190 | part->Print(); |
191 | if (showParents) { |
192 | while (part->GetMother(0) >= 0) { |
193 | part = stack->Particle(part->GetMother(0)); |
194 | part->Print(); |
195 | } |
196 | } |
197 | } |
198 | return stack->Particle(label); |
199 | } |