]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/clusters_from_index.C
Separate import of standard macros into a special function so that
[u/mrichter/AliRoot.git] / EVE / alice-macros / clusters_from_index.C
CommitLineData
cdd1f390 1// $Id$
2
32e219c2 3Reve::PointSet* clusters_from_index(Int_t index=0, Reve::RenderElement* cont=0)
cdd1f390 4{
22aefef8 5 AliESDEvent* esd = Alieve::Event::AssertESD();
cdd1f390 6
0e0a00ee 7 if (index < 0) {
8 Warning("clusters_from_index", "index not set.");
9 return 0;
10 }
11
12 if (index >= esd->GetNumberOfTracks()) {
13 Warning("clusters_from_index", "index out of range");
cdd1f390 14 return 0;
15 }
16
17 Reve::PointSet* clusters = new Reve::PointSet(64);
18 clusters->SetOwnIds(kTRUE);
19
20 AliESDtrack* at = esd->GetTrack(index);
2caed564 21 const AliTrackPointArray* pArr = at->GetTrackPointArray();
22 if (pArr == 0) {
23 Warning("clusters_from_index", "TrackPointArray not stored with ESD track.");
24 continue;
25 }
26 Int_t np = pArr->GetNPoints();
27 const Float_t* x = pArr->GetX();
28 const Float_t* y = pArr->GetY();
29 const Float_t* z = pArr->GetZ();
30 for (Int_t i=0; i<np; ++i) {
31 clusters->SetNextPoint(x[i], y[i], z[i]);
32 AliTrackPoint *atp = new AliTrackPoint;
33 pArr->GetPoint(*atp, i);
34 clusters->SetPointId(atp); }
35
36
37 if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
38 Warning("clusters_from_index", Form("No clusters for index '%d'", index));
39 delete clusters;
40 return 0;
41 }
cdd1f390 42
43 clusters->SetMarkerStyle(2);
44 clusters->SetMarkerSize(0.5);
45 clusters->SetMarkerColor(4);
46
47 //PH The line below is replaced waiting for a fix in Root
48 //PH which permits to use variable siza arguments in CINT
49 //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
50 //PH clusters->SetName(Form("Clusters idx=%d", index));
51 char form[1000];
52 sprintf(form,"Clusters idx=%d", index);
53 clusters->SetName(form);
54
2caed564 55 char tip[1000];
56 sprintf(tip,"N=%d", clusters->Size());
57 clusters->SetTitle(tip);
58
cdd1f390 59 using namespace Reve;
60 gReve->AddRenderElement(clusters);
61 gReve->Redraw3D();
62
63 return clusters;
64}