32e219c2 |
1 | #ifdef __CINT__ |
ae1afd97 |
2 | |
84aff7a4 |
3 | namespace TEveUtil |
32e219c2 |
4 | { |
84aff7a4 |
5 | class TEveElement; |
6 | class 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 | #include <TPC/AliTPCClustersRow.h> |
19 | |
20 | #endif |
21 | |
84aff7a4 |
22 | TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270) |
ae1afd97 |
23 | { |
24 | const Int_t kMaxCl=100*160; |
25 | |
26 | Alieve::Event::AssertGeometry(); |
27 | |
84aff7a4 |
28 | TEvePointSet* clusters = new TEvePointSet(kMaxCl); |
ae1afd97 |
29 | clusters->SetOwnIds(kTRUE); |
30 | |
31 | AliRunLoader* rl = Alieve::Event::AssertRunLoader(); |
32 | rl->LoadRecPoints("TPC"); |
33 | |
34 | AliTPCClustersRow *clrow=new AliTPCClustersRow(); |
35 | clrow->SetClass("AliTPCclusterMI"); |
36 | clrow->SetArray(kMaxCl); |
37 | |
38 | TTree *cTree = rl->GetTreeR("TPC", false); |
32e219c2 |
39 | cTree->SetBranchAddress("Segment", &clrow); |
ae1afd97 |
40 | |
41 | Float_t maxRsqr = maxR*maxR; |
42 | TClonesArray *cl=clrow->GetArray(); |
43 | Int_t nentr=(Int_t)cTree->GetEntries(); |
44 | for (Int_t i=0; i<nentr; i++) { |
45 | if (!cTree->GetEvent(i)) continue; |
46 | |
47 | Int_t ncl=cl->GetEntriesFast(); |
48 | |
49 | while (ncl--) { |
50 | AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl); |
51 | Float_t g[3]; //global coordinates |
52 | c->GetGlobalXYZ(g); |
53 | if (g[0]*g[0]+g[1]*g[1] < maxRsqr) |
54 | { |
55 | clusters->SetNextPoint(g[0], g[1], g[2]); |
56 | AliCluster *atp = new AliCluster(*c); |
57 | clusters->SetPointId(atp); |
58 | } |
59 | } |
60 | cl->Clear(); |
61 | } |
62 | |
63 | delete clrow; |
64 | |
84aff7a4 |
65 | if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) { |
ae1afd97 |
66 | Warning("tpc_clusters", "No TPC clusters"); |
67 | delete clusters; |
68 | return 0; |
69 | } |
70 | |
71 | clusters->SetMarkerStyle(2); |
72 | clusters->SetMarkerSize(0.2); |
73 | clusters->SetMarkerColor(4); |
74 | |
75 | char form[1000]; |
76 | sprintf(form,"TPC Clusters"); |
77 | clusters->SetName(form); |
78 | |
79 | char tip[1000]; |
80 | sprintf(tip,"N=%d", clusters->Size()); |
81 | clusters->SetTitle(tip); |
84aff7a4 |
82 | gEve->AddElement(clusters, cont); |
83 | gEve->Redraw3D(); |
ae1afd97 |
84 | |
85 | return clusters; |
86 | } |