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 **************************************************************************/
10 #if !defined(__CINT__) || defined(__MAKECINT__)
11 #include <TObjArray.h>
13 #include <TEveManager.h>
14 #include <TEveElement.h>
15 #include <TEvePointSet.h>
17 #include <AliCluster.h>
18 #include <AliRunLoader.h>
19 #include <AliTRDcluster.h>
20 #include <AliEveEventManager.h>
26 TEvePointSet* trd_clusters(TEveElement *cont = 0)
28 const Int_t kMaxClusters = 18 * 6 * 24 *10;
30 AliEveEventManager::AssertGeometry();
32 AliRunLoader *rl = AliEveEventManager::AssertRunLoader();
33 rl->LoadRecPoints("TRD");
35 TTree *recPoints = rl->GetTreeR("TRD", kFALSE);
39 TObjArray *TRDcluster = 0x0;
40 recPoints->SetBranchAddress("TRDcluster", &TRDcluster);
42 TEvePointSet *clusters = new TEvePointSet(kMaxClusters);
43 clusters->SetOwnIds(kTRUE);
46 Int_t nentr=(Int_t)recPoints->GetEntries();
47 for (Int_t i=0; i<nentr; i++) {
48 if (!recPoints->GetEvent(i)) continue;
50 Int_t ncl=TRDcluster->GetEntriesFast();
53 AliTRDcluster *c = (AliTRDcluster*)TRDcluster->UncheckedAt(ncl);
54 Float_t g[3]; //global coordinates
56 clusters->SetNextPoint(g[0], g[1], g[2]);
57 AliCluster *atp = new AliCluster(*c);
58 clusters->SetPointId(atp);
63 rl->UnloadRecPoints("TRD");
65 if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
66 Warning("trd_clusters.C", "No TRD clusters");
71 clusters->SetName("TRD Clusters");
73 clusters->SetTitle(Form("N=%d", clusters->Size()));
75 const TString viz_tag("REC Clusters TRD");
77 clusters->ApplyVizTag(viz_tag, "Clusters");
79 gEve->AddElement(clusters, cont);