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