]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/esd_hlt_tracks.C
doxy: code cleanup: comments and clarifications
[u/mrichter/AliRoot.git] / EVE / alice-macros / esd_hlt_tracks.C
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 #if !defined(__CINT__) || defined(__MAKECINT__)
18 #include <TObject.h>
19 #include <TClass.h>
20 #include <TFile.h>
21 #include <TTree.h>
22 #include <TEveManager.h>
23 #include <TEveTrack.h>
24 #include <TEveUtil.h>
25
26 #include <AliESDEvent.h>
27 #include <AliEveEventManager.h>
28
29 #include <EVE/alice-macros/esd_tracks.C>
30 #endif
31
32 /**
33  * Display ESD Tracks from the HLTesdTree in AliEVE.
34  *
35  * Usage:
36  * <pre>
37  *   alieve $ALICE_ROOT/EVE/alice-macros/event_next.C \
38  *          $ALICE_ROOT/EVE/macros/alieve_init.C \
39  *          $ALICE_ROOT/EVE/alice-macros/geom_simple.C \
40  *          $ALICE_ROOT/EVE/alice-macros/esd_hlt_tracks.C
41  * </pre>
42  * Display is changed to next event by executing event_next()
43  * from the root prompt.
44  * <pre>
45  *   event_next(); esd_tracks(); esd_hlt_tracks();
46  * </pre>
47  *
48  * @ingroup alihlt_tpc
49  * @author Matthias.Richter@ift.uib.no
50  * @date   2008-11-22
51  */
52 TEveTrackList* esd_hlt_tracks()
53 {
54   if (!TClass::GetClass("AliEveEventManager")) {
55     Error("hlt_tpc_clusters.C", "EVE library not loaded, please start alieve correctly");
56     return NULL;
57   }
58
59   AliEveEventManager* eveManager=AliEveEventManager::GetMaster();
60   if (!eveManager) {
61     Error("esd_hlt_tracks.C", "EVE manager not initialized");
62     return NULL;
63   }
64
65   TEveUtil::LoadMacro("esd_tracks.C");
66    
67   int eventId=eveManager->GetEventId();
68   TFile* esdFile=eveManager->GetESDFile();
69   if (!esdFile) {
70     Warning("esd_hlt_tracks.C", "can not get esd file from EVE manager");
71     return NULL;
72   }
73
74   TObject* pObj=NULL;
75   TTree* pHLTTree=NULL;
76   esdFile->GetObject("HLTesdTree", pObj);
77   if (!pObj || (pHLTTree=dynamic_cast<TTree*>(pObj))==NULL) {
78     Info("esd_hlt_tracks.C", "no HLT ESD tree in ESD file");
79     return NULL;
80   }
81   if (pHLTTree->GetEntries()<=eventId) {
82     Warning("esd_hlt_tracks.C", "skiping event %d: out of range %lld", eventId, pHLTTree->GetEntries());
83     return NULL;
84   }
85
86   AliESDEvent* esd=new AliESDEvent;
87   esd->ReadFromTree(pHLTTree);
88   pHLTTree->GetEntry(eventId);
89
90   TEveTrackList* cont = new TEveTrackList("HLT ESD Tracks");
91   cont->SetMainColor(kCyan+3);
92   esd_track_propagator_setup(cont->GetPropagator(),
93                              0.1*esd->GetMagneticField(), 520);
94
95   eveManager->AddElement(cont);
96
97   Int_t count = 0;
98   for (Int_t n = 0; n < esd->GetNumberOfTracks(); ++n)
99   {
100     ++count;
101     TEveTrack* track = esd_make_track(esd->GetTrack(n), cont);
102
103     cont->AddElement(track);
104   }
105   cont->SetTitle(Form("N=%d", count));
106   cont->MakeTracks();
107
108   gEve->Redraw3D();
109
110   return cont;
111 }