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++)
46 if (!cTree->GetEvent(i)) continue;
48 Int_t ncl=cl->GetEntriesFast();
51 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
52 Float_t g[3]; //global coordinates
55 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
56 clusters->SetNextPoint(g[0], g[1], g[2]);
57 AliCluster *atp = new AliCluster(*c);
58 clusters->SetPointId(atp);
63 rl->UnloadRecPoints("TOF");
65 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
67 Warning("tof_clusters.C", "No TOF clusters");
72 clusters->SetName("TOF Clusters");
73 clusters->SetTitle(Form("N=%d", clusters->Size()));
75 const TString viz_tag("REC Clusters TOF");
76 clusters->ApplyVizTag(viz_tag, "Clusters");
78 gEve->AddElement(clusters, cont);
84 TEvePointSet* tof_clusters_sec(Int_t selectedSector,
85 TEveElement* cont=0, Float_t maxR=390)
87 AliEveEventManager::AssertGeometry();
89 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
90 rl->LoadRecPoints("TOF");
92 TTree *cTree = rl->GetTreeR("TOF", false);
97 cTree->SetBranchAddress("TOF", &cl);
99 TEvePointSet* clusters = new TEvePointSet(10000);
100 clusters->SetOwnIds(kTRUE);
102 Float_t maxRsqr = maxR*maxR;
103 Double_t phiAngle = maxR*maxR;
105 Int_t nentr=(Int_t)cTree->GetEntries();
106 for (Int_t i=0; i<nentr; i++) {
107 if (!cTree->GetEvent(i)) continue;
109 Int_t ncl=cl->GetEntriesFast();
111 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
112 Float_t g[3]; //global coordinates
115 phiAngle = 180./TMath::Pi()*(TMath::ATan2(-g[1],-g[0])+TMath::Pi());
117 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
119 (selectedSector!=-1 &&
120 phiAngle>=selectedSector*20. && phiAngle<(selectedSector+1)*20.)
124 clusters->SetNextPoint(g[0], g[1], g[2]);
125 AliCluster *atp = new AliCluster(*c);
126 clusters->SetPointId(atp);
133 rl->UnloadRecPoints("TOF");
135 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
136 Warning("tof_clusters.C", "No TOF clusters");
141 clusters->SetName(Form("REC Clusters TOF"));
142 clusters->SetTitle(Form("N=%d", clusters->Size()));
144 const TString viz_tag("REC Clusters TOF");
145 clusters->ApplyVizTag(viz_tag, "Clusters");
147 gEve->AddElement(clusters, cont);