]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/tpc_clusters.C
Update to new method names in AliESDv0, load them in visscan_init.C.
[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>
18#include <TEvePointSet.h>
ea5d9491 19#include <EveBase/AliEveEventManager.h>
32e219c2 20
21#include <AliRunLoader.h>
22#include <AliCluster.h>
23#include <TPC/AliTPCClustersRow.h>
24
25#endif
26
84aff7a4 27TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
ae1afd97 28{
29 const Int_t kMaxCl=100*160;
30
d810d0de 31 AliEveEventManager::AssertGeometry();
ae1afd97 32
84aff7a4 33 TEvePointSet* clusters = new TEvePointSet(kMaxCl);
ae1afd97 34 clusters->SetOwnIds(kTRUE);
35
d810d0de 36 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
ae1afd97 37 rl->LoadRecPoints("TPC");
38
39 AliTPCClustersRow *clrow=new AliTPCClustersRow();
40 clrow->SetClass("AliTPCclusterMI");
41 clrow->SetArray(kMaxCl);
42
43 TTree *cTree = rl->GetTreeR("TPC", false);
32e219c2 44 cTree->SetBranchAddress("Segment", &clrow);
ae1afd97 45
46 Float_t maxRsqr = maxR*maxR;
ae1afd97 47 Int_t nentr=(Int_t)cTree->GetEntries();
0abe4b3a 48 for (Int_t i=0; i<nentr; i++)
49 {
ae1afd97 50 if (!cTree->GetEvent(i)) continue;
51
0abe4b3a 52 TClonesArray *cl = clrow->GetArray();
53 Int_t ncl = cl->GetEntriesFast();
ae1afd97 54
0abe4b3a 55 while (ncl--)
56 {
57 AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
ae1afd97 58 Float_t g[3]; //global coordinates
59 c->GetGlobalXYZ(g);
60 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
61 {
62 clusters->SetNextPoint(g[0], g[1], g[2]);
63 AliCluster *atp = new AliCluster(*c);
64 clusters->SetPointId(atp);
65 }
66 }
67 cl->Clear();
68 }
69
70 delete clrow;
71
0abe4b3a 72 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
73 {
ae1afd97 74 Warning("tpc_clusters", "No TPC clusters");
75 delete clusters;
76 return 0;
77 }
78
79 clusters->SetMarkerStyle(2);
80 clusters->SetMarkerSize(0.2);
81 clusters->SetMarkerColor(4);
82
83 char form[1000];
84 sprintf(form,"TPC Clusters");
85 clusters->SetName(form);
86
87 char tip[1000];
88 sprintf(tip,"N=%d", clusters->Size());
89 clusters->SetTitle(tip);
84aff7a4 90 gEve->AddElement(clusters, cont);
91 gEve->Redraw3D();
ae1afd97 92
93 return clusters;
94}