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