diff --git a/benchmarks/b0_tracker/analysis/b0_tracker_hits.cxx b/benchmarks/b0_tracker/analysis/b0_tracker_hits.cxx index b4984adaa3ef6c31788a38c6ba35f3d0f3e9e466..721445ba9331c5a34487246b7d93011d46c9ccda 100644 --- a/benchmarks/b0_tracker/analysis/b0_tracker_hits.cxx +++ b/benchmarks/b0_tracker/analysis/b0_tracker_hits.cxx @@ -26,7 +26,7 @@ R__LOAD_LIBRARY(libfmt.so) #include "dd4pod/TrackerHitCollection.h" -void b0_tracker_hits(const char* fname = "./sim_output/sim_forward_protons.root"){ +void b0_tracker_hits(const char* fname = "./sim_output/sim_forward_protons.edm4hep.root"){ ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel double degree = TMath::Pi()/180.0; diff --git a/benchmarks/b0_tracker/forward_protons.sh b/benchmarks/b0_tracker/forward_protons.sh index f0a6be991dbbb99286629a85fbb127b15586c3f2..1471658e9a2ac929e5d620f74dbcad62b73d9925 100755 --- a/benchmarks/b0_tracker/forward_protons.sh +++ b/benchmarks/b0_tracker/forward_protons.sh @@ -10,7 +10,7 @@ fi export FILE_NAME_TAG="forward_protons" export JUGGLER_GEN_FILE="${LOCAL_DATA_PATH}/${FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="${LOCAL_DATA_PATH}/sim_${FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="${LOCAL_DATA_PATH}/sim_${FILE_NAME_TAG}.edm4hep.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}" @@ -23,9 +23,10 @@ if [[ "$?" -ne "0" ]] ; then fi # Run geant4 simulations -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/barrel_ecal/config.yml b/benchmarks/barrel_ecal/config.yml index dcf41f273946ad191130f3d4eb0440c9cfc9cc7e..100037cc7a8ba3df765ae8eb3388292e154fabf1 100644 --- a/benchmarks/barrel_ecal/config.yml +++ b/benchmarks/barrel_ecal/config.yml @@ -40,9 +40,9 @@ calib:emcal_barrel_electrons: - ["sim:emcal_barrel_electrons"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_emcal_barrel_electron.root + - rootls -t sim_output/sim_emcal_barrel_electron.edm4hep.root - root -b -q 'benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx+("electron", true)' - - mv sim_output/sim_emcal_barrel_electron.root results/. + - mv sim_output/sim_emcal_barrel_electron.edm4hep.root results/. - echo "JSON file(s) from analysis:" ; cat results/*.json bench:emcal_barrel_pions: @@ -77,9 +77,9 @@ bench:emcal_barrel_photons: - ["sim:emcal_barrel_photons"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_emcal_barrel_photon.root + - rootls -t sim_output/sim_emcal_barrel_photon.edm4hep.root - root -b -q 'benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx+("photon", false)' - - mv sim_output/sim_emcal_barrel_photon.root results/. + - mv sim_output/sim_emcal_barrel_photon.edm4hep.root results/. - if [[ "$RUN_EXTENDED_BENCHMARK" == "true" ]] ; then root -b -q 'benchmarks/barrel_ecal/scripts/emcal_barrel_energy_scan_analysis.cxx+("photon")' ; fi bench:emcal_barrel_pion_rejection: @@ -89,8 +89,8 @@ bench:emcal_barrel_pion_rejection: - ["sim:emcal_barrel_pion_rejection"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_emcal_barrel_piRej_piminus.root - - rootls -t sim_output/sim_emcal_barrel_piRej_electron.root + - rootls -t sim_output/sim_emcal_barrel_piRej_piminus.edm4hep.root + - rootls -t sim_output/sim_emcal_barrel_piRej_electron.edm4hep.root - root -b -q benchmarks/barrel_ecal/scripts/emcal_barrel_pion_rejection_analysis.cxx+ collect_results:barrel_ecal: diff --git a/benchmarks/barrel_ecal/run_emcal_barrel_electrons.sh b/benchmarks/barrel_ecal/run_emcal_barrel_electrons.sh index 7b03df11288ecc0e6ea7496498eb553721d0b325..df97c7b21e3132f4dd923faca8826b5f1e2765ba 100755 --- a/benchmarks/barrel_ecal/run_emcal_barrel_electrons.sh +++ b/benchmarks/barrel_ecal/run_emcal_barrel_electrons.sh @@ -18,7 +18,7 @@ fi export JUGGLER_FILE_NAME_TAG="emcal_barrel_uniform_electrons" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" @@ -38,9 +38,10 @@ if [[ "$?" -ne "0" ]] ; then fi # Run geant4 simulations -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/barrel_ecal/run_emcal_barrel_energy_scan.sh b/benchmarks/barrel_ecal/run_emcal_barrel_energy_scan.sh index ad6e73f3eb360c93c0d278347d65bb9778c7d933..4492ddcfcebede727f09b05d56ac5604005f989f 100755 --- a/benchmarks/barrel_ecal/run_emcal_barrel_energy_scan.sh +++ b/benchmarks/barrel_ecal/run_emcal_barrel_energy_scan.sh @@ -20,7 +20,7 @@ do mkdir -p "$path_rootfiles" mkdir -p "$path_plots" ls -lthaR sim_output/ - mv "sim_output/sim_emcal_barrel_${PARTICLE}.root" "$path_rootfiles" + mv "sim_output/sim_emcal_barrel_${PARTICLE}.edm4hep.root" "$path_rootfiles" done export JUGGLER_N_EVENTS=$ORIGINAL_JUGGLER_N_EVENTS diff --git a/benchmarks/barrel_ecal/run_emcal_barrel_particles.sh b/benchmarks/barrel_ecal/run_emcal_barrel_particles.sh index 71977b285ac930d2a6d532df7db68a671469ec5f..7d463d7f8fe95043f8e7eec5b21e9dde973ab96a 100755 --- a/benchmarks/barrel_ecal/run_emcal_barrel_particles.sh +++ b/benchmarks/barrel_ecal/run_emcal_barrel_particles.sh @@ -24,7 +24,7 @@ fi export JUGGLER_FILE_NAME_TAG="emcal_barrel_${PARTICLE}" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" @@ -45,9 +45,10 @@ fi ls -ltRhL -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles data/${JUGGLER_FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/barrel_ecal/run_emcal_barrel_pi0.sh b/benchmarks/barrel_ecal/run_emcal_barrel_pi0.sh index 62384d07db67f4da02cd6211697a84bfc2bd94ad..cdcc583ac6e7e6f9414d9bfea306d0c0bf8da7b0 100755 --- a/benchmarks/barrel_ecal/run_emcal_barrel_pi0.sh +++ b/benchmarks/barrel_ecal/run_emcal_barrel_pi0.sh @@ -23,7 +23,7 @@ fi export JUGGLER_FILE_NAME_TAG="emcal_barrel_uniform_pi0" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" @@ -43,9 +43,10 @@ if [[ "$?" -ne "0" ]] ; then fi # Run geant4 simulations -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/barrel_ecal/run_emcal_barrel_pion_rejection.sh b/benchmarks/barrel_ecal/run_emcal_barrel_pion_rejection.sh index 34482d31b78eb035d493ba20909e3f6a34062aa5..5e394a6f26d07abac807791684e0d05f070c7759 100644 --- a/benchmarks/barrel_ecal/run_emcal_barrel_pion_rejection.sh +++ b/benchmarks/barrel_ecal/run_emcal_barrel_pion_rejection.sh @@ -24,7 +24,7 @@ fi export JUGGLER_FILE_NAME_TAG="emcal_barrel_piRej_${PARTICLE}" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" @@ -45,9 +45,10 @@ fi ls -ltRhL -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles data/${JUGGLER_FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/barrel_ecal/run_emcal_barrel_pions.sh b/benchmarks/barrel_ecal/run_emcal_barrel_pions.sh index 755a589df4731854eb08c82fafdcc64bb3178979..a42b7aedb13d74cfad63d0a1a9f85542cc42d929 100755 --- a/benchmarks/barrel_ecal/run_emcal_barrel_pions.sh +++ b/benchmarks/barrel_ecal/run_emcal_barrel_pions.sh @@ -23,7 +23,7 @@ fi export JUGGLER_FILE_NAME_TAG="emcal_barrel_uniform_pions" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" @@ -43,9 +43,10 @@ if [[ "$?" -ne "0" ]] ; then fi # Run geant4 simulations -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_energy_scan_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_energy_scan_analysis.cxx index 91e35341952feec6a5c670050075dd54c861cd76..b145f3c41e7ef895a6c0e137a3556ecd00749a2e 100644 --- a/benchmarks/barrel_ecal/scripts/emcal_barrel_energy_scan_analysis.cxx +++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_energy_scan_analysis.cxx @@ -8,8 +8,8 @@ #include <iostream> #include <fmt/core.h> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "TCanvas.h" #include "TStyle.h" @@ -50,25 +50,25 @@ void save_canvas(TCanvas* c, std::string var_label, std::string E_label, std::st std::tuple <double, double, double, double> extract_sampling_fraction_parameters(std::string particle_label, std::string E_label, dd4hep::Detector& detector) { - std::string input_fname = fmt::format("sim_output/energy_scan/{}/sim_emcal_barrel_{}.root", E_label, particle_label); + std::string input_fname = fmt::format("sim_output/energy_scan/{}/sim_emcal_barrel_{}.edm4hep.root", E_label, particle_label); ROOT::EnableImplicitMT(); ROOT::RDataFrame d0("events", input_fname); // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { auto p = input[2]; - auto energy = TMath::Sqrt(p.ps.x * p.ps.x + p.ps.y * p.ps.y + p.ps.z * p.ps.z + p.mass * p.mass); + auto energy = TMath::Sqrt(p.momentum.x * p.momentum.x + p.momentum.y * p.momentum.y + p.momentum.z * p.momentum.z + p.mass * p.mass); return energy; }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) - total_edep += i.energyDeposit; + total_edep += i.energy; return total_edep; }; @@ -84,7 +84,7 @@ std::tuple <double, double, double, double> extract_sampling_fraction_parameters fmt::print(" layer index is {}.\n", layer_index); // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) .Define("nhits", nhits, {"EcalBarrelHits"}) .Define("EsimImg", Esim, {"EcalBarrelHits"}) .Define("EsimScFi", Esim, {"EcalBarrelScFiHits"}) @@ -117,11 +117,11 @@ std::tuple <double, double, double, double> extract_sampling_fraction_parameters clayer->Divide(4,5); for(int layer=1; layer<nlayers+1; layer++) { - auto Esim_layer = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_layer = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto layer_edep = 0.0; for (const auto& i: evt) { if (decoder->get(i.cellID, layer_index) == layer) { - layer_edep += i.energyDeposit; + layer_edep += i.energy; } } return layer_edep; diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx index a9613072ceba195c7c0604d49ffce88a87f0588e..ca589efec6392aee706c45611d8ad01f44606970 100644 --- a/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx +++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx @@ -8,8 +8,8 @@ #include <fstream> #include <fmt/core.h> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "TCanvas.h" #include "TStyle.h" @@ -61,7 +61,7 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo double fSam_scfi_mean_err; ROOT::EnableImplicitMT(); - std::string input_fname = fmt::format("sim_output/sim_emcal_barrel_{}.root", particle_name); + std::string input_fname = fmt::format("sim_output/sim_emcal_barrel_{}.edm4hep.root", particle_name); ROOT::RDataFrame d0("events", input_fname); // Environment Variables @@ -75,20 +75,20 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo } // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { auto p = input[2]; - auto energy = TMath::Sqrt(p.ps.x * p.ps.x + p.ps.y * p.ps.y + p.ps.z * p.ps.z + p.mass * p.mass); + auto energy = TMath::Sqrt(p.momentum.x * p.momentum.x + p.momentum.y * p.momentum.y + p.momentum.z * p.momentum.z + p.mass * p.mass); return energy; }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) - total_edep += i.energyDeposit; + total_edep += i.energy; return total_edep; }; @@ -98,7 +98,7 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) .Define("nhits", nhits, {"EcalBarrelHits"}) .Define("EsimImg", Esim, {"EcalBarrelHits"}) .Define("EsimScFi", Esim, {"EcalBarrelScFiHits"}) diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx index 062e934643cbdde8c33b452d0ad27e0d32c8c055..c0ed9ae308708d87bdfd8d4bc41cc37f7b193f29 100644 --- a/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx +++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx @@ -6,8 +6,8 @@ #include "ROOT/RDataFrame.hxx" #include <iostream> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "common_bench/benchmark.h" #include "common_bench/mt.h" @@ -30,8 +30,8 @@ using namespace ROOT::VecOps; using json = nlohmann::json; void emcal_barrel_pi0_analysis( - const char* input_fname = "sim_output/sim_emcal_barrel_pi0.root" - //const char* input_fname = "../sim_output/sim_emcal_barrel_uniform_pi0.root" + const char* input_fname = "sim_output/sim_emcal_barrel_pi0.edm4hep.root" + //const char* input_fname = "../sim_output/sim_emcal_barrel_uniform_pi0.edm4hep.root" ) { // Setting for graphs @@ -56,18 +56,18 @@ void emcal_barrel_pi0_analysis( double samp_frac = j["electron"]["sampling_fraction"]; // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - return TMath::Sqrt(input[2].ps.x*input[2].ps.x + input[2].ps.y*input[2].ps.y + input[2].ps.z*input[2].ps.z + input[2].mass*input[2].mass); + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { + return TMath::Sqrt(input[2].momentum.x*input[2].momentum.x + input[2].momentum.y*input[2].momentum.y + input[2].momentum.z*input[2].momentum.z + input[2].mass*input[2].mass); }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt){ - total_edep += i.energyDeposit; + total_edep += i.energy; } return total_edep; }; @@ -88,24 +88,24 @@ void emcal_barrel_pi0_analysis( }; // Returns the pdgID of the particle - auto getpid = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - return input[2].pdgID; + auto getpid = [](std::vector<edm4hep::MCParticleData> const& input) { + return input[2].PDG; }; // Returns number of particle daughters - auto getdau = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto getdau = [](std::vector<edm4hep::MCParticleData> const& input) { return input[2].daughters_begin; }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) .Define("nhits", nhits, {"EcalBarrelHits"}) .Define("EsimImg", Esim, {"EcalBarrelHits"}) .Define("EsimScFi", Esim, {"EcalBarrelScFiHits"}) .Define("Esim", "EsimImg+EsimScFi") .Define("fsam", fsam, {"Esim","Ethr"}) - .Define("pid", getpid, {"mcparticles"}) - .Define("dau", getdau, {"mcparticles"}) + .Define("pid", getpid, {"MCParticles"}) + .Define("dau", getdau, {"MCParticles"}) .Define("dE", eResol, {"Esim","Ethr"}) .Define("dE_rel", eResol_rel, {"Esim","Ethr"}) ; diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_pion_rejection_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pion_rejection_analysis.cxx index 2e0d41cd2e3557c597b1e29fcbaf6a7329a14ae0..89156923d250eabf6361eafebca2a31e5eaf1f80 100644 --- a/benchmarks/barrel_ecal/scripts/emcal_barrel_pion_rejection_analysis.cxx +++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_pion_rejection_analysis.cxx @@ -8,8 +8,8 @@ #include <algorithm> #include <string> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "common_bench/benchmark.h" #include "common_bench/mt.h" @@ -48,8 +48,8 @@ using ROOT::RDataFrame; using namespace ROOT::VecOps; void emcal_barrel_pion_rejection_analysis( - const char* input_fname1 = "sim_output/sim_emcal_barrel_piRej_electron.root", - const char* input_fname2 = "sim_output/sim_emcal_barrel_piRej_piminus.root" + const char* input_fname1 = "sim_output/sim_emcal_barrel_piRej_electron.edm4hep.root", + const char* input_fname2 = "sim_output/sim_emcal_barrel_piRej_piminus.edm4hep.root" ) { // Error Ignore Level Set @@ -105,44 +105,44 @@ void emcal_barrel_pion_rejection_analysis( auto layer_indexScFi = decoderScFi->index("layer"); // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - return TMath::Sqrt(input[2].ps.x*input[2].ps.x + input[2].ps.y*input[2].ps.y + input[2].ps.z*input[2].ps.z + input[2].mass*input[2].mass); + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { + return TMath::Sqrt(input[2].momentum.x*input[2].momentum.x + input[2].momentum.y*input[2].momentum.y + input[2].momentum.z*input[2].momentum.z + input[2].mass*input[2].mass); }; // Thrown Momentum [GeV] - auto Pthr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - return TMath::Sqrt(input[2].ps.x*input[2].ps.x + input[2].ps.y*input[2].ps.y + input[2].ps.z*input[2].ps.z); + auto Pthr = [](std::vector<edm4hep::MCParticleData> const& input) { + return TMath::Sqrt(input[2].momentum.x*input[2].momentum.x + input[2].momentum.y*input[2].momentum.y + input[2].momentum.z*input[2].momentum.z); }; // Thrown Eta - auto Eta = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - double E = TMath::Sqrt(input[2].ps.x*input[2].ps.x + input[2].ps.y*input[2].ps.y + input[2].ps.z*input[2].ps.z + input[2].mass*input[2].mass); - return 0.5*TMath::Log((E + input[2].ps.z) / (E - input[2].ps.z)); + auto Eta = [](std::vector<edm4hep::MCParticleData> const& input) { + double E = TMath::Sqrt(input[2].momentum.x*input[2].momentum.x + input[2].momentum.y*input[2].momentum.y + input[2].momentum.z*input[2].momentum.z + input[2].mass*input[2].mass); + return 0.5*TMath::Log((E + input[2].momentum.z) / (E - input[2].momentum.z)); }; // Thrown pT [GeV] - auto pT = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - return TMath::Sqrt(input[2].ps.x*input[2].ps.x + input[2].ps.y*input[2].ps.y); + auto pT = [](std::vector<edm4hep::MCParticleData> const& input) { + return TMath::Sqrt(input[2].momentum.x*input[2].momentum.x + input[2].momentum.y*input[2].momentum.y); }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { double total_edep = 0.0; for (const auto& i: evt){ - total_edep += i.energyDeposit; + total_edep += i.energy; } return total_edep; }; // Energy deposititon [GeV] in the first 2 layers - auto Esim_dep2 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep2 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 3 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; @@ -150,87 +150,87 @@ void emcal_barrel_pion_rejection_analysis( // Energy deposititon [GeV] in the first 3 layers // Same as Esim_front from previous codes - auto Esim_dep3 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep3 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 4 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; }; // Energy deposititon [GeV] in the first 4 layers - auto Esim_dep4 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep4 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 5 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; }; // Energy deposititon [GeV] in the first 5 layers - auto Esim_dep5 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep5 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 6 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; }; // Energy deposititon [GeV] in the first 6 layers - auto Esim_dep6 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep6 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 7 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; }; // Energy deposititon [GeV] in the first 6 layers - auto Esim_dep6_ScFi = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep6_ScFi = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoderScFi->get(i.cellID, layer_indexScFi) < 7 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; }; // Energy deposititon [GeV] in the first 7 layers - auto Esim_dep7 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep7 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 8 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; }; // Energy deposititon [GeV] in the first 8 layers - auto Esim_dep8 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep8 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 9 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; }; // Energy deposititon [GeV] in the first 9 layers - auto Esim_dep9 = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep9 = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) { if( decoder->get(i.cellID, layer_index) < 10 ){ - total_edep += i.energyDeposit; + total_edep += i.energy; } } return total_edep; @@ -238,10 +238,10 @@ void emcal_barrel_pion_rejection_analysis( // Energy deposititon [GeV], returns array // Note Layer_index = 0 does not exist at the wrting of this code - auto Esim_dep = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim_dep = [=](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { std::vector<double>res(20); for (const auto& i: evt) { - res[decoder->get(i.cellID, layer_index)] += i.energyDeposit; + res[decoder->get(i.cellID, layer_index)] += i.energy; } return res; }; @@ -271,24 +271,24 @@ void emcal_barrel_pion_rejection_analysis( return E_front / mom; }; - // Returns the pdgID of the particle - auto getpid = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - return input[2].pdgID; + // Returns the PDG of the particle + auto getpid = [](std::vector<edm4hep::MCParticleData> const& input) { + return input[2].PDG; }; // Returns number of particle daughters - auto getdau = [](std::vector<dd4pod::Geant4ParticleData> const& input){ + auto getdau = [](std::vector<edm4hep::MCParticleData> const& input){ return input[2].daughters_begin; }; // Filter function to get electrons - auto is_electron = [](std::vector<dd4pod::Geant4ParticleData> const& input){ - return (input[2].pdgID == 11 ? true : false); + auto is_electron = [](std::vector<edm4hep::MCParticleData> const& input){ + return (input[2].PDG == 11 ? true : false); }; // Filter function to get just negative pions - auto is_piMinus = [](std::vector<dd4pod::Geant4ParticleData> const& input){ - return (input[2].pdgID == -211 ? true : false); + auto is_piMinus = [](std::vector<edm4hep::MCParticleData> const& input){ + return (input[2].PDG == -211 ? true : false); }; // Filter function Edeposit @@ -302,8 +302,8 @@ void emcal_barrel_pion_rejection_analysis( // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) - .Define("Pthr", Pthr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) + .Define("Pthr", Pthr, {"MCParticles"}) .Define("nhits", nhits, {"EcalBarrelHits"}) .Define("Esim", Esim, {"EcalBarrelHits"}) .Define("EsimScFi", Esim, {"EcalBarrelScFiHits"}) @@ -312,7 +312,7 @@ void emcal_barrel_pion_rejection_analysis( .Define("EsimTot", "EsimScFi+Esim") .Define("EsimTotOverP", fEp, {"EsimTot", "Pthr"}) .Define("fsam", fsam, {"Esim","Ethr"}) - .Define("pid", getpid, {"mcparticles"}) + .Define("pid", getpid, {"MCParticles"}) .Define("EDep", Esim_dep, {"EcalBarrelHits"}) .Define("EDepSum", Esim_dep_sum, {"EDep"}) .Define("EDepN", Esim_depN, {"EDep"}) @@ -323,8 +323,8 @@ void emcal_barrel_pion_rejection_analysis( .Define("EDep6", Esim_dep6, {"EcalBarrelHits"}) .Define("EDep6OverP", fEp, {"EDep6", "Pthr"}) .Define("EOverP", fEp, {"EDep3", "Pthr"}) - .Define("Eta", Eta, {"mcparticles"}) - .Define("pT", pT, {"mcparticles"}) + .Define("Eta", Eta, {"MCParticles"}) + .Define("pT", pT, {"MCParticles"}) .Define("EDepOverP", fEp, {"EDepN", "Pthr"}) .Define("EDepOverPT", fEp, {"EDepN", "pT"}) .Define("EDepSumOverP", fEp, {"EDepSum", "Pthr"}) @@ -335,8 +335,8 @@ void emcal_barrel_pion_rejection_analysis( // Particle Filters dep_min = 1; dep_max = 6; - auto d_ele = d1.Filter(is_electron, {"mcparticles"}); - auto d_pim = d1.Filter(is_piMinus, {"mcparticles"}); + auto d_ele = d1.Filter(is_electron, {"MCParticles"}); + auto d_pim = d1.Filter(is_piMinus, {"MCParticles"}); // Cut Filter std::string currentCut = "(EDep6OverP>2.5e-3)&&(EDep6>5e-3)";// Good athena cut, that is changed by cutEE later diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx index 24eaafdc50d5fc55297faf8f7e8c9fef14d3ffbb..3e61c8e168b99cae1e0b9786258af21c8eb15ad5 100644 --- a/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx +++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx @@ -6,8 +6,8 @@ #include "ROOT/RDataFrame.hxx" #include <iostream> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "common_bench/benchmark.h" #include "common_bench/mt.h" @@ -24,7 +24,7 @@ using ROOT::RDataFrame; using namespace ROOT::VecOps; -void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal_barrel_piplus.root") +void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal_barrel_piplus.edm4hep.root") { // Setting for graphs gROOT->SetStyle("Plain"); @@ -44,20 +44,20 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal double samp_frac = 0.0136; // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { auto p = input[2]; - auto energy = TMath::Sqrt(p.ps.x * p.ps.x + p.ps.y * p.ps.y + p.ps.z * p.ps.z + p.mass * p.mass); + auto energy = TMath::Sqrt(p.momentum.x * p.momentum.x + p.momentum.y * p.momentum.y + p.momentum.z * p.momentum.z + p.mass * p.mass); return energy; }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) - total_edep += i.energyDeposit; + total_edep += i.energy; return total_edep; }; @@ -77,23 +77,23 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal }; // Returns the pdgID of the particle - auto getpid = [](std::vector<dd4pod::Geant4ParticleData> const& input) { - return input[2].pdgID; + auto getpid = [](std::vector<edm4hep::MCParticleData> const& input) { + return input[2].PDG; }; // Returns number of particle daughters - auto getdau = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto getdau = [](std::vector<edm4hep::MCParticleData> const& input) { return input[2].daughters_begin; }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) .Define("nhits", nhits, {"EcalBarrelHits"}) .Define("EsimImg", Esim, {"EcalBarrelHits"}) .Define("EsimScFi", Esim, {"EcalBarrelScFiHits"}) .Define("Esim", "EsimImg+EsimScFi") .Define("fsam", fsam, {"Esim", "Ethr"}) - .Define("pid", getpid, {"mcparticles"}); + .Define("pid", getpid, {"MCParticles"}); // Define Histograms auto hEthr = d1.Histo1D({"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, 7.5}, "Ethr"); diff --git a/benchmarks/barrel_hcal/config.yml b/benchmarks/barrel_hcal/config.yml index d47f63da9b7f197eff4aefba1598cc7292865375..1674c8e8d9e97a0045f183695ca8efe4e667cad2 100644 --- a/benchmarks/barrel_hcal/config.yml +++ b/benchmarks/barrel_hcal/config.yml @@ -42,7 +42,7 @@ bench:hcal_barrel_protons: - ["sim:hcal_barrel_protons"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_hcal_barrel_proton.root + - rootls -t sim_output/sim_hcal_barrel_proton.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("proton")' - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx+("proton")' @@ -53,7 +53,7 @@ bench:hcal_barrel_muons: - ["sim:hcal_barrel_muons"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_hcal_barrel_muon.root + - rootls -t sim_output/sim_hcal_barrel_muon.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("muon")' - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx+("muon")' @@ -64,7 +64,7 @@ bench:hcal_barrel_antimuons: - ["sim:hcal_barrel_antimuons"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_hcal_barrel_antimuon.root + - rootls -t sim_output/sim_hcal_barrel_antimuon.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("antimuon")' - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx+("antimuon")' @@ -75,13 +75,13 @@ bench:hcal_barrel_kaons: - ["sim:hcal_barrel_kaons"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_hcal_barrel_kplus.root + - rootls -t sim_output/sim_hcal_barrel_kplus.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("kplus")' - - rootls -t sim_output/sim_hcal_barrel_kminus.root + - rootls -t sim_output/sim_hcal_barrel_kminus.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("kminus")' - - rootls -t sim_output/sim_hcal_barrel_kshort.root + - rootls -t sim_output/sim_hcal_barrel_kshort.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("kshort")' - - rootls -t sim_output/sim_hcal_barrel_klong.root + - rootls -t sim_output/sim_hcal_barrel_klong.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("klong")' bench:hcal_barrel_pions: @@ -91,9 +91,9 @@ bench:hcal_barrel_pions: - ["sim:hcal_barrel_pions"] script: - ls -lhtR sim_output/ - - rootls -t sim_output/sim_hcal_barrel_piplus.root + - rootls -t sim_output/sim_hcal_barrel_piplus.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("piplus")' - - rootls -t sim_output/sim_hcal_barrel_piminus.root + - rootls -t sim_output/sim_hcal_barrel_piminus.edm4hep.root - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("piminus")' collect_results:barrel_hcal: diff --git a/benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh b/benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh index 794333896dbbe35c233b419af962f09102d5a626..92388286b75e6bfb8bca59252dbad716c9f2c316 100755 --- a/benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh +++ b/benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh @@ -15,7 +15,7 @@ do mkdir -p "$path_rootfiles" mkdir -p "$path_plots" ls -lthaR sim_output/ - mv "sim_output/sim_hcal_barrel_${PARTICLE}.root" "$path_rootfiles" + mv "sim_output/sim_hcal_barrel_${PARTICLE}.edm4hep.root" "$path_rootfiles" done ls -lthaR sim_output diff --git a/benchmarks/barrel_hcal/run_hcal_barrel_particles.sh b/benchmarks/barrel_hcal/run_hcal_barrel_particles.sh index edeaba1e4ece7d1cde7dbbf931a3f91d28f43143..bbd7b728d4e7cc61a9420d4663764e93cd5e1dd8 100755 --- a/benchmarks/barrel_hcal/run_hcal_barrel_particles.sh +++ b/benchmarks/barrel_hcal/run_hcal_barrel_particles.sh @@ -24,7 +24,7 @@ fi export JUGGLER_FILE_NAME_TAG="hcal_barrel_${PARTICLE}" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" @@ -45,9 +45,10 @@ fi ls -ltRhL -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles data/${JUGGLER_FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx b/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx index 1d66a9819fdc05a31e420bbe0c2e3218bb4e852d..8446d0c19191079cdd14225bfa4f7a5f6a0ca56a 100644 --- a/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx +++ b/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx @@ -8,8 +8,8 @@ #include <fstream> #include <fmt/core.h> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "TCanvas.h" #include "TStyle.h" @@ -47,25 +47,25 @@ void save_canvas(TCanvas* c, std::string var_label, std::string E_label, std::st std::tuple <double, double, double, double> extract_sampling_fraction_parameters(std::string particle_label, std::string E_label) { - std::string input_fname = fmt::format("sim_output/energy_scan/{}/sim_hcal_barrel_{}.root", E_label, particle_label); + std::string input_fname = fmt::format("sim_output/energy_scan/{}/sim_hcal_barrel_{}.edm4hep.root", E_label, particle_label); ROOT::EnableImplicitMT(); ROOT::RDataFrame d0("events", input_fname); // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { auto p = input[2]; - auto energy = TMath::Sqrt(p.ps.x * p.ps.x + p.ps.y * p.ps.y + p.ps.z * p.ps.z + p.mass * p.mass); + auto energy = TMath::Sqrt(p.momentum.x * p.momentum.x + p.momentum.y * p.momentum.y + p.momentum.z * p.momentum.z + p.mass * p.mass); return energy; }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) - total_edep += i.energyDeposit; + total_edep += i.energy; return total_edep; }; @@ -75,7 +75,7 @@ std::tuple <double, double, double, double> extract_sampling_fraction_parameters }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) .Define("nhits", nhits, {"EcalBarrelHits"}) .Define("Esim", Esim, {"EcalBarrelHits"}) .Define("fsam", fsam, {"Esim", "Ethr"}); diff --git a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx index fbe72c2a1b3daf700f256679099e87ed82d04e29..424802d33765b57ec223b745330f60a771ff2bc7 100644 --- a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx +++ b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx @@ -8,8 +8,8 @@ #include <fstream> #include <fmt/core.h> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "TCanvas.h" #include "TStyle.h" @@ -49,24 +49,24 @@ void hcal_barrel_particles_analysis(std::string particle_name = "electron") gStyle->SetPadRightMargin(0.14); ROOT::EnableImplicitMT(); - std::string input_fname = fmt::format("sim_output/sim_hcal_barrel_{}.root", particle_name); + std::string input_fname = fmt::format("sim_output/sim_hcal_barrel_{}.edm4hep.root", particle_name); ROOT::RDataFrame d0("events", input_fname); // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { auto p = input[2]; - auto energy = TMath::Sqrt(p.ps.x * p.ps.x + p.ps.y * p.ps.y + p.ps.z * p.ps.z + p.mass * p.mass); + auto energy = TMath::Sqrt(p.momentum.x * p.momentum.x + p.momentum.y * p.momentum.y + p.momentum.z * p.momentum.z + p.mass * p.mass); return energy; }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) - total_edep += i.energyDeposit; + total_edep += i.energy; return total_edep; }; @@ -76,7 +76,7 @@ void hcal_barrel_particles_analysis(std::string particle_name = "electron") }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) .Define("nhits", nhits, {"HcalBarrelHits"}) .Define("Esim", Esim, {"HcalBarrelHits"}) .Define("fsam", fsam, {"Esim", "Ethr"}); diff --git a/benchmarks/crystal_calorimeter/config.yml b/benchmarks/crystal_calorimeter/config.yml index f13c18bce7862b4a848212ffcd1846231ff43785..96b1accd6f67592e4a70eecc085ef526a5134b91 100644 --- a/benchmarks/crystal_calorimeter/config.yml +++ b/benchmarks/crystal_calorimeter/config.yml @@ -8,7 +8,7 @@ cal_sim:crystal_pion: extends: .det_benchmark stage: simulate script: - - npsim --runType batch --numberOfEvents 100 --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml --inputFiles data/emcal_electrons.hepmc --outputFile sim_output/output_emcal_electrons.root + - ddsim --runType batch --numberOfEvents 100 --filter.tracker edep0 --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml --inputFiles data/emcal_electrons.hepmc --outputFile sim_output/output_emcal_electrons.edm4hep.root cal_bench:crystal_benchmark: extends: .det_benchmark @@ -16,7 +16,7 @@ cal_bench:crystal_benchmark: needs: - ["cal_sim:crystal_emcal"] script: - #- rootls -t sim_output/output_emcal_electrons.root + #- rootls -t sim_output/output_emcal_electrons.edm4hep.root - echo " Not yet complete" #- root -b -q benchmarks/cryxtal_calorimeter/simple_checking_crystal.cxx+ # diff --git a/benchmarks/crystal_calorimeter/makeplot_pion.C b/benchmarks/crystal_calorimeter/makeplot_pion.C index 9c1b409383428acbb165702b01de7873bd2183ad..d590d963c76d8ffc2692bb423b6328bca5aae04d 100644 --- a/benchmarks/crystal_calorimeter/makeplot_pion.C +++ b/benchmarks/crystal_calorimeter/makeplot_pion.C @@ -15,7 +15,7 @@ int makeplot_pion(void) gStyle->SetPadLeftMargin(0.14); // Input ROOT file - TFile *f = new TFile("sim_output/rec_crystal_pion_output.root","read"); + TFile *f = new TFile("sim_output/rec_crystal_pion_output.edm4hep.root","read"); TTree *t = (TTree *)f->Get("events"); // Set Branch status and addressed diff --git a/benchmarks/crystal_calorimeter/run_simulation_crystal.sh b/benchmarks/crystal_calorimeter/run_simulation_crystal.sh index 8a44a4b3b5c25bbeb3232c152905f2a2a6851bbc..9a1dbb0f0ccaeadf8b926f75bdd9df6ec9187608 100755 --- a/benchmarks/crystal_calorimeter/run_simulation_crystal.sh +++ b/benchmarks/crystal_calorimeter/run_simulation_crystal.sh @@ -3,4 +3,4 @@ ddsim --runType batch --numberOfEvents 100 \ --compactFile benchmarks/crystal_calorimeter/Crystal_example.xml \ --inputFiles ./data/emcal_electrons.hepmc \ - --outputFile ./sim_output/output_emcal_electrons.root + --outputFile ./sim_output/output_emcal_electrons.edm4hep.root diff --git a/benchmarks/crystal_calorimeter/run_simulation_crystal_pion.sh b/benchmarks/crystal_calorimeter/run_simulation_crystal_pion.sh index f8eb44f94802cf3b26561788270f6bcdb7166f77..a728fa104ce98936909f10570fef73a510377538 100755 --- a/benchmarks/crystal_calorimeter/run_simulation_crystal_pion.sh +++ b/benchmarks/crystal_calorimeter/run_simulation_crystal_pion.sh @@ -1,6 +1,7 @@ #!/bin/bash -npsim --runType batch --numberOfEvents 10000 \ +ddsim --runType batch --numberOfEvents 10000 \ + --filter.tracker edep0 \ --compactFile benchmarks/calorimeters/topside.xml \ --inputFiles ./data/emcal_pions_upto1GeV_10kevents.hepmc \ - --outputFile ./sim_output/sim_crystal_pion_input.root + --outputFile ./sim_output/sim_crystal_pion_input.edm4hep.root diff --git a/benchmarks/crystal_calorimeter/simple_checking_crystal.cxx b/benchmarks/crystal_calorimeter/simple_checking_crystal.cxx index d60c2d6c243c79a2a27713e77f3c3b4b579810f7..e99add75082c39aa60ad564b43cc286aab153a6b 100644 --- a/benchmarks/crystal_calorimeter/simple_checking_crystal.cxx +++ b/benchmarks/crystal_calorimeter/simple_checking_crystal.cxx @@ -5,7 +5,7 @@ R__LOAD_LIBRARY(libDDG4IO.so) #include "TChain.h" #include <random> -void simple_checking_crystal(const char* fname = "sim_output/output_emcal_electrons.root"){ +void simple_checking_crystal(const char* fname = "sim_output/output_emcal_electrons.edm4hep.root"){ ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel double degree = TMath::Pi()/180.0; diff --git a/benchmarks/pid/config.yml b/benchmarks/pid/config.yml index 112d1b594c5a71caefeee7f2fc930ec7093a6175..6d93582e3bd74eb8682b895bc25641fa135959de 100644 --- a/benchmarks/pid/config.yml +++ b/benchmarks/pid/config.yml @@ -2,8 +2,8 @@ sim:backward: extends: .det_benchmark stage: simulate script: - - npsim --runType batch --numberOfEvents 100 --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml --enableGun --gun.energy "5*GeV" --gun.particle "${PARTICLE}" --gun.thetaMin 130*deg --gun.thetaMax 177*deg --gun.distribution "cos(theta)" --outputFile sim_output/sim_pid_backward_${PARTICLE}_5GeV.root - - rootls -t sim_output/sim_pid_backward_${PARTICLE}_5GeV.root + - ddsim --runType batch --numberOfEvents 100 --filter.tracker edep0 --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml --enableGun --gun.energy "5*GeV" --gun.particle "${PARTICLE}" --gun.thetaMin 130*deg --gun.thetaMax 177*deg --gun.distribution "cos(theta)" --outputFile sim_output/sim_pid_backward_${PARTICLE}_5GeV.edm4hep.root + - rootls -t sim_output/sim_pid_backward_${PARTICLE}_5GeV.edm4hep.root parallel: matrix: - PARTICLE: ["e-", "pi+", "proton"] @@ -17,7 +17,7 @@ bench:mrich: if [[ ${JUGGLER_DETECTOR_VERSION} =~ acadia ]]; then echo "Performing MRICH benchmarks for acadia" mkdir -p results/pid/backward/mrich/ - root -t -x -q -b "benchmarks/pid/scripts/mrich_analysis.cxx+(\"sim_output/sim_pid_backward_${PARTICLE}_5GeV.root\", \"${PARTICLE}\")" + root -t -x -q -b "benchmarks/pid/scripts/mrich_analysis.cxx+(\"sim_output/sim_pid_backward_${PARTICLE}_5GeV.edm4hep.root\", \"${PARTICLE}\")" else echo "Skipping MRICH Benchmarks for non-acadia detector version ${JUGGLER_DETECTOR_VERSION}" fi diff --git a/benchmarks/pid/scripts/mrich_analysis.cxx b/benchmarks/pid/scripts/mrich_analysis.cxx index f8ca59f4351c00396734405c79c23fc7b693af84..fd4484afe40f97b65fcef54768c5890692644709 100644 --- a/benchmarks/pid/scripts/mrich_analysis.cxx +++ b/benchmarks/pid/scripts/mrich_analysis.cxx @@ -20,7 +20,7 @@ using ROOT::RDataFrame; using namespace ROOT::VecOps; -void mrich_analysis(const char* input_fname = "sim_output/sim_pid_backward_e-_5GeV.root", const char* input_pname = "e-") +void mrich_analysis(const char* input_fname = "sim_output/sim_pid_backward_e-_5GeV.edm4hep.root", const char* input_pname = "e-") { // Setting for graphs gROOT->SetStyle("Plain"); diff --git a/benchmarks/roman_pots/roman_pot_hit_eta.cxx b/benchmarks/roman_pots/roman_pot_hit_eta.cxx index ebe3b06c65f339789ecc6ae7c9151122e6a029fd..4e6574b93377c147ee6451b660ac256310a3fe6f 100644 --- a/benchmarks/roman_pots/roman_pot_hit_eta.cxx +++ b/benchmarks/roman_pots/roman_pot_hit_eta.cxx @@ -29,12 +29,12 @@ R__LOAD_LIBRARY(libDDG4IO.so) //#include "lcio2/TrackerRawDataData.h" //#include "lcio2/TrackerRawData.h" -void roman_pot_hit_eta(const char* fname = "./sim_output/roman_pot_out.root"){ +void roman_pot_hit_eta(const char* fname = "./sim_output/roman_pot_out.edm4hep.root"){ ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel double degree = TMath::Pi()/180.0; - TChain* t = new TChain("EVENT"); + TChain* t = new TChain("events"); t->Add(fname); ROOT::RDataFrame d0(*t); diff --git a/benchmarks/roman_pots/roman_pot_simu.sh b/benchmarks/roman_pots/roman_pot_simu.sh index ca29f1809d93a4d2c93480303cf3bfb748e6d5b4..a5809796445184e3f21ef69f85bc5d995053a40b 100755 --- a/benchmarks/roman_pots/roman_pot_simu.sh +++ b/benchmarks/roman_pots/roman_pot_simu.sh @@ -10,9 +10,10 @@ fi ddsim --runType batch -N 300 \ -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ./data/forward_ions.hepmc \ diff --git a/benchmarks/roman_pots/simple_tracking.cxx b/benchmarks/roman_pots/simple_tracking.cxx index 0afe2a1182e3621fe76cca399e7ca25e9e843e55..94ac1ed4c536883e109d258d5888cdc418595e4b 100644 --- a/benchmarks/roman_pots/simple_tracking.cxx +++ b/benchmarks/roman_pots/simple_tracking.cxx @@ -29,13 +29,13 @@ R__LOAD_LIBRARY(libDDG4IO.so) //#include "lcio2/TrackerRawDataData.h" //#include "lcio2/TrackerRawData.h" -void simple_tracking(const char* fname = "./sim_output/roman_pot_out.root"){ +void simple_tracking(const char* fname = "./sim_output/roman_pot_out.edm4hep.root"){ ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel //using namespace lcio2; double degree = TMath::Pi()/180.0; - TChain* t = new TChain("EVENT"); + TChain* t = new TChain("events"); t->Add(fname); ROOT::RDataFrame d0(*t);//, {"GEMTrackerHintits","MCParticles"}); diff --git a/benchmarks/timing/run_timing.sh b/benchmarks/timing/run_timing.sh index cc158bf5b71e4f092a3ebcc4d8c9af84f8f9a759..e0aba39f417beecf31f0cf1c628899e7a0345b94 100755 --- a/benchmarks/timing/run_timing.sh +++ b/benchmarks/timing/run_timing.sh @@ -75,15 +75,16 @@ echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}" # Run geant4 simulations output_dir="data/timing/${particle}/${energy/\*/}" -output_file="sim_${nevents}.root" +output_file="sim_${nevents}.edm4hep.root" mkdir -p ${output_dir} timing_dir="results/timing/${particle}/${energy/\*/}" timing_file="time_${nevents}events.log" -npsim_file="npsim_${nevents}events.log" +ddsim_file="npsim_${nevents}events.log" mkdir -p ${timing_dir} /usr/bin/time -v -o ${timing_dir}/time_${nevents}events.log \ - npsim --runType batch \ + ddsim --runType batch \ --printLevel WARNING \ + --filter.tracker edep0 \ --numberOfEvents ${nevents} \ --enableGun \ --gun.energy "${energy}" \ @@ -94,7 +95,7 @@ mkdir -p ${timing_dir} --part.minimalKineticEnergy "1*TeV" \ --compactFile ${compact_path} \ --outputFile ${output_dir}/${output_file} \ - 2>&1 > ${timing_dir}/${npsim_file} + 2>&1 > ${timing_dir}/${ddsim_file} echo "For ${nevents} events:" cat ${timing_dir}/${timing_file} diff --git a/benchmarks/trackers/roman_pot_hit_eta.cxx b/benchmarks/trackers/roman_pot_hit_eta.cxx index ebe3b06c65f339789ecc6ae7c9151122e6a029fd..b203ec96f753898e1ae318c29e8d0efa6072f654 100644 --- a/benchmarks/trackers/roman_pot_hit_eta.cxx +++ b/benchmarks/trackers/roman_pot_hit_eta.cxx @@ -29,19 +29,24 @@ R__LOAD_LIBRARY(libDDG4IO.so) //#include "lcio2/TrackerRawDataData.h" //#include "lcio2/TrackerRawData.h" -void roman_pot_hit_eta(const char* fname = "./sim_output/roman_pot_out.root"){ +#include "edm4hep/SimTrackerHitData.h" + +void roman_pot_hit_eta(const char* fname = "./sim_output/roman_pot_out.edm4hep.root"){ ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel double degree = TMath::Pi()/180.0; - TChain* t = new TChain("EVENT"); + TChain* t = new TChain("events"); t->Add(fname); ROOT::RDataFrame d0(*t); - auto hits_eta = [&](const std::vector<dd4hep::sim::Geant4Tracker::Hit*>& hits){ + auto hits_eta = [&](const std::vector<edm4hep::SimTrackerHitData>& hits){ std::vector<double> result; for (const auto& h: hits){ - result.push_back(h->momentum.eta()); + auto p = h.momentum; + auto theta = std::atan2(std::hypot(p.x, p.y), p.z); + auto eta = -std::log(std::tan(theta/2)); + result.push_back(eta); } return result; }; diff --git a/benchmarks/trackers/roman_pot_simu.sh b/benchmarks/trackers/roman_pot_simu.sh index 4520c52d59dbf5412e5023f8e4aa57bd0e1dde39..1c5d1f31078131bb6e375daa3fdb2f99d19ebd08 100755 --- a/benchmarks/trackers/roman_pot_simu.sh +++ b/benchmarks/trackers/roman_pot_simu.sh @@ -3,4 +3,4 @@ ddsim --runType batch -N 300 \ --inputFiles ./data/forward_ions.hepmc \ --compactFile benchmarks/trackers/roman_pot.xml \ - --outputFile ./sim_output/roman_pot_out.root + --outputFile ./sim_output/roman_pot_out.edm4hep.root diff --git a/benchmarks/trackers/simple_tracking.cxx b/benchmarks/trackers/simple_tracking.cxx index 0afe2a1182e3621fe76cca399e7ca25e9e843e55..e1f2b54ceeb2056831877206f74dd33fcf2115cc 100644 --- a/benchmarks/trackers/simple_tracking.cxx +++ b/benchmarks/trackers/simple_tracking.cxx @@ -29,13 +29,15 @@ R__LOAD_LIBRARY(libDDG4IO.so) //#include "lcio2/TrackerRawDataData.h" //#include "lcio2/TrackerRawData.h" -void simple_tracking(const char* fname = "./sim_output/roman_pot_out.root"){ +#include "edm4hep/SimTrackerHitData.h" + +void simple_tracking(const char* fname = "./sim_output/roman_pot_out.edm4hep.root"){ ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel //using namespace lcio2; double degree = TMath::Pi()/180.0; - TChain* t = new TChain("EVENT"); + TChain* t = new TChain("events"); t->Add(fname); ROOT::RDataFrame d0(*t);//, {"GEMTrackerHintits","MCParticles"}); @@ -56,7 +58,7 @@ void simple_tracking(const char* fname = "./sim_output/roman_pot_out.root"){ //dd4hep::rec::SurfaceManager& surfMan = *detector.extension<dd4hep::rec::SurfaceManager>() ; //auto surfMap = surfMan.map( "world" ) ; - auto nhits = [] (std::vector<dd4hep::sim::Geant4Tracker::Hit*>& hits){ return (int) hits.size(); }; + auto nhits = [] (std::vector<edm4hep::SimTrackerHitData>& hits){ return (int) hits.size(); }; //auto hit_position = [&](const std::vector<dd4hep::sim::Geant4Tracker::Hit*>& hits){ //for(const auto& h: hits){ // //std::cout << (h->position/10.0) << std::endl; diff --git a/benchmarks/tracking_detectors/scripts/sim_track_hits.cxx b/benchmarks/tracking_detectors/analysis/sim_track_hits.cxx similarity index 86% rename from benchmarks/tracking_detectors/scripts/sim_track_hits.cxx rename to benchmarks/tracking_detectors/analysis/sim_track_hits.cxx index 010f87a577788d6f6438730c1eba82e5391c2829..40b310bc4445680b0e1f57acd3ad5c69b4890645 100644 --- a/benchmarks/tracking_detectors/scripts/sim_track_hits.cxx +++ b/benchmarks/tracking_detectors/analysis/sim_track_hits.cxx @@ -3,6 +3,8 @@ #include "TH1D.h" #include "TLegend.h" #include "TProfile.h" +#include "THStack.h" +#include "Math/Vector4D.h" #include <cstdlib> #include <iostream> @@ -12,11 +14,9 @@ R__LOAD_LIBRARY(libDD4pod.so) #include <fmt/format.h> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/TrackerHitCollection.h" -#include "dd4pod/TrackerHitData.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" #include "eicd/ClusterCollection.h" -#include "eicd/ClusterData.h" #include "eicd/TrackParametersCollection.h" #include "eicd/TrackerHitCollection.h" @@ -31,10 +31,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { return result; }; -std::vector<float> pt(std::vector<dd4pod::Geant4ParticleData> const& in) { +std::vector<float> pt(std::vector<edm4hep::MCParticleData> const& in) { std::vector<float> result; for (size_t i = 0; i < in.size(); ++i) { - result.push_back(std::sqrt(in[i].ps.x * in[i].ps.x + in[i].ps.y * in[i].ps.y)); + result.push_back(std::sqrt(in[i].momentum.x * in[i].momentum.x + in[i].momentum.y * in[i].momentum.y)); } return result; } @@ -53,11 +53,11 @@ auto theta = [](std::vector<ROOT::Math::PxPyPzMVector> const& in) { } return result; }; -auto fourvec = [](ROOT::VecOps::RVec<dd4pod::Geant4ParticleData> const& in) { +auto fourvec = [](ROOT::VecOps::RVec<edm4hep::MCParticleData> const& in) { std::vector<ROOT::Math::PxPyPzMVector> result; ROOT::Math::PxPyPzMVector lv; for (size_t i = 0; i < in.size(); ++i) { - lv.SetCoordinates(in[i].ps.x, in[i].ps.y, in[i].ps.z, in[i].mass); + lv.SetCoordinates(in[i].momentum.x, in[i].momentum.y, in[i].momentum.z, in[i].mass); result.push_back(lv); } return result; @@ -90,12 +90,12 @@ ROOT::RDF::RNode add_subsystems(ROOT::RDF::RNode df, std::vector<std::pair<std:: } const auto [name, collection] = hitcols.back(); std::cout << " --> registering subsystem " << collection << "\n"; - auto df2 = df.Define("N_" + name, [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size(); }, {collection}); + auto df2 = df.Define("N_" + name, [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size(); }, {collection}); hitcols.pop_back(); return add_subsystems(df2, hitcols); }; -int sim_track_hits(const char* fname = "sim_track_hits.root") { +int sim_track_hits(const char* fname = "sim_track_hits.edm4hep.root") { ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); @@ -114,18 +114,18 @@ int sim_track_hits(const char* fname = "sim_track_hits.root") { // minimal hit collection setup std::vector<std::pair<std::string, std::string>> hitCollections{{"vtx_barrel", "VertexBarrelHits"}, {"trk_barrel", "TrackerBarrelHits"}, - {"trk_endcap", "TrackerEndcapHits"}, - {"gem_endcap", "GEMTrackerEndcapHits"}}; + {"trk_endcap", "TrackerEndcapHits1"}, + {"gem_endcap", "GEMTrackerEndcapHits1"}}; // append extra hit collections based on detector setup if (detector == "acadia") { - hitCollections.push_back({"vtx_endcap", "VertexEndcapHits"}); + hitCollections.push_back({"vtx_endcap", "VertexEndcapHits1"}); } else if (detector == "canyonlands" || detector == "default") { - hitCollections.push_back({"mm_barrel", "MPGDTrackerBarrelHits"}); + hitCollections.push_back({"mm_barrel", "MPGDTrackerBarrelHits1"}); } - auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") - .Define("thrownParticles", "mcparticles[isThrown]") + auto df0 = df.Define("isThrown", "MCParticles.generatorStatus == 1") + .Define("thrownParticles", "MCParticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("p_thrown", momentum, {"thrownP"}) .Define("theta_thrown", theta, {"thrownP"}) diff --git a/benchmarks/tracking_detectors/config.yml b/benchmarks/tracking_detectors/config.yml index 031cc85039579cca9b0e4e2429adaf778ffc34bd..2aebdc1b56968c3a19bc8a5646ca4293fd57b191 100644 --- a/benchmarks/tracking_detectors/config.yml +++ b/benchmarks/tracking_detectors/config.yml @@ -2,6 +2,7 @@ tracking_detectors:sim_track_hits: extends: .det_benchmark stage: simulate script: + - compile_analyses.py tracking_detectors - bash benchmarks/tracking_detectors/track_hits.sh --sim-only tracking_detectors:plot_hits: diff --git a/benchmarks/tracking_detectors/track_hits.sh b/benchmarks/tracking_detectors/track_hits.sh index a7a54e2e31333c9c6e0d868ae1de3a637ffa7f64..cc883487d315bd34db69ad5ff4e0fa5e70f21bc0 100644 --- a/benchmarks/tracking_detectors/track_hits.sh +++ b/benchmarks/tracking_detectors/track_hits.sh @@ -60,7 +60,7 @@ fi export JUGGLER_FILE_NAME_TAG="track_hits" export JUGGLER_GEN_FILE="${LOCAL_DATA_PATH}/${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="${LOCAL_DATA_PATH}/sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="${LOCAL_DATA_PATH}/sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}" @@ -78,8 +78,9 @@ if [ -z "${ANALYSIS_ONLY}" ] ; then echo "Running geant4 simulation" ## run geant4 simulations - npsim --runType batch \ + ddsim --runType batch \ --part.minimalKineticEnergy 1000*GeV \ + --filter.tracker edep0 \ -v WARNING \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ @@ -99,7 +100,7 @@ if [ -z "${SIM_ONLY}" ] ; then mkdir -p results/tracking_detectors rootls -t ${JUGGLER_SIM_FILE} - root -b -q "benchmarks/tracking_detectors/scripts/sim_track_hits.cxx(\"${JUGGLER_SIM_FILE}\")" + root -b -q "benchmarks/tracking_detectors/analysis/sim_track_hits.cxx+(\"${JUGGLER_SIM_FILE}\")" if [[ "$?" -ne "0" ]] ; then echo "ERROR running root script" exit 1 diff --git a/benchmarks/zdc/run_simulation_zdc.sh b/benchmarks/zdc/run_simulation_zdc.sh index ddacc7555d169c7d8ec69f82030cb775c66f7241..6e71f647cd03eba17ccb1d87f137e3e5d92d321a 100755 --- a/benchmarks/zdc/run_simulation_zdc.sh +++ b/benchmarks/zdc/run_simulation_zdc.sh @@ -3,4 +3,4 @@ ddsim --runType batch --numberOfEvents 10 \ --compactFile benchmarks/zdc/ZDC_example.xml \ --inputFiles ./data/zdc_photons.hepmc \ - --outputFile ./sim_output/output_zdc_photons.root + --outputFile ./sim_output/output_zdc_photons.edm4hep.root diff --git a/benchmarks/zdc/run_zdc_neutrons.sh b/benchmarks/zdc/run_zdc_neutrons.sh index 981056e86b4453f8841f8600c915913385d951ad..049c1bd8f9763e7ad8d25e0fef624e2af8dc1c54 100755 --- a/benchmarks/zdc/run_zdc_neutrons.sh +++ b/benchmarks/zdc/run_zdc_neutrons.sh @@ -20,7 +20,7 @@ fi export JUGGLER_FILE_NAME_TAG="zdc_uniform_neutrons" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" @@ -34,9 +34,10 @@ if [[ "$?" -ne "0" ]] ; then fi # Run geant4 simulations -npsim --runType batch \ +ddsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ + --filter.tracker edep0 \ --numberOfEvents ${JUGGLER_N_EVENTS} \ --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ diff --git a/benchmarks/zdc/scripts/zdc_neutrons_analysis.cxx b/benchmarks/zdc/scripts/zdc_neutrons_analysis.cxx index 3c8bcd632a7da207550597ae36b2a24f3ec69293..742a19744713872f8b4a6e183e32a6322455b1e9 100644 --- a/benchmarks/zdc/scripts/zdc_neutrons_analysis.cxx +++ b/benchmarks/zdc/scripts/zdc_neutrons_analysis.cxx @@ -6,8 +6,8 @@ #include "ROOT/RDataFrame.hxx" #include <iostream> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "TCanvas.h" #include "TStyle.h" @@ -19,7 +19,7 @@ using ROOT::RDataFrame; using namespace ROOT::VecOps; -void zdc_neutrons_analysis(const char* input_fname = "sim_output/sim_zdc_uniform_neutrons.root") +void zdc_neutrons_analysis(const char* input_fname = "sim_output/sim_zdc_uniform_neutrons.edm4hep.root") { // Setting for graphs gROOT->SetStyle("Plain"); @@ -36,20 +36,20 @@ void zdc_neutrons_analysis(const char* input_fname = "sim_output/sim_zdc_uniform ROOT::RDataFrame d0("events", input_fname); // Thrown Energy [GeV] - auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) { + auto Ethr = [](std::vector<edm4hep::MCParticleData> const& input) { auto p = input[2]; - auto energy = TMath::Sqrt(p.ps.x * p.ps.x + p.ps.y * p.ps.y + p.ps.z * p.ps.z + p.mass * p.mass); + auto energy = TMath::Sqrt(p.momentum.x * p.momentum.x + p.momentum.y * p.momentum.y + p.momentum.z * p.momentum.z + p.mass * p.mass); return energy; }; // Number of hits - auto nhits = [] (const std::vector<dd4pod::CalorimeterHitData>& evt) {return (int) evt.size(); }; + auto nhits = [] (const std::vector<edm4hep::SimCalorimeterHitData>& evt) {return (int) evt.size(); }; // Energy deposition [GeV] - auto Esim = [](const std::vector<dd4pod::CalorimeterHitData>& evt) { + auto Esim = [](const std::vector<edm4hep::SimCalorimeterHitData>& evt) { auto total_edep = 0.0; for (const auto& i: evt) - total_edep += i.energyDeposit; + total_edep += i.energy; return total_edep; }; @@ -59,7 +59,7 @@ void zdc_neutrons_analysis(const char* input_fname = "sim_output/sim_zdc_uniform }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) .Define("nhits", nhits, {"EcalBarrelHits"}) .Define("Esim", Esim, {"EcalBarrelHits"}) .Define("fsam", fsam, {"Esim", "Ethr"}); diff --git a/benchmarks/zdc/simple_checking.cxx b/benchmarks/zdc/simple_checking.cxx index 158f4f781b320fc18bf704a92b1d78fa10cecf76..25db8c114a5ce415dcc33aa7e0468d8fa02ae64b 100644 --- a/benchmarks/zdc/simple_checking.cxx +++ b/benchmarks/zdc/simple_checking.cxx @@ -29,13 +29,13 @@ R__LOAD_LIBRARY(libDDG4IO.so) //#include "lcio2/TrackerRawDataData.h" //#include "lcio2/TrackerRawData.h" -void simple_checking(const char* fname = "sim_output/output_zdc_photons.root"){ +void simple_checking(const char* fname = "sim_output/output_zdc_photons.edm4hep.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"); + TChain* t = new TChain("events"); t->Add(fname); ROOT::RDataFrame d0(*t);//, {"GEMTrackerHintits","MCParticles"}); diff --git a/benchmarks/zdc/simple_info_plot_histograms.cxx b/benchmarks/zdc/simple_info_plot_histograms.cxx index 07ec554a8566116203c9921ae4a02f371903b3ec..85960e2ea4f17dee24bc853dd75d3022a1152f0e 100644 --- a/benchmarks/zdc/simple_info_plot_histograms.cxx +++ b/benchmarks/zdc/simple_info_plot_histograms.cxx @@ -35,7 +35,7 @@ R__LOAD_LIBRARY(libDDG4IO.so) #include <iostream> #include "TStyle.h" -void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_photons.root"){ +void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_photons.edm4hep.root"){ // Setting for graphs gROOT->SetStyle("Plain"); @@ -47,7 +47,7 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot gStyle->SetPadGridY(1); gStyle->SetPadLeftMargin(0.14); - TChain* t = new TChain("EVENT"); + TChain* t = new TChain("events"); t->Add(fname); ROOT::RDataFrame d0(*t);//, {"ZDCHits","MCParticles"}); @@ -152,7 +152,7 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot auto n0 = d1.Filter([](int n){ return (n>0); },{"nhits"}).Count(); - d1.Snapshot("info_EVENT","sim_output/info_zdc_photons.root"); + d1.Snapshot("info_EVENT","sim_output/info_zdc_photons.edm4hep.root"); std::cout << *n0 << " events with nonzero hits\n"; TCanvas *c1 = new TCanvas("c1","c1",800,600);