AliEveMacro
[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();
c7ee3856 30
31 // We have event id everywhere now.
32 Int_t iev = AliEveEventManager::GetMaster()->GetEventId();
8c47e13d 33
08b0f222 34 gStyle->SetPalette(1, 0);
35
d810d0de 36 AliEveJetPlane* jp = new AliEveJetPlane(iev);
115b6655 37 jp->SetPickable(kTRUE);
8c47e13d 38
84aff7a4 39 // Read Jets in current event
8c47e13d 40
84aff7a4 41 TClonesArray* jets = aod->GetJets();
42 Int_t njets = jets->GetEntries();
16718cdc 43 printf("Event: %5d Number of jets: %5d \n", iev, njets);
8c47e13d 44
84aff7a4 45 for (Int_t ij = 0; ij < njets; ij++)
46 {
47 AliAODJet jet = (AliAODJet) jets->At(ij);
48 jp->AddJet(jet);
49 }
8c47e13d 50
84aff7a4 51 // Read tracks in current event
8c47e13d 52
84aff7a4 53 TClonesArray* tracks = aod->GetTracks();
54 Int_t ntracks = tracks->GetEntries();
16718cdc 55 printf("Event: %5d Number of tracks: %5d \n", iev, ntracks);
8c47e13d 56
84aff7a4 57 for (Int_t ij = 0; ij < ntracks; ij++)
58 {
59 AliAODTrack track = (AliAODTrack) tracks->At(ij);
60 jp->AddTrack(track);
61 }
8c47e13d 62
84aff7a4 63 // Render Jet Plane
c7ee3856 64 gJPScene->AddElement(jp);
08b0f222 65 AliEveEventManager::RegisterTransient(jp);
c7ee3856 66
84aff7a4 67 gEve->Redraw3D();
8c47e13d 68
84aff7a4 69 return jp;
8c47e13d 70}