Put all classes in Alieve/ sub-module out of the Alieve namespace and
[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 *
7 * full copyright notice. *
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
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);
51 clusters->SetMarkerSize(0.5);
52 clusters->SetMarkerColor(4);
53
54 //PH The line below is replaced waiting for a fix in Root
55 //PH which permits to use variable siza arguments in CINT
56 //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
57 //PH clusters->SetName(Form("Clusters idx=%d", index));
58 char form[1000];
59 sprintf(form,"Clusters idx=%d", index);
60 clusters->SetName(form);
61
2caed564 62 char tip[1000];
63 sprintf(tip,"N=%d", clusters->Size());
64 clusters->SetTitle(tip);
84aff7a4 65 gEve->AddElement(clusters);
66 gEve->Redraw3D();
cdd1f390 67
68 return clusters;
69}