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