Added support to display the HLT ESD Tree. See the comment in visscan_local.C for How
[u/mrichter/AliRoot.git] / EVE / alice-macros / phos_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 **************************************************************************/
8544d635 9
ba978640 10#if !defined(__CINT__) || defined(__MAKECINT__)
11#include <TObjArray.h>
12#include <TBranch.h>
13#include <TTree.h>
14#include <TString.h>
15#include <TEveManager.h>
16#include <TEveElement.h>
17#include <TEvePointSet.h>
18
6c49a8e1 19#include <AliCluster.h>
20#include <AliRunLoader.h>
21#include <AliEveEventManager.h>
ba978640 22#endif
23
84aff7a4 24TEvePointSet* phos_clusters(TEveElement* cont=0)
8544d635 25{
d810d0de 26 AliEveEventManager::AssertGeometry();
8544d635 27
d810d0de 28 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
8544d635 29 rl->LoadRecPoints("PHOS");
30
31 TTree *cTree = rl->GetTreeR("PHOS", false);
32
e10d437c 33 if(!cTree) return 0;
34
84aff7a4 35 TEvePointSet* clusters = new TEvePointSet(10000);
8544d635 36 clusters->SetOwnIds(kTRUE);
37
895164e4 38 TObjArray *arr=NULL;
8544d635 39 TBranch *branch=cTree->GetBranch("PHOSEmcRP");
895164e4 40 branch->SetAddress(&arr);
8544d635 41
6baa2e65 42 Int_t nentr=(Int_t)branch->GetEntries();
8544d635 43 for (Int_t i=0; i<nentr; i++) {
6baa2e65 44 if (!branch->GetEvent(i)) continue;
8544d635 45
895164e4 46 Int_t ncl=arr->GetEntriesFast();
47 while (ncl--) {
48 AliCluster *cl=(AliCluster*)arr->UncheckedAt(ncl);
8544d635 49
895164e4 50 Float_t g[3]; //global coordinates
51 cl->GetGlobalXYZ(g);
52
53 AliCluster *atp = new AliCluster(*cl);
54 clusters->SetNextPoint(g[0], g[1], g[2]);
55 clusters->SetPointId(atp);
56 }
8544d635 57 }
58
84aff7a4 59 Warning("phos_clusters"," %d", clusters->Size());
895164e4 60
84aff7a4 61 if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
8544d635 62 Warning("phos_clusters", "No PHOS clusters");
63 delete clusters;
64 return 0;
65 }
66
67 clusters->SetMarkerStyle(2);
68 clusters->SetMarkerSize(0.5);
69 clusters->SetMarkerColor(4);
70
30650838 71 clusters->SetName("PHOS Clusters");
8544d635 72
9dcd42ea 73 clusters->SetTitle(Form("N=%d", clusters->Size()));
30650838 74
75 const TString viz_tag("REC Clusters PHOS");
76
77 clusters->ApplyVizTag(viz_tag, "Clusters");
78
84aff7a4 79 gEve->AddElement(clusters);
30650838 80
84aff7a4 81 gEve->Redraw3D();
8544d635 82
83 return clusters;
84}