From Cvetan: new macro to load ITS clusters.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 Mar 2007 11:53:11 +0000 (11:53 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 Mar 2007 11:53:11 +0000 (11:53 +0000)
EVE/alice-macros/its_clusters.C [new file with mode: 0644]

diff --git a/EVE/alice-macros/its_clusters.C b/EVE/alice-macros/its_clusters.C
new file mode 100644 (file)
index 0000000..f243e93
--- /dev/null
@@ -0,0 +1,59 @@
+
+Reve::PointSet* its_clusters(RenderElement* cont=0)
+{
+  if (!gGeoManager)
+    gReve->GetGeometry("$PWD/misaligned_geometry.root");
+
+  AliRunLoader* rl = Alieve::Event::AssertRunLoader();
+  rl->LoadRecPoints("ITS");
+
+  TTree *cTree = rl->GetTreeR("ITS", false);
+
+  Reve::PointSet* clusters = new Reve::PointSet(10000);
+  clusters->SetOwnIds(kTRUE);
+
+  TClonesArray *cl=NULL;
+  TBranch *branch=cTree->GetBranch("ITSRecPoints");
+  branch->SetAddress(&cl);
+
+  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);
+
+      clusters->SetNextPoint(g[0], g[1], g[2]);
+      AliCluster *atp = new AliCluster(*c);
+      clusters->SetPointId(atp);
+    }
+  }
+
+  if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
+    Warning("its_clusters", "No ITS clusters");
+    delete clusters;
+    return 0;
+  }
+
+  clusters->SetMarkerStyle(2);
+  clusters->SetMarkerSize(0.5);
+  clusters->SetMarkerColor(4);
+
+  char form[1000];
+  sprintf(form,"ITS 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;
+}