From d6668f478f596586a7fd3cd779051db42d8f90a1 Mon Sep 17 00:00:00 2001
From: Alex Jentsch <ajentsch@bnl.gov>
Date: Wed, 8 Sep 2021 19:21:19 +0000
Subject: [PATCH] Still working.

---
 .../scripts/hits_far_forward_protons.cxx      | 24 +++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/benchmarks/far_forward/scripts/hits_far_forward_protons.cxx b/benchmarks/far_forward/scripts/hits_far_forward_protons.cxx
index be3515b1..b6796c46 100644
--- a/benchmarks/far_forward/scripts/hits_far_forward_protons.cxx
+++ b/benchmarks/far_forward/scripts/hits_far_forward_protons.cxx
@@ -19,6 +19,11 @@ R__LOAD_LIBRARY(libDD4pod.so)
 using ROOT::RDataFrame;
 using namespace ROOT::VecOps;
 
+dd4hep::Detector& detector = dd4hep::Detector::getInstance();
+detector.fromCompact("eic_ip6.xml");
+dd4hep::rec::CellIDPositionConverter cellid_converter(detector);
+
+
 auto p_track = [](std::vector<eic::TrackParametersData> const& in) {
   std::vector<double> result;
   for (size_t i = 0; i < in.size(); ++i) {
@@ -80,7 +85,7 @@ auto delta_p_over_p = [](const std::vector<double>& tracks, const std::vector<do
   return res;
 };
 
-auto local_position = [&](const std::vector<dd4pod::TrackerHitData>& hits) {
+auto local_position = [](const std::vector<dd4pod::TrackerHitData>& hits) {
     std::vector<std::array<double, 2>> result;
     for (const auto& h : hits) {
       // The actual hit position:
@@ -97,6 +102,21 @@ auto local_position = [&](const std::vector<dd4pod::TrackerHitData>& hits) {
     return result;
   };
 
+auto x_pos = [](const std::vector<std::array<double, 2>>& xypos) {
+    std::vector<double> result;
+    for (const auto& h : xypos) {
+      result.push_back(h.at(0));
+    }
+    return result;
+  };
+  auto y_pos = [](const std::vector<std::array<double, 2>>& xypos) {
+    std::vector<double> result;
+    for (auto h : xypos) {
+      result.push_back(h.at(1));
+    }
+    return result;
+  };
+
 
 int hits_far_forward_protons(const char* fname = "sim_far_forward_protons.root")
 {
@@ -130,7 +150,7 @@ int hits_far_forward_protons(const char* fname = "sim_far_forward_protons.root")
                  .Define("y_pos", y_pos, {"xy_hit_pos"})
                  ;
 
-  auto h_local_pos = d1.Histo2D({"h_local_pos", ";x [cm]; y [cm] ", 100, -5.0, 5.0, 100, -5.0, 5.0}, "x_pos", "y_pos");
+  auto h_local_pos = df0.Histo2D({"h_local_pos", ";x [cm]; y [cm] ", 100, -5.0, 5.0, 100, -5.0, 5.0}, "x_pos", "y_pos");
 
                  
 
-- 
GitLab