]>
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 | **************************************************************************/ |
32e219c2 | 9 | #ifdef __CINT__ |
d5e9edb3 | 10 | |
84aff7a4 | 11 | class TEveElement; |
12 | class TEvePointSet; | |
32e219c2 | 13 | |
14 | #else | |
15 | ||
84aff7a4 | 16 | #include <TEveManager.h> |
17 | #include <TEvePointSet.h> | |
ea5d9491 | 18 | #include <EveBase/AliEveEventManager.h> |
32e219c2 | 19 | |
20 | #include <AliRunLoader.h> | |
21 | #include <AliCluster.h> | |
22 | ||
23 | #include <TClonesArray.h> | |
24 | ||
25 | #endif | |
26 | ||
84aff7a4 | 27 | TEvePointSet* its_clusters(TEveElement* cont=0, Float_t maxR=50) |
d5e9edb3 | 28 | { |
d810d0de | 29 | AliEveEventManager::AssertGeometry(); |
d5e9edb3 | 30 | |
d810d0de | 31 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); |
d5e9edb3 | 32 | rl->LoadRecPoints("ITS"); |
33 | ||
34 | TTree *cTree = rl->GetTreeR("ITS", false); | |
35 | ||
84aff7a4 | 36 | TEvePointSet* clusters = new TEvePointSet(10000); |
d5e9edb3 | 37 | clusters->SetOwnIds(kTRUE); |
38 | ||
32e219c2 | 39 | TClonesArray *cl = NULL; |
40 | TBranch *branch = cTree->GetBranch("ITSRecPoints"); | |
d5e9edb3 | 41 | branch->SetAddress(&cl); |
42 | ||
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 | ||
ec357b01 | 49 | Float_t maxRsqr = maxR*maxR; |
d5e9edb3 | 50 | while (ncl--) { |
51 | AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl); | |
52 | Float_t g[3]; //global coordinates | |
53 | c->GetGlobalXYZ(g); | |
ec357b01 | 54 | if (g[0]*g[0]+g[1]*g[1] < maxRsqr) |
55 | { | |
56 | clusters->SetNextPoint(g[0], g[1], g[2]); | |
57 | AliCluster *atp = new AliCluster(*c); | |
58 | clusters->SetPointId(atp); | |
59 | } | |
d5e9edb3 | 60 | } |
61 | } | |
62 | ||
84aff7a4 | 63 | if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) { |
d5e9edb3 | 64 | Warning("its_clusters", "No ITS clusters"); |
65 | delete clusters; | |
66 | return 0; | |
67 | } | |
68 | ||
69 | clusters->SetMarkerStyle(2); | |
0ccc545c | 70 | clusters->SetMarkerSize(0.2); |
d5e9edb3 | 71 | clusters->SetMarkerColor(4); |
72 | ||
73 | char form[1000]; | |
74 | sprintf(form,"ITS Clusters"); | |
75 | clusters->SetName(form); | |
76 | ||
77 | char tip[1000]; | |
78 | sprintf(tip,"N=%d", clusters->Size()); | |
79 | clusters->SetTitle(tip); | |
84aff7a4 | 80 | gEve->AddElement(clusters, cont); |
81 | gEve->Redraw3D(); | |
d5e9edb3 | 82 | |
83 | return clusters; | |
84 | } |