New macro from Jouri: display TPC clusters.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Jul 2007 09:11:01 +0000 (09:11 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Jul 2007 09:11:01 +0000 (09:11 +0000)
EVE/alice-macros/tpc_clusters.C [new file with mode: 0644]

diff --git a/EVE/alice-macros/tpc_clusters.C b/EVE/alice-macros/tpc_clusters.C
new file mode 100644 (file)
index 0000000..d3ae171
--- /dev/null
@@ -0,0 +1,68 @@
+
+Reve::PointSet* tpc_clusters(RenderElement* cont=0, Float_t maxR=270)
+{
+  const Int_t kMaxCl=100*160;
+
+  Alieve::Event::AssertGeometry();
+
+  Reve::PointSet* clusters = new Reve::PointSet(kMaxCl);
+  clusters->SetOwnIds(kTRUE);
+
+  AliRunLoader* rl = Alieve::Event::AssertRunLoader();
+  rl->LoadRecPoints("TPC");
+
+  AliTPCClustersRow *clrow=new AliTPCClustersRow();
+  clrow->SetClass("AliTPCclusterMI");
+  clrow->SetArray(kMaxCl);
+
+  TTree *cTree = rl->GetTreeR("TPC", false);
+  TBranch *branch=cTree->SetBranchAddress("Segment",&clrow);
+
+  Float_t maxRsqr = maxR*maxR;
+  TClonesArray *cl=clrow->GetArray(); 
+  Int_t nentr=(Int_t)cTree->GetEntries();
+  for (Int_t i=0; i<nentr; i++) {
+    if (!cTree->GetEvent(i)) continue;
+
+    Int_t ncl=cl->GetEntriesFast();
+
+    while (ncl--) {
+      AliCluster *c=(AliCluster*)cl->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]);
+       AliCluster *atp = new AliCluster(*c);
+       clusters->SetPointId(atp);
+      }
+    }
+    cl->Clear();
+  }
+
+  delete clrow;
+
+  if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
+    Warning("tpc_clusters", "No TPC clusters");
+    delete clusters;
+    return 0;
+  }
+
+  clusters->SetMarkerStyle(2);
+  clusters->SetMarkerSize(0.2);
+  clusters->SetMarkerColor(4);
+
+  char form[1000];
+  sprintf(form,"TPC Clusters");
+  clusters->SetName(form);
+
+  char tip[1000];
+  sprintf(tip,"N=%d", clusters->Size());
+  clusters->SetTitle(tip);
+
+  using namespace Reve;
+  gReve->AddRenderElement(clusters);
+  gReve->Redraw3D();
+
+  return clusters;
+}