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 // when going to new root call:
78 // clusters->ApplyVizTag(viz_tag, "Clusters");
79 clusters->ApplyVizTag(viz_tag);
81 gEve->AddElement(clusters, cont);
88 TEvePointSet* tof_clusters_sec(Int_t selectedSector,
89 TEveElement* cont=0, Float_t maxR=390)
91 AliEveEventManager::AssertGeometry();
93 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
94 rl->LoadRecPoints("TOF");
96 TTree *cTree = rl->GetTreeR("TOF", false);
101 cTree->SetBranchAddress("TOF", &cl);
103 TEvePointSet* clusters = new TEvePointSet(10000);
104 clusters->SetOwnIds(kTRUE);
106 Float_t maxRsqr = maxR*maxR;
107 Double_t phiAngle = maxR*maxR;
109 Int_t nentr=(Int_t)cTree->GetEntries();
110 for (Int_t i=0; i<nentr; i++) {
111 if (!cTree->GetEvent(i)) continue;
113 Int_t ncl=cl->GetEntriesFast();
115 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
116 Float_t g[3]; //global coordinates
119 phiAngle = 180./TMath::Pi()*(TMath::ATan2(-g[1],-g[0])+TMath::Pi());
121 if (g[0]*g[0]+g[1]*g[1] < maxRsqr) {
123 (selectedSector!=-1 &&
124 phiAngle>=selectedSector*20. && phiAngle<(selectedSector+1)*20.)
128 clusters->SetNextPoint(g[0], g[1], g[2]);
129 AliCluster *atp = new AliCluster(*c);
130 clusters->SetPointId(atp);
137 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
138 Warning("tof_clusters.C", "No TOF clusters");
144 sprintf(form,"TOF Clusters");
145 clusters->SetName(form);
148 sprintf(tip,"N=%d", clusters->Size());
149 clusters->SetTitle(tip);
151 const TString viz_tag("TOF Clusters");
152 // when going to new root call:
153 // clusters->ApplyVizTag(viz_tag, "Clusters");
154 clusters->ApplyVizTag(viz_tag);
156 gEve->AddElement(clusters, cont);