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 **************************************************************************/
9 #if !defined(__CINT__) || defined(__MAKECINT__)
10 #include <TObjArray.h>
14 #include <TEveManager.h>
15 #include <TEvePointSet.h>
17 #include <AliCluster.h>
18 #include <AliRunLoader.h>
19 #include <AliEveEventManager.h>
25 TEvePointSet* tof_clusters(TEveElement* cont=0, Float_t maxR=390)
27 AliEveEventManager::AssertGeometry();
29 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
30 rl->LoadRecPoints("TOF");
32 TTree *cTree = rl->GetTreeR("TOF", false);
37 cTree->SetBranchAddress("TOF", &cl);
39 TEvePointSet* clusters = new TEvePointSet(10000);
40 clusters->SetOwnIds(kTRUE);
42 Float_t maxRsqr = maxR*maxR;
44 Int_t nentr=(Int_t)cTree->GetEntries();
45 for (Int_t i=0; i<nentr; i++)
47 if (!cTree->GetEvent(i)) continue;
49 Int_t ncl=cl->GetEntriesFast();
52 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
53 Float_t g[3]; //global coordinates
56 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
57 clusters->SetNextPoint(g[0], g[1], g[2]);
58 AliCluster *atp = new AliCluster(*c);
59 clusters->SetPointId(atp);
64 rl->UnloadRecPoints("TOF");
66 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
68 Warning("tof_clusters.C", "No TOF clusters");
73 clusters->SetName("TOF Clusters");
74 clusters->SetTitle(Form("N=%d", clusters->Size()));
76 const TString viz_tag("REC Clusters TOF");
77 clusters->ApplyVizTag(viz_tag, "Clusters");
79 gEve->AddElement(clusters, cont);
85 TEvePointSet* tof_clusters_sec(Int_t selectedSector,
86 TEveElement* cont=0, Float_t maxR=390)
88 AliEveEventManager::AssertGeometry();
90 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
91 rl->LoadRecPoints("TOF");
93 TTree *cTree = rl->GetTreeR("TOF", false);
98 cTree->SetBranchAddress("TOF", &cl);
100 TEvePointSet* clusters = new TEvePointSet(10000);
101 clusters->SetOwnIds(kTRUE);
103 Float_t maxRsqr = maxR*maxR;
104 Double_t phiAngle = maxR*maxR;
106 Int_t nentr=(Int_t)cTree->GetEntries();
107 for (Int_t i=0; i<nentr; i++) {
108 if (!cTree->GetEvent(i)) continue;
110 Int_t ncl=cl->GetEntriesFast();
112 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
113 Float_t g[3]; //global coordinates
116 phiAngle = 180./TMath::Pi()*(TMath::ATan2(-g[1],-g[0])+TMath::Pi());
118 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
120 (selectedSector!=-1 &&
121 phiAngle>=selectedSector*20. && phiAngle<(selectedSector+1)*20.)
125 clusters->SetNextPoint(g[0], g[1], g[2]);
126 AliCluster *atp = new AliCluster(*c);
127 clusters->SetPointId(atp);
134 rl->UnloadRecPoints("TOF");
136 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
137 Warning("tof_clusters.C", "No TOF clusters");
142 clusters->SetName(Form("REC Clusters TOF"));
143 clusters->SetTitle(Form("N=%d", clusters->Size()));
145 const TString viz_tag("REC Clusters TOF");
146 clusters->ApplyVizTag(viz_tag, "Clusters");
148 gEve->AddElement(clusters, cont);