]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/its_clusters.C
From Cvetan: new macro to load ITS clusters.
[u/mrichter/AliRoot.git] / EVE / alice-macros / its_clusters.C
1
2 Reve::PointSet* its_clusters(RenderElement* cont=0)
3 {
4   if (!gGeoManager)
5     gReve->GetGeometry("$PWD/misaligned_geometry.root");
6
7   AliRunLoader* rl = Alieve::Event::AssertRunLoader();
8   rl->LoadRecPoints("ITS");
9
10   TTree *cTree = rl->GetTreeR("ITS", false);
11
12   Reve::PointSet* clusters = new Reve::PointSet(10000);
13   clusters->SetOwnIds(kTRUE);
14
15   TClonesArray *cl=NULL;
16   TBranch *branch=cTree->GetBranch("ITSRecPoints");
17   branch->SetAddress(&cl);
18
19   Int_t nentr=(Int_t)cTree->GetEntries();
20   for (Int_t i=0; i<nentr; i++) {
21     if (!cTree->GetEvent(i)) continue;
22
23     Int_t ncl=cl->GetEntriesFast();
24
25     while (ncl--) {
26       AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
27       Float_t g[3]; //global coordinates
28       c->GetGlobalXYZ(g);
29
30       clusters->SetNextPoint(g[0], g[1], g[2]);
31       AliCluster *atp = new AliCluster(*c);
32       clusters->SetPointId(atp);
33     }
34   }
35
36   if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
37     Warning("its_clusters", "No ITS clusters");
38     delete clusters;
39     return 0;
40   }
41
42   clusters->SetMarkerStyle(2);
43   clusters->SetMarkerSize(0.5);
44   clusters->SetMarkerColor(4);
45
46   char form[1000];
47   sprintf(form,"ITS Clusters");
48   clusters->SetName(form);
49
50   char tip[1000];
51   sprintf(tip,"N=%d", clusters->Size());
52   clusters->SetTitle(tip);
53
54   using namespace Reve;
55   gReve->AddRenderElement(clusters);
56   gReve->Redraw3D();
57
58   return clusters;
59 }