1 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 **************************************************************************/
15 #include <TEveManager.h>
16 #include <TEvePointSet.h>
17 #include <EveBase/AliEveEventManager.h>
19 #include <AliRunLoader.h>
20 #include <AliCluster.h>
24 TEvePointSet* tof_clusters(TEveElement* cont=0, Float_t maxR=390)
26 AliEveEventManager::AssertGeometry();
28 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
29 rl->LoadRecPoints("TOF");
31 TTree *cTree = rl->GetTreeR("TOF", false);
36 cTree->SetBranchAddress("TOF", &cl);
38 TEvePointSet* clusters = new TEvePointSet(10000);
39 clusters->SetOwnIds(kTRUE);
41 Float_t maxRsqr = maxR*maxR;
43 Int_t nentr=(Int_t)cTree->GetEntries();
44 for (Int_t i=0; i<nentr; i++) {
45 if (!cTree->GetEvent(i)) continue;
47 Int_t ncl=cl->GetEntriesFast();
49 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
50 Float_t g[3]; //global coordinates
53 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
54 clusters->SetNextPoint(g[0], g[1], g[2]);
55 AliCluster *atp = new AliCluster(*c);
56 clusters->SetPointId(atp);
62 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
63 Warning("tof_clusters.C", "No TOF clusters");
69 sprintf(form,"TOF Clusters");
70 clusters->SetName(form);
73 sprintf(tip,"N=%d", clusters->Size());
74 clusters->SetTitle(tip);
76 const TString viz_tag("TOF Clusters");
77 if (gEve->FindVizDBEntry(viz_tag) == 0)
79 TEvePointSet* m = new TEvePointSet();
81 m->SetMarkerSize(0.2);
83 gEve->InsertVizDBEntry(viz_tag, m);
85 clusters->ApplyVizTag(viz_tag);
87 gEve->AddElement(clusters, cont);
94 TEvePointSet* tof_clusters_sec(Int_t selectedSector,
95 TEveElement* cont=0, Float_t maxR=390)
97 AliEveEventManager::AssertGeometry();
99 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
100 rl->LoadRecPoints("TOF");
102 TTree *cTree = rl->GetTreeR("TOF", false);
107 cTree->SetBranchAddress("TOF", &cl);
109 TEvePointSet* clusters = new TEvePointSet(10000);
110 clusters->SetOwnIds(kTRUE);
112 Float_t maxRsqr = maxR*maxR;
113 Double_t phiAngle = maxR*maxR;
115 Int_t nentr=(Int_t)cTree->GetEntries();
116 for (Int_t i=0; i<nentr; i++) {
117 if (!cTree->GetEvent(i)) continue;
119 Int_t ncl=cl->GetEntriesFast();
121 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
122 Float_t g[3]; //global coordinates
125 phiAngle = 180./TMath::Pi()*(TMath::ATan2(-g[1],-g[0])+TMath::Pi());
127 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
129 (selectedSector!=-1 &&
130 phiAngle>=selectedSector*20. && phiAngle<(selectedSector+1)*20.)
134 clusters->SetNextPoint(g[0], g[1], g[2]);
135 AliCluster *atp = new AliCluster(*c);
136 clusters->SetPointId(atp);
143 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
144 Warning("tof_clusters.C", "No TOF clusters");
150 sprintf(form,"TOF Clusters");
151 clusters->SetName(form);
154 sprintf(tip,"N=%d", clusters->Size());
155 clusters->SetTitle(tip);
157 const TString viz_tag("TOF Clusters");
158 if (gEve->FindVizDBEntry(viz_tag) == 0)
160 TEvePointSet* m = new TEvePointSet();
161 m->SetMarkerColor(4);
162 m->SetMarkerSize(0.2);
163 m->SetMarkerStyle(2);
164 gEve->InsertVizDBEntry(viz_tag, m);
166 // The above can be removed when going to new root - then call:
167 // clusters->ApplyVizTag(viz_tag, "Clusters");
168 clusters->ApplyVizTag(viz_tag);
170 gEve->AddElement(clusters, cont);