Use TPointSelector for point extraction.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Jul 2006 16:05:44 +0000 (16:05 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Jul 2006 16:05:44 +0000 (16:05 +0000)
EVE/alice-macros/its_hits.C
EVE/alice-macros/tpc_hits.C
EVE/alice-macros/tpc_hits_eta_split.C

index d69e829..163d17b 100644 (file)
@@ -2,18 +2,19 @@
 
 Reve::PointSet*
 its_hits(const char *varexp    = "fX:fY:fZ",
-        const char *selection = "",
-        Option_t *option      = "goff")
+        const char *selection = "")
 {
   AliRunLoader* rl =  Alieve::Event::AssertRunLoader();
   rl->LoadHits("ITS");
 
   TTree* ht = rl->GetTreeH("ITS", false);
-  ht->Draw(varexp, selection, option);
   
-  Reve::PointSet* points =
-    new Reve::PointSet(Form("ITS Hits '%s'", selection), ht);
-  points->SetTitle(Form("N=%d", points->GetN()));
+  Reve::PointSet* points = new Reve::PointSet(Form("ITS Hits '%s'", selection));
+
+  TPointSelector ps(ht, points, varexp, selection);
+  ps.Select();
+
+  points->SetTitle(Form("N=%d", points->Size()));
   points->SetMarkerSize(2);
   points->SetMarkerColor((Color_t)2);
 
index f1e3b99..b7b6192 100644 (file)
@@ -2,8 +2,7 @@
 
 Reve::PointSet*
 tpc_hits(const char *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",
-        const char *selection = "TPC2.fArray.fR>80",
-        Option_t *option      = "goff")
+        const char *selection = "TPC2.fArray.fR>80")
 {
   // Extracts 'major' TPC hits (not the compressed ones).
   // This gives ~2.5% of all hits.
@@ -12,13 +11,14 @@ tpc_hits(const char *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ"
   rl->LoadHits("TPC");
 
   TTree* ht = rl->GetTreeH("TPC", false);
-  ht->SetEstimate(800*ht->GetEntries());
-  ht->Draw(varexp, selection, option);
-  
-  Reve::PointSet* points =
-    new Reve::PointSet(Form("TPC Hits '%s'", selection), ht,
-                      Reve::PointSet::TVT_RPhiZ);
-  points->SetTitle(Form("N=%d", points->GetN()));
+
+  Reve::PointSet* points = new Reve::PointSet(Form("TPC Hits '%s'", selection));
+  points->SetSourceCS(TPointSelectorConsumer::TVT_RPhiZ);
+
+  TPointSelector ps(ht, points, varexp, selection);
+  ps.Select();
+
+  points->SetTitle(Form("N=%d", points->Size()));
   points->SetMarkerSize(2);
   points->SetMarkerColor((Color_t)3);
 
index c0dda06..bef2f5e 100644 (file)
@@ -1,8 +1,9 @@
 // $Id$
 
-void tpc_hits_eta_split(const char *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",
-                       const char *selection = "TPC2.fArray.fR>80",
-                       Option_t *option      = "goff")
+void tpc_hits_eta_split(const char *varexp    =
+                       "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ"
+                       ":TPC2.fArray.Eta()",
+                       const char *selection = "TPC2.fArray.fR>80")
 {
   // Extracts 'major' TPC hits (not the compressed ones).
   // This gives ~2.5% of all hits.
@@ -11,33 +12,21 @@ void tpc_hits_eta_split(const char *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:
   rl->LoadHits("TPC");
 
   TTree* ht = rl->GetTreeH("TPC", false);
-  ht->SetEstimate(800*ht->GetEntries());
-  ht->Draw(varexp, selection, option);
 
   gReve->DisableRedraw();
 
-  Reve::PointSetArray* l = new Reve::PointSetArray
-    ("TPC hits - Eta Slices", "");
+  Reve::PointSetArray* l = new Reve::PointSetArray("TPC hits - Eta Slices", "");
+  l->SetSourceCS(TPointSelectorConsumer::TVT_RPhiZ);
   l->SetMarkerColor((Color_t)3);
   l->SetMarkerStyle(20); // full circle
-  l->SetMarkerSize(1);
+  l->SetMarkerSize(2);
   
   TGListTreeItem *ti = gReve->AddRenderElement(l);
 
   l->InitBins(ti, "Eta", 20, -2, 2);
 
-  Double_t *vr = ht->GetV1(), *vphi = ht->GetV2(), *vz = ht->GetV3();
-  Long64_t nr  = ht->GetSelectedRows();
-  while(nr-- > 0) {
-    using namespace TMath;
-    Double_t ctg = *vz / *vr;
-    Double_t eta = -Log(Hypot(1,ctg)-Abs(ctg)); if(ctg < 0) eta = -eta;
-    Double_t cos_theta = *vz / Hypot(*vr, *vz);
-    Double_t eta1       = -0.5*Log( (1.0-cos_theta)/(1.0+cos_theta) );
-    if(Abs(eta1 - eta) > 0.01) printf("etadiff %lf %lf\n", eta1, eta);
-    l->Fill(eta, *vr * Cos(*vphi), *vr * Sin(*vphi), *vz);
-    ++vr; ++vphi; ++vz;
-  }
+  TPointSelector ps(ht, l, varexp, selection);
+  ps.Select();
 
   l->CloseBins();