]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/clusters_from_label.C
Temporary replacement of Form by sprintf to avoid problems on some platforms (alpahli...
[u/mrichter/AliRoot.git] / EVE / alice-macros / clusters_from_label.C
1 // $Id$
2
3 void clusters_from_label(Int_t label=0)
4 {
5   AliESD* esd = Alieve::Event::AssertESD();
6   Reve::PointSet* clusters = new Reve::PointSet(64);
7   clusters->SetOwnIds(kTRUE);
8
9   for (Int_t n=0; n<esd->GetNumberOfTracks(); n++) {
10     AliESDtrack* at = esd->GetTrack(n);
11     if (at->GetLabel() == label) {
12       const AliTrackPointArray* pArr = at->GetTrackPointArray();
13       if (pArr == 0) {
14         Warning("clusters_from_label", "TrackPointArray not stored with ESD track.");
15         continue;
16       }
17       Int_t np =  pArr->GetNPoints();
18       const Float_t* x = pArr->GetX();
19       const Float_t* y = pArr->GetY();
20       const Float_t* z = pArr->GetZ();
21       for (Int_t i=0; i<np; ++i) {
22         clusters->SetNextPoint(x[i], y[i], z[i]);
23         AliTrackPoint *atp = new AliTrackPoint;
24         pArr->GetPoint(*atp, i);
25         clusters->SetPointId(atp);
26       }
27     }
28   }
29   clusters->SetMarkerStyle(2);
30   clusters->SetMarkerSize(0.5);
31   clusters->SetMarkerColor(4);
32   //PH The line below is replaced waiting for a fix in Root
33   //PH which permits to use variable siza arguments in CINT
34   //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
35   //PH  clusters->SetName(Form("Clusters lab=%d", label));
36   char form[1000];
37   sprintf(form,"Clusters lab=%d", label);
38   clusters->SetName(form);
39
40   using namespace Reve;
41   gReve->AddRenderElement(clusters);
42   gReve->Redraw3D();
43 }