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 **************************************************************************/
17 #include <TEveManager.h>
18 #include <TEvePointSet.h>
19 #include <EveBase/AliEveEventManager.h>
21 #include <AliRunLoader.h>
22 #include <AliCluster.h>
26 TEvePointSet* tof_clusters(TEveElement* cont=0, Float_t maxR=390)
28 AliEveEventManager::AssertGeometry();
30 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
31 rl->LoadRecPoints("TOF");
33 TTree *cTree = rl->GetTreeR("TOF", false);
38 cTree->SetBranchAddress("TOF", &cl);
40 TEvePointSet* clusters = new TEvePointSet(10000);
41 clusters->SetOwnIds(kTRUE);
43 Float_t maxRsqr = maxR*maxR;
45 Int_t nentr=(Int_t)cTree->GetEntries();
46 for (Int_t i=0; i<nentr; i++)
48 if (!cTree->GetEvent(i)) continue;
50 Int_t ncl=cl->GetEntriesFast();
53 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
54 Float_t g[3]; //global coordinates
57 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
58 clusters->SetNextPoint(g[0], g[1], g[2]);
59 AliCluster *atp = new AliCluster(*c);
60 clusters->SetPointId(atp);
65 rl->UnloadRecPoints("TOF");
67 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
69 Warning("tof_clusters.C", "No TOF clusters");
74 clusters->SetName("TOF Clusters");
75 clusters->SetTitle(Form("N=%d", clusters->Size()));
77 const TString viz_tag("REC Clusters TOF");
78 clusters->ApplyVizTag(viz_tag, "Clusters");
80 gEve->AddElement(clusters, cont);
86 TEvePointSet* tof_clusters_sec(Int_t selectedSector,
87 TEveElement* cont=0, Float_t maxR=390)
89 AliEveEventManager::AssertGeometry();
91 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
92 rl->LoadRecPoints("TOF");
94 TTree *cTree = rl->GetTreeR("TOF", false);
99 cTree->SetBranchAddress("TOF", &cl);
101 TEvePointSet* clusters = new TEvePointSet(10000);
102 clusters->SetOwnIds(kTRUE);
104 Float_t maxRsqr = maxR*maxR;
105 Double_t phiAngle = maxR*maxR;
107 Int_t nentr=(Int_t)cTree->GetEntries();
108 for (Int_t i=0; i<nentr; i++) {
109 if (!cTree->GetEvent(i)) continue;
111 Int_t ncl=cl->GetEntriesFast();
113 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
114 Float_t g[3]; //global coordinates
117 phiAngle = 180./TMath::Pi()*(TMath::ATan2(-g[1],-g[0])+TMath::Pi());
119 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
121 (selectedSector!=-1 &&
122 phiAngle>=selectedSector*20. && phiAngle<(selectedSector+1)*20.)
126 clusters->SetNextPoint(g[0], g[1], g[2]);
127 AliCluster *atp = new AliCluster(*c);
128 clusters->SetPointId(atp);
135 rl->UnloadRecPoints("TOF");
137 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
138 Warning("tof_clusters.C", "No TOF clusters");
143 clusters->SetName(Form("REC Clusters TOF"));
144 clusters->SetTitle(Form("N=%d", clusters->Size()));
146 const TString viz_tag("REC Clusters TOF");
147 clusters->ApplyVizTag(viz_tag, "Clusters");
149 gEve->AddElement(clusters, cont);