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>
22 #include <TClonesArray.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);
37 TClonesArray *cl = NULL;
38 TBranch *branch = cTree->GetBranch("TOF");
39 branch->SetAddress(&cl);
41 TEvePointSet* clusters = new TEvePointSet(10000);
42 clusters->SetOwnIds(kTRUE);
44 Int_t nentr=(Int_t)cTree->GetEntries();
45 for (Int_t i=0; i<nentr; i++) {
46 if (!cTree->GetEvent(i)) continue;
48 Int_t ncl=cl->GetEntriesFast();
49 cout<<" ncl = "<<ncl<<endl;
50 Float_t maxRsqr = maxR*maxR;
52 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
53 Float_t g[3]; //global coordinates
55 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 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
65 Warning("tof_clusters.C", "No TOF clusters");
70 clusters->SetMarkerStyle(2);
71 clusters->SetMarkerSize(0.2);
72 clusters->SetMarkerColor(4);
75 sprintf(form,"TOF Clusters");
76 clusters->SetName(form);
79 sprintf(tip,"N=%d", clusters->Size());
80 clusters->SetTitle(tip);
81 gEve->AddElement(clusters, cont);