]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/hmpid_clusters.C
Remove EVE/Reve/ sub-module.
[u/mrichter/AliRoot.git] / EVE / alice-macros / hmpid_clusters.C
CommitLineData
d9df40bc 1#ifdef __CINT__
2
84aff7a4 3namespace TEveUtil
d9df40bc 4{
84aff7a4 5class TEveElement;
6class TEvePointSet;
d9df40bc 7}
8
9#else
10
84aff7a4 11#include <TEve.h>
12#include <TEveManager.h>
13#include <TEvePointSet.h>
d9df40bc 14#include <Alieve/EventAlieve.h>
15
16#include <AliRunLoader.h>
17#include <AliCluster3D.h>
18
19#include <TClonesArray.h>
20
21#endif
22
84aff7a4 23TEvePointSet* hmpid_clusters(TEveElement* cont=0, Float_t maxR=1000)
d9df40bc 24{
25 const Int_t nCh=7;
26 TClonesArray *cl[nCh] = {0,0,0,0,0,0,0};
27 Char_t *name[nCh]={
28 "HMPID0",
29 "HMPID1",
30 "HMPID2",
31 "HMPID3",
32 "HMPID4",
33 "HMPID5",
34 "HMPID6"
35 };
36
37
84aff7a4 38 TEvePointSet* clusters = new TEvePointSet(10000);
d9df40bc 39 clusters->SetOwnIds(kTRUE);
40
41 Alieve::Event::AssertGeometry();
42
43 AliRunLoader* rl = Alieve::Event::AssertRunLoader();
44 rl->LoadRecPoints("HMPID");
45
46 TTree *cTree = rl->GetTreeR("HMPID", false);
47 if (!cTree) return 0;
48
49 for (Int_t k=0; k<nCh; k++) {
50 TBranch *br=cTree->GetBranch(name[k]);
51 if (!br) return 0;
52 br->SetAddress(&(cl[k]));
53 }
54
55 if (!cTree->GetEvent(0)) return 0;
56
57
58 for (Int_t i=0; i<nCh; i++) {
59 TClonesArray *arr=cl[i];
60 Int_t ncl=arr->GetEntriesFast();
61
62 Float_t maxRsqr = maxR*maxR;
63 while (ncl--) {
64 AliCluster3D *c=(AliCluster3D*)arr->UncheckedAt(ncl);
65 Float_t g[3]; //global coordinates
66 c->GetGlobalXYZ(g);
67 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
68 {
69 clusters->SetNextPoint(g[0], g[1], g[2]);
70 AliCluster3D *atp = new AliCluster3D(*c);
71 clusters->SetPointId(atp);
72 }
73 }
74 }
75
84aff7a4 76 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
d9df40bc 77 Warning("hmpid_clusters", "No HMPID clusters");
78 delete clusters;
79 return 0;
80 }
81
82 clusters->SetMarkerStyle(2);
83 clusters->SetMarkerSize(0.2);
84 clusters->SetMarkerColor(4);
85
86 char form[1000];
87 sprintf(form,"HMPID Clusters");
88 clusters->SetName(form);
89
90 char tip[1000];
91 sprintf(tip,"N=%d", clusters->Size());
92 clusters->SetTitle(tip);
84aff7a4 93 gEve->AddElement(clusters, cont);
94 gEve->Redraw3D();
d9df40bc 95
96 return clusters;
97}