ciccio
[u/mrichter/AliRoot.git] / EVE / macros / visscan_init.C
CommitLineData
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
10class TEveProjectionManager;
11class TEveGeoShape;
12class TEveUtil;
13
14R__EXTERN TEveProjectionManager *gRPhiMgr;
15R__EXTERN TEveProjectionManager *gRhoZMgr;
16
5e078eda 17TEveGeoShape *gGeomGentle = 0;
18TEveGeoShape *gGeomGentleRPhi = 0;
19TEveGeoShape *gGeomGentleRhoZ = 0;
20TEveGeoShape *gGeomGentleTRD = 0;
503bfbc8 21
22Bool_t gShowTRD = kFALSE;
e9b9f7d2 23
24void visscan_init()
25{
26 TEveUtil::LoadMacro("alieve_init.C");
2142305c 27 alieve_init(".", -1, 0, 0, 0, 0, kFALSE, kTRUE, kFALSE, kFALSE);
e9b9f7d2 28
e9b9f7d2 29 AliEveTrackFitter* fitter = new AliEveTrackFitter();
30 gEve->AddToListTree(fitter, 1);
31 gEve->AddElement(fitter, gEve->GetEventScene());
32
f76c9e9b 33 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
e9b9f7d2 34 gEve->AddToListTree(g_trkcnt, kFALSE);
35
36
a6337352 37 gROOT->ProcessLine(".L SplitGLView.C+");
e9b9f7d2 38 TEveBrowser* browser = gEve->GetBrowser();
39 browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)");
40
41 if (gRPhiMgr) {
42 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
43 a->SetNumTickMarks(3);
44 a->SetText("R-Phi");
45 a->SetFontFile("comicbd");
46 a->SetFontSize(10);
47 gEve->GetScenes()->FindChild("R-Phi Projection")->AddElement(a);
e9b9f7d2 48 }
49 if (gRhoZMgr) {
50 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
51 a->SetNumTickMarks(3);
52 a->SetText("Rho-Z");
53 a->SetFontFile("comicbd");
54 a->SetFontSize(10);
55 gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a);
e9b9f7d2 56 }
57
f6afd0e1 58 // geometry
59 TEveUtil::LoadMacro("geom_gentle.C");
5e078eda 60 gGeomGentle = geom_gentle();
61 gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
62 gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
f6afd0e1 63 if (gShowTRD) {
64 TEveUtil::LoadMacro("geom_gentle_trd.C");
65 gGeomGentleTRD = geom_gentle_trd();
66 }
67
68 // event data
69 TEveUtil::LoadMacro("primary_vertex.C");
70 TEveUtil::LoadMacro("esd_V0_points.C");
71 TEveUtil::LoadMacro("esd_V0.C");
75b17362 72 TEveUtil::LoadMacro("esd_cascade_points.C");
73ce6137 73 TEveUtil::LoadMacro("esd_cascade.C");
f6afd0e1 74 TEveUtil::LoadMacro("esd_tracks.C");
75 TEveUtil::LoadMacro("its_clusters.C+");
76 TEveUtil::LoadMacro("tpc_clusters.C+");
77 TEveUtil::LoadMacro("trd_clusters.C+");
78 TEveUtil::LoadMacro("tof_clusters.C+");
79
df56539f 80 // TEveLine::SetDefaultSmooth(1);
f6afd0e1 81
82 TEveBrowser* browser = gEve->GetBrowser();
83
84 browser->StartEmbedding(TRootBrowser::kBottom);
ba5d58f2 85 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
f6afd0e1 86 browser->StopEmbedding("EventCtrl");
87
e9b9f7d2 88 // event
4d62585e 89 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
90 AliEveEventManager::GetMaster()->GotoEvent(0);
e9b9f7d2 91
ca49b003 92 gEve->EditElement(g_trkcnt);
93
e9b9f7d2 94 gEve->Redraw3D(kTRUE);
95}
96
97/******************************************************************************/
98
99void on_new_event()
100{
101 try {
102 TEvePointSet* itsc = its_clusters();
787c89c5 103 if (itsc) {
104 itsc->SetMarkerColor(5);
105 }
e9b9f7d2 106
107 TEvePointSet* tpcc = tpc_clusters();
787c89c5 108 if (tpcc) {
109 tpcc->SetMarkerColor(4);
110 }
503bfbc8 111
112 TEvePointSet* trdc = trd_clusters();
787c89c5 113 if (trdc) {
114 trdc->SetMarkerColor(7);
115 trdc->SetMarkerStyle(4);
116 trdc->SetMarkerSize(0.5);
117 }
a6337352 118
119 TEvePointSet* tofc = tof_clusters();
120 if (tofc) {
121 tofc->SetMarkerColor(kOrange);
122 tofc->SetMarkerStyle(4);
123 tofc->SetMarkerSize(0.5);
124 }
e9b9f7d2 125 }
126 catch(TEveException& exc) {
127 printf("Exception loading ITS/TPC clusters: %s\n", exc.Data());
128 }
129
ad5abc55 130 primary_vertex();
131 primary_vertex_ellipse();
132 primary_vertex_spd();
133 primary_vertex_ellipse_spd();
134
3a60982a 135 esd_V0_points();
ca8a6926 136 esd_V0();
e9b9f7d2 137
75b17362 138 esd_cascade_points();
73ce6137 139 esd_cascade();
75b17362 140
f76c9e9b 141 AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
e9b9f7d2 142 g_trkcnt->Reset();
4d62585e 143 g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId());
29207369 144
145 TEveElementList* cont = esd_tracks_by_category();
146
147 // Here we expect several TEveTrackList containers.
148 // First two have reasonable primaries (sigma-to-prim-vertex < 5).
149 // Others are almost certainly secondaries.
150 Int_t count = 1;
e9b9f7d2 151 TEveElement::List_i i = cont->BeginChildren();
df56539f 152 while (i != cont->EndChildren())
153 {
e9b9f7d2 154 TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
29207369 155 if (l != 0)
156 {
e9b9f7d2 157 g_trkcnt->RegisterTracks(l, (count <= 2));
158 ++count;
159 }
160 ++i;
161 }
162
163 AliESDEvent* esd = AliEveEventManager::AssertESD();
a27140cb 164 {
165 TTimeStamp ts(esd->GetTimeStamp());
166 TString win_title("Eve Main Window -- Timestamp: ");
167 win_title += ts.AsString("s");
5858bcbe 168 win_title += "; Event # in ESD file: ";
a27140cb 169 win_title += esd->GetEventNumberInFile();
170 gEve->GetBrowser()->SetWindowName(win_title);
171 }
e9b9f7d2 172 Double_t x[3];
173 esd->GetPrimaryVertex()->GetXYZ(x);
174
175 TEveElement* top = gEve->GetCurrentEvent();
176
177 if (gRPhiMgr && top) {
178 gRPhiMgr->DestroyElements();
179 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
5e078eda 180 gRPhiMgr->ImportElements(gGeomGentleRPhi);
503bfbc8 181 if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD);
e9b9f7d2 182 gRPhiMgr->ImportElements(top);
183 }
184 if (gRhoZMgr && top) {
185 gRhoZMgr->DestroyElements();
186 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
5e078eda 187 gRhoZMgr->ImportElements(gGeomGentleRhoZ);
503bfbc8 188 if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD);
e9b9f7d2 189 gRhoZMgr->ImportElements(top);
190 }
191
192 gROOT->ProcessLine("SplitGLView::UpdateSummary()");
193}