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>
19 #include <TEvePointSet.h>
20 #include <EveBase/AliEveEventManager.h>
23 #include <AliRunLoader.h>
24 #include <AliCluster.h>
25 #include <TPC/AliTPCClustersRow.h>
26 #include <TPC/AliTPCclusterMI.h>
30 TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
33 const Int_t kMaxCl=100*160;
35 Int_t fNColorBins = 5;
37 AliEveEventManager::AssertGeometry();
39 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
40 rl->LoadRecPoints("TPC");
42 TTree *cTree = rl->GetTreeR("TPC", false);
46 AliTPCClustersRow *clrow = new AliTPCClustersRow();
47 clrow->SetClass("AliTPCclusterMI");
48 clrow->SetArray(kMaxCl);
49 cTree->SetBranchAddress("Segment", &clrow);
51 TEvePointSet* clusters = new TEvePointSet(kMaxCl);
52 clusters->SetOwnIds(kTRUE);
54 TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized");
55 cc->SetMainColor(kRed);
56 cc->SetMarkerStyle(4);
57 cc->SetMarkerSize(0.4);
58 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*60.);
60 cc->GetBin(0)->SetMainColor(kGray);
61 cc->GetBin(0)->SetMarkerSize(0.4);
62 cc->GetBin(1)->SetMainColor(kBlue);
63 cc->GetBin(1)->SetMarkerSize(0.42);
64 cc->GetBin(2)->SetMainColor(kCyan);
65 cc->GetBin(2)->SetMarkerSize(0.44);
66 cc->GetBin(3)->SetMainColor(kGreen);
67 cc->GetBin(3)->SetMarkerSize(0.46);
68 cc->GetBin(4)->SetMainColor(kYellow);
69 cc->GetBin(4)->SetMarkerSize(0.48);
70 cc->GetBin(5)->SetMainColor(kRed);
71 cc->GetBin(5)->SetMarkerSize(0.50);
72 cc->GetBin(6)->SetMainColor(kMagenta);
73 cc->GetBin(6)->SetMarkerSize(0.52);
75 Float_t maxRsqr = maxR*maxR;
76 Int_t nentr=(Int_t)cTree->GetEntries();
77 for (Int_t i=0; i<nentr; i++)
79 if (!cTree->GetEvent(i)) continue;
81 TClonesArray *cl = clrow->GetArray();
82 Int_t ncl = cl->GetEntriesFast();
87 AliTPCclusterMI* clusterMi = (AliTPCclusterMI*) cl->At(ncl);
89 AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
90 Float_t g[3]; //global coordinates
92 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
94 cc->Fill(g[0], g[1], g[2], clusterMi->GetQ());
95 clusters->SetNextPoint(g[0], g[1], g[2]);
96 AliCluster *atp = new AliCluster(*c);
97 clusters->SetPointId(atp);
105 rl->UnloadRecPoints("TPC");
107 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
109 Warning("tpc_clusters.C", "No TPC clusters");
114 clusters->SetName("TPC Clusters");
116 clusters->SetTitle(Form("N=%d", clusters->Size()));
118 const TString viz_tag("REC Clusters TPC");
120 clusters->ApplyVizTag(viz_tag, "Clusters");
122 // clusters->SetRnrSelf(kFALSE);
123 // clusters->SetRnrChildren(kFALSE);
125 // gEve->AddElement(clusters, cont);
127 cc->SetRnrSelf(kTRUE);
129 gEve->AddElement(cc);