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