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>
16 #include <TGeoMatrix.h>
18 #include <AliCluster.h>
19 #include <AliGeomManager.h>
20 #include <AliRunLoader.h>
21 #include <AliTRDcluster.h>
22 #include <AliEveEventManager.h>
28 TEvePointSet* trd_clusters(TEveElement *cont = 0)
30 const Int_t kMaxClusters = 18 * 6 * 24 *10;
32 AliEveEventManager::AssertGeometry();
34 AliRunLoader *rl = AliEveEventManager::AssertRunLoader();
35 rl->LoadRecPoints("TRD");
37 TTree *recPoints = rl->GetTreeR("TRD", kFALSE);
41 TObjArray *TRDcluster = 0x0;
42 recPoints->SetBranchAddress("TRDcluster", &TRDcluster);
44 TEvePointSet *clusters = new TEvePointSet(kMaxClusters);
45 clusters->SetOwnIds(kTRUE);
47 Int_t nentr=(Int_t)recPoints->GetEntries();
48 for (Int_t i=0; i<nentr; i++) {
49 if (!recPoints->GetEvent(i)) continue;
51 Int_t ncl=TRDcluster->GetEntriesFast();
54 AliTRDcluster *c = (AliTRDcluster*)TRDcluster->UncheckedAt(ncl);
55 //Float_t g[3]; //global coordinates
58 Int_t fVolumeId = c->GetVolumeId();
59 const TGeoHMatrix *mt =AliGeomManager::GetTracking2LocalMatrix(fVolumeId);;
60 Double_t txyz[3] = {c->GetX(), c->GetY(), c->GetZ()};
61 Double_t lxyz[3] = {0, 0, 0};
62 mt->LocalToMaster(txyz,lxyz);
64 TGeoHMatrix *mlIdeal = AliGeomManager::GetOrigGlobalMatrix(fVolumeId);
65 Double_t gxyzIdeal[3] = {0, 0, 0};
66 mlIdeal->LocalToMaster(lxyz,gxyzIdeal);
68 clusters->SetNextPoint(gxyzIdeal[0], gxyzIdeal[1], gxyzIdeal[2]);
70 AliCluster *atp = new AliCluster(*c);
71 clusters->SetPointId(atp);
76 rl->UnloadRecPoints("TRD");
78 if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
79 Warning("trd_clusters.C", "No TRD clusters");
84 clusters->SetName("TRD Clusters");
86 clusters->SetTitle(Form("N=%d", clusters->Size()));
88 const TString viz_tag("REC Clusters TRD");
90 clusters->ApplyVizTag(viz_tag, "Clusters");
92 gEve->AddElement(clusters, cont);