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