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