ciccio
[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
16R__EXTERN TEveProjectionManager *gRPhiMgr;
17R__EXTERN TEveProjectionManager *gRhoZMgr;
18
ad5abc55 19TEveGeoShape *gGeomGentle = 0;
20TEveGeoShape *gGeomGentleRPhi = 0;
21TEveGeoShape *gGeomGentleRhoZ = 0;
22TEveGeoShape *gGeomGentleTRD = 0;
f6afd0e1 23
24Bool_t gShowTRD = kFALSE;
25
26void anyscan_init()
27{
28 TEveUtil::LoadMacro("alieve_init.C");
29 alieve_init(".", -1);
30
df56539f 31 // TEveLine::SetDefaultSmooth(1);
f6afd0e1 32
33 TEveUtil::AssertMacro("VizDB_scan.C");
34
35
36 AliEveTrackFitter* fitter = new AliEveTrackFitter();
37 gEve->AddToListTree(fitter, 1);
38 gEve->AddElement(fitter, gEve->GetEventScene());
39
40 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
41 gEve->AddToListTree(g_trkcnt, kFALSE);
42
43
44 gROOT->ProcessLine(".L SplitGLView.C+");
45 TEveBrowser* browser = gEve->GetBrowser();
46 browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)");
47
48 if (gRPhiMgr) {
49 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
50 a->SetNumTickMarks(3);
51 a->SetText("R-Phi");
52 a->SetFontFile("comicbd");
53 a->SetFontSize(10);
54 gEve->GetScenes()->FindChild("R-Phi Projection")->AddElement(a);
55 }
56 if (gRhoZMgr) {
57 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
58 a->SetNumTickMarks(3);
59 a->SetText("Rho-Z");
60 a->SetFontFile("comicbd");
61 a->SetFontSize(10);
62 gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a);
63 }
64
65 // geometry
66 TEveUtil::LoadMacro("geom_gentle.C");
67 gGeomGentle = geom_gentle();
ad5abc55 68 gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
69 gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
f6afd0e1 70 if (gShowTRD) {
71 TEveUtil::LoadMacro("geom_gentle_trd.C");
72 gGeomGentleTRD = geom_gentle_trd();
73 }
74
75
4d62585e 76 AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor();
f6afd0e1 77
7b2d546e 78 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE));
6c841fa2 79
7b2d546e 80 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C", "its_hits", "", kFALSE));
81 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C", "tpc_hits", "", kFALSE));
6c841fa2 82 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE));
83
29207369 84 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
6c841fa2 85 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
29207369 86 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
87 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE));
88 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C", "fmd_hits", "", kFALSE));
89 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
7b2d546e 90
ad5abc55 91 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
92 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
93 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
94 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
95 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
96 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
97 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
98 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
99 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
100
75b17362 101 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points"));
102 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0"));
103 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points"));
73ce6137 104 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
f6afd0e1 105
29207369 106 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
107 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
108 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
109
110 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
ad5abc55 111
7b2d546e 112 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters"));
113 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters"));
114 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
115 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
f6afd0e1 116
117 TEveBrowser* browser = gEve->GetBrowser();
118
119 browser->StartEmbedding(TRootBrowser::kRight);
120 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
121 browser->StopEmbedding("DataSelection");
122 exewin->PopulateMacros();
123
12365217 124 browser->StartEmbedding();
125 new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
126 browser->StopEmbedding("QA histograms");
127
f6afd0e1 128 browser->GetTabRight()->SetTab(1);
129
130 browser->StartEmbedding(TRootBrowser::kBottom);
4d62585e 131 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
f6afd0e1 132 browser->StopEmbedding("EventCtrl");
133
134 // event
4d62585e 135 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
136 AliEveEventManager::GetMaster()->GotoEvent(0);
f6afd0e1 137
138 gEve->EditElement(g_trkcnt);
139
140 gEve->Redraw3D(kTRUE);
141}
142
143/******************************************************************************/
144
145void on_new_event()
146{
f6afd0e1 147 AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
148 g_trkcnt->Reset();
4d62585e 149 g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId());
29207369 150
151 if (g_esd_tracks_by_category_container != 0)
152 {
153 TEveElementList* cont = g_esd_tracks_by_category_container;
154
155 // Here we expect several TEveTrackList containers.
156 // First two have reasonable primaries (sigma-to-prim-vertex < 5).
157 // Others are almost certainly secondaries.
158 Int_t count = 1;
159 TEveElement::List_i i = cont->BeginChildren();
160 while (i != cont->EndChildren())
161 {
162 TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
163 if (l != 0)
164 {
165 g_trkcnt->RegisterTracks(l, (count <= 2));
166 ++count;
167 }
168 ++i;
f6afd0e1 169 }
29207369 170
171 // Set it to zero, so that we do not reuse an old one.
172 g_esd_tracks_by_category_container = 0;
173 }
174 else
175 {
176 Warning("on_new_event", "g_esd_tracks_by_category_container not initialized.");
f6afd0e1 177 }
178
2142305c 179 Double_t x[3] = { 0, 0, 0};
180
181 if (AliEveEventManager::HasESD())
f6afd0e1 182 {
2142305c 183 AliESDEvent* esd = AliEveEventManager::AssertESD();
184 esd->GetPrimaryVertex()->GetXYZ(x);
185
f6afd0e1 186 TTimeStamp ts(esd->GetTimeStamp());
187 TString win_title("Eve Main Window -- Timestamp: ");
188 win_title += ts.AsString("s");
189 win_title += "; Event # in ESD file: ";
190 win_title += esd->GetEventNumberInFile();
191 gEve->GetBrowser()->SetWindowName(win_title);
192 }
f6afd0e1 193
194 TEveElement* top = gEve->GetCurrentEvent();
195
29207369 196 if (gRPhiMgr && top)
197 {
f6afd0e1 198 gRPhiMgr->DestroyElements();
199 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
ad5abc55 200 gRPhiMgr->ImportElements(gGeomGentleRPhi);
f6afd0e1 201 if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD);
202 gRPhiMgr->ImportElements(top);
203 }
29207369 204 if (gRhoZMgr && top)
205 {
f6afd0e1 206 gRhoZMgr->DestroyElements();
207 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
ad5abc55 208 gRhoZMgr->ImportElements(gGeomGentleRhoZ);
f6afd0e1 209 if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD);
210 gRhoZMgr->ImportElements(top);
211 }
212
29207369 213 SplitGLView::UpdateSummary();
f6afd0e1 214}