]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/hmpid_clusters.C
Modified macros to be compilable by ACLiC
[u/mrichter/AliRoot.git] / EVE / alice-macros / hmpid_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 **************************************************************************/
d9df40bc 9
ba978640 10#if !defined(__CINT__) || defined(__MAKECINT__)
11#include <TClonesArray.h>
4ccefff8 12#include <TBranch.h>
13#include <TTree.h>
ba978640 14#include <TEveManager.h>
15#include <TEveElement.h>
16#include <TEvePointSet.h>
d9df40bc 17
ba978640 18#include <STEER/STEER/AliCluster3D.h>
19#include <STEER/STEER/AliRunLoader.h>
20#include <EveBase/AliEveEventManager.h>
21#else
22class TEveElement;
23class TEvePointSet;
d9df40bc 24#endif
25
391fa967 26TEvePointSet* hmpid_clusters(TEveElement* cont=0)
d9df40bc 27{
28 const Int_t nCh=7;
29 TClonesArray *cl[nCh] = {0,0,0,0,0,0,0};
b631c5f2 30 const Char_t *name[nCh]={
d9df40bc 31 "HMPID0",
32 "HMPID1",
33 "HMPID2",
34 "HMPID3",
35 "HMPID4",
36 "HMPID5",
37 "HMPID6"
38 };
39
40
84aff7a4 41 TEvePointSet* clusters = new TEvePointSet(10000);
d9df40bc 42 clusters->SetOwnIds(kTRUE);
43
d810d0de 44 AliEveEventManager::AssertGeometry();
51346b82 45
d810d0de 46 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
d9df40bc 47 rl->LoadRecPoints("HMPID");
48
49 TTree *cTree = rl->GetTreeR("HMPID", false);
50 if (!cTree) return 0;
51
52 for (Int_t k=0; k<nCh; k++) {
53 TBranch *br=cTree->GetBranch(name[k]);
54 if (!br) return 0;
55 br->SetAddress(&(cl[k]));
51346b82 56 }
d9df40bc 57
58 if (!cTree->GetEvent(0)) return 0;
59
60
61 for (Int_t i=0; i<nCh; i++) {
62 TClonesArray *arr=cl[i];
63 Int_t ncl=arr->GetEntriesFast();
64
d9df40bc 65 while (ncl--) {
66 AliCluster3D *c=(AliCluster3D*)arr->UncheckedAt(ncl);
67 Float_t g[3]; //global coordinates
68 c->GetGlobalXYZ(g);
391fa967 69 clusters->SetNextPoint(g[0], g[1], g[2]);
70 AliCluster3D *atp = new AliCluster3D(*c);
71 clusters->SetPointId(atp);
d9df40bc 72 }
73 }
74
f1fa3b4b 75 rl->UnloadRecPoints("HMPID");
76
84aff7a4 77 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
d9df40bc 78 Warning("hmpid_clusters", "No HMPID clusters");
79 delete clusters;
80 return 0;
81 }
82
83 clusters->SetMarkerStyle(2);
84 clusters->SetMarkerSize(0.2);
85 clusters->SetMarkerColor(4);
86
30650838 87 clusters->SetName("HMPID Clusters");
88
89 clusters->SetTitle(Form("N=%d", clusters->Size()));
90
199f125c 91 const TString viz_tag("REC Clusters HMPID");
30650838 92
93 clusters->ApplyVizTag(viz_tag, "Clusters");
d9df40bc 94
84aff7a4 95 gEve->AddElement(clusters, cont);
30650838 96
84aff7a4 97 gEve->Redraw3D();
d9df40bc 98
99 return clusters;
100}