alice-data/gentle_geo_trd.root
[u/mrichter/AliRoot.git] / EVE / alice-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
503bfbc8 17TEveGeoShape *gGeomGentle = 0;
18TEveGeoShape *gGeomGentleTRD = 0;
19
20Bool_t gShowTRD = kFALSE;
e9b9f7d2 21
22void visscan_init()
23{
24 TEveUtil::LoadMacro("alieve_init.C");
25 alieve_init(".", -1);
26
27 TEveUtil::LoadMacro("geom_gentle.C");
503bfbc8 28 if (gShowTRD) TEveUtil::LoadMacro("geom_gentle_trd.C");
e9b9f7d2 29
30 TEveUtil::LoadMacro("primary_vertex.C");
31 TEveUtil::LoadMacro("esd_tracks.C");
32 TEveUtil::LoadMacro("its_clusters.C+");
33 TEveUtil::LoadMacro("tpc_clusters.C+");
503bfbc8 34 TEveUtil::LoadMacro("trd_clusters.C+");
e9b9f7d2 35
36 TEveLine::SetDefaultSmooth(1);
37
38 /*
39 TEveViewer* nv = gEve->SpawnNewViewer("NLT Projected");
40 TEveScene* ns = gEve->SpawnNewScene("NLT");
41 nv->AddScene(ns);
42 TGLViewer* v = nv->GetGLViewer();
43 v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
44 TGLCameraMarkupStyle* mup = v->GetCameraMarkup();
45 if(mup) mup->SetShow(kFALSE);
46 */
47
48 AliEveTrackFitter* fitter = new AliEveTrackFitter();
49 gEve->AddToListTree(fitter, 1);
50 gEve->AddElement(fitter, gEve->GetEventScene());
51
52 TEveTrackCounter* g_trkcnt = new TEveTrackCounter("Primary Counter");
53 gEve->AddToListTree(g_trkcnt, kFALSE);
54
55
56 // geometry
503bfbc8 57 gGeomGentle = geom_gentle();
58 if (gShowTRD) gGeomGentleTRD = geom_gentle_trd();
e9b9f7d2 59
60
61 gROOT->ProcessLine(".L SplitGLView.C+g"); // !!!! debug-mode
62 TEveBrowser* browser = gEve->GetBrowser();
63 browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)");
64
65 if (gRPhiMgr) {
66 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
67 a->SetNumTickMarks(3);
68 a->SetText("R-Phi");
69 a->SetFontFile("comicbd");
70 a->SetFontSize(10);
71 gEve->GetScenes()->FindChild("R-Phi Projection")->AddElement(a);
e9b9f7d2 72 }
73 if (gRhoZMgr) {
74 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
75 a->SetNumTickMarks(3);
76 a->SetText("Rho-Z");
77 a->SetFontFile("comicbd");
78 a->SetFontSize(10);
79 gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a);
e9b9f7d2 80 }
81
82 // event
83 gAliEveEvent->AddNewEventCommand("on_new_event();");
84 gAliEveEvent->GotoEvent(0);
85
86 gEve->Redraw3D(kTRUE);
87}
88
89/******************************************************************************/
90
91void on_new_event()
92{
93 try {
94 TEvePointSet* itsc = its_clusters();
95 itsc->SetMarkerColor(5);
96
97 TEvePointSet* tpcc = tpc_clusters();
98 tpcc->SetMarkerColor(4);
503bfbc8 99
100 TEvePointSet* trdc = trd_clusters();
101 trdc->SetMarkerColor(7);
102 trdc->SetMarkerStyle(4);
103 trdc->SetMarkerSize(0.5);
e9b9f7d2 104 }
105 catch(TEveException& exc) {
106 printf("Exception loading ITS/TPC clusters: %s\n", exc.Data());
107 }
108
109 primary_vertex(1, 1);
110
111 TEveElementList* cont = esd_tracks_vertex_cut();
112
113 // Here we expect five TEveTrackList containers.
114 // First two have reasonable primaries (sigma-to-prim-vertex < 5).
115 // Other three are almost certainly secondaries.
116 Int_t count = 1;
117 TEveTrackCounter* g_trkcnt = TEveTrackCounter::fgInstance;
118 g_trkcnt->Reset();
119 g_trkcnt->SetEventId(gAliEveEvent->GetEventId());
120 TEveElement::List_i i = cont->BeginChildren();
121 while (i != cont->EndChildren()) {
122 TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
123 if (l != 0) {
124 // l->SetLineWidth(2);
125 g_trkcnt->RegisterTracks(l, (count <= 2));
126 ++count;
127 }
128 ++i;
129 }
130
131 AliESDEvent* esd = AliEveEventManager::AssertESD();
132 Double_t x[3];
133 esd->GetPrimaryVertex()->GetXYZ(x);
134
135 TEveElement* top = gEve->GetCurrentEvent();
136
137 if (gRPhiMgr && top) {
138 gRPhiMgr->DestroyElements();
139 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
140 gRPhiMgr->ImportElements(gGeomGentle);
503bfbc8 141 if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD);
e9b9f7d2 142 gRPhiMgr->ImportElements(top);
143 }
144 if (gRhoZMgr && top) {
145 gRhoZMgr->DestroyElements();
146 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
147 gRhoZMgr->ImportElements(gGeomGentle);
503bfbc8 148 if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD);
e9b9f7d2 149 gRhoZMgr->ImportElements(top);
150 }
151
152 gROOT->ProcessLine("SplitGLView::UpdateSummary()");
153}
154
155/******************************************************************************/
156
157TParticle* id(Int_t label=0, Bool_t showParents=kTRUE)
158{
159 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
160 rl->LoadKinematics();
161 AliStack* stack = rl->Stack();
162
163 printf("Number primaries %d, all particles %d, label %d\n",
164 stack->GetNprimary(), stack->GetNtrack(), label);
165 if (label < 0 || label >= stack->GetNtrack()) {
166 printf(" Label exceeds available range.\n");
167 return 0;
168 }
169
170 TParticle* part = stack->Particle(label);
171 if (part != 0) {
172 part->Print();
173 if (showParents) {
174 while (part->GetMother(0) >= 0) {
175 part = stack->Particle(part->GetMother(0));
176 part->Print();
177 }
178 }
179 }
180 return stack->Particle(label);
181}