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