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 **************************************************************************/
20 #include <TEve/TEve.h>
21 #include <TEve/TEveManager.h>
22 #include <TEve/PointSet.h>
23 #include <Alieve/EventAlieve.h>
25 #include <AliRunLoader.h>
26 #include <AliCluster.h>
28 #include <TClonesArray.h>
32 TEvePointSet* tof_clusters(TEveElement* cont=0, Float_t maxR=390)
35 AliEveEventManager::AssertGeometry();
37 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
38 rl->LoadRecPoints("TOF");
40 TTree *cTree = rl->GetTreeR("TOF", false);
42 TEvePointSet* clusters = new TEvePointSet(10000);
43 clusters->SetOwnIds(kTRUE);
45 TClonesArray *cl=NULL;
46 TBranch *branch=cTree->GetBranch("TOF");
47 branch->SetAddress(&cl);
49 Int_t nentr=(Int_t)cTree->GetEntries();
50 for (Int_t i=0; i<nentr; i++) {
51 if (!cTree->GetEvent(i)) continue;
53 Int_t ncl=cl->GetEntriesFast();
54 cout<<" ncl = "<<ncl<<endl;
55 Float_t maxRsqr = maxR*maxR;
58 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
60 Float_t g[3]; //global coordinates
63 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
65 clusters->SetNextPoint(g[0], g[1], g[2]);
66 AliCluster *atp = new AliCluster(*c);
68 clusters->SetPointId(atp);
73 if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
74 Warning("tof_clusters", "No TOF clusters");
79 clusters->SetMarkerStyle(2);
80 clusters->SetMarkerSize(0.2);
81 clusters->SetMarkerColor(4);
84 sprintf(form,"TOF Clusters");
85 clusters->SetName(form);
88 sprintf(tip,"N=%d", clusters->Size());
89 clusters->SetTitle(tip);
91 gEve->AddElement(clusters, cont);