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 **************************************************************************/
12 /// \author P. Pillot, L. Aphecetche; Subatech
14 class AliEveMacroExecutor;
15 class TEveProjectionManager;
21 Bool_t gShowMuonRPhi = kFALSE;
22 Bool_t gShowMuonRhoZ = kTRUE;
23 Bool_t gShowMuon = kTRUE;
25 Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
28 void muon_init(const TString& cdburi = "",
29 const TString& path = ".",
30 Bool_t showBarrel = kTRUE)
32 if (gSystem->Getenv("ALICE_ROOT") != 0)
34 gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT")));
35 gInterpreter->AddIncludePath(Form("%s/MUON/mapping", gSystem->Getenv("ALICE_ROOT")));
38 if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet())
40 gEnv->SetValue("Root.Stacktrace", "no");
41 Fatal("muon_init.C", "OCDB path MUST be specified as the first argument.");
44 TEveUtil::LoadMacro("alieve_init.C");
45 path.Remove(TString::kTrailing, '/');
46 if (path.BeginsWith("alien:")) AliEveEventManager::SearchRawForCentralReconstruction();
47 alieve_init(cdburi, path, -1);
49 TEveUtil::AssertMacro("VizDB_scan.C");
51 AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor();
52 TEveBrowser *browser = gEve->GetBrowser();
53 browser->ShowCloseTab(kFALSE);
56 //==============================================================================
57 // Geometry, scenes, projections and viewers
58 //==============================================================================
60 AliEveMultiView *mv = new AliEveMultiView;
64 TEveUtil::LoadMacro("geom_gentle.C");
65 TEveUtil::LoadMacro("geom_gentle_muon.C");
67 mv->InitGeomGentle(geom_gentle(), geom_gentle_rphi(), geom_gentle_rhoz(), geom_gentle_muon(kFALSE));
69 mv->InitGeomGentleMuon(geom_gentle_muon(kFALSE), gShowMuonRPhi, gShowMuonRhoZ, gShowMuon);
73 //==============================================================================
74 // Registration of per-event macros
75 //==============================================================================
77 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track","kine_tracks.C+", "kine_tracks", "", kFALSE));
79 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM TrackRef","muon_trackRefs.C+","muon_trackRefs","kTRUE", kFALSE));
81 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW MUON", "muon_raw.C+", "muon_raw", "", kTRUE));
83 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG MUON", "muon_digits.C+", "muon_digits", "", kFALSE));
85 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "CLU MUON", "muon_clusters.C+","muon_clusters","", kTRUE));
87 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_muon_tracks.C+", "esd_muon_tracks","kTRUE,kTRUE", kTRUE));
90 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C+", "primary_vertex", "", kTRUE));
91 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX SPD", "primary_vertex.C+", "primary_vertex_spd", "", kTRUE));
92 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks by category", "esd_tracks.C+", "esd_tracks_by_category", "", kTRUE));
95 //==============================================================================
96 // Additional GUI components
97 //==============================================================================
99 // Macro / data selection
100 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
101 slot->StartEmbedding();
102 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
103 slot->StopEmbedding("DataSelection");
104 exewin->PopulateMacros();
106 // Event selection tab
107 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
108 slot->StartEmbedding();
109 new AliEveEventSelectorWindow(gClient->GetRoot(), 600, 400, AliEveEventManager::GetMaster()->GetEventSelector());
110 slot->StopEmbedding("Selections");
113 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
114 slot->StartEmbedding();
115 new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
116 slot->StopEmbedding("QA histograms");
118 browser->GetTabRight()->SetTab(1);
120 browser->StartEmbedding(TRootBrowser::kBottom);
121 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
122 browser->StopEmbedding("EventCtrl");
124 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
125 TEveWindowTab *store_tab = slot->MakeTab();
126 store_tab->SetElementNameTitle("WindowStore",
127 "Undocked windows whose previous container is not known\n"
128 "are placed here when the main-frame is closed.");
129 gEve->GetWindowManager()->SetDefaultContainer(store_tab);
132 //==============================================================================
133 // AliEve objects - global tools
134 //==============================================================================
136 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
137 gEve->AddToListTree(g_trkcnt, kFALSE);
140 //==============================================================================
142 //==============================================================================
144 // A refresh to show proper window.
145 //gEve->GetViewers()->SwitchColorSet();
146 gEve->Redraw3D(kTRUE);
147 gSystem->ProcessEvents();
149 // Register command to call on each event.
150 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
151 AliEveEventManager::GetMaster()->GotoEvent(0);
153 gEve->EditElement(g_trkcnt);
155 gEve->Redraw3D(kTRUE);
157 // Assure 3D view rotates around the origin.
158 gSystem->ProcessEvents();
159 AliEveMultiView::Instance()->Get3DView()->GetGLViewer()->CurrentCamera().SetCenterVec(0,0,0);
160 AliEveMultiView::Instance()->Get3DView()->GetGLViewer()->RequestDraw();
163 /******************************************************************************/
167 Double_t x[3] = { 0, 0, 0 };
169 if (AliEveEventManager::HasESD())
171 AliESDEvent* esd = AliEveEventManager::AssertESD();
172 esd->GetPrimaryVertex()->GetXYZ(x);
174 TTimeStamp ts(esd->GetTimeStamp());
175 TString win_title("Eve Main Window -- Timestamp: ");
176 win_title += ts.AsString("s");
177 win_title += "; Event # in ESD file: ";
178 win_title += esd->GetEventNumberInFile();
179 gEve->GetBrowser()->SetWindowName(win_title);
182 TEveElement* top = gEve->GetCurrentEvent();
184 AliEveMultiView *mv = AliEveMultiView::Instance();
186 mv->DestroyEventRPhi();
187 if (gCenterProjectionsAtPrimaryVertex)
188 mv->SetCenterRPhi(x[0], x[1], x[2]);
189 mv->ImportEventRPhi(top);
191 mv->DestroyEventRhoZ();
192 if (gCenterProjectionsAtPrimaryVertex)
193 mv->SetCenterRhoZ(x[0], x[1], x[2]);
194 mv->ImportEventRhoZ(top);