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