Added support to display the HLT ESD Tree. See the comment in visscan_local.C for How
[u/mrichter/AliRoot.git] / EVE / alice-macros / trd_clusters.C
index 8cb21ac..5e99f57 100644 (file)
@@ -7,17 +7,22 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-#ifdef __CINT__
-class TEvePointSet;
-class TEveElement;
-#else
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TObjArray.h>
+#include <TTree.h>
 #include <TEveManager.h>
+#include <TEveElement.h>
 #include <TEvePointSet.h>
-#include <EveBase/AliEveEventManager.h>
+#include <TGeoMatrix.h>
 
-#include "AliRunLoader.h"
-#include "AliCluster.h"
-#include "TRD/AliTRDcluster.h"
+#include <AliCluster.h>
+#include <AliGeomManager.h>
+#include <AliRunLoader.h>
+#include <AliTRDcluster.h>
+#include <AliEveEventManager.h>
+#else
+class TEvePointSet;
+class TEveElement;
 #endif
 
 TEvePointSet* trd_clusters(TEveElement *cont = 0)
@@ -39,7 +44,6 @@ TEvePointSet* trd_clusters(TEveElement *cont = 0)
   TEvePointSet *clusters = new TEvePointSet(kMaxClusters);
   clusters->SetOwnIds(kTRUE);
 
-
   Int_t nentr=(Int_t)recPoints->GetEntries();
   for (Int_t i=0; i<nentr; i++) {
     if (!recPoints->GetEvent(i)) continue;
@@ -48,9 +52,21 @@ TEvePointSet* trd_clusters(TEveElement *cont = 0)
 
     while (ncl--) {
       AliTRDcluster *c = (AliTRDcluster*)TRDcluster->UncheckedAt(ncl);
-      Float_t g[3]; //global coordinates
-      c->GetGlobalXYZ(g);
-      clusters->SetNextPoint(g[0], g[1], g[2]);
+      //Float_t g[3]; //global coordinates
+      //c->GetGlobalXYZ(g);
+      
+      Int_t fVolumeId = c->GetVolumeId();
+      const TGeoHMatrix *mt =AliGeomManager::GetTracking2LocalMatrix(fVolumeId);;
+      Double_t txyz[3] = {c->GetX(), c->GetY(), c->GetZ()};
+      Double_t lxyz[3] = {0, 0, 0};
+      mt->LocalToMaster(txyz,lxyz);
+   
+      TGeoHMatrix *mlIdeal = AliGeomManager::GetOrigGlobalMatrix(fVolumeId);
+      Double_t gxyzIdeal[3] = {0, 0, 0};
+      mlIdeal->LocalToMaster(lxyz,gxyzIdeal);
+      
+      clusters->SetNextPoint(gxyzIdeal[0], gxyzIdeal[1], gxyzIdeal[2]);
+      
       AliCluster *atp = new AliCluster(*c);
       clusters->SetPointId(atp);
     }
@@ -65,15 +81,12 @@ TEvePointSet* trd_clusters(TEveElement *cont = 0)
     return 0;
   }
 
-  char form[1000];
-  sprintf(form,"TRD Clusters");
-  clusters->SetName(form);
+  clusters->SetName("TRD Clusters");
+
+  clusters->SetTitle(Form("N=%d", clusters->Size()));
 
-  char tip[1000];
-  sprintf(tip,"N=%d", clusters->Size());
-  clusters->SetTitle(tip);
+  const TString viz_tag("REC Clusters TRD");
 
-  const TString viz_tag("TRD Clusters");
   clusters->ApplyVizTag(viz_tag, "Clusters");
 
   gEve->AddElement(clusters, cont);