]>
Commit | Line | Data |
---|---|---|
39d6561a | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
5 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
6 | * full copyright notice. * | |
7 | **************************************************************************/ | |
8 | ||
9 | class AliEveMacroExecutor; | |
10 | class TEveProjectionManager; | |
11 | class TEveGeoShape; | |
12 | class TEveUtil; | |
13 | class TSystem; | |
14 | class TInterpreter; | |
15 | ||
16 | Bool_t gShowMuonRPhi = kFALSE; | |
17 | Bool_t gShowMuonRhoZ = kTRUE; | |
18 | ||
19 | Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE; | |
20 | ||
21 | ||
22 | void muon_init(const TString& cdburi = "", | |
23 | const TString& path = ".") | |
24 | { | |
25 | if (gSystem->Getenv("ALICE_ROOT") != 0) | |
26 | { | |
27 | gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT"))); | |
28 | gInterpreter->AddIncludePath(Form("%s/MUON/mapping", gSystem->Getenv("ALICE_ROOT"))); | |
29 | } | |
30 | ||
31 | if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet()) | |
32 | { | |
33 | gEnv->SetValue("Root.Stacktrace", "no"); | |
34 | Fatal("muon_init.C", "OCDB path MUST be specified as the first argument."); | |
35 | } | |
36 | ||
37 | TEveUtil::LoadMacro("alieve_init.C"); | |
38 | if (path.BeginsWith("alien:")) AliEveEventManager::SearchRawForCentralReconstruction(); | |
39 | alieve_init(cdburi, path, -1); | |
40 | ||
41 | TEveUtil::AssertMacro("VizDB_scan.C"); | |
42 | ||
43 | AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor(); | |
44 | TEveBrowser *browser = gEve->GetBrowser(); | |
45 | browser->ShowCloseTab(kFALSE); | |
46 | ||
47 | ||
48 | //============================================================================== | |
49 | // Geometry, scenes, projections and viewers | |
50 | //============================================================================== | |
51 | ||
52 | AliEveMultiView *mv = new AliEveMultiView; | |
53 | ||
54 | mv->SetDepth(-10); | |
55 | ||
56 | TEveUtil::LoadMacro("geom_gentle.C"); | |
57 | mv->InitGeomGentle(geom_gentle(), geom_gentle_rphi(), geom_gentle_rhoz()); | |
58 | ||
59 | TEveUtil::LoadMacro("geom_gentle_muon.C"); | |
60 | mv->InitGeomGentleMuon(geom_gentle_muon(kFALSE), gShowMuonRPhi, gShowMuonRhoZ); | |
61 | ||
62 | mv->SetDepth(0); | |
63 | ||
64 | //============================================================================== | |
65 | // Registration of per-event macros | |
66 | //============================================================================== | |
67 | ||
68 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track","kine_tracks.C+", "kine_tracks", "", kFALSE)); | |
69 | ||
70 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM TrackRef","muon_trackRefs.C+","muon_trackRefs","kTRUE", kFALSE)); | |
71 | ||
72 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW MUON", "muon_raw.C+", "muon_raw", "", kTRUE)); | |
73 | ||
74 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG MUON", "muon_digits.C+", "muon_digits", "", kFALSE)); | |
75 | ||
76 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "CLU MUON", "muon_clusters.C+","muon_clusters","", kTRUE)); | |
77 | ||
78 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_muon_tracks.C+", "esd_muon_tracks","kTRUE,kTRUE", kTRUE)); | |
79 | ||
80 | //============================================================================== | |
81 | // Additional GUI components | |
82 | //============================================================================== | |
83 | ||
84 | // Macro / data selection | |
85 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); | |
86 | slot->StartEmbedding(); | |
87 | AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec); | |
88 | slot->StopEmbedding("DataSelection"); | |
89 | exewin->PopulateMacros(); | |
90 | ||
91 | // Event selection tab | |
92 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); | |
93 | slot->StartEmbedding(); | |
94 | new AliEveEventSelectorWindow(gClient->GetRoot(), 600, 400, AliEveEventManager::GetMaster()->GetEventSelector()); | |
95 | slot->StopEmbedding("Selections"); | |
96 | ||
97 | // QA viewer | |
98 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); | |
99 | slot->StartEmbedding(); | |
100 | new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE); | |
101 | slot->StopEmbedding("QA histograms"); | |
102 | ||
103 | browser->GetTabRight()->SetTab(1); | |
104 | ||
105 | browser->StartEmbedding(TRootBrowser::kBottom); | |
106 | new AliEveEventManagerWindow(AliEveEventManager::GetMaster()); | |
107 | browser->StopEmbedding("EventCtrl"); | |
108 | ||
109 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); | |
110 | TEveWindowTab *store_tab = slot->MakeTab(); | |
111 | store_tab->SetElementNameTitle("WindowStore", | |
112 | "Undocked windows whose previous container is not known\n" | |
113 | "are placed here when the main-frame is closed."); | |
114 | gEve->GetWindowManager()->SetDefaultContainer(store_tab); | |
115 | ||
116 | ||
117 | //============================================================================== | |
118 | // AliEve objects - global tools | |
119 | //============================================================================== | |
120 | ||
121 | AliEveTrackFitter* fitter = new AliEveTrackFitter(); | |
122 | gEve->AddToListTree(fitter, 1); | |
123 | gEve->AddElement(fitter, gEve->GetEventScene()); | |
124 | ||
125 | AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter"); | |
126 | gEve->AddToListTree(g_trkcnt, kFALSE); | |
127 | ||
128 | ||
129 | //============================================================================== | |
130 | // Final stuff | |
131 | //============================================================================== | |
132 | ||
133 | // A refresh to show proper window. | |
134 | //gEve->GetViewers()->SwitchColorSet(); | |
135 | gEve->Redraw3D(kTRUE); | |
136 | gSystem->ProcessEvents(); | |
137 | ||
138 | // Register command to call on each event. | |
139 | AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();"); | |
140 | AliEveEventManager::GetMaster()->GotoEvent(0); | |
141 | ||
142 | gEve->EditElement(g_trkcnt); | |
143 | ||
144 | gEve->Redraw3D(kTRUE); | |
145 | } | |
146 | ||
147 | /******************************************************************************/ | |
148 | ||
149 | void on_new_event() | |
150 | { | |
151 | Double_t x[3] = { 0, 0, 0 }; | |
152 | ||
153 | if (AliEveEventManager::HasESD()) | |
154 | { | |
155 | AliESDEvent* esd = AliEveEventManager::AssertESD(); | |
156 | esd->GetPrimaryVertex()->GetXYZ(x); | |
157 | ||
158 | TTimeStamp ts(esd->GetTimeStamp()); | |
159 | TString win_title("Eve Main Window -- Timestamp: "); | |
160 | win_title += ts.AsString("s"); | |
161 | win_title += "; Event # in ESD file: "; | |
162 | win_title += esd->GetEventNumberInFile(); | |
163 | gEve->GetBrowser()->SetWindowName(win_title); | |
164 | } | |
165 | ||
166 | TEveElement* top = gEve->GetCurrentEvent(); | |
167 | ||
168 | AliEveMultiView *mv = AliEveMultiView::Instance(); | |
169 | ||
170 | mv->DestroyEventRPhi(); | |
171 | if (gCenterProjectionsAtPrimaryVertex) | |
172 | mv->SetCenterRPhi(x[0], x[1], x[2]); | |
173 | mv->ImportEventRPhi(top); | |
174 | ||
175 | mv->DestroyEventRhoZ(); | |
176 | if (gCenterProjectionsAtPrimaryVertex) | |
177 | mv->SetCenterRhoZ(x[0], x[1], x[2]); | |
178 | mv->ImportEventRhoZ(top); | |
179 | } |