]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
vplot_tpc.C
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 Feb 2009 15:55:45 +0000 (15:55 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 Feb 2009 15:55:45 +0000 (15:55 +0000)
-----------
With Adam J.: subtract primary vertex tpc from cluster positions.

primary_vertex.C
----------------
TPC vertex box/ellipse/cross were checking wrong vertex.
Add more descriptive titles/tooltips.

geom_gentle.C
-------------
Add optional argument (Bool_t register_as_global=kTRUE) so that the
function can be used from elsewhere.

EVE/alice-macros/geom_gentle.C
EVE/alice-macros/primary_vertex.C
EVE/alice-macros/vplot_tpc.C

index 4f5a76477bec422f2362daac5a96b36702671fb9..1a2ecec8c6a529d2d06103a40aca5c9bd18622d3 100644 (file)
@@ -7,14 +7,18 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-TEveGeoShape* geom_gentle()
+TEveGeoShape* geom_gentle(Bool_t register_as_global=kTRUE)
 {
   TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo.root");
   TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
   TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
-  gEve->AddGlobalElement(gsre);
   f.Close();
 
+  if (register_as_global)
+  {
+    gEve->AddGlobalElement(gsre);
+  }
+
   return gsre;
 }
 
index 13ce5aee1f28f50109e38be2539772b633068c9d..a41cae3cf08a8ed419710767d1a8d99e52d92b08 100644 (file)
@@ -41,16 +41,21 @@ make_vertex_cross(AliESDVertex* v, Bool_t use_sigma, Float_t fx, Float_t fy, Flo
   v->GetXYZ(x); v->GetSigmaXYZ(e);
 
   TEveStraightLineSet* ls = new TEveStraightLineSet("Cross");
+  TString title;
   if (use_sigma)
   {
     e[0] *= fx; e[1] *= fy; e[2] *= fz;
-    ls->SetTitle(Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f*sigma_z", fx, fy, fz));
+    title += Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f*sigma_z", fx, fy, fz);
   }
   else
   {
     e[0] = fx; e[1] = fy; e[2] = fz;
-    ls->SetTitle(Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz));
+    title += Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz);
   }
+  title += Form("\nx=%.5f, y=%.5f, z=%.5f\nsx=%.5f, sy=%.5f, sz=%.5f",
+               x[0], x[1], x[2], e[0], e[1], e[2]);
+  ls.SetTitle(title);
+
   ls->AddLine(e[0], 0,    0,   -e[0], 0,    0);
   ls->AddLine(0,    e[1], 0,    0,   -e[1], 0);
   ls->AddLine(0,    0,    e[2], 0,    0,   -e[2]);
@@ -66,16 +71,20 @@ make_vertex_ellipse(AliESDVertex* v, Bool_t use_sigma, Float_t fx, Float_t fy, F
   v->GetXYZ(x); v->GetSigmaXYZ(e);
 
   TEveStraightLineSet* ls = new TEveStraightLineSet("Ellipse");
+  TString title;
   if (use_sigma)
   {
     e[0] *= fx; e[1] *= fy; e[2] *= fz;
-    ls->SetTitle(Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f sigma_z", fx, fy, fz));
+    title += Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f sigma_z", fx, fy, fz);
   }
   else
   {
     e[0] = fx; e[1] = fy; e[2] = fz;
-    ls->SetTitle(Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz));
+    title += Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz);
   }
+  title += Form("\nx=%.5f, y=%.5f, z=%.5f\nsx=%.5f, sy=%.5f, sz=%.5f",
+               x[0], x[1], x[2], e[0], e[1], e[2]);
+  ls.SetTitle(title);
 
   const Int_t   N = 32;
   const Float_t S = 2*TMath::Pi()/N;
@@ -106,16 +115,21 @@ make_vertex_box(AliESDVertex* v, Bool_t use_sigma, Float_t fx, Float_t fy, Float
   v->GetXYZ(x); v->GetSigmaXYZ(e);
 
   TEveStraightLineSet* ls = new TEveStraightLineSet("Box");
+  TString title;
   if (use_sigma)
   {
     e[0] *= fx; e[1] *= fy; e[2] *= fz;
-    ls->SetTitle(Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f*sigma_z", fx, fy, fz));
+    title += Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f*sigma_z", fx, fy, fz);
   }
   else
   {
     e[0] = fx; e[1] = fy; e[2] = fz;
-    ls->SetTitle(Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz));
+    title += Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz);
   }
+  title += Form("\nx=%.5f, y=%.5f, z=%.5f\nsx=%.5f, sy=%.5f, sz=%.5f",
+               x[0], x[1], x[2], e[0], e[1], e[2]);
+  ls.SetTitle(title);
+
   // pos z
   ls->AddLine( e[0],  e[1],  e[2],  e[0], -e[1],  e[2]);
   ls->AddLine( e[0], -e[1],  e[2], -e[0], -e[1],  e[2]);
@@ -180,7 +194,7 @@ primary_vertex_tpc(Bool_t use_sigma=kTRUE, Float_t fx=1, Float_t fy=1, Float_t f
 {
   AliESDEvent  *esd  = AliEveEventManager::AssertESD();
   AliESDVertex *tpcv = esd->GetPrimaryVertexTPC();
-  if ( ! pv->GetStatus()) {
+  if ( ! tpcv->GetStatus()) {
     Info("primary_vertex_tpc", "Primary vertex TPC not available.");
     return 0;
   }
@@ -235,7 +249,7 @@ primary_vertex_ellipse_tpc(Bool_t use_sigma=kTRUE, Float_t fx=30, Float_t fy=30,
 {
   AliESDEvent  *esd  = AliEveEventManager::AssertESD();
   AliESDVertex *tpcv = esd->GetPrimaryVertexTPC();
-  if ( ! pv->GetStatus()) {
+  if ( ! tpcv->GetStatus()) {
     Info("primary_vertex_ellipse_tpc", "Primary vertex TPC not available.");
     return 0;
   }
@@ -290,7 +304,7 @@ primary_vertex_box_tpc(Bool_t use_sigma=kTRUE, Float_t fx=30, Float_t fy=30, Flo
 {
   AliESDEvent  *esd  = AliEveEventManager::AssertESD();
   AliESDVertex *tpcv = esd->GetPrimaryVertexTPC();
-  if ( ! pv->GetStatus()) {
+  if ( ! tpcv->GetStatus()) {
     Info("primary_vertex_box_tpc", "Primary vertex TPC not available.");
     return 0;
   }
index 9d7bb94efb8f4bc3bb9e70e30c6daae4c876bf57..fc9d7e71f1cc82073be8d0b829551e5470eff837 100644 (file)
@@ -20,6 +20,9 @@
 
 #include <EveBase/AliEveEventManager.h>
 
+#include <AliESDEvent.h>
+#include <AliESDVertex.h>
+
 #include <AliRunLoader.h>
 #include <AliCluster.h>
 #include <TPC/AliTPCClustersRow.h>
@@ -55,6 +58,21 @@ TEvePointSet* vplot_tpc(TEveElement* cont=0, Float_t maxR=270)
 
   AliEveEventManager::AssertGeometry();
 
+  Double_t pvert[3] = { 0, 0, 0 };
+  if (AliEveEventManager::HasESD())
+  {
+    AliESDEvent  *esd  = AliEveEventManager::AssertESD();
+    const AliESDVertex *tpcv = esd->GetPrimaryVertexTPC();
+    if (tpcv->GetStatus())
+      tpcv->GetXYZ(pvert);
+    else
+      Info("vplot_tpc", "Primary vertex TPC not available, using 0.");
+  }
+  else
+  {
+      Info("vplot_tpc", "ESD not available, using 0 for primary vertex.");
+  }
+
   AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
   rl->LoadRecPoints("TPC");
 
@@ -97,6 +115,9 @@ TEvePointSet* vplot_tpc(TEveElement* cont=0, Float_t maxR=270)
       AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
       Float_t g[3]; //global coordinates
       c->GetGlobalXYZ(g);
+      g[0] -= pvert[0];
+      g[1] -= pvert[1];
+      g[2] -= pvert[2];
       if (g[0]*g[0] + g[1]*g[1] < maxRsqr)
       {
         phi    =  TMath::ATan2(g[1], g[0]);