2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
17 #include <TEveManager.h>
18 #include <TEvePointSet.h>
19 #include <EveBase/AliEveEventManager.h>
21 #include <AliRunLoader.h>
22 #include <AliCluster.h>
23 #include <TPC/AliTPCClustersRow.h>
27 TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
29 const Int_t kMaxCl=100*160;
31 AliEveEventManager::AssertGeometry();
33 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
34 rl->LoadRecPoints("TPC");
36 TTree *cTree = rl->GetTreeR("TPC", false);
40 AliTPCClustersRow *clrow = new AliTPCClustersRow();
41 clrow->SetClass("AliTPCclusterMI");
42 clrow->SetArray(kMaxCl);
43 cTree->SetBranchAddress("Segment", &clrow);
45 TEvePointSet* clusters = new TEvePointSet(kMaxCl);
46 clusters->SetOwnIds(kTRUE);
49 Float_t maxRsqr = maxR*maxR;
50 Int_t nentr=(Int_t)cTree->GetEntries();
51 for (Int_t i=0; i<nentr; i++)
53 if (!cTree->GetEvent(i)) continue;
55 TClonesArray *cl = clrow->GetArray();
56 Int_t ncl = cl->GetEntriesFast();
60 AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
61 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);
67 clusters->SetPointId(atp);
75 rl->UnloadRecPoints("TPC");
77 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
79 Warning("tpc_clusters.C", "No TPC clusters");
85 sprintf(form,"TPC Clusters");
86 clusters->SetName(form);
89 sprintf(tip,"N=%d", clusters->Size());
90 clusters->SetTitle(tip);
92 const TString viz_tag("TPC Clusters");
93 if (gEve->FindVizDBEntry(viz_tag) == 0)
95 TEvePointSet* m = new TEvePointSet();
97 m->SetMarkerSize(0.2);
99 gEve->InsertVizDBEntry(viz_tag, m);
101 // The above can be removed when going to new root - then call:
102 // clusters->ApplyVizTag(viz_tag, "Clusters");
103 clusters->ApplyVizTag(viz_tag);
105 gEve->AddElement(clusters, cont);