]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/tof_clusters.C
Error removed
[u/mrichter/AliRoot.git] / EVE / alice-macros / tof_clusters.C
CommitLineData
455b87be 1// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
2
3/**************************************************************************
4 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
5 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
6 * full copyright notice. *
7 **************************************************************************/
8
9
10#ifdef __CINT__
11
12namespace TEve
13{
14class Element;
15class PointSet;
16}
17
18#else
19
20#include <TEve/TEve.h>
21#include <TEve/TEveManager.h>
22#include <TEve/PointSet.h>
23#include <Alieve/EventAlieve.h>
24
25#include <AliRunLoader.h>
26#include <AliCluster.h>
27
28#include <TClonesArray.h>
29
30#endif
31
32TEvePointSet* tof_clusters(TEveElement* cont=0, Float_t maxR=390)
33{
34
35 AliEveEventManager::AssertGeometry();
36
37 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
38 rl->LoadRecPoints("TOF");
39
40 TTree *cTree = rl->GetTreeR("TOF", false);
41
42 TEvePointSet* clusters = new TEvePointSet(10000);
43 clusters->SetOwnIds(kTRUE);
44
45 TClonesArray *cl=NULL;
46 TBranch *branch=cTree->GetBranch("TOF");
47 branch->SetAddress(&cl);
48
49 Int_t nentr=(Int_t)cTree->GetEntries();
50 for (Int_t i=0; i<nentr; i++) {
51 if (!cTree->GetEvent(i)) continue;
52
53 Int_t ncl=cl->GetEntriesFast();
54 cout<<" ncl = "<<ncl<<endl;
55 Float_t maxRsqr = maxR*maxR;
56 while (ncl--) {
57
58 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
59
60 Float_t g[3]; //global coordinates
61 c->GetGlobalXYZ(g);
62
63 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
64 {
65 clusters->SetNextPoint(g[0], g[1], g[2]);
66 AliCluster *atp = new AliCluster(*c);
67
68 clusters->SetPointId(atp);
69 }
70 }
71 }
72
73 if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
74 Warning("tof_clusters", "No TOF 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,"TOF Clusters");
85 clusters->SetName(form);
86
87 char tip[1000];
88 sprintf(tip,"N=%d", clusters->Size());
89 clusters->SetTitle(tip);
90
455b87be 91 gEve->AddElement(clusters, cont);
92 gEve->Redraw3D();
93
94 return clusters;
95}