2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
14 #include <TEveManager.h>
15 #include <TEvePointSet.h>
17 #include <EveBase/AliEveEventManager.h>
19 #include "AliRunLoader.h"
20 #include "AliCluster.h"
21 #include "TRD/AliTRDcluster.h"
24 TEvePointSet* trd_clusters(TEveElement *cont = 0)
26 const Int_t kMaxClusters = 18 * 6 * 24 *10;
28 AliEveEventManager::AssertGeometry();
30 AliRunLoader *rl = AliEveEventManager::AssertRunLoader();
31 rl->LoadRecPoints("TRD");
33 TTree *recPoints = rl->GetTreeR("TRD", kFALSE);
37 TObjArray *TRDcluster = 0x0;
38 recPoints->SetBranchAddress("TRDcluster", &TRDcluster);
40 TEvePointSet *clusters = new TEvePointSet(kMaxClusters);
41 clusters->SetOwnIds(kTRUE);
44 Int_t nentr=(Int_t)recPoints->GetEntries();
45 for (Int_t i=0; i<nentr; i++) {
46 if (!recPoints->GetEvent(i)) continue;
48 Int_t ncl=TRDcluster->GetEntriesFast();
51 AliTRDcluster *c = (AliTRDcluster*)TRDcluster->UncheckedAt(ncl);
52 Float_t g[3]; //global coordinates
54 clusters->SetNextPoint(g[0], g[1], g[2]);
55 AliCluster *atp = new AliCluster(*c);
56 clusters->SetPointId(atp);
61 rl->UnloadRecPoints("TRD");
63 if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
64 Warning("trd_clusters.C", "No TRD clusters");
69 clusters->SetName("TRD Clusters");
71 clusters->SetTitle(Form("N=%d", clusters->Size()));
73 const TString viz_tag("REC Clusters TRD");
75 clusters->ApplyVizTag(viz_tag, "Clusters");
77 gEve->AddElement(clusters, cont);