AliEveMacro
[u/mrichter/AliRoot.git] / EVE / alice-macros / jetplane.C
... / ...
CommitLineData
1// $Id$
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
10TEveViewer *gJPView = 0;
11TEveScene *gJPScene = 0;
12
13AliEveJetPlane* jetplane()
14{
15 if (gJPView == 0)
16 {
17 TEveWindowSlot *slot = 0;
18 TEveBrowser *browser = gEve->GetBrowser();
19
20 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
21 slot->MakeCurrent();
22 gJPView = gEve->SpawnNewViewer("JetPlane", "");
23 gJPScene = gEve->SpawnNewScene("JetPlane", "Scene holding elements of the jet-plane view.");
24 gJPView->AddScene(gJPScene);
25
26 gJPView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraPerspXOY);
27 }
28
29 AliAODEvent* aod = AliEveEventManager::AssertAOD();
30
31 // We have event id everywhere now.
32 Int_t iev = AliEveEventManager::GetMaster()->GetEventId();
33
34 gStyle->SetPalette(1, 0);
35
36 AliEveJetPlane* jp = new AliEveJetPlane(iev);
37 jp->SetPickable(kTRUE);
38
39 // Read Jets in current event
40
41 TClonesArray* jets = aod->GetJets();
42 Int_t njets = jets->GetEntries();
43 printf("Event: %5d Number of jets: %5d \n", iev, njets);
44
45 for (Int_t ij = 0; ij < njets; ij++)
46 {
47 AliAODJet jet = (AliAODJet) jets->At(ij);
48 jp->AddJet(jet);
49 }
50
51 // Read tracks in current event
52
53 TClonesArray* tracks = aod->GetTracks();
54 Int_t ntracks = tracks->GetEntries();
55 printf("Event: %5d Number of tracks: %5d \n", iev, ntracks);
56
57 for (Int_t ij = 0; ij < ntracks; ij++)
58 {
59 AliAODTrack track = (AliAODTrack) tracks->At(ij);
60 jp->AddTrack(track);
61 }
62
63 // Render Jet Plane
64 gJPScene->AddElement(jp);
65 AliEveEventManager::RegisterTransient(jp);
66
67 gEve->Redraw3D();
68
69 return jp;
70}