]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - EVE/alice-macros/clusters_from_label.C
Small correction for shifts in SSD (M. Van Leeuwen)
[u/mrichter/AliRoot.git] / EVE / alice-macros / clusters_from_label.C
... / ...
CommitLineData
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
10TEvePointSet* clusters_from_label(Int_t label=0, TEveElement* cont=0)
11{
12 AliESDEvent* esd = AliEveEventManager::AssertESD();
13 TEvePointSet* clusters = new TEvePointSet(64);
14 clusters->SetOwnIds(kTRUE);
15
16 for (Int_t n=0; n<esd->GetNumberOfTracks(); n++)
17 {
18 AliESDtrack* at = esd->GetTrack(n);
19 if (at->GetLabel() == label) {
20 const AliTrackPointArray* pArr = at->GetTrackPointArray();
21 if (pArr == 0) {
22 Warning("clusters_from_label", "TrackPointArray not stored with ESD track.");
23 continue;
24 }
25 Int_t np = pArr->GetNPoints();
26 const Float_t* x = pArr->GetX();
27 const Float_t* y = pArr->GetY();
28 const Float_t* z = pArr->GetZ();
29 for (Int_t i=0; i<np; ++i) {
30 clusters->SetNextPoint(x[i], y[i], z[i]);
31 AliTrackPoint *atp = new AliTrackPoint;
32 pArr->GetPoint(*atp, i);
33 clusters->SetPointId(atp);
34 }
35 }
36 }
37
38 if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
39 Warning("clusters_from_label", Form("No clusters match label '%d'", label));
40 delete clusters;
41 return 0;
42 }
43
44 clusters->SetMarkerStyle(2);
45 clusters->SetMarkerSize(0.5);
46 clusters->SetMarkerColor(4);
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 lab=%d", label));
51 char form[1000];
52 sprintf(form,"Clusters lab=%d", label);
53 clusters->SetName(form);
54
55 char tip[1000];
56 sprintf(tip,"N=%d", clusters->Size());
57 clusters->SetTitle(tip);
58 gEve->AddElement(clusters, cont);
59 gEve->Redraw3D();
60
61 return clusters;
62}