]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/macros/visscan_init.C
alieve_init.C
[u/mrichter/AliRoot.git] / EVE / macros / visscan_init.C
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
10 class TEveProjectionManager;
11 class TEveGeoShape;
12 class TEveUtil;
13
14 R__EXTERN TEveProjectionManager *gRPhiMgr;
15 R__EXTERN TEveProjectionManager *gRhoZMgr;
16
17 TEveGeoShape *gGeomGentle     = 0;
18 TEveGeoShape *gGeomGentleRPhi = 0;
19 TEveGeoShape *gGeomGentleRhoZ = 0;
20 TEveGeoShape *gGeomGentleTRD  = 0;
21
22 Bool_t gShowTRD = kFALSE;
23
24 void visscan_init()
25 {
26   TEveUtil::LoadMacro("alieve_init.C");
27   alieve_init(".", -1);
28
29   AliEveTrackFitter* fitter = new AliEveTrackFitter();
30   gEve->AddToListTree(fitter, 1);
31   gEve->AddElement(fitter, gEve->GetEventScene());
32
33   AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
34   gEve->AddToListTree(g_trkcnt, kFALSE);
35
36
37   gROOT->ProcessLine(".L SplitGLView.C+");
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);
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);
56    }
57
58   // geometry
59   TEveUtil::LoadMacro("geom_gentle.C");
60   gGeomGentle     = geom_gentle();
61   gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
62   gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
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");
72   TEveUtil::LoadMacro("esd_tracks.C");
73   TEveUtil::LoadMacro("its_clusters.C+");
74   TEveUtil::LoadMacro("tpc_clusters.C+");
75   TEveUtil::LoadMacro("trd_clusters.C+");
76   TEveUtil::LoadMacro("tof_clusters.C+");
77
78   TEveLine::SetDefaultSmooth(1);
79
80   TEveBrowser* browser = gEve->GetBrowser();
81
82   browser->StartEmbedding(TRootBrowser::kBottom);
83   new AliEveEventManagerWindow;
84   browser->StopEmbedding("EventCtrl");
85
86   // event
87   gAliEveEvent->AddNewEventCommand("on_new_event();");
88   gAliEveEvent->GotoEvent(0);
89
90   gEve->EditElement(g_trkcnt);
91
92   gEve->Redraw3D(kTRUE);
93 }
94
95 /******************************************************************************/
96
97 void on_new_event()
98 {
99   try {
100     TEvePointSet* itsc = its_clusters();
101     if (itsc) {
102       itsc->SetMarkerColor(5);
103     }
104
105     TEvePointSet* tpcc = tpc_clusters();
106     if (tpcc) {
107       tpcc->SetMarkerColor(4);
108     }
109
110     TEvePointSet* trdc = trd_clusters();
111     if (trdc) {
112       trdc->SetMarkerColor(7);
113       trdc->SetMarkerStyle(4);
114       trdc->SetMarkerSize(0.5);
115     }
116
117     TEvePointSet* tofc = tof_clusters();
118     if (tofc) {
119       tofc->SetMarkerColor(kOrange);
120       tofc->SetMarkerStyle(4);
121       tofc->SetMarkerSize(0.5);
122     }
123   }
124   catch(TEveException& exc) {
125     printf("Exception loading ITS/TPC clusters: %s\n", exc.Data());
126   }
127
128   primary_vertex();
129   primary_vertex_ellipse();
130   primary_vertex_spd();
131   primary_vertex_ellipse_spd();
132
133   esd_V0_points();
134   esd_V0();
135
136   TEveElementList* cont = esd_tracks_vertex_cut();
137
138   // Here we expect five TEveTrackList containers.
139   // First two have reasonable primaries (sigma-to-prim-vertex < 5).
140   // Other three are almost certainly secondaries.
141   Int_t count = 1;
142   AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
143   g_trkcnt->Reset();
144   g_trkcnt->SetEventId(gAliEveEvent->GetEventId());
145   TEveElement::List_i i = cont->BeginChildren();
146   while (i != cont->EndChildren()) {
147     TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
148     if (l != 0) {
149       // l->SetLineWidth(2);
150       g_trkcnt->RegisterTracks(l, (count <= 2));
151       ++count;
152     }
153     ++i;
154   }
155
156   AliESDEvent* esd = AliEveEventManager::AssertESD();
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   Double_t x[3];
166   esd->GetPrimaryVertex()->GetXYZ(x);
167
168   TEveElement* top = gEve->GetCurrentEvent();
169
170   if (gRPhiMgr && top) {
171     gRPhiMgr->DestroyElements();
172     gRPhiMgr->SetCenter(x[0], x[1], x[2]);
173     gRPhiMgr->ImportElements(gGeomGentleRPhi);
174     if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD);
175     gRPhiMgr->ImportElements(top);
176   }
177   if (gRhoZMgr && top) {
178     gRhoZMgr->DestroyElements();
179     gRhoZMgr->SetCenter(x[0], x[1], x[2]);
180     gRhoZMgr->ImportElements(gGeomGentleRhoZ);
181     if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD);
182     gRhoZMgr->ImportElements(top);
183   }
184
185   gROOT->ProcessLine("SplitGLView::UpdateSummary()");
186 }