]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/clusters_from_index.C
tpc_clusters.C - added missing AliRunLoader::UnloadRecPoints(). New tpc_raw.C macro...
[u/mrichter/AliRoot.git] / EVE / alice-macros / clusters_from_index.C
1 // $Id$
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  **************************************************************************/
9
10 TEvePointSet* clusters_from_index(Int_t index=0, TEveElement* cont=0)
11 {
12   AliESDEvent* esd = AliEveEventManager::AssertESD();
13
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");
21     return 0;
22   }
23
24   TEvePointSet* clusters = new TEvePointSet(64);
25   clusters->SetOwnIds(kTRUE);
26
27   AliESDtrack* at = esd->GetTrack(index);
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
44   if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
45     Warning("clusters_from_index", Form("No clusters for index '%d'", index));
46     delete clusters;
47     return 0;
48   }
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
62   char tip[1000];
63   sprintf(tip,"N=%d", clusters->Size());
64   clusters->SetTitle(tip);
65   gEve->AddElement(clusters);
66   gEve->Redraw3D();
67
68   return clusters;
69 }