]>
Commit | Line | Data |
---|---|---|
455b87be | 1 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
5 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
6 | * full copyright notice. * | |
7 | **************************************************************************/ | |
455b87be | 8 | |
ba978640 | 9 | #if !defined(__CINT__) || defined(__MAKECINT__) |
10 | #include <TObjArray.h> | |
e383d8e4 | 11 | #include <TMath.h> |
176fc00c | 12 | #include <TTree.h> |
ba978640 | 13 | #include <TString.h> |
a172375c | 14 | #include <TEveManager.h> |
15 | #include <TEvePointSet.h> | |
455b87be | 16 | |
6c49a8e1 | 17 | #include <AliCluster.h> |
18 | #include <AliRunLoader.h> | |
19 | #include <AliEveEventManager.h> | |
ba978640 | 20 | #else |
21 | class TEveElement; | |
22 | class TEvePointSet; | |
455b87be | 23 | #endif |
24 | ||
25 | TEvePointSet* tof_clusters(TEveElement* cont=0, Float_t maxR=390) | |
26 | { | |
455b87be | 27 | AliEveEventManager::AssertGeometry(); |
28 | ||
29 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); | |
30 | rl->LoadRecPoints("TOF"); | |
31 | ||
32 | TTree *cTree = rl->GetTreeR("TOF", false); | |
a172375c | 33 | if (cTree == 0) |
34 | return 0; | |
455b87be | 35 | |
02000333 | 36 | TObjArray *cl = 0x0; |
37 | cTree->SetBranchAddress("TOF", &cl); | |
455b87be | 38 | |
a172375c | 39 | TEvePointSet* clusters = new TEvePointSet(10000); |
40 | clusters->SetOwnIds(kTRUE); | |
41 | ||
02000333 | 42 | Float_t maxRsqr = maxR*maxR; |
43 | ||
455b87be | 44 | Int_t nentr=(Int_t)cTree->GetEntries(); |
9dcd42ea | 45 | for (Int_t i=0; i<nentr; i++) |
46 | { | |
455b87be | 47 | if (!cTree->GetEvent(i)) continue; |
48 | ||
49 | Int_t ncl=cl->GetEntriesFast(); | |
9dcd42ea | 50 | while (ncl--) |
51 | { | |
455b87be | 52 | AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl); |
455b87be | 53 | Float_t g[3]; //global coordinates |
54 | c->GetGlobalXYZ(g); | |
02000333 | 55 | |
56 | if (g[0]*g[0]+g[1]*g[1] < maxRsqr) { | |
455b87be | 57 | clusters->SetNextPoint(g[0], g[1], g[2]); |
58 | AliCluster *atp = new AliCluster(*c); | |
455b87be | 59 | clusters->SetPointId(atp); |
a172375c | 60 | } |
02000333 | 61 | } |
62 | } | |
63 | ||
95a0b764 | 64 | rl->UnloadRecPoints("TOF"); |
65 | ||
9dcd42ea | 66 | if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) |
67 | { | |
02000333 | 68 | Warning("tof_clusters.C", "No TOF clusters"); |
69 | delete clusters; | |
70 | return 0; | |
71 | } | |
72 | ||
9dcd42ea | 73 | clusters->SetName("TOF Clusters"); |
74 | clusters->SetTitle(Form("N=%d", clusters->Size())); | |
02000333 | 75 | |
9dcd42ea | 76 | const TString viz_tag("REC Clusters TOF"); |
68ca2fe7 | 77 | clusters->ApplyVizTag(viz_tag, "Clusters"); |
f6afd0e1 | 78 | |
02000333 | 79 | gEve->AddElement(clusters, cont); |
80 | gEve->Redraw3D(); | |
81 | ||
82 | return clusters; | |
83 | } | |
84 | ||
a6337352 | 85 | TEvePointSet* tof_clusters_sec(Int_t selectedSector, |
86 | TEveElement* cont=0, Float_t maxR=390) | |
02000333 | 87 | { |
88 | AliEveEventManager::AssertGeometry(); | |
89 | ||
90 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); | |
91 | rl->LoadRecPoints("TOF"); | |
92 | ||
93 | TTree *cTree = rl->GetTreeR("TOF", false); | |
94 | if (cTree == 0) | |
95 | return 0; | |
96 | ||
97 | TObjArray *cl = 0x0; | |
98 | cTree->SetBranchAddress("TOF", &cl); | |
99 | ||
100 | TEvePointSet* clusters = new TEvePointSet(10000); | |
101 | clusters->SetOwnIds(kTRUE); | |
102 | ||
103 | Float_t maxRsqr = maxR*maxR; | |
104 | Double_t phiAngle = maxR*maxR; | |
105 | ||
106 | Int_t nentr=(Int_t)cTree->GetEntries(); | |
107 | for (Int_t i=0; i<nentr; i++) { | |
108 | if (!cTree->GetEvent(i)) continue; | |
109 | ||
110 | Int_t ncl=cl->GetEntriesFast(); | |
02000333 | 111 | while (ncl--) { |
112 | AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl); | |
113 | Float_t g[3]; //global coordinates | |
114 | c->GetGlobalXYZ(g); | |
115 | ||
116 | phiAngle = 180./TMath::Pi()*(TMath::ATan2(-g[1],-g[0])+TMath::Pi()); | |
117 | ||
118 | if (g[0]*g[0]+g[1]*g[1] < maxRsqr) { | |
119 | if ( | |
120 | (selectedSector!=-1 && | |
121 | phiAngle>=selectedSector*20. && phiAngle<(selectedSector+1)*20.) | |
122 | || | |
123 | selectedSector==-1) | |
124 | { | |
125 | clusters->SetNextPoint(g[0], g[1], g[2]); | |
126 | AliCluster *atp = new AliCluster(*c); | |
127 | clusters->SetPointId(atp); | |
128 | } | |
129 | } | |
130 | ||
455b87be | 131 | } |
132 | } | |
133 | ||
95a0b764 | 134 | rl->UnloadRecPoints("TOF"); |
135 | ||
a172375c | 136 | if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) { |
137 | Warning("tof_clusters.C", "No TOF clusters"); | |
455b87be | 138 | delete clusters; |
139 | return 0; | |
140 | } | |
141 | ||
9dcd42ea | 142 | clusters->SetName(Form("REC Clusters TOF")); |
9dcd42ea | 143 | clusters->SetTitle(Form("N=%d", clusters->Size())); |
f6afd0e1 | 144 | |
9dcd42ea | 145 | const TString viz_tag("REC Clusters TOF"); |
146 | clusters->ApplyVizTag(viz_tag, "Clusters"); | |
147 | ||
455b87be | 148 | gEve->AddElement(clusters, cont); |
149 | gEve->Redraw3D(); | |
150 | ||
151 | return clusters; | |
152 | } |