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