]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/phos_clusters.C
Remove trailing whitespace.
[u/mrichter/AliRoot.git] / EVE / alice-macros / phos_clusters.C
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
10 TEvePointSet* phos_clusters(TEveElement* cont=0)
11 {
12   AliEveEventManager::AssertGeometry();
13
14   AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
15   rl->LoadRecPoints("PHOS");
16
17   TTree *cTree = rl->GetTreeR("PHOS", false);
18
19   TEvePointSet* clusters = new TEvePointSet(10000);
20   clusters->SetOwnIds(kTRUE);
21
22   TObjArray *arr=NULL;
23   TBranch *branch=cTree->GetBranch("PHOSEmcRP");
24   branch->SetAddress(&arr);
25
26   Int_t nentr=(Int_t)branch->GetEntries();
27   for (Int_t i=0; i<nentr; i++) {
28     if (!branch->GetEvent(i)) continue;
29
30     Int_t ncl=arr->GetEntriesFast();
31     while (ncl--) {
32       AliCluster *cl=(AliCluster*)arr->UncheckedAt(ncl);
33
34       Float_t g[3]; //global coordinates
35       cl->GetGlobalXYZ(g);
36
37       AliCluster *atp = new AliCluster(*cl);
38       clusters->SetNextPoint(g[0], g[1], g[2]);
39       clusters->SetPointId(atp);
40     }
41   }
42
43   Warning("phos_clusters"," %d", clusters->Size());
44
45   if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
46     Warning("phos_clusters", "No PHOS clusters");
47     delete clusters;
48     return 0;
49   }
50
51   clusters->SetMarkerStyle(2);
52   clusters->SetMarkerSize(0.5);
53   clusters->SetMarkerColor(4);
54
55   char form[1000];
56   sprintf(form,"PHOS Clusters");
57   clusters->SetName(form);
58
59   char tip[1000];
60   sprintf(tip,"N=%d", clusters->Size());
61   clusters->SetTitle(tip);
62   gEve->AddElement(clusters);
63   gEve->Redraw3D();
64
65   return clusters;
66 }