ae1afd97 |
1 | |
2 | Reve::PointSet* tpc_clusters(RenderElement* cont=0, Float_t maxR=270) |
3 | { |
4 | const Int_t kMaxCl=100*160; |
5 | |
6 | Alieve::Event::AssertGeometry(); |
7 | |
8 | Reve::PointSet* clusters = new Reve::PointSet(kMaxCl); |
9 | clusters->SetOwnIds(kTRUE); |
10 | |
11 | AliRunLoader* rl = Alieve::Event::AssertRunLoader(); |
12 | rl->LoadRecPoints("TPC"); |
13 | |
14 | AliTPCClustersRow *clrow=new AliTPCClustersRow(); |
15 | clrow->SetClass("AliTPCclusterMI"); |
16 | clrow->SetArray(kMaxCl); |
17 | |
18 | TTree *cTree = rl->GetTreeR("TPC", false); |
19 | TBranch *branch=cTree->SetBranchAddress("Segment",&clrow); |
20 | |
21 | Float_t maxRsqr = maxR*maxR; |
22 | TClonesArray *cl=clrow->GetArray(); |
23 | Int_t nentr=(Int_t)cTree->GetEntries(); |
24 | for (Int_t i=0; i<nentr; i++) { |
25 | if (!cTree->GetEvent(i)) continue; |
26 | |
27 | Int_t ncl=cl->GetEntriesFast(); |
28 | |
29 | while (ncl--) { |
30 | AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl); |
31 | Float_t g[3]; //global coordinates |
32 | c->GetGlobalXYZ(g); |
33 | if (g[0]*g[0]+g[1]*g[1] < maxRsqr) |
34 | { |
35 | clusters->SetNextPoint(g[0], g[1], g[2]); |
36 | AliCluster *atp = new AliCluster(*c); |
37 | clusters->SetPointId(atp); |
38 | } |
39 | } |
40 | cl->Clear(); |
41 | } |
42 | |
43 | delete clrow; |
44 | |
45 | if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) { |
46 | Warning("tpc_clusters", "No TPC clusters"); |
47 | delete clusters; |
48 | return 0; |
49 | } |
50 | |
51 | clusters->SetMarkerStyle(2); |
52 | clusters->SetMarkerSize(0.2); |
53 | clusters->SetMarkerColor(4); |
54 | |
55 | char form[1000]; |
56 | sprintf(form,"TPC Clusters"); |
57 | clusters->SetName(form); |
58 | |
59 | char tip[1000]; |
60 | sprintf(tip,"N=%d", clusters->Size()); |
61 | clusters->SetTitle(tip); |
62 | |
63 | using namespace Reve; |
64 | gReve->AddRenderElement(clusters); |
65 | gReve->Redraw3D(); |
66 | |
67 | return clusters; |
68 | } |