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");
68 clusters->SetMarkerStyle(2);
69 clusters->SetMarkerSize(0.2);
70 clusters->SetMarkerColor(4);
73 sprintf(form,"TOF Clusters");
74 clusters->SetName(form);
77 sprintf(tip,"N=%d", clusters->Size());
78 clusters->SetTitle(tip);
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 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
135 Warning("tof_clusters.C", "No TOF clusters");
140 clusters->SetMarkerStyle(2);
141 clusters->SetMarkerSize(0.2);
142 clusters->SetMarkerColor(4);
145 sprintf(form,"TOF Clusters");
146 clusters->SetName(form);
149 sprintf(tip,"N=%d", clusters->Size());
150 clusters->SetTitle(tip);
151 gEve->AddElement(clusters, cont);