adding AliEVE bindings for the HLT TPC
[u/mrichter/AliRoot.git] / HLT / TPCLib / EVE / macros / esd_hlt_tracks.C
CommitLineData
b658d7e4 1// $Id$
2//**************************************************************************
3//* This file is property of and copyright by the ALICE HLT Project *
4//* ALICE Experiment at CERN, All rights reserved. *
5//* *
6//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7//* for The ALICE HLT Project. *
8//* *
9//* Permission to use, copy, modify and distribute this software and its *
10//* documentation strictly for non-commercial purposes is hereby granted *
11//* without fee, provided that the above copyright notice appears in all *
12//* copies and that both the copyright notice and this permission notice *
13//* appear in the supporting documentation. The authors make no claims *
14//* about the suitability of this software for any purpose. It is *
15//* provided "as is" without express or implied warranty. *
16//**************************************************************************
17
18/**
19 * Display ESD Tracks from the HLTesdTree in AliEVE.
20 *
21 * Usage:
22 * <pre>
23 * alieve $ALICE_ROOT/EVE/alice-macros/event_next.C \
24 * $ALICE_ROOT/EVE/macros/alieve_init.C \
25 * $ALICE_ROOT/EVE/alice-macros/geom_simple.C \
26 * $ALICE_ROOT/EVE/alice-macros/esd_tracks.C \
27 * $ALICE_ROOT/HLT/TPCLib/EVE/macros/esd_hlt_tracks.C
28 * </pre>
29 * Display is changed to next event by executing event_next()
30 * from the root prompt.
31 * <pre>
32 * event_next(); esd_tracks(); esd_hlt_tracks();
33 * </pre>
34 *
35 * @ingroup alihlt_tpc
36 * @author Matthias.Richter@ift.uib.no
37 * @date 2008-11-22
38 */
39TEveTrackList* esd_hlt_tracks()
40{
41 if (!TClass::GetClass("AliEveEventManager")) {
42 Error("hlt_tpc_clusters.C", "EVE library not loaded, please start alieve correctly");
43 return NULL;
44 }
45
46 AliEveEventManager* eveManager=AliEveEventManager::GetMaster();
47 if (!eveManager) {
48 Error("esd_hlt_tracks.C", "EVE manager not initialized");
49 return NULL;
50 }
51
52 int eventId=eveManager->GetEventId();
53 TFile* esdFile=eveManager->GetESDFile();
54 if (!esdFile) {
55 Warning("esd_hlt_tracks.C", "can not get esd file from EVE manager");
56 return NULL;
57 }
58
59 TObject* pObj=NULL;
60 TTree* pHLTTree=NULL;
61 esdFile->GetObject("HLTesdTree", pObj);
62 if (!pObj || (pHLTTree=dynamic_cast<TTree*>(pObj))==NULL) {
63 Info("esd_hlt_tracks.C", "no HLT ESD tree in ESD file");
64 return NULL;
65 }
66 if (pHLTTree->GetEntries()<=eventId) {
67 Warning("esd_hlt_tracks.C", "skiping event %d: out of range %d", eventId, pHLTTree->GetEntries());
68 return NULL;
69 }
70
71 AliESDEvent* esd=new AliESDEvent;
72 esd->ReadFromTree(pHLTTree);
73 pHLTTree->GetEntry(eventId);
74
75 TEveTrackList* cont = new TEveTrackList("HLT ESD Tracks");
76 cont->SetMainColor(7);
77 TEveTrackPropagator* trkProp = cont->GetPropagator();
78 trkProp->SetMagField(0.1*esd->GetMagneticField());
79 trkProp->SetMaxR (520);
80
81 eveManager->AddElement(cont);
82
83 Int_t count = 0;
84 for (Int_t n = 0; n < esd->GetNumberOfTracks(); ++n)
85 {
86 ++count;
87 TEveTrack* track = esd_make_track(esd->GetTrack(n), cont);
88
89 cont->AddElement(track);
90 }
91 cont->SetTitle(Form("N=%d", count));
92 cont->MakeTracks();
93
94 gEve->Redraw3D();
95
96 return cont;
97}