]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/alice-macros/hmpid_clusters.C
In muon-related macros in EVE:
[u/mrichter/AliRoot.git] / EVE / alice-macros / hmpid_clusters.C
index 26194067c3dda0aeeda3e96b9ff6c81af0802182..4cd981354f3f80b143074abc791a5857f1d88698 100644 (file)
@@ -1,17 +1,21 @@
+// $Id$
+// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
 #ifdef __CINT__
 
-namespace TEveUtil
-{
 class TEveElement;
 class TEvePointSet;
-}
 
 #else
 
-#include <TEve.h>
 #include <TEveManager.h>
 #include <TEvePointSet.h>
-#include <Alieve/EventAlieve.h>
+#include <EveBase/AliEveEventManager.h>
 
 #include <AliRunLoader.h>
 #include <AliCluster3D.h>
@@ -20,11 +24,11 @@ class TEvePointSet;
 
 #endif
 
-TEvePointSet* hmpid_clusters(TEveElement* cont=0, Float_t maxR=1000)
+TEvePointSet* hmpid_clusters(TEveElement* cont=0)
 {
   const Int_t nCh=7;
   TClonesArray *cl[nCh] = {0,0,0,0,0,0,0};
-  Char_t *name[nCh]={
+  const Char_t *name[nCh]={
     "HMPID0",
     "HMPID1",
     "HMPID2",
@@ -38,9 +42,9 @@ TEvePointSet* hmpid_clusters(TEveElement* cont=0, Float_t maxR=1000)
   TEvePointSet* clusters = new TEvePointSet(10000);
   clusters->SetOwnIds(kTRUE);
 
-  Alieve::Event::AssertGeometry();
-  
-  AliRunLoader* rl = Alieve::Event::AssertRunLoader();
+  AliEveEventManager::AssertGeometry();
+
+  AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
   rl->LoadRecPoints("HMPID");
 
   TTree *cTree = rl->GetTreeR("HMPID", false);
@@ -50,7 +54,7 @@ TEvePointSet* hmpid_clusters(TEveElement* cont=0, Float_t maxR=1000)
      TBranch *br=cTree->GetBranch(name[k]);
      if (!br) return 0;
      br->SetAddress(&(cl[k]));
-  } 
+  }
 
   if (!cTree->GetEvent(0)) return 0;
 
@@ -59,20 +63,18 @@ TEvePointSet* hmpid_clusters(TEveElement* cont=0, Float_t maxR=1000)
     TClonesArray *arr=cl[i];
     Int_t ncl=arr->GetEntriesFast();
 
-    Float_t maxRsqr = maxR*maxR;
     while (ncl--) {
       AliCluster3D *c=(AliCluster3D*)arr->UncheckedAt(ncl);
       Float_t g[3]; //global coordinates
       c->GetGlobalXYZ(g);
-      if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
-      {
-       clusters->SetNextPoint(g[0], g[1], g[2]);
-       AliCluster3D *atp = new AliCluster3D(*c);
-       clusters->SetPointId(atp);
-      }
+      clusters->SetNextPoint(g[0], g[1], g[2]);
+      AliCluster3D *atp = new AliCluster3D(*c);
+      clusters->SetPointId(atp);
     }
   }
 
+  rl->UnloadRecPoints("HMPID");
+
   if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
     Warning("hmpid_clusters", "No HMPID clusters");
     delete clusters;
@@ -83,14 +85,16 @@ TEvePointSet* hmpid_clusters(TEveElement* cont=0, Float_t maxR=1000)
   clusters->SetMarkerSize(0.2);
   clusters->SetMarkerColor(4);
 
-  char form[1000];
-  sprintf(form,"HMPID Clusters");
-  clusters->SetName(form);
+  clusters->SetName("HMPID Clusters");
+
+  clusters->SetTitle(Form("N=%d", clusters->Size()));
+
+  const TString viz_tag("REC Clusters HMPID");
+
+  clusters->ApplyVizTag(viz_tag, "Clusters");
 
-  char tip[1000];
-  sprintf(tip,"N=%d", clusters->Size());
-  clusters->SetTitle(tip);
   gEve->AddElement(clusters, cont);
+
   gEve->Redraw3D();
 
   return clusters;