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