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