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 **************************************************************************/
10 #if !defined(__CINT__) || defined(__MAKECINT__)
13 #include <TEveManager.h>
14 #include <TEvePointSet.h>
16 #include <AliCluster.h>
17 #include <AliRunLoader.h>
18 #include <AliTPCClustersRow.h>
19 #include <AliTPCclusterMI.h>
20 #include <AliEveEventManager.h>
26 TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
29 const Int_t kMaxCl=100*160;
31 Int_t fNColorBins = 5;
33 AliEveEventManager::AssertGeometry();
35 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
36 rl->LoadRecPoints("TPC");
38 TTree *cTree = rl->GetTreeR("TPC", false);
42 AliTPCClustersRow *clrow = new AliTPCClustersRow();
43 clrow->SetClass("AliTPCclusterMI");
44 clrow->SetArray(kMaxCl);
45 cTree->SetBranchAddress("Segment", &clrow);
47 TEvePointSet* clusters = new TEvePointSet(kMaxCl);
48 clusters->SetOwnIds(kTRUE);
50 TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized");
51 cc->SetMainColor(kRed);
52 cc->SetMarkerStyle(4);
53 cc->SetMarkerSize(0.4);
54 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*60.);
56 cc->GetBin(0)->SetMainColor(kGray);
57 cc->GetBin(0)->SetMarkerSize(0.4);
58 cc->GetBin(1)->SetMainColor(kBlue);
59 cc->GetBin(1)->SetMarkerSize(0.42);
60 cc->GetBin(2)->SetMainColor(kCyan);
61 cc->GetBin(2)->SetMarkerSize(0.44);
62 cc->GetBin(3)->SetMainColor(kGreen);
63 cc->GetBin(3)->SetMarkerSize(0.46);
64 cc->GetBin(4)->SetMainColor(kYellow);
65 cc->GetBin(4)->SetMarkerSize(0.48);
66 cc->GetBin(5)->SetMainColor(kRed);
67 cc->GetBin(5)->SetMarkerSize(0.50);
68 cc->GetBin(6)->SetMainColor(kMagenta);
69 cc->GetBin(6)->SetMarkerSize(0.52);
71 Float_t maxRsqr = maxR*maxR;
72 Int_t nentr=(Int_t)cTree->GetEntries();
73 for (Int_t i=0; i<nentr; i++)
75 if (!cTree->GetEvent(i)) continue;
77 TClonesArray *cl = clrow->GetArray();
78 Int_t ncl = cl->GetEntriesFast();
83 AliTPCclusterMI* clusterMi = (AliTPCclusterMI*) cl->At(ncl);
85 AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
86 Float_t g[3]; //global coordinates
88 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
90 cc->Fill(g[0], g[1], g[2], clusterMi->GetQ());
91 clusters->SetNextPoint(g[0], g[1], g[2]);
92 AliCluster *atp = new AliCluster(*c);
93 clusters->SetPointId(atp);
101 rl->UnloadRecPoints("TPC");
103 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
105 Warning("tpc_clusters.C", "No TPC clusters");
110 clusters->SetName("TPC Clusters");
112 clusters->SetTitle(Form("N=%d", clusters->Size()));
114 const TString viz_tag("REC Clusters TPC");
116 clusters->ApplyVizTag(viz_tag, "Clusters");
118 // clusters->SetRnrSelf(kFALSE);
119 // clusters->SetRnrChildren(kFALSE);
121 // gEve->AddElement(clusters, cont);
123 cc->SetRnrSelf(kTRUE);
125 gEve->AddElement(cc);