]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New macro for visualization of the HMPID clusters (Jouri)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Oct 2007 09:54:21 +0000 (09:54 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Oct 2007 09:54:21 +0000 (09:54 +0000)
EVE/alice-macros/hmpid_clusters.C [new file with mode: 0644]

diff --git a/EVE/alice-macros/hmpid_clusters.C b/EVE/alice-macros/hmpid_clusters.C
new file mode 100644 (file)
index 0000000..466e838
--- /dev/null
@@ -0,0 +1,99 @@
+#ifdef __CINT__
+
+namespace Reve
+{
+class RenderElement;
+class PointSet;
+}
+
+#else
+
+#include <Reve/Reve.h>
+#include <Reve/ReveManager.h>
+#include <Reve/PointSet.h>
+#include <Alieve/EventAlieve.h>
+
+#include <AliRunLoader.h>
+#include <AliCluster3D.h>
+
+#include <TClonesArray.h>
+
+#endif
+
+Reve::PointSet* hmpid_clusters(Reve::RenderElement* cont=0, Float_t maxR=1000)
+{
+  const Int_t nCh=7;
+  TClonesArray *cl[nCh] = {0,0,0,0,0,0,0};
+  Char_t *name[nCh]={
+    "HMPID0",
+    "HMPID1",
+    "HMPID2",
+    "HMPID3",
+    "HMPID4",
+    "HMPID5",
+    "HMPID6"
+  };
+
+
+  Reve::PointSet* clusters = new Reve::PointSet(10000);
+  clusters->SetOwnIds(kTRUE);
+
+  Alieve::Event::AssertGeometry();
+  
+  AliRunLoader* rl = Alieve::Event::AssertRunLoader();
+  rl->LoadRecPoints("HMPID");
+
+  TTree *cTree = rl->GetTreeR("HMPID", false);
+  if (!cTree) return 0;
+
+  for (Int_t k=0; k<nCh; k++) {
+     TBranch *br=cTree->GetBranch(name[k]);
+     if (!br) return 0;
+     br->SetAddress(&(cl[k]));
+  } 
+
+  if (!cTree->GetEvent(0)) return 0;
+
+
+  for (Int_t i=0; i<nCh; i++) {
+    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);
+      }
+    }
+  }
+
+  if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
+    Warning("hmpid_clusters", "No HMPID clusters");
+    delete clusters;
+    return 0;
+  }
+
+  clusters->SetMarkerStyle(2);
+  clusters->SetMarkerSize(0.2);
+  clusters->SetMarkerColor(4);
+
+  char form[1000];
+  sprintf(form,"HMPID Clusters");
+  clusters->SetName(form);
+
+  char tip[1000];
+  sprintf(tip,"N=%d", clusters->Size());
+  clusters->SetTitle(tip);
+
+  using namespace Reve;
+  gReve->AddRenderElement(clusters, cont);
+  gReve->Redraw3D();
+
+  return clusters;
+}