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