new years resolution
[u/mrichter/AliRoot.git] / EVE / alice-macros / jetplane.C
CommitLineData
d810d0de 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 *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
16718cdc 9
c7ee3856 10TEveViewer *gJPView = 0;
11TEveScene *gJPScene = 0;
12
13AliEveJetPlane* jetplane()
51346b82 14{
c7ee3856 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);
115b6655 25
26 gJPView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraPerspXOY);
c7ee3856 27 }
28
29 AliAODEvent* aod = AliEveEventManager::AssertAOD();
30
31
32 // We have event id everywhere now.
33 Int_t iev = AliEveEventManager::GetMaster()->GetEventId();
8c47e13d 34
d810d0de 35 AliEveJetPlane* jp = new AliEveJetPlane(iev);
115b6655 36 jp->SetPickable(kTRUE);
8c47e13d 37
84aff7a4 38 // Read Jets in current event
8c47e13d 39
84aff7a4 40 TClonesArray* jets = aod->GetJets();
41 Int_t njets = jets->GetEntries();
16718cdc 42 printf("Event: %5d Number of jets: %5d \n", iev, njets);
8c47e13d 43
84aff7a4 44 for (Int_t ij = 0; ij < njets; ij++)
45 {
46 AliAODJet jet = (AliAODJet) jets->At(ij);
47 jp->AddJet(jet);
48 }
8c47e13d 49
84aff7a4 50 // Read tracks in current event
8c47e13d 51
84aff7a4 52 TClonesArray* tracks = aod->GetTracks();
53 Int_t ntracks = tracks->GetEntries();
16718cdc 54 printf("Event: %5d Number of tracks: %5d \n", iev, ntracks);
8c47e13d 55
84aff7a4 56 for (Int_t ij = 0; ij < ntracks; ij++)
57 {
58 AliAODTrack track = (AliAODTrack) tracks->At(ij);
59 jp->AddTrack(track);
60 }
8c47e13d 61
84aff7a4 62 // Render Jet Plane
63 gStyle->SetPalette(1, 0);
c7ee3856 64 // gEve->AddElement(jp);
65 gJPScene->AddElement(jp);
66
84aff7a4 67 gEve->Redraw3D();
8c47e13d 68
84aff7a4 69 return jp;
8c47e13d 70}