]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/macros/anyscan_init.C
Bug fix in assigning the local trigger deviation to ghost ESDMuon tracks
[u/mrichter/AliRoot.git] / EVE / macros / anyscan_init.C
CommitLineData
f6afd0e1 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
10class AliEveMacroExecutor;
11
12class TEveProjectionManager;
13class TEveGeoShape;
14class TEveUtil;
15
ad5abc55 16TEveGeoShape *gGeomGentle = 0;
17TEveGeoShape *gGeomGentleRPhi = 0;
18TEveGeoShape *gGeomGentleRhoZ = 0;
19TEveGeoShape *gGeomGentleTRD = 0;
f6afd0e1 20
68ca2fe7 21TEveScene *gRPhiGeomScene = 0;
22TEveScene *gRhoZGeomScene = 0;
23TEveScene *gRPhiEventScene = 0;
24TEveScene *gRhoZEventScene = 0;
25
26TEveProjectionManager *gRPhiMgr = 0;
27TEveProjectionManager *gRhoZMgr = 0;
28
29TEveViewer *g3DView = 0;
30TEveViewer *gRPhiView = 0;
31TEveViewer *gRhoZView = 0;
32
f6afd0e1 33Bool_t gShowTRD = kFALSE;
34
68ca2fe7 35Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
36
f6afd0e1 37void anyscan_init()
38{
39 TEveUtil::LoadMacro("alieve_init.C");
40 alieve_init(".", -1);
41
df56539f 42 // TEveLine::SetDefaultSmooth(1);
f6afd0e1 43
44 TEveUtil::AssertMacro("VizDB_scan.C");
45
68ca2fe7 46 AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor();
47 TEveBrowser *browser = gEve->GetBrowser();
f6afd0e1 48
68ca2fe7 49 //==============================================================================
50 // Geometry, scenes, projections and viewers
51 //==============================================================================
f6afd0e1 52
68ca2fe7 53 browser->ShowCloseTab(kFALSE);
f6afd0e1 54
68ca2fe7 55 // Geometry
f6afd0e1 56
f6afd0e1 57 TEveUtil::LoadMacro("geom_gentle.C");
58 gGeomGentle = geom_gentle();
ad5abc55 59 gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
60 gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
f6afd0e1 61 if (gShowTRD) {
62 TEveUtil::LoadMacro("geom_gentle_trd.C");
63 gGeomGentleTRD = geom_gentle_trd();
64 }
65
68ca2fe7 66 // Scenes
67
68 gRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
69 "Scene holding projected geometry for the RPhi view.");
70 gRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
71 "Scene holding projected geometry for the RhoZ view.");
72 gRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
73 "Scene holding projected geometry for the RPhi view.");
74 gRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
75 "Scene holding projected geometry for the RhoZ view.");
76
77 // Projection managers
78
79 gRPhiMgr = new TEveProjectionManager();
80 gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
d4dbbb43 81 gEve->AddToListTree(gRPhiMgr, kFALSE);
68ca2fe7 82 {
83 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
84 a->SetMainColor(kWhite);
85 a->SetTitle("R-Phi");
86 a->SetTitleSize(0.05);
87 a->SetTitleFontName("comicbd");
88 a->SetLabelSize(0.025);
89 a->SetLabelFontName("comicbd");
90 gRPhiGeomScene->AddElement(a);
91 }
92 gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene);
93 if (gShowTRD)
94 gRPhiMgr->ImportElements(gGeomGentleTRD, gRPhiGeomScene);
f6afd0e1 95
68ca2fe7 96 gRhoZMgr = new TEveProjectionManager();
97 gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
d4dbbb43 98 gEve->AddToListTree(gRhoZMgr, kFALSE);
68ca2fe7 99 {
100 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
101 a->SetMainColor(kWhite);
102 a->SetTitle("Rho-Z");
103 a->SetTitleSize(0.05);
104 a->SetTitleFontName("comicbd");
105 a->SetLabelSize(0.025);
106 a->SetLabelFontName("comicbd");
107 gRhoZGeomScene->AddElement(a);
108 }
109 gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene);
110 if (gShowTRD)
111 gRhoZMgr->ImportElements(gGeomGentleTRD, gRhoZGeomScene);
112
113 // Viewers
114
115 TEveWindowSlot *slot = 0;
116 TEveWindowPack *pack = 0;
117
118 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
119 pack = slot->MakePack();
120 pack->SetElementName("Multi View");
121 pack->SetHorizontal();
122 pack->SetShowTitleBar(kFALSE);
123 pack->NewSlot()->MakeCurrent();
124 g3DView = gEve->SpawnNewViewer("3D View", "");
125 g3DView->AddScene(gEve->GetGlobalScene());
126 g3DView->AddScene(gEve->GetEventScene());
127
128 pack = pack->NewSlot()->MakePack();
129 pack->SetShowTitleBar(kFALSE);
130 pack->NewSlot()->MakeCurrent();
131 gRPhiView = gEve->SpawnNewViewer("RPhi View", "");
132 gRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
133 gRPhiView->AddScene(gRPhiGeomScene);
134 gRPhiView->AddScene(gRPhiEventScene);
135
136 pack->NewSlot()->MakeCurrent();
137 gRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
138 gRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
139 gRhoZView->AddScene(gRhoZGeomScene);
140 gRhoZView->AddScene(gRhoZEventScene);
141
142
143 //==============================================================================
144 // Registration of per-event macros
145 //==============================================================================
f6afd0e1 146
7b2d546e 147 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE));
6c841fa2 148
7b2d546e 149 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C", "its_hits", "", kFALSE));
150 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C", "tpc_hits", "", kFALSE));
6c841fa2 151 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE));
a3e7341e 152 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C", "fmd_hits", "", kFALSE));
153
154 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE));
6c841fa2 155
29207369 156 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
6c841fa2 157 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
29207369 158 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
29207369 159 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
a3e7341e 160 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
7b2d546e 161
ad5abc55 162 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
163 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
164 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
165 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
166 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
167 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
168 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
169 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
170 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
171
68ca2fe7 172 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_onfly"));
173 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_offline"));
75b17362 174 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0"));
175 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points"));
73ce6137 176 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
f6afd0e1 177
29207369 178 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
179 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
180 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
181
182 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
ad5abc55 183
5138b34a 184 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC", "esd_zdc.C", "esd_zdc", "", kFALSE));
185
7b2d546e 186 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters"));
187 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters"));
188 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
189 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
f6afd0e1 190
f6afd0e1 191
68ca2fe7 192 //==============================================================================
193 // Additional GUI components
194 //==============================================================================
195
196 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
197 slot->StartEmbedding();
f6afd0e1 198 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
68ca2fe7 199 slot->StopEmbedding("DataSelection");
f6afd0e1 200 exewin->PopulateMacros();
201
68ca2fe7 202 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
203 slot->StartEmbedding();
12365217 204 new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
68ca2fe7 205 slot->StopEmbedding("QA histograms");
12365217 206
f6afd0e1 207 browser->GetTabRight()->SetTab(1);
208
209 browser->StartEmbedding(TRootBrowser::kBottom);
4d62585e 210 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
f6afd0e1 211 browser->StopEmbedding("EventCtrl");
212
68ca2fe7 213 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
214 TEveWindowTab *store_tab = slot->MakeTab();
215 store_tab->SetElementNameTitle("WindowStore",
216 "Undocked windows whose previous container is not known\n"
217 "are placed here when the main-frame is closed.");
218 gEve->GetWindowManager()->SetDefaultContainer(store_tab);
219
220 //==============================================================================
221 // AliEve objects - global tools
222 //==============================================================================
223
224 AliEveTrackFitter* fitter = new AliEveTrackFitter();
225 gEve->AddToListTree(fitter, 1);
226 gEve->AddElement(fitter, gEve->GetEventScene());
227
228 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
229 gEve->AddToListTree(g_trkcnt, kFALSE);
230
231
232 //==============================================================================
233 // Final stuff
234 //==============================================================================
235
236 // A refresh to show proper window.
237 gEve->Redraw3D(kTRUE);
238 gSystem->ProcessEvents();
239
240 // Register command to call on each event.
4d62585e 241 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
242 AliEveEventManager::GetMaster()->GotoEvent(0);
f6afd0e1 243
244 gEve->EditElement(g_trkcnt);
245
246 gEve->Redraw3D(kTRUE);
247}
248
249/******************************************************************************/
250
251void on_new_event()
252{
f6afd0e1 253 AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
254 g_trkcnt->Reset();
4d62585e 255 g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId());
29207369 256
257 if (g_esd_tracks_by_category_container != 0)
258 {
259 TEveElementList* cont = g_esd_tracks_by_category_container;
260
261 // Here we expect several TEveTrackList containers.
262 // First two have reasonable primaries (sigma-to-prim-vertex < 5).
263 // Others are almost certainly secondaries.
264 Int_t count = 1;
265 TEveElement::List_i i = cont->BeginChildren();
266 while (i != cont->EndChildren())
267 {
268 TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
269 if (l != 0)
270 {
271 g_trkcnt->RegisterTracks(l, (count <= 2));
272 ++count;
273 }
274 ++i;
f6afd0e1 275 }
29207369 276
277 // Set it to zero, so that we do not reuse an old one.
278 g_esd_tracks_by_category_container = 0;
279 }
280 else
281 {
282 Warning("on_new_event", "g_esd_tracks_by_category_container not initialized.");
f6afd0e1 283 }
284
68ca2fe7 285 Double_t x[3] = { 0, 0, 0 };
2142305c 286
287 if (AliEveEventManager::HasESD())
f6afd0e1 288 {
2142305c 289 AliESDEvent* esd = AliEveEventManager::AssertESD();
290 esd->GetPrimaryVertex()->GetXYZ(x);
291
f6afd0e1 292 TTimeStamp ts(esd->GetTimeStamp());
293 TString win_title("Eve Main Window -- Timestamp: ");
294 win_title += ts.AsString("s");
295 win_title += "; Event # in ESD file: ";
296 win_title += esd->GetEventNumberInFile();
297 gEve->GetBrowser()->SetWindowName(win_title);
298 }
f6afd0e1 299
300 TEveElement* top = gEve->GetCurrentEvent();
301
29207369 302 if (gRPhiMgr && top)
303 {
68ca2fe7 304 gRPhiEventScene->DestroyElements();
305 if (gCenterProjectionsAtPrimaryVertex)
306 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
307 gRPhiMgr->ImportElements(top, gRPhiEventScene);
f6afd0e1 308 }
29207369 309 if (gRhoZMgr && top)
310 {
68ca2fe7 311 gRhoZEventScene->DestroyElements();
312 if (gCenterProjectionsAtPrimaryVertex)
313 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
314 gRhoZMgr->ImportElements(top, gRhoZEventScene);
f6afd0e1 315 }
f6afd0e1 316}