Geometry for MFT (Brigitte)
[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
ba978640 10#if !defined(__CINT__) || defined(__MAKECINT__)
11#include <TClonesArray.h>
12#include <TGLViewer.h>
13#include <TStyle.h>
14#include <TEveBrowser.h>
15#include <TEveManager.h>
16#include <TEveViewer.h>
17#include <TEveWindow.h>
18#include <TEveScene.h>
19#include <TEveTreeTools.h>
20
6c49a8e1 21#include <AliRunLoader.h>
22#include <AliAODEvent.h>
23#include <AliAODTrack.h>
24#include <AliEveEventManager.h>
25#include <AliEveJetPlane.h>
ba978640 26#endif
27
c7ee3856 28TEveViewer *gJPView = 0;
29TEveScene *gJPScene = 0;
30
31AliEveJetPlane* jetplane()
51346b82 32{
c7ee3856 33 if (gJPView == 0)
34 {
35 TEveWindowSlot *slot = 0;
36 TEveBrowser *browser = gEve->GetBrowser();
37
38 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
39 slot->MakeCurrent();
40 gJPView = gEve->SpawnNewViewer("JetPlane", "");
41 gJPScene = gEve->SpawnNewScene("JetPlane", "Scene holding elements of the jet-plane view.");
42 gJPView->AddScene(gJPScene);
115b6655 43
44 gJPView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraPerspXOY);
c7ee3856 45 }
46
47 AliAODEvent* aod = AliEveEventManager::AssertAOD();
c7ee3856 48
49 // We have event id everywhere now.
50 Int_t iev = AliEveEventManager::GetMaster()->GetEventId();
8c47e13d 51
08b0f222 52 gStyle->SetPalette(1, 0);
53
d810d0de 54 AliEveJetPlane* jp = new AliEveJetPlane(iev);
115b6655 55 jp->SetPickable(kTRUE);
8c47e13d 56
84aff7a4 57 // Read Jets in current event
8c47e13d 58
84aff7a4 59 TClonesArray* jets = aod->GetJets();
60 Int_t njets = jets->GetEntries();
ba978640 61 Info("jetplane", "Event: %5d Number of jets: %5d \n", iev, njets);
8c47e13d 62
84aff7a4 63 for (Int_t ij = 0; ij < njets; ij++)
64 {
2ea57cb0 65 AliAODJet *jet = (AliAODJet*) jets->At(ij);
84aff7a4 66 jp->AddJet(jet);
67 }
8c47e13d 68
84aff7a4 69 // Read tracks in current event
8c47e13d 70
84aff7a4 71 TClonesArray* tracks = aod->GetTracks();
72 Int_t ntracks = tracks->GetEntries();
ba978640 73 Info("jetplane", "Event: %5d Number of tracks: %5d \n", iev, ntracks);
8c47e13d 74
84aff7a4 75 for (Int_t ij = 0; ij < ntracks; ij++)
76 {
2ea57cb0 77 AliAODTrack* track = (AliAODTrack*) tracks->At(ij);
84aff7a4 78 jp->AddTrack(track);
79 }
8c47e13d 80
e930bdfa 81 jp->CreateArrows();
82
84aff7a4 83 // Render Jet Plane
c7ee3856 84 gJPScene->AddElement(jp);
08b0f222 85 AliEveEventManager::RegisterTransient(jp);
c7ee3856 86
84aff7a4 87 gEve->Redraw3D();
8c47e13d 88
84aff7a4 89 return jp;
8c47e13d 90}