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