]>
Commit | Line | Data |
---|---|---|
cdd1f390 | 1 | // $Id$ |
d810d0de | 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 | **************************************************************************/ |
ba978640 | 9 | #if !defined(__CINT__) || defined(__MAKECINT__) |
10 | #include <TEveManager.h> | |
11 | #include <TEveElement.h> | |
12 | #include <TEvePointSet.h> | |
13 | ||
6c49a8e1 | 14 | #include <AliESDEvent.h> |
15 | #include <AliTrackPointArray.h> | |
16 | #include <AliEveEventManager.h> | |
17 | #include <AliEveMultiView.h> | |
ba978640 | 18 | #endif |
cdd1f390 | 19 | |
84aff7a4 | 20 | TEvePointSet* clusters_from_index(Int_t index=0, TEveElement* cont=0) |
cdd1f390 | 21 | { |
d810d0de | 22 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
cdd1f390 | 23 | |
0e0a00ee | 24 | if (index < 0) { |
25 | Warning("clusters_from_index", "index not set."); | |
26 | return 0; | |
27 | } | |
28 | ||
29 | if (index >= esd->GetNumberOfTracks()) { | |
30 | Warning("clusters_from_index", "index out of range"); | |
cdd1f390 | 31 | return 0; |
32 | } | |
33 | ||
84aff7a4 | 34 | TEvePointSet* clusters = new TEvePointSet(64); |
cdd1f390 | 35 | clusters->SetOwnIds(kTRUE); |
36 | ||
37 | AliESDtrack* at = esd->GetTrack(index); | |
2caed564 | 38 | const AliTrackPointArray* pArr = at->GetTrackPointArray(); |
39 | if (pArr == 0) { | |
40 | Warning("clusters_from_index", "TrackPointArray not stored with ESD track."); | |
2caed564 | 41 | } |
ba978640 | 42 | |
2caed564 | 43 | Int_t np = pArr->GetNPoints(); |
44 | const Float_t* x = pArr->GetX(); | |
45 | const Float_t* y = pArr->GetY(); | |
46 | const Float_t* z = pArr->GetZ(); | |
47 | for (Int_t i=0; i<np; ++i) { | |
48 | clusters->SetNextPoint(x[i], y[i], z[i]); | |
49 | AliTrackPoint *atp = new AliTrackPoint; | |
50 | pArr->GetPoint(*atp, i); | |
51 | clusters->SetPointId(atp); } | |
52 | ||
51346b82 | 53 | |
84aff7a4 | 54 | if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) { |
ba978640 | 55 | Warning("clusters_from_index", "No clusters for index '%d'", index); |
2caed564 | 56 | delete clusters; |
57 | return 0; | |
58 | } | |
cdd1f390 | 59 | |
60 | clusters->SetMarkerStyle(2); | |
4267948f | 61 | clusters->SetMarkerSize(2); |
cdd1f390 | 62 | clusters->SetMarkerColor(4); |
63 | ||
4267948f | 64 | clusters->SetName(Form("Clusters idx=%d", index)); |
65 | clusters->SetTitle(Form("N=%d", clusters->Size())); | |
cdd1f390 | 66 | |
84aff7a4 | 67 | gEve->AddElement(clusters); |
4267948f | 68 | |
1e9caa37 | 69 | if (AliEveMultiView::Instance()) |
4267948f | 70 | { |
1e9caa37 | 71 | AliEveMultiView::Instance()->ImportEventRPhi(clusters); |
72 | AliEveMultiView::Instance()->ImportEventRhoZ(clusters); | |
4267948f | 73 | } |
74 | ||
84aff7a4 | 75 | gEve->Redraw3D(); |
cdd1f390 | 76 | |
77 | return clusters; | |
78 | } |