From 24286b19c3cc0fc167fea765e9d36b921e0f6919 Mon Sep 17 00:00:00 2001
From: Whitney Armstrong <warmstrong@anl.gov>
Date: Tue, 20 Apr 2021 18:39:38 -0500
Subject: [PATCH] Split calorimeter subsystems into their own benchmark
 directories.

---
 .../{calorimeters => barrel_ecal}/.gitignore  |   0
 benchmarks/barrel_ecal/config.yml             |  29 +++
 .../{calorimeters => barrel_ecal}/rootlogon.C |   0
 .../run_emcal_barrel_electrons.sh             |   0
 .../run_emcal_barrel_pions.sh                 |   0
 .../scripts/emcal_barrel_electrons.cxx        |   0
 .../emcal_barrel_electrons_analysis.cxx       |   0
 .../scripts/emcal_barrel_electrons_reader.cxx |   0
 .../scripts/emcal_barrel_pions.cxx            |   0
 .../scripts/emcal_barrel_pions_analysis.cxx   |   0
 .../scripts/emcal_barrel_pions_reader.cxx     |   0
 .../simple_checking.cxx                       |   0
 .../simple_info_plot_histograms.cxx           |   0
 benchmarks/calorimeters/.rootrc               |   2 -
 benchmarks/calorimeters/config.yml            |  96 --------
 .../Crystal_example.xml                       |   0
 benchmarks/crystal_calorimeter/config.yml     |  22 ++
 .../elements.xml                              |   0
 .../makeplot_pion.C                           |   0
 .../materials.xml                             |   0
 .../run_simulation_crystal.sh                 |   2 +-
 .../run_simulation_crystal_pion.sh            |   0
 .../simple_checking_crystal.cxx               |   0
 .../{calorimeters => zdc}/ZDC_example.xml     |   0
 benchmarks/zdc/config.yml                     |  32 +++
 .../run_simulation_zdc.sh                     |   2 +-
 benchmarks/zdc/simple_checking.cxx            | 124 ++++++++++
 .../zdc/simple_info_plot_histograms.cxx       | 216 ++++++++++++++++++
 .../zdc_neutrons_reader.cxx                   |   0
 29 files changed, 425 insertions(+), 100 deletions(-)
 rename benchmarks/{calorimeters => barrel_ecal}/.gitignore (100%)
 create mode 100644 benchmarks/barrel_ecal/config.yml
 rename benchmarks/{calorimeters => barrel_ecal}/rootlogon.C (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/run_emcal_barrel_electrons.sh (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/run_emcal_barrel_pions.sh (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/scripts/emcal_barrel_electrons.cxx (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/scripts/emcal_barrel_electrons_analysis.cxx (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/scripts/emcal_barrel_electrons_reader.cxx (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/scripts/emcal_barrel_pions.cxx (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/scripts/emcal_barrel_pions_analysis.cxx (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/scripts/emcal_barrel_pions_reader.cxx (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/simple_checking.cxx (100%)
 rename benchmarks/{calorimeters => barrel_ecal}/simple_info_plot_histograms.cxx (100%)
 delete mode 100644 benchmarks/calorimeters/.rootrc
 delete mode 100644 benchmarks/calorimeters/config.yml
 rename benchmarks/{calorimeters => crystal_calorimeter}/Crystal_example.xml (100%)
 create mode 100644 benchmarks/crystal_calorimeter/config.yml
 rename benchmarks/{calorimeters => crystal_calorimeter}/elements.xml (100%)
 rename benchmarks/{calorimeters => crystal_calorimeter}/makeplot_pion.C (100%)
 rename benchmarks/{calorimeters => crystal_calorimeter}/materials.xml (100%)
 rename benchmarks/{calorimeters => crystal_calorimeter}/run_simulation_crystal.sh (69%)
 rename benchmarks/{calorimeters => crystal_calorimeter}/run_simulation_crystal_pion.sh (100%)
 rename benchmarks/{calorimeters => crystal_calorimeter}/simple_checking_crystal.cxx (100%)
 rename benchmarks/{calorimeters => zdc}/ZDC_example.xml (100%)
 create mode 100644 benchmarks/zdc/config.yml
 rename benchmarks/{calorimeters => zdc}/run_simulation_zdc.sh (72%)
 create mode 100644 benchmarks/zdc/simple_checking.cxx
 create mode 100644 benchmarks/zdc/simple_info_plot_histograms.cxx
 rename benchmarks/{calorimeters => zdc}/zdc_neutrons_reader.cxx (100%)

diff --git a/benchmarks/calorimeters/.gitignore b/benchmarks/barrel_ecal/.gitignore
similarity index 100%
rename from benchmarks/calorimeters/.gitignore
rename to benchmarks/barrel_ecal/.gitignore
diff --git a/benchmarks/barrel_ecal/config.yml b/benchmarks/barrel_ecal/config.yml
new file mode 100644
index 00000000..cedd1e03
--- /dev/null
+++ b/benchmarks/barrel_ecal/config.yml
@@ -0,0 +1,29 @@
+cal_sim:emcal_barrel_pions:
+  extends: .det_benchmark
+  stage: simulate
+  script:
+    - bash benchmarks/barrel_ecal/run_emcal_barrel_pions.sh
+
+cal_sim:emcal_barrel_electrons:
+  extends: .det_benchmark
+  stage: simulate
+  script:
+    - bash benchmarks/barrel_ecal/run_emcal_barrel_electrons.sh
+
+cal_bench:emcal_barrel_pions:
+  extends: .det_benchmark
+  stage: benchmarks
+  needs:
+    - ["cal_sim:emcal_barrel_pions"]
+  script:
+    - root -b -q benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx+
+
+cal_bench:emcal_barrel_electrons:
+  extends: .det_benchmark
+  stage: benchmarks
+  needs:
+    - ["cal_sim:emcal_barrel_electrons"]
+  script:
+    - rootls -t sim_output/sim_emcal_barrel_uniform_electrons.root
+    - root -b -q benchmarks/barrel_ecal/scripts/emcal_barrel_electrons_analysis.cxx+
+
diff --git a/benchmarks/calorimeters/rootlogon.C b/benchmarks/barrel_ecal/rootlogon.C
similarity index 100%
rename from benchmarks/calorimeters/rootlogon.C
rename to benchmarks/barrel_ecal/rootlogon.C
diff --git a/benchmarks/calorimeters/run_emcal_barrel_electrons.sh b/benchmarks/barrel_ecal/run_emcal_barrel_electrons.sh
similarity index 100%
rename from benchmarks/calorimeters/run_emcal_barrel_electrons.sh
rename to benchmarks/barrel_ecal/run_emcal_barrel_electrons.sh
diff --git a/benchmarks/calorimeters/run_emcal_barrel_pions.sh b/benchmarks/barrel_ecal/run_emcal_barrel_pions.sh
similarity index 100%
rename from benchmarks/calorimeters/run_emcal_barrel_pions.sh
rename to benchmarks/barrel_ecal/run_emcal_barrel_pions.sh
diff --git a/benchmarks/calorimeters/scripts/emcal_barrel_electrons.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_electrons.cxx
similarity index 100%
rename from benchmarks/calorimeters/scripts/emcal_barrel_electrons.cxx
rename to benchmarks/barrel_ecal/scripts/emcal_barrel_electrons.cxx
diff --git a/benchmarks/calorimeters/scripts/emcal_barrel_electrons_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_electrons_analysis.cxx
similarity index 100%
rename from benchmarks/calorimeters/scripts/emcal_barrel_electrons_analysis.cxx
rename to benchmarks/barrel_ecal/scripts/emcal_barrel_electrons_analysis.cxx
diff --git a/benchmarks/calorimeters/scripts/emcal_barrel_electrons_reader.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_electrons_reader.cxx
similarity index 100%
rename from benchmarks/calorimeters/scripts/emcal_barrel_electrons_reader.cxx
rename to benchmarks/barrel_ecal/scripts/emcal_barrel_electrons_reader.cxx
diff --git a/benchmarks/calorimeters/scripts/emcal_barrel_pions.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions.cxx
similarity index 100%
rename from benchmarks/calorimeters/scripts/emcal_barrel_pions.cxx
rename to benchmarks/barrel_ecal/scripts/emcal_barrel_pions.cxx
diff --git a/benchmarks/calorimeters/scripts/emcal_barrel_pions_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx
similarity index 100%
rename from benchmarks/calorimeters/scripts/emcal_barrel_pions_analysis.cxx
rename to benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx
diff --git a/benchmarks/calorimeters/scripts/emcal_barrel_pions_reader.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_reader.cxx
similarity index 100%
rename from benchmarks/calorimeters/scripts/emcal_barrel_pions_reader.cxx
rename to benchmarks/barrel_ecal/scripts/emcal_barrel_pions_reader.cxx
diff --git a/benchmarks/calorimeters/simple_checking.cxx b/benchmarks/barrel_ecal/simple_checking.cxx
similarity index 100%
rename from benchmarks/calorimeters/simple_checking.cxx
rename to benchmarks/barrel_ecal/simple_checking.cxx
diff --git a/benchmarks/calorimeters/simple_info_plot_histograms.cxx b/benchmarks/barrel_ecal/simple_info_plot_histograms.cxx
similarity index 100%
rename from benchmarks/calorimeters/simple_info_plot_histograms.cxx
rename to benchmarks/barrel_ecal/simple_info_plot_histograms.cxx
diff --git a/benchmarks/calorimeters/.rootrc b/benchmarks/calorimeters/.rootrc
deleted file mode 100644
index ec5dcc3c..00000000
--- a/benchmarks/calorimeters/.rootrc
+++ /dev/null
@@ -1,2 +0,0 @@
-#.rootrc file
-Rint.Logon: ./rootlogon.C
diff --git a/benchmarks/calorimeters/config.yml b/benchmarks/calorimeters/config.yml
deleted file mode 100644
index 153241ac..00000000
--- a/benchmarks/calorimeters/config.yml
+++ /dev/null
@@ -1,96 +0,0 @@
-#####################
-# Simulations
-# - Generate datasets
-# - Run Geant4
-# - Run Juggler
-#####################
-
-cal_sim:emcal_barrel_pions:
-  extends: .det_benchmark
-  stage: simulate
-  script:
-    - bash benchmarks/calorimeters/run_emcal_barrel_pions.sh
-
-cal_sim:emcal_barrel_electrons:
-  extends: .det_benchmark
-  stage: simulate
-  script:
-    - bash benchmarks/calorimeters/run_emcal_barrel_electrons.sh
-
-cal_sim:crystal_emcal:
-  extends: .det_benchmark
-  stage: simulate
-  script:
-    - bash benchmarks/calorimeters/run_simulation_crystal.sh
-
-cal_sim:crystal_pion:
-  extends: .det_benchmark
-  stage: simulate
-  script:
-    - npsim --runType batch --numberOfEvents 100 --compactFile ${DETECTOR_PATH}/topside.xml --inputFiles  data/emcal_electrons.hepmc  --outputFile  sim_output/output_emcal_electrons.root
-
-cal_sim:zdc:
-  extends: .det_benchmark
-  stage: simulate
-  script:
-    - bash benchmarks/calorimeters/run_simulation_zdc.sh
-
-###################
-# Benchmarks
-###################
-
-cal_bench:emcal_barrel_pions:
-  extends: .det_benchmark
-  stage: benchmarks
-  needs:
-    - ["cal_sim:emcal_barrel_pions"]
-  script:
-    - root -b -q benchmarks/calorimeters/scripts/emcal_barrel_pions_analysis.cxx+
-
-cal_bench:emcal_barrel_electrons:
-  extends: .det_benchmark
-  stage: benchmarks
-  needs:
-    - ["cal_sim:emcal_barrel_electrons"]
-  script:
-    - rootls -t sim_output/sim_emcal_barrel_uniform_electrons.root
-    - root -b -q benchmarks/calorimeters/scripts/emcal_barrel_electrons_analysis.cxx+
-
-cal_bench:crystal_benchmark:
-  extends: .det_benchmark
-  stage: benchmarks
-  needs:
-    - ["cal_sim:crystal_emcal"]
-  script:
-    - rootls -t sim_output/output_emcal_electrons.root
-    - echo " Not yet complete"
-      #- root -b -q benchmarks/calorimeters/simple_checking_crystal.cxx+
-
-    #cal_test_3_zdc_neutrons_reader:
-    #stage: benchmarks
-    #tags:
-    #- sodium
-    #script:
-    #- root -b -q benchmarks/calorimeters/zdc_neutrons_reader.cxx
-      #artifact:
-      #  paths: 
-      #    - results/
-      #allow_failure: true
-
-cal_bench:zdc_benchmark:
-  extends: .det_benchmark
-  stage: benchmarks
-  needs: 
-    - ["cal_sim:zdc"]
-  script:
-    - echo " Not yet complete"
-    #- root -b -q benchmarks/calorimeters/simple_checking.cxx+
-
-cal_bench:zdc_benchmark_info_histogram:
-  extends: .det_benchmark
-  stage: benchmarks
-  needs: 
-    - ["cal_sim:zdc"]
-  script:
-    - root -b -q benchmarks/calorimeters/simple_info_plot_histograms.cxx+
-
diff --git a/benchmarks/calorimeters/Crystal_example.xml b/benchmarks/crystal_calorimeter/Crystal_example.xml
similarity index 100%
rename from benchmarks/calorimeters/Crystal_example.xml
rename to benchmarks/crystal_calorimeter/Crystal_example.xml
diff --git a/benchmarks/crystal_calorimeter/config.yml b/benchmarks/crystal_calorimeter/config.yml
new file mode 100644
index 00000000..d4d66996
--- /dev/null
+++ b/benchmarks/crystal_calorimeter/config.yml
@@ -0,0 +1,22 @@
+cal_sim:crystal_emcal:
+  extends: .det_benchmark
+  stage: simulate
+  script:
+    - bash benchmarks/crystal_calorimeter/run_simulation_crystal.sh
+
+cal_sim:crystal_pion:
+  extends: .det_benchmark
+  stage: simulate
+  script:
+    - npsim --runType batch --numberOfEvents 100 --compactFile ${DETECTOR_PATH}/topside.xml --inputFiles  data/emcal_electrons.hepmc  --outputFile  sim_output/output_emcal_electrons.root
+
+cal_bench:crystal_benchmark:
+  extends: .det_benchmark
+  stage: benchmarks
+  needs:
+    - ["cal_sim:crystal_emcal"]
+  script:
+    - rootls -t sim_output/output_emcal_electrons.root
+    - echo " Not yet complete"
+      #- root -b -q benchmarks/cryxtal_calorimeter/simple_checking_crystal.cxx+
+
diff --git a/benchmarks/calorimeters/elements.xml b/benchmarks/crystal_calorimeter/elements.xml
similarity index 100%
rename from benchmarks/calorimeters/elements.xml
rename to benchmarks/crystal_calorimeter/elements.xml
diff --git a/benchmarks/calorimeters/makeplot_pion.C b/benchmarks/crystal_calorimeter/makeplot_pion.C
similarity index 100%
rename from benchmarks/calorimeters/makeplot_pion.C
rename to benchmarks/crystal_calorimeter/makeplot_pion.C
diff --git a/benchmarks/calorimeters/materials.xml b/benchmarks/crystal_calorimeter/materials.xml
similarity index 100%
rename from benchmarks/calorimeters/materials.xml
rename to benchmarks/crystal_calorimeter/materials.xml
diff --git a/benchmarks/calorimeters/run_simulation_crystal.sh b/benchmarks/crystal_calorimeter/run_simulation_crystal.sh
similarity index 69%
rename from benchmarks/calorimeters/run_simulation_crystal.sh
rename to benchmarks/crystal_calorimeter/run_simulation_crystal.sh
index f00e8033..8a44a4b3 100755
--- a/benchmarks/calorimeters/run_simulation_crystal.sh
+++ b/benchmarks/crystal_calorimeter/run_simulation_crystal.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
 ddsim --runType batch --numberOfEvents 100 \
-      --compactFile benchmarks/calorimeters/Crystal_example.xml \
+      --compactFile benchmarks/crystal_calorimeter/Crystal_example.xml \
       --inputFiles  ./data/emcal_electrons.hepmc \
       --outputFile  ./sim_output/output_emcal_electrons.root
diff --git a/benchmarks/calorimeters/run_simulation_crystal_pion.sh b/benchmarks/crystal_calorimeter/run_simulation_crystal_pion.sh
similarity index 100%
rename from benchmarks/calorimeters/run_simulation_crystal_pion.sh
rename to benchmarks/crystal_calorimeter/run_simulation_crystal_pion.sh
diff --git a/benchmarks/calorimeters/simple_checking_crystal.cxx b/benchmarks/crystal_calorimeter/simple_checking_crystal.cxx
similarity index 100%
rename from benchmarks/calorimeters/simple_checking_crystal.cxx
rename to benchmarks/crystal_calorimeter/simple_checking_crystal.cxx
diff --git a/benchmarks/calorimeters/ZDC_example.xml b/benchmarks/zdc/ZDC_example.xml
similarity index 100%
rename from benchmarks/calorimeters/ZDC_example.xml
rename to benchmarks/zdc/ZDC_example.xml
diff --git a/benchmarks/zdc/config.yml b/benchmarks/zdc/config.yml
new file mode 100644
index 00000000..20c617bf
--- /dev/null
+++ b/benchmarks/zdc/config.yml
@@ -0,0 +1,32 @@
+sim:zdc:
+  extends: .det_benchmark
+  stage: simulate
+  script:
+    - bash benchmarks/zdc/run_simulation_zdc.sh
+
+zdc_neutrons:
+  extends: .det_benchmark
+  stage: benchmarks
+  needs: 
+    - ["cal_sim:zdc"]
+  script:
+    - echo " Not yet complete"
+      #- root -b -q benchmarks/zdc/zdc_neutrons_reader.cxx
+
+zdc_benchmark:
+  extends: .det_benchmark
+  stage: benchmarks
+  needs: 
+    - ["cal_sim:zdc"]
+  script:
+    - echo " Not yet complete"
+    #- root -b -q benchmarks/zdc/simple_checking.cxx+
+
+cal_bench:zdc_benchmark_info_histogram:
+  extends: .det_benchmark
+  stage: benchmarks
+  needs: 
+    - ["cal_sim:zdc"]
+  script:
+    - root -b -q benchmarks/zdc/simple_info_plot_histograms.cxx+
+
diff --git a/benchmarks/calorimeters/run_simulation_zdc.sh b/benchmarks/zdc/run_simulation_zdc.sh
similarity index 72%
rename from benchmarks/calorimeters/run_simulation_zdc.sh
rename to benchmarks/zdc/run_simulation_zdc.sh
index c8486d56..ddacc755 100755
--- a/benchmarks/calorimeters/run_simulation_zdc.sh
+++ b/benchmarks/zdc/run_simulation_zdc.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
 ddsim --runType batch --numberOfEvents 10 \
-      --compactFile benchmarks/calorimeters/ZDC_example.xml \
+      --compactFile benchmarks/zdc/ZDC_example.xml \
       --inputFiles  ./data/zdc_photons.hepmc \
       --outputFile  ./sim_output/output_zdc_photons.root
diff --git a/benchmarks/zdc/simple_checking.cxx b/benchmarks/zdc/simple_checking.cxx
new file mode 100644
index 00000000..158f4f78
--- /dev/null
+++ b/benchmarks/zdc/simple_checking.cxx
@@ -0,0 +1,124 @@
+//R__LOAD_LIBRARY(libfmt.so)
+//#include "fmt/core.h"
+R__LOAD_LIBRARY(libDDG4IO.so)
+//
+//#include "DD4hep/Detector.h"
+#include "DDG4/Geant4Data.h"
+//#include "DDRec/CellIDPositionConverter.h"
+//#include "DDRec/SurfaceManager.h"
+//#include "DDRec/Surface.h"
+#include "ROOT/RDataFrame.hxx"
+//
+//#include "lcio2/MCParticleData.h"
+//#include "lcio2/ReconstructedParticleData.h"
+
+//#include "Math/Vector3D.h"
+//#include "Math/Vector4D.h"
+//#include "Math/VectorUtil.h"
+#include "TCanvas.h"
+//#include "TLegend.h"
+//#include "TMath.h"
+//#include "TRandom3.h"
+//#include "TFile.h"
+//#include "TH1F.h"
+//#include "TH1D.h"
+//#include "TTree.h"
+#include "TChain.h"
+//#include "TF1.h"
+#include <random>
+//#include "lcio2/TrackerRawDataData.h"
+//#include "lcio2/TrackerRawData.h"
+
+void simple_checking(const char* fname = "sim_output/output_zdc_photons.root"){
+std::cout << "testing 1\n";
+  ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel
+  //using namespace lcio2;
+  double degree = TMath::Pi()/180.0;
+
+  TChain* t = new TChain("EVENT");
+  t->Add(fname);
+
+  ROOT::RDataFrame d0(*t);//, {"GEMTrackerHintits","MCParticles"});
+std::cout << "testing 2\n";
+  //std::cout << t->GetBranch("GEMTrackerHits")->GetClassName() << std::endl;
+  //std::vector<dd4hep::sim::Geant4Tracker::Hit*>
+  
+  // -------------------------
+  // Get the DD4hep instance
+  // Load the compact XML file
+  // Initialize the position converter tool
+  //dd4hep::Detector& detector = dd4hep::Detector::getInstance();
+  //detector.fromCompact("gem_tracker_disc.xml");
+  //dd4hep::rec::CellIDPositionConverter cellid_converter(detector);
+
+  //// -------------------------
+  //// Get the surfaces map
+  //dd4hep::rec::SurfaceManager& surfMan = *detector.extension<dd4hep::rec::SurfaceManager>() ;
+  //auto surfMap = surfMan.map( "world" ) ;
+  
+  auto nhits = [] (std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits){ return (int) hits.size(); };
+std::cout << "testing 3\n";
+  //for(const auto& h: hits){
+  //  //std::cout << (h->position/10.0) << std::endl;
+  //  //std::cout << cellid_converter.position(h->cellID) << std::endl;
+  //  //dd4hep::rec::SurfaceMap::const_iterator
+  //  const auto si = _surfMap.find( cellid_converter.findContext(h->cellID)->identifier ); //identifier=volumeID
+  //  dd4hep::rec::ISurface* surf = (si != _surfMap.end() ?  si->second  : 0);
+  //  dd4hep::rec::Vector3D pos =  surf->origin();//fit_global(pivot[0],pivot[1],pivot[2]);
+  //  //std::cout << pos.x() << ", " << pos.y() << ", " << pos.z()<< std::endl;
+  //  // transform lcio units to dd4hep units, see documentation for other functions              
+  //  //DDSurfaces::Vector2D fit_local = surf->globalToLocal( dd4hep::mm * fit_global );
+  //}
+  //  return hits.size(); };
+
+  //auto digitize_gem_hits = 
+  //  [&](const std::vector<dd4hep::sim::Geant4Tracker::Hit*>& hits) {
+  //    std::vector<lcio2::TrackerRawDataData> digi_hits;
+  //    std::normal_distribution<> time_dist(0,2.0);
+  //    std::normal_distribution<> adc_dist(5.0,3.0);
+
+  //    std::map<int64_t,lcio2::TrackerRawDataData> hits_by_id;
+  //    for(const auto& h: hits) {
+  //      //lcio2::TrackerRawDataData ahit;
+  //      auto& ahit = hits_by_id[(int64_t)h->cellID];
+  //      auto pos = h->position/10.0; //cm
+
+  //      ahit.cellID0   = h->cellID;
+  //      ahit.cellID1   = h->cellID;
+  //      ahit.channelID = h->cellID;
+  //      //fmt::print("{} vs {} vs {}\n", id1, id2,id3);
+  //      fmt::print("{} vs {}\n", h->cellID, ahit.cellID0);
+  //      // time is not kept from dd4hep hit, instead using z position as crude substitute
+  //      ahit.time = pos.z() + time_dist(gen);
+  //      ahit.adc  = adc_dist(gen);
+  //      //digi_hits.push_back(ahit);
+  //    }
+  //    for (auto& [cell, hit] : hits_by_id) {
+  //      //fmt::print("{} vs {}\n", cell, hit.cellID0);
+  //      digi_hits.push_back(hit);
+  //    }
+  //    return digi_hits;
+  //  };
+
+  auto d1 = d0.Define("nhits", nhits, {"ZDCHits"})
+              //.Filter([](int n){ return (n>4); },{"nhits"})
+              //.Define("delta",hit_position, {"GEMTrackerHits"})
+              //.Define("RawTrackerHits", digitize_gem_hits, {"GEMTrackerHits"})
+              ;
+std::cout << "testing 4\n";
+  auto h0 = d1.Histo1D(TH1D("h0", "nhits; ", 20, 0,20), "nhits");
+
+  auto n0 = d1.Filter([](int n){ return (n>0); },{"nhits"}).Count();
+
+  TCanvas* c = new TCanvas();
+
+  //d1.Snapshot("digitized_EVENT","test_gem_tracker_digi.root");
+std::cout << "testing 5\n";
+  std::cout << *n0 << " events with nonzero hits\n";
+std::cout << "testing 6\n";
+  if(*n0<5) {
+    std::quick_exit(1);
+  }
+
+}
+
diff --git a/benchmarks/zdc/simple_info_plot_histograms.cxx b/benchmarks/zdc/simple_info_plot_histograms.cxx
new file mode 100644
index 00000000..07ec554a
--- /dev/null
+++ b/benchmarks/zdc/simple_info_plot_histograms.cxx
@@ -0,0 +1,216 @@
+R__LOAD_LIBRARY(libGenDetectors.so)
+R__LOAD_LIBRARY(libfmt.so)
+#include "fmt/core.h"
+R__LOAD_LIBRARY(libDDG4IO.so)
+#include "DD4hep/Detector.h"
+#include "DDG4/Geant4Data.h"
+#include "DDRec/CellIDPositionConverter.h"
+#include "DDRec/SurfaceManager.h"
+#include "DD4hep/VolumeManager.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/ObjectsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/VolumeManagerInterna.h"
+#include "DDRec/Surface.h"
+#include "DD4hep/Volumes.h"
+#include "DD4hep/DetElement.h"
+#include "DD4hep/NamedObject.h"
+#include "DD4hep/IDDescriptor.h"
+#include "DD4hep/ConditionsMap.h"
+#include "TGeoMatrix.h"
+#include "ROOT/RDataFrame.hxx"
+#include "Math/Vector3D.h"
+#include "Math/Vector4D.h"
+#include "Math/VectorUtil.h"
+#include "TCanvas.h"
+#include "TLegend.h"
+#include "TMath.h"
+#include "TRandom3.h"
+#include "TFile.h"
+#include "TH1F.h"
+#include "TH1D.h"
+#include "TTree.h"
+#include "TChain.h"
+#include <random>
+#include <iostream>
+#include "TStyle.h"
+
+void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_photons.root"){
+
+  // Setting for graphs
+  gROOT->SetStyle("Plain");
+  gStyle->SetOptFit(1);
+  gStyle->SetLineWidth(2);
+  gStyle->SetPadTickX(1);
+  gStyle->SetPadTickY(1);
+  gStyle->SetPadGridX(1);
+  gStyle->SetPadGridY(1);
+  gStyle->SetPadLeftMargin(0.14);
+
+  TChain* t = new TChain("EVENT");
+  t->Add(fname);
+
+  ROOT::RDataFrame d0(*t);//, {"ZDCHits","MCParticles"});
+
+  // Detector
+  dd4hep::Detector& detector = dd4hep::Detector::getInstance();
+  detector.fromCompact("benchmarks/zdc/ZDC_example.xml");  
+  // Volume
+  dd4hep::VolumeManager volman = dd4hep::VolumeManager::getVolumeManager(detector);
+  // CellID Coverter
+  dd4hep::rec::CellIDPositionConverter cellid_converter(detector);
+
+  // Number of hits
+  auto nhits = [] (std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits){ return (int) hits.size(); };
+
+  // Cell ID
+  auto cellID = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
+        std::vector<double> result;
+        for(const auto& h: hits)
+                result.push_back(h->cellID);
+  return result;
+  };
+
+  // Volume ID
+  auto volID = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
+        std::vector<double> result;
+        for(const auto& h: hits) {
+		// method 1: use cell ID to get volume ID
+                auto volcontext = cellid_converter.findContext(h->cellID);
+		//auto volid = volcontext->identifier;             
+
+		// method 2: use detector element, readout, segmentation, then volume ID
+		//dd4hep::Readout r = cellid_converter.findReadout(volcontext->element);
+		//dd4hep::Segmentation seg = r.segmentation();
+		//auto volid = seg.volumeID(h->cellID);
+
+		 result.push_back(volcontext->identifier);
+        }
+  return result;
+  };
+
+  // Detector ID
+  auto detID = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
+        std::vector<double> result;
+        for(const auto& h: hits) {
+		auto detelement = volman.lookupDetector(h->cellID);
+		result.push_back(detelement.volumeID());
+	}
+  return result;
+  };
+
+  // Hit position X
+  auto hit_x_position = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
+	std::vector<double> result;
+	for(const auto& h: hits)
+		result.push_back(h->position.x()); //mm
+  return result; 
+  };
+
+  // Hit position Y
+  auto hit_y_position = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
+        std::vector<double> result;
+        for(const auto& h: hits)
+		result.push_back(h->position.y()); //mm
+  return result;
+  };
+
+  // Hit position Z
+  auto hit_z_position = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
+        std::vector<double> result;
+        for(const auto& h: hits)
+		result.push_back(h->position.z()); //mm
+  return result;
+  };
+
+  // Energy deposition
+  auto e_dep = [&] (const std::vector<dd4hep::sim::Geant4Calorimeter::Hit*>& hits) {
+        std::vector<double> result;
+        for(const auto& h: hits)
+		result.push_back(h->energyDeposit); //GeV
+  return result;
+  };
+
+  auto d1 = d0.Define("nhits", nhits, {"ZDCHits"})
+	      .Define("cellID", cellID, {"ZDCHits"})
+	      .Define("volID", volID, {"ZDCHits"})
+	      .Define("detID", detID, {"ZDCHits"})
+    	      .Define("hit_x_position", hit_x_position, {"ZDCHits"})
+	      .Define("hit_y_position", hit_y_position, {"ZDCHits"})
+              .Define("hit_z_position", hit_z_position, {"ZDCHits"})
+	      .Define("e_dep", e_dep, {"ZDCHits"})
+  	      ;
+
+  // Define Histograms
+  auto h0 = d1.Histo1D({"h0", "nhits histogram; nhits; Events", 100, 0,5000}, "nhits");
+  auto h1 = d1.Histo1D({"h1", "hit position X histogram; hit position X [mm]; Events", 60,-30,30}, "hit_x_position");
+  auto h2 = d1.Histo1D({"h2", "hit position Y histogram; hit position Y [mm]; Events", 100,-30,80}, "hit_y_position");
+  auto h3 = d1.Histo1D({"h3", "hit position Z histogram; hit position Z [mm]; Events", 100,1000,1300}, "hit_z_position");
+  auto h4 = d1.Histo1D({"h4", "energy deposition histogram; energy deposition [GeV]; Events", 100,0,300}, "e_dep");
+  auto h5 = d1.Histo1D({"h5", "detector ID; detector ID; Events", 3,-0.5,2.5}, "detID");
+  auto h6 = d1.Histo1D({"h6", "volume ID; volume ID; Events", 100,0,50000000}, "volID");
+
+  auto n0 = d1.Filter([](int n){ return (n>0); },{"nhits"}).Count();
+
+  d1.Snapshot("info_EVENT","sim_output/info_zdc_photons.root");
+  std::cout << *n0 << " events with nonzero hits\n";
+
+  TCanvas *c1 = new TCanvas("c1","c1",800,600);
+  c1->SetLogy(1);
+  h0->GetYaxis()->SetTitleOffset(1.4);
+  h0->SetLineWidth(2);
+  h0->SetLineColor(kBlack);
+  h0->DrawClone();
+  c1->SaveAs("sim_output/nhits_histo_zdc_photons.png");
+
+  TCanvas *c2 = new TCanvas("c2","c2",1000,1000);
+  c2->Divide(2,2);
+  c2->cd(1);
+  h1->GetYaxis()->SetTitleOffset(1.7);
+  h1->SetLineWidth(2);
+  h1->SetLineColor(kBlack);
+  h1->DrawClone();
+
+  c2->cd(2);
+  h2->GetYaxis()->SetTitleOffset(1.7);
+  h2->SetLineWidth(2);
+  h2->SetLineColor(kBlack);  
+  h2->DrawClone();
+
+  c2->cd(3);
+  h3->GetYaxis()->SetTitleOffset(1.7);
+  h3->SetLineWidth(2);
+  h3->SetLineColor(kBlack);  
+  h3->DrawClone();
+  c2->SaveAs("sim_output/hit_postion_histo_zdc_photons.png");
+
+  TCanvas *c3 = new TCanvas("c3","c3",600,600);
+  c3->cd();
+  c3->SetLogy(1);
+  h4->GetYaxis()->SetTitleOffset(1.4);
+  h4->SetLineWidth(2);
+  h4->SetLineColor(kBlack);
+  h4->DrawClone();
+  c3->SaveAs("sim_output/edep_histo_zdc_photons.png");
+
+  TCanvas *c4 = new TCanvas("c4","c4",1000,600);
+  c4->Divide(2,1);
+  c4->SetLogy(0);
+  c4->cd(1);
+  h5->GetYaxis()->SetTitleOffset(2.0);
+  h5->SetLineWidth(2);
+  h5->SetLineColor(kBlack);
+  h5->DrawClone();
+
+  c4->cd(2);
+  h6->GetYaxis()->SetTitleOffset(2.0);
+  h6->SetLineWidth(2);
+  h6->SetLineColor(kBlack);
+  h6->DrawClone();
+  c4->SaveAs("sim_output/detID_volID_histo_zdc_photons.png");
+
+  if(*n0<1) {
+    std::quick_exit(1);
+  }
+}
+
diff --git a/benchmarks/calorimeters/zdc_neutrons_reader.cxx b/benchmarks/zdc/zdc_neutrons_reader.cxx
similarity index 100%
rename from benchmarks/calorimeters/zdc_neutrons_reader.cxx
rename to benchmarks/zdc/zdc_neutrons_reader.cxx
-- 
GitLab