]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/clusters_from_index.C
Remove EVE/Reve/ sub-module.
[u/mrichter/AliRoot.git] / EVE / alice-macros / clusters_from_index.C
1 // $Id$
2
3 TEvePointSet* clusters_from_index(Int_t index=0, TEveElement* cont=0)
4 {
5   AliESDEvent* esd = Alieve::Event::AssertESD();
6
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");
14     return 0;
15   }
16
17   TEvePointSet* clusters = new TEvePointSet(64);
18   clusters->SetOwnIds(kTRUE);
19
20   AliESDtrack* at = esd->GetTrack(index);
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 && gEve->GetKeepEmptyCont() == kFALSE) {
38     Warning("clusters_from_index", Form("No clusters for index '%d'", index));
39     delete clusters;
40     return 0;
41   }
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
55   char tip[1000];
56   sprintf(tip,"N=%d", clusters->Size());
57   clusters->SetTitle(tip);
58   gEve->AddElement(clusters);
59   gEve->Redraw3D();
60
61   return clusters;
62 }