ROOT logo
// $Id$
// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/**************************************************************************
 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
 * full copyright notice.                                                 *
 **************************************************************************/

#if !defined(__CINT__) || defined(__MAKECINT__)
#include <TClonesArray.h>
#include <TBranch.h>
#include <TTree.h>
#include <TEveManager.h>
#include <TEveElement.h>
#include <TEvePointSet.h>
#include <TTree.h>
#include <TBranch.h>

#include <AliCluster3D.h>
#include <AliRunLoader.h>
#include <AliEveEventManager.h>
#else
class TEveElement;
class TEvePointSet;
class TTree;
class TBranch;
#endif

TEvePointSet* hmpid_clusters(TEveElement* cont=0)
{
  const Int_t nCh=7;
  TClonesArray *cl[nCh] = {0,0,0,0,0,0,0};
  const Char_t *name[nCh]={
    "HMPID0",
    "HMPID1",
    "HMPID2",
    "HMPID3",
    "HMPID4",
    "HMPID5",
    "HMPID6"
  };


  TEvePointSet* clusters = new TEvePointSet(10000);
  clusters->SetOwnIds(kTRUE);

  AliEveEventManager::AssertGeometry();

  AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
  rl->LoadRecPoints("HMPID");

  TTree *cTree = rl->GetTreeR("HMPID", false);
  if (!cTree) return 0;

  for (Int_t k=0; k<nCh; k++) {
     TBranch *br=cTree->GetBranch(name[k]);
     if (!br) return 0;
     br->SetAddress(&(cl[k]));
  }

  if (!cTree->GetEvent(0)) return 0;


  for (Int_t i=0; i<nCh; i++) {
    TClonesArray *arr=cl[i];
    Int_t ncl=arr->GetEntriesFast();

    while (ncl--) {
      AliCluster3D *c=(AliCluster3D*)arr->UncheckedAt(ncl);
      Float_t g[3]; //global coordinates
      c->GetGlobalXYZ(g);
      clusters->SetNextPoint(g[0], g[1], g[2]);
      AliCluster3D *atp = new AliCluster3D(*c);
      clusters->SetPointId(atp);
    }
  }

  rl->UnloadRecPoints("HMPID");

  if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
    Warning("hmpid_clusters", "No HMPID clusters");
    delete clusters;
    return 0;
  }

  clusters->SetMarkerStyle(2);
  clusters->SetMarkerSize(0.2);
  clusters->SetMarkerColor(4);

  clusters->SetName("HMPID Clusters");

  clusters->SetTitle(Form("N=%d", clusters->Size()));

  const TString viz_tag("REC Clusters HMPID");

  clusters->ApplyVizTag(viz_tag, "Clusters");

  gEve->AddElement(clusters, cont);

  gEve->Redraw3D();

  return clusters;
}
 hmpid_clusters.C:1
 hmpid_clusters.C:2
 hmpid_clusters.C:3
 hmpid_clusters.C:4
 hmpid_clusters.C:5
 hmpid_clusters.C:6
 hmpid_clusters.C:7
 hmpid_clusters.C:8
 hmpid_clusters.C:9
 hmpid_clusters.C:10
 hmpid_clusters.C:11
 hmpid_clusters.C:12
 hmpid_clusters.C:13
 hmpid_clusters.C:14
 hmpid_clusters.C:15
 hmpid_clusters.C:16
 hmpid_clusters.C:17
 hmpid_clusters.C:18
 hmpid_clusters.C:19
 hmpid_clusters.C:20
 hmpid_clusters.C:21
 hmpid_clusters.C:22
 hmpid_clusters.C:23
 hmpid_clusters.C:24
 hmpid_clusters.C:25
 hmpid_clusters.C:26
 hmpid_clusters.C:27
 hmpid_clusters.C:28
 hmpid_clusters.C:29
 hmpid_clusters.C:30
 hmpid_clusters.C:31
 hmpid_clusters.C:32
 hmpid_clusters.C:33
 hmpid_clusters.C:34
 hmpid_clusters.C:35
 hmpid_clusters.C:36
 hmpid_clusters.C:37
 hmpid_clusters.C:38
 hmpid_clusters.C:39
 hmpid_clusters.C:40
 hmpid_clusters.C:41
 hmpid_clusters.C:42
 hmpid_clusters.C:43
 hmpid_clusters.C:44
 hmpid_clusters.C:45
 hmpid_clusters.C:46
 hmpid_clusters.C:47
 hmpid_clusters.C:48
 hmpid_clusters.C:49
 hmpid_clusters.C:50
 hmpid_clusters.C:51
 hmpid_clusters.C:52
 hmpid_clusters.C:53
 hmpid_clusters.C:54
 hmpid_clusters.C:55
 hmpid_clusters.C:56
 hmpid_clusters.C:57
 hmpid_clusters.C:58
 hmpid_clusters.C:59
 hmpid_clusters.C:60
 hmpid_clusters.C:61
 hmpid_clusters.C:62
 hmpid_clusters.C:63
 hmpid_clusters.C:64
 hmpid_clusters.C:65
 hmpid_clusters.C:66
 hmpid_clusters.C:67
 hmpid_clusters.C:68
 hmpid_clusters.C:69
 hmpid_clusters.C:70
 hmpid_clusters.C:71
 hmpid_clusters.C:72
 hmpid_clusters.C:73
 hmpid_clusters.C:74
 hmpid_clusters.C:75
 hmpid_clusters.C:76
 hmpid_clusters.C:77
 hmpid_clusters.C:78
 hmpid_clusters.C:79
 hmpid_clusters.C:80
 hmpid_clusters.C:81
 hmpid_clusters.C:82
 hmpid_clusters.C:83
 hmpid_clusters.C:84
 hmpid_clusters.C:85
 hmpid_clusters.C:86
 hmpid_clusters.C:87
 hmpid_clusters.C:88
 hmpid_clusters.C:89
 hmpid_clusters.C:90
 hmpid_clusters.C:91
 hmpid_clusters.C:92
 hmpid_clusters.C:93
 hmpid_clusters.C:94
 hmpid_clusters.C:95
 hmpid_clusters.C:96
 hmpid_clusters.C:97
 hmpid_clusters.C:98
 hmpid_clusters.C:99
 hmpid_clusters.C:100
 hmpid_clusters.C:101
 hmpid_clusters.C:102
 hmpid_clusters.C:103
 hmpid_clusters.C:104
 hmpid_clusters.C:105