]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/phos_clusters.C
First big commit of the mchview program and its accompanying library,
[u/mrichter/AliRoot.git] / EVE / alice-macros / phos_clusters.C
CommitLineData
8544d635 1
32e219c2 2Reve::PointSet* phos_clusters(Reve::RenderElement* cont=0)
8544d635 3{
0ccc545c 4 Alieve::Event::AssertGeometry();
8544d635 5
6 AliRunLoader* rl = Alieve::Event::AssertRunLoader();
7 rl->LoadRecPoints("PHOS");
8
9 TTree *cTree = rl->GetTreeR("PHOS", false);
10
11 Reve::PointSet* clusters = new Reve::PointSet(10000);
12 clusters->SetOwnIds(kTRUE);
13
895164e4 14 TObjArray *arr=NULL;
8544d635 15 TBranch *branch=cTree->GetBranch("PHOSEmcRP");
895164e4 16 branch->SetAddress(&arr);
8544d635 17
6baa2e65 18 Int_t nentr=(Int_t)branch->GetEntries();
8544d635 19 for (Int_t i=0; i<nentr; i++) {
6baa2e65 20 if (!branch->GetEvent(i)) continue;
8544d635 21
895164e4 22 Int_t ncl=arr->GetEntriesFast();
23 while (ncl--) {
24 AliCluster *cl=(AliCluster*)arr->UncheckedAt(ncl);
8544d635 25
895164e4 26 Float_t g[3]; //global coordinates
27 cl->GetGlobalXYZ(g);
28
29 AliCluster *atp = new AliCluster(*cl);
30 clusters->SetNextPoint(g[0], g[1], g[2]);
31 clusters->SetPointId(atp);
32 }
8544d635 33 }
34
895164e4 35 Warning("phos_clusters"," %d",clusters->Size());
36
8544d635 37 if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
38 Warning("phos_clusters", "No PHOS clusters");
39 delete clusters;
40 return 0;
41 }
42
43 clusters->SetMarkerStyle(2);
44 clusters->SetMarkerSize(0.5);
45 clusters->SetMarkerColor(4);
46
47 char form[1000];
48 sprintf(form,"PHOS Clusters");
49 clusters->SetName(form);
50
51 char tip[1000];
52 sprintf(tip,"N=%d", clusters->Size());
53 clusters->SetTitle(tip);
54
55 using namespace Reve;
56 gReve->AddRenderElement(clusters);
57 gReve->Redraw3D();
58
59 return clusters;
60}