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