]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/tpc_clusters.C
Futher development of macros for AliEve preparations for PbPb
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_clusters.C
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
cb4245bb 9
32e219c2 10#ifdef __CINT__
ae1afd97 11
84aff7a4 12class TEveElement;
13class TEvePointSet;
32e219c2 14
15#else
16
84aff7a4 17#include <TEveManager.h>
6aafad45 18#include <TColor.h>
84aff7a4 19#include <TEvePointSet.h>
ea5d9491 20#include <EveBase/AliEveEventManager.h>
32e219c2 21
22#include <AliRunLoader.h>
23#include <AliCluster.h>
24#include <TPC/AliTPCClustersRow.h>
6aafad45 25#include <TPC/AliTPCclusterMI.h>
32e219c2 26
27#endif
28
84aff7a4 29TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
ae1afd97 30{
6aafad45 31
ae1afd97 32 const Int_t kMaxCl=100*160;
33
6aafad45 34 Int_t fNColorBins = 5;
35
d810d0de 36 AliEveEventManager::AssertGeometry();
ae1afd97 37
d810d0de 38 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
ae1afd97 39 rl->LoadRecPoints("TPC");
40
787c89c5 41 TTree *cTree = rl->GetTreeR("TPC", false);
42 if (cTree == 0)
43 return 0;
44
45 AliTPCClustersRow *clrow = new AliTPCClustersRow();
ae1afd97 46 clrow->SetClass("AliTPCclusterMI");
47 clrow->SetArray(kMaxCl);
32e219c2 48 cTree->SetBranchAddress("Segment", &clrow);
ae1afd97 49
787c89c5 50 TEvePointSet* clusters = new TEvePointSet(kMaxCl);
51 clusters->SetOwnIds(kTRUE);
52
6aafad45 53 TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized");
54 cc->SetMainColor(kRed);
55 cc->SetMarkerStyle(4);
56 cc->SetMarkerSize(0.4);
57 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*60.);
58
59 cc->GetBin(0)->SetMainColor(kGray);
60 cc->GetBin(0)->SetMarkerSize(0.4);
61 cc->GetBin(1)->SetMainColor(kBlue);
62 cc->GetBin(1)->SetMarkerSize(0.42);
63 cc->GetBin(2)->SetMainColor(kCyan);
64 cc->GetBin(2)->SetMarkerSize(0.44);
65 cc->GetBin(3)->SetMainColor(kGreen);
66 cc->GetBin(3)->SetMarkerSize(0.46);
67 cc->GetBin(4)->SetMainColor(kYellow);
68 cc->GetBin(4)->SetMarkerSize(0.48);
69 cc->GetBin(5)->SetMainColor(kRed);
70 cc->GetBin(5)->SetMarkerSize(0.50);
71 cc->GetBin(6)->SetMainColor(kMagenta);
72 cc->GetBin(6)->SetMarkerSize(0.52);
787c89c5 73
ae1afd97 74 Float_t maxRsqr = maxR*maxR;
ae1afd97 75 Int_t nentr=(Int_t)cTree->GetEntries();
0abe4b3a 76 for (Int_t i=0; i<nentr; i++)
77 {
ae1afd97 78 if (!cTree->GetEvent(i)) continue;
79
0abe4b3a 80 TClonesArray *cl = clrow->GetArray();
81 Int_t ncl = cl->GetEntriesFast();
ae1afd97 82
0abe4b3a 83 while (ncl--)
84 {
6aafad45 85
86 AliTPCclusterMI* clusterMi = (AliTPCclusterMI*) cl->At(ncl);
87
0abe4b3a 88 AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
ae1afd97 89 Float_t g[3]; //global coordinates
90 c->GetGlobalXYZ(g);
91 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
92 {
6aafad45 93 cc->Fill(g[0], g[1], g[2], clusterMi->GetQ());
ae1afd97 94 clusters->SetNextPoint(g[0], g[1], g[2]);
95 AliCluster *atp = new AliCluster(*c);
96 clusters->SetPointId(atp);
97 }
98 }
99 cl->Clear();
100 }
101
102 delete clrow;
103
442b2a2f 104 rl->UnloadRecPoints("TPC");
6b6f47ac 105
0abe4b3a 106 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
107 {
8ebd7df4 108 Warning("tpc_clusters.C", "No TPC clusters");
ae1afd97 109 delete clusters;
110 return 0;
111 }
112
30650838 113 clusters->SetName("TPC Clusters");
ae1afd97 114
9dcd42ea 115 clusters->SetTitle(Form("N=%d", clusters->Size()));
f6afd0e1 116
9dcd42ea 117 const TString viz_tag("REC Clusters TPC");
30650838 118
68ca2fe7 119 clusters->ApplyVizTag(viz_tag, "Clusters");
f6afd0e1 120
6aafad45 121// clusters->SetRnrSelf(kFALSE);
122// clusters->SetRnrChildren(kFALSE);
123
124// gEve->AddElement(clusters, cont);
125
126 cc->SetRnrSelf(kTRUE);
127
128 gEve->AddElement(cc);
f6afd0e1 129
84aff7a4 130 gEve->Redraw3D();
ae1afd97 131
132 return clusters;
133}