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