diff --git a/benchmarks/clustering/scripts/cluster_plots.py b/benchmarks/clustering/scripts/cluster_plots.py index 567c51515e21b2b0d60c07b13f27d251aeec9af9..5210fe25cd5e2486344c011903b6710fbf4099ed 100644 --- a/benchmarks/clustering/scripts/cluster_plots.py +++ b/benchmarks/clustering/scripts/cluster_plots.py @@ -48,7 +48,7 @@ def flatten_collection(rdf, collection, cols=None): return dfp -def thrown_particles_figure(rdf, save, mcbranch="mcparticles"): +def thrown_particles_figure(rdf, save, mcbranch="MCParticles"): # define truth particle info dft = flatten_collection(rdf, mcbranch, ['genStatus', 'pdgID', 'ps.x', 'ps.y', 'ps.z', 'mass']) dft.rename(columns={c: c.replace(mcbranch + '.', '') for c in dft.columns}, inplace=True) @@ -109,7 +109,7 @@ if __name__ == '__main__': parser.add_argument('-o', dest='outdir', default='.', help='Output directory.') parser.add_argument('-m', '--macros', dest='macros', default='rootlogon.C', help='Macro files to be loaded by root, separated by \",\".') - parser.add_argument('--mc-branch', dest='mc', default='mcparticles', + parser.add_argument('--mc-branch', dest='mc', default='MCParticles', help='Branch name of MC particles truth info.') parser.add_argument('--collections', dest='coll', default='', help='Collection name of clusters to plot') diff --git a/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx b/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx index 5720c7ea3fa19f07154a41e325bd508c368e645e..efc8291491b87c0748f940de386a82815a8fceeb 100644 --- a/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx +++ b/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx @@ -1,10 +1,8 @@ #include <iostream> #include "ROOT/RDataFrame.hxx" -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" -// If root cannot find a dd4pod header make sure to add the include dir to ROOT_INCLUDE_PATH: -// export ROOT_INCLUDE_PATH=$HOME/include:$ROOT_INCLUDE_PATH using ROOT::RDataFrame; using namespace ROOT::VecOps; @@ -23,34 +21,34 @@ 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].psx, in[i].psy, in[i].psz, 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; }; -auto pt = [](std::vector<dd4pod::Geant4ParticleData> const& in) { +auto 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].psx * in[i].psx + in[i].psy * in[i].psy)); + result.push_back(std::sqrt(in[i].momentum.x * in[i].momentum.x + in[i].momentum.y * in[i].momentum.y)); } return result; }; -auto pid = [](ROOT::VecOps::RVec<dd4pod::Geant4ParticleData> const& in) { +auto pid = [](ROOT::VecOps::RVec<edm4hep::MCParticleData> const& in) { std::vector<int> result; for (size_t i = 0; i < in.size(); ++i) { - result.push_back(in[i].pdgID); + result.push_back(in[i].PDG); } return result; }; -auto eta = [](ROOT::VecOps::RVec<dd4pod::Geant4ParticleData> const& in) { +auto eta = [](ROOT::VecOps::RVec<edm4hep::MCParticleData> const& in) { std::vector<float> result; ROOT::Math::PxPyPzMVector lv; for (size_t i = 0; i < in.size(); ++i) { - lv.SetCoordinates(in[i].psx, in[i].psy, in[i].psz, in[i].mass); + lv.SetCoordinates(in[i].momentum.x, in[i].momentum.y, in[i].momentum.z, in[i].mass); result.push_back(lv.Eta()); } return result; @@ -91,8 +89,8 @@ int barrel_clusters(const char* in_fname = "topside/rec_barrel_clusters.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", in_fname); - auto d0 = df.Define("isThrown", "mcparticles.genStatus == 1") - .Define("thrownParticles", "mcparticles[isThrown]") + auto d0 = df.Define("isThrown", "MCParticles.generatorStatus == 1") + .Define("thrownParticles", "MCParticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("thrownEta", eta, {"thrownParticles"}) .Define("thrownTheta", theta, {"thrownP"}) @@ -159,6 +157,6 @@ int barrel_clusters(const char* in_fname = "topside/rec_barrel_clusters.root") //c->SaveAs("results/crystal_cal_electrons_Ecluster.png"); //std::string outfilename = "rdf_test.root"; - //df2.Snapshot("events", outfilename, {"MCParticles_pt", "mcparticles"}); + //df2.Snapshot("events", outfilename, {"MCParticles_pt", "MCParticles"}); return 0; } diff --git a/benchmarks/far_forward/analysis/analysis_zdc_neutrons.cxx b/benchmarks/far_forward/analysis/analysis_zdc_neutrons.cxx index 07ec683b655d27968fcc2425336eb5f4fe3c346e..5ac4ecaae55679140d568447c9151990df001725 100644 --- a/benchmarks/far_forward/analysis/analysis_zdc_neutrons.cxx +++ b/benchmarks/far_forward/analysis/analysis_zdc_neutrons.cxx @@ -8,8 +8,8 @@ #include <iostream> #include <vector> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" #include "TCanvas.h" #include "TStyle.h" @@ -67,38 +67,39 @@ void analysis_zdc_neutrons(const char* input_fname = "sim_zdc_uniform_neutron.ed ROOT::RDataFrame d0("events", input_fname); // Thrown Energy [GeV] - auto Ethr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Ethr = [](const std::vector<edm4hep::MCParticleData> & 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; }; // Theta [mrad] - auto Thetathr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Thetathr = [](const std::vector<edm4hep::MCParticleData> & input) { auto p = input[2]; - auto theta = p.ps.theta(); + auto theta = std::atan2(std::hypot(p.momentum.x, p.momentum.y), p.momentum.z); return theta*1000.0; }; // Phi [rad] - auto Phithr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Phithr = [](const std::vector<edm4hep::MCParticleData> & input) { auto p = input[2]; - auto phi = p.ps.phi(); + auto phi = std::atan2(p.momentum.y, p.momentum.x); return phi; }; // Eta - auto Etathr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Etathr = [](const std::vector<edm4hep::MCParticleData> & input) { auto p = input[2]; - auto eta = p.ps.eta(); + auto theta = std::atan2(std::hypot(p.momentum.x, p.momentum.y), p.momentum.z); + auto eta = -std::log(std::tan(theta/2)); return eta; }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) - .Define("Thetathr", Thetathr, {"mcparticles"}) - .Define("Phithr", Phithr, {"mcparticles"}) - .Define("Etathr", Etathr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) + .Define("Thetathr", Thetathr, {"MCParticles"}) + .Define("Phithr", Phithr, {"MCParticles"}) + .Define("Etathr", Etathr, {"MCParticles"}) ; // Define Histograms diff --git a/benchmarks/far_forward/analysis/analysis_zdc_photons.cxx b/benchmarks/far_forward/analysis/analysis_zdc_photons.cxx index 3c88182bfdc71ce09ab189feda9e512bb8cb7d86..4f2ae18e765c98ceec0b34ff2732c9ef43c3bfe1 100644 --- a/benchmarks/far_forward/analysis/analysis_zdc_photons.cxx +++ b/benchmarks/far_forward/analysis/analysis_zdc_photons.cxx @@ -8,8 +8,8 @@ #include <iostream> #include <vector> -#include "dd4pod/Geant4ParticleCollection.h" -#include "dd4pod/CalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/CalorimeterHitCollection.h" #include "TCanvas.h" #include "TStyle.h" @@ -67,38 +67,39 @@ void analysis_zdc_photons(const char* input_fname = "sim_zdc_uniform_photon.edm4 ROOT::RDataFrame d0("events", input_fname); // Thrown Energy [GeV] - auto Ethr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Ethr = [](const std::vector<edm4hep::MCParticleData> & 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; }; // Theta [mrad] - auto Thetathr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Thetathr = [](const std::vector<edm4hep::MCParticleData> & input) { auto p = input[2]; - auto theta = p.ps.theta(); + auto theta = std::atan2(std::hypot(p.momentum.x, p.momentum.y), p.momentum.z); return theta*1000.0; }; // Phi [rad] - auto Phithr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Phithr = [](const std::vector<edm4hep::MCParticleData> & input) { auto p = input[2]; - auto phi = p.ps.phi(); + auto phi = std::atan2(p.momentum.y, p.momentum.x); return phi; }; // Eta - auto Etathr = [](const std::vector<dd4pod::Geant4ParticleData> & input) { + auto Etathr = [](const std::vector<edm4hep::MCParticleData> & input) { auto p = input[2]; - auto eta = p.ps.eta(); + auto theta = std::atan2(std::hypot(p.momentum.x, p.momentum.y), p.momentum.z); + auto eta = -std::log(std::tan(theta/2)); return eta; }; // Define variables - auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) - .Define("Thetathr", Thetathr, {"mcparticles"}) - .Define("Phithr", Phithr, {"mcparticles"}) - .Define("Etathr", Etathr, {"mcparticles"}) + auto d1 = d0.Define("Ethr", Ethr, {"MCParticles"}) + .Define("Thetathr", Thetathr, {"MCParticles"}) + .Define("Phithr", Phithr, {"MCParticles"}) + .Define("Etathr", Etathr, {"MCParticles"}) ; // Define Histograms diff --git a/benchmarks/far_forward/analysis/hits_far_forward_protons.cxx b/benchmarks/far_forward/analysis/hits_far_forward_protons.cxx index 986bf36e359a7cc3c0098b3855238d4cf4d37b01..374f5861f4001e3fb8959a0cfb6f421702327333 100644 --- a/benchmarks/far_forward/analysis/hits_far_forward_protons.cxx +++ b/benchmarks/far_forward/analysis/hits_far_forward_protons.cxx @@ -10,9 +10,9 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/TrackerHitCollection.h" -#include "dd4pod/TrackerHitData.h" -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/SimTrackerHitData.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -30,10 +30,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -52,11 +52,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; @@ -88,8 +88,8 @@ int hits_far_forward_protons(const char* fname = "sim_far_forward_protons.edm4he ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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"}) @@ -105,8 +105,8 @@ int hits_far_forward_protons(const char* fname = "sim_far_forward_protons.edm4he //.Define("delta_p_over_p1",delta_p_over_p, {"p_track1", "p_thrown"}) //.Define("delta_p_over_p2",delta_p_over_p, {"p_track2", "p_thrown"}) //.Define("N_VtxBarrelHits",[](std::vector<eic::TrackerHitData> hits) { return hits.size();},{"VertexBarrelRecHits"}) - .Define("N_BarrelHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"}) - .Define("N_EndcapHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"}) + .Define("N_BarrelHits", [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"}) + .Define("N_EndcapHits", [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"}) ; auto hBarrel_x_vs_y = df0.Histo2D({"hBarrel_x_vs_y", "; x ; y ", 100, -900, 900,100, -900, 900 }, "TrackerBarrelHits.position.x", "TrackerBarrelHits.position.y"); diff --git a/benchmarks/far_forward/analysis/print_far_forward_protons.cxx b/benchmarks/far_forward/analysis/print_far_forward_protons.cxx index 0fbbf60f500cc2cbdd1bb35e45ff4b0297ea9dc0..841c0bf89b3659d50d5341e8cf1c6f3e86ee05a8 100644 --- a/benchmarks/far_forward/analysis/print_far_forward_protons.cxx +++ b/benchmarks/far_forward/analysis/print_far_forward_protons.cxx @@ -8,7 +8,7 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" diff --git a/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx b/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx index 9e0ae6b8c8dfdcd7e4cfde904fd5ea21c9219fd6..8a84c11cb1f6be7c0f97484c2d8add61652cca91 100644 --- a/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx +++ b/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx @@ -10,7 +10,7 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -28,10 +28,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -50,11 +50,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; @@ -86,8 +86,8 @@ int rec_far_forward_protons(const char* fname = "topside/rec_far_forward_protons ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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/imaging_ecal/analysis/emcal_barrel_pion_rejection_analysis.cxx b/benchmarks/imaging_ecal/analysis/emcal_barrel_pion_rejection_analysis.cxx index b07f5728b38685f19831b33fde5c01f905d3e2f1..288c59c5cacfbe5fdbf2f18a8cdb98a3e2b0f603 100644 --- a/benchmarks/imaging_ecal/analysis/emcal_barrel_pion_rejection_analysis.cxx +++ b/benchmarks/imaging_ecal/analysis/emcal_barrel_pion_rejection_analysis.cxx @@ -8,8 +8,8 @@ #include <algorithm> #include <string> -#include "dd4pod/CalorimeterHitCollection.h" -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/CalorimeterHitCollection.h" #include "eicd/CalorimeterHitData.h" @@ -104,34 +104,34 @@ void emcal_barrel_pion_rejection_analysis( // MCParticles Functions///////////////////////////////////////////////////////////////////////////////////// // 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); }; // 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); }; // RecoEcalBarrelImagingHits Functions///////////////////////////////////////////////////////////////////////////////////// @@ -475,10 +475,10 @@ void emcal_barrel_pion_rejection_analysis( // Define variables auto d1 = d0 - .Define("Ethr", Ethr, {"mcparticles"}) - .Define("Pthr", Pthr, {"mcparticles"}) - .Define("Eta", Eta, {"mcparticles"}) - .Define("pT", pT, {"mcparticles"}) + .Define("Ethr", Ethr, {"MCParticles"}) + .Define("Pthr", Pthr, {"MCParticles"}) + .Define("Eta", Eta, {"MCParticles"}) + .Define("pT", pT, {"MCParticles"}) .Define("ERecoImg", ERecoImg, {"RecoEcalBarrelImagingHits"}) .Define("nhitsImgLayer", nhitsImgLayer, {"RecoEcalBarrelImagingHits"}) @@ -552,8 +552,8 @@ void emcal_barrel_pion_rejection_analysis( "ERecoScFiLayer3OverP", "ERecoScFiLayer4OverP", "ERecoScFiLayer5OverP","ERecoScFiLayer6OverP"}; std::vector<std::vector<double>> colRange = {{0,23},{0,19},{0,570},{-300,300},{0,280},{0.065,0.45},{-0.5,1},{0,1.5},{0,1.5},{0,2.5e-2},{0,2.5e-2},{0,2.5e-2},{0,2.5e-2},}; - auto d_temp_ele = d1.Filter(is_electron, {"mcparticles"}); - auto d_temp_pim = d1.Filter(is_piMinus, {"mcparticles"}); + auto d_temp_ele = d1.Filter(is_electron, {"MCParticles"}); + auto d_temp_pim = d1.Filter(is_piMinus, {"MCParticles"}); int rangeCount = 0; for (auto && name : colList){ @@ -792,12 +792,12 @@ void emcal_barrel_pion_rejection_analysis( double effPim[7]; double rejRatios[7]; - auto he_uncut = d1.Filter(is_electron, {"mcparticles"}).Histo1D({"he_uncut", "P", 7, &binEdges[0]}, "Pthr"); + auto he_uncut = d1.Filter(is_electron, {"MCParticles"}).Histo1D({"he_uncut", "P", 7, &binEdges[0]}, "Pthr"); auto he_cut = d_ele.Histo1D({"he_cut", "P", 7, &binEdges[0]}, "Pthr"); - auto hp_uncut = d1.Filter(is_piMinus, {"mcparticles"}).Histo1D({"hp_uncut", "P", 7, &binEdges[0]}, "Pthr"); + auto hp_uncut = d1.Filter(is_piMinus, {"MCParticles"}).Histo1D({"hp_uncut", "P", 7, &binEdges[0]}, "Pthr"); auto hp_cut = d_pim.Histo1D({"hp_cut", "P", 7, &binEdges[0]}, "Pthr"); - double ele_eff_total = (double)*d_ele.Count() / (double)*d1.Filter(is_electron, {"mcparticles"}).Count(); + double ele_eff_total = (double)*d_ele.Count() / (double)*d1.Filter(is_electron, {"MCParticles"}).Count(); he_cut->Divide(he_uncut.GetPtr());//Effienciency hp_uncut->Divide(hp_cut.GetPtr());//Rejection power diff --git a/benchmarks/imaging_ecal/scripts/draw_cluster.py b/benchmarks/imaging_ecal/scripts/draw_cluster.py index 02cc76832e35ee34230edb253f2720a4571ef311..faeac4becb72b6f36185a3253abea9ed3d8c1e58 100755 --- a/benchmarks/imaging_ecal/scripts/draw_cluster.py +++ b/benchmarks/imaging_ecal/scripts/draw_cluster.py @@ -148,7 +148,7 @@ if __name__ == '__main__': df['eta'] = -np.log(np.tan(df['theta'].values/1000./2.)) # Read all mc particles - dfallmcp = get_all_mcp(args.file, args.iev, 'mcparticles') + dfallmcp = get_all_mcp(args.file, args.iev, 'MCParticles') pdgbase = ROOT.TDatabasePDG() # Select decaying particles dftemp = dfallmcp[dfallmcp['g4Parent'] == 1.0] @@ -169,7 +169,7 @@ if __name__ == '__main__': dfdecaymcp['eta'] = -np.log(np.tan(dfdecaymcp['theta'].values/1000./2.)) # truth - dfmcp = get_mcp_simple(args.file, args.iev, 'mcparticles').iloc[0] + dfmcp = get_mcp_simple(args.file, args.iev, 'MCParticles').iloc[0] #pdgbase = ROOT.TDatabasePDG() inpart = pdgbase.GetParticle(int(dfmcp['pid'])) if inpart: diff --git a/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py b/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py index 42b80d4305f3bdc8927346196274dc3c4b2dc985..0a37a5222b2332112bd356f16afb814e03598fe6 100644 --- a/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py +++ b/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py @@ -98,7 +98,7 @@ if __name__ == '__main__': df['eta'] = -np.log(np.tan(df['theta'].values/1000./2.)) # truth - dfmcp = get_mcp_simple(args.file, args.iev, 'mcparticles').iloc[0] + dfmcp = get_mcp_simple(args.file, args.iev, 'MCParticles').iloc[0] pdgbase = ROOT.TDatabasePDG() inpart = pdgbase.GetParticle(int(dfmcp['pid'])) print("Incoming particle = {}, pdgcode = {}, charge = {}, mass = {}"\ diff --git a/benchmarks/imaging_ecal/scripts/utils.py b/benchmarks/imaging_ecal/scripts/utils.py index 0f4e40a239a6aced7430162e11f932a8bffab05a..452a9334ac68ac866b05df73d4f0c10d647ccfda 100644 --- a/benchmarks/imaging_ecal/scripts/utils.py +++ b/benchmarks/imaging_ecal/scripts/utils.py @@ -37,7 +37,7 @@ def load_root_macros(arg_macros): # read mc particles from root file -def get_mcp_data(path, evnums=None, branch='mcparticles'): +def get_mcp_data(path, evnums=None, branch='MCParticles'): f = ROOT.TFile(path) events = f.events if evnums is None: @@ -61,7 +61,7 @@ def get_mcp_data(path, evnums=None, branch='mcparticles'): # read mc particles from root file -def get_mcp_simple(path, evnums=None, branch='mcparticles'): +def get_mcp_simple(path, evnums=None, branch='MCParticles'): f = ROOT.TFile(path) events = f.events if evnums is None: @@ -86,7 +86,7 @@ def get_mcp_simple(path, evnums=None, branch='mcparticles'): ####################################### # read all mc particles from root file ####################################### -def get_all_mcp(path, evnums=None, branch='mcparticles'): +def get_all_mcp(path, evnums=None, branch='MCParticles'): f = ROOT.TFile(path) events = f.events if evnums is None: diff --git a/benchmarks/imaging_shower_ML/scripts/check_edep_dists.py b/benchmarks/imaging_shower_ML/scripts/check_edep_dists.py index 404855b1c6fac23883ad7b3537d67b4013edc123..c865af89310b70343a7ff5c6344d88a1d94f9fdb 100644 --- a/benchmarks/imaging_shower_ML/scripts/check_edep_dists.py +++ b/benchmarks/imaging_shower_ML/scripts/check_edep_dists.py @@ -63,7 +63,7 @@ if __name__ == '__main__': parser.add_argument('-m', '--macros', type=str, default='rootlogon.C', dest='macros', help='root macros to load (accept multiple paths separated by \",\")') parser.add_argument('--branch', type=str, default='EcalBarrelImagingHitsReco', help='name of data branch (eic::CalorimeterHitCollection)') - parser.add_argument('--truth-branch', type=str, default='mcparticles', help='name of truth mc branch') + parser.add_argument('--truth-branch', type=str, default='MCParticles', help='name of truth mc branch') parser.add_argument('--edep-max', type=float, default=0., help='maximum edep (GeV) to plot') parser.add_argument('--edep-nbins', type=int, default=200, help='number of bins') parser.add_argument('--name-tag', type=str, default='test', help='name tag to save the file') @@ -73,7 +73,7 @@ if __name__ == '__main__': os.makedirs(args.outdir, exist_ok=True) load_root_macros(args.macros) - # read data and mcparticles + # read data and MCParticles rdf = ROOT.RDataFrame("events", args.file) mc_branch = args.truth_branch diff --git a/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py b/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py index d94d1cb6ad9f177625367a8aa134e8da5d917018..88477d568a08d2491fcacfe3eb987abe845f5e58 100644 --- a/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py +++ b/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py @@ -73,7 +73,7 @@ if __name__ == '__main__': os.makedirs(args.outdir, exist_ok=True) load_root_macros(args.macros) - # read data and mcparticles + # read data and MCParticles rdf = ROOT.RDataFrame("events", args.file) df = flatten_collection(rdf, args.branch, ['layer', 'energy', 'position.x', 'position.y', 'position.z']) df.rename(columns={c: c.replace(args.branch + '.', '') for c in df.columns}, inplace=True) @@ -85,8 +85,8 @@ if __name__ == '__main__': df.loc[:, 'rc'] = rc df.loc[:, 'eta'] = eta - dfm = flatten_collection(rdf, 'mcparticles', ['genStatus', 'pdgID', 'ps.x', 'ps.y', 'ps.z', 'mass']) - dfm.rename(columns={c: c.replace('mcparticles.', '') for c in dfm.columns}, inplace=True) + dfm = flatten_collection(rdf, 'MCParticles', ['generatorStatus', 'PDG', 'momentum.x', 'momentum.y', 'momentum.z', 'mass']) + dfm.rename(columns={c: c.replace('MCParticles.', '') for c in dfm.columns}, inplace=True) # selete incident particles dfm = dfm[dfm['genStatus'].isin([0, 1])] # NOTE: assumed single particles diff --git a/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx b/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx index 9b3e551205fed66a47e04e54e3ac2193202d8659..8026faeef6624f9f29ca6c317c044bac2062df36 100644 --- a/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx +++ b/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx @@ -8,7 +8,7 @@ R__LOAD_LIBRARY(libJugBase.so) R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -26,10 +26,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -48,11 +48,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; @@ -87,8 +87,8 @@ int rec_multiple_tracks(const char* fname = "topside/rec_multiple_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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("nThrown", "thrownParticles.size()") .Define("nProto", "outputProtoTracks.size()") diff --git a/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx b/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx index ada976a32d3f7af3c1f8762cb14bd729d8424c3e..819047625ea27c0e21d1afc6b8ab0bc8baa643d6 100644 --- a/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx +++ b/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx @@ -8,7 +8,7 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -26,10 +26,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -48,11 +48,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; @@ -84,8 +84,8 @@ int rec_multiple_tracks(const char* fname = "topside/rec_multiple_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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/track_fitting/scripts/rec_single_tracks.cxx b/benchmarks/track_fitting/scripts/rec_single_tracks.cxx index 9aad6734df65ecd7fc0dec19ab4484addfefe63a..f649268505ef076214c0d77fde488d4ca76f07bf 100644 --- a/benchmarks/track_fitting/scripts/rec_single_tracks.cxx +++ b/benchmarks/track_fitting/scripts/rec_single_tracks.cxx @@ -8,7 +8,7 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -29,10 +29,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -51,11 +51,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; @@ -87,8 +87,8 @@ int rec_single_tracks(const char* fname = "topside/rec_single_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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/run_tracking_benchmarks.py b/benchmarks/tracking/run_tracking_benchmarks.py index b6da02f9b554ce1b41074ce4e227b96636da7904..93c005771198c69e2f80c355dc1e2f1f37c6fd36 100755 --- a/benchmarks/tracking/run_tracking_benchmarks.py +++ b/benchmarks/tracking/run_tracking_benchmarks.py @@ -91,7 +91,7 @@ if 'rec' in procs: if 'ana' in procs: os.makedirs('results', exist_ok=True) ana_cmd = ['python', analysis_script, rec_file, - '--mc-collection', 'mcparticles', + '--mc-collection', 'MCParticles', '--tracking-collection', 'outputTrackParameters', '-o', 'results', '-t', args.nametag] return_code = subprocess.run(ana_cmd).returncode diff --git a/benchmarks/tracking/scripts/hits_central_electrons.cxx b/benchmarks/tracking/scripts/hits_central_electrons.cxx index d76cacdf78fcd33f407f304bc55965eda1a15d93..493a35a4c4d3d5cd7f5a151c80352f404b7a6c4b 100644 --- a/benchmarks/tracking/scripts/hits_central_electrons.cxx +++ b/benchmarks/tracking/scripts/hits_central_electrons.cxx @@ -8,9 +8,9 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/TrackerHitCollection.h" -#include "dd4pod/TrackerHitData.h" -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/SimTrackerHitData.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -28,10 +28,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -50,11 +50,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; @@ -86,8 +86,8 @@ int hits_central_electrons(const char* fname = "sim_central_electrons.edm4hep.ro ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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"}) @@ -103,9 +103,9 @@ int hits_central_electrons(const char* fname = "sim_central_electrons.edm4hep.ro //.Define("delta_p_over_p1",delta_p_over_p, {"p_track1", "p_thrown"}) //.Define("delta_p_over_p2",delta_p_over_p, {"p_track2", "p_thrown"}) //.Define("N_VtxBarrelHits",[](std::vector<eic::TrackerHitData> hits) { return hits.size();},{"VertexBarrelRecHits"}) - //.Define("N_Hits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"trackingHits"}) - .Define("N_BarrelHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"}) - .Define("N_EndcapHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"}) + //.Define("N_Hits", [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size();}, {"trackingHits"}) + .Define("N_BarrelHits", [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"}) + .Define("N_EndcapHits", [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"}) ; auto hBarrel_x_vs_y = df0.Histo2D({"hBarrel_x_vs_y", "; x ; y ", 100, -900, 900,100, -900, 900 }, "TrackerBarrelHits.position.x", "TrackerBarrelHits.position.y"); diff --git a/benchmarks/tracking/scripts/hits_central_pions.cxx b/benchmarks/tracking/scripts/hits_central_pions.cxx index 74a2091591d50c84fe2e126216aaf34796decb6e..ef7d3fefe38ee05a8e335c7b324f5112580a8ccd 100644 --- a/benchmarks/tracking/scripts/hits_central_pions.cxx +++ b/benchmarks/tracking/scripts/hits_central_pions.cxx @@ -8,9 +8,9 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/TrackerHitCollection.h" -#include "dd4pod/TrackerHitData.h" -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/SimTrackerHitData.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -28,10 +28,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -50,11 +50,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; @@ -86,8 +86,8 @@ int hits_central_pions(const char* fname = "sim_central_pions.edm4hep.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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"}) @@ -103,8 +103,8 @@ int hits_central_pions(const char* fname = "sim_central_pions.edm4hep.root") //.Define("delta_p_over_p1",delta_p_over_p, {"p_track1", "p_thrown"}) //.Define("delta_p_over_p2",delta_p_over_p, {"p_track2", "p_thrown"}) //.Define("N_VtxBarrelHits",[](std::vector<eic::TrackerHitData> hits) { return hits.size();},{"VertexBarrelRecHits"}) - .Define("N_BarrelHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"}) - .Define("N_EndcapHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"}) + .Define("N_BarrelHits", [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"}) + .Define("N_EndcapHits", [](std::vector<edm4hep::SimTrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"}) ; auto hBarrel_x_vs_y = df0.Histo2D({"hBarrel_x_vs_y", "; x ; y ", 100, -900, 900,100, -900, 900 }, "TrackerBarrelHits.position.x", "TrackerBarrelHits.position.y"); diff --git a/benchmarks/tracking/scripts/rec_central_electrons.cxx b/benchmarks/tracking/scripts/rec_central_electrons.cxx index 8c3708f1c52d9d08b65dd53e52188176f94512a1..4c7a76b64e38355c8468ef1be87c516db15bb8ef 100644 --- a/benchmarks/tracking/scripts/rec_central_electrons.cxx +++ b/benchmarks/tracking/scripts/rec_central_electrons.cxx @@ -8,7 +8,7 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -26,10 +26,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -48,11 +48,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; @@ -84,8 +84,8 @@ int rec_central_electrons(const char* fname = "topside/rec_central_electrons.roo ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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/scripts/rec_central_pions.cxx b/benchmarks/tracking/scripts/rec_central_pions.cxx index 516ecb2b315252dd495878472f0d8b58f9fab00a..102c79003996e852516eb5d5e111b38ea4b97e4b 100644 --- a/benchmarks/tracking/scripts/rec_central_pions.cxx +++ b/benchmarks/tracking/scripts/rec_central_pions.cxx @@ -8,7 +8,7 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -26,10 +26,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -48,11 +48,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; @@ -84,8 +84,8 @@ int rec_central_pions(const char* fname = "topside/rec_central_pions.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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/scripts/rec_multiple_tracks.cxx b/benchmarks/tracking/scripts/rec_multiple_tracks.cxx index ada976a32d3f7af3c1f8762cb14bd729d8424c3e..819047625ea27c0e21d1afc6b8ab0bc8baa643d6 100644 --- a/benchmarks/tracking/scripts/rec_multiple_tracks.cxx +++ b/benchmarks/tracking/scripts/rec_multiple_tracks.cxx @@ -8,7 +8,7 @@ R__LOAD_LIBRARY(libeicd.so) R__LOAD_LIBRARY(libDD4pod.so) -#include "dd4pod/Geant4ParticleCollection.h" +#include "edm4hep/MCParticleCollection.h" #include "eicd/TrackParametersCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ClusterData.h" @@ -26,10 +26,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) { }; -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; } @@ -48,11 +48,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; @@ -84,8 +84,8 @@ int rec_multiple_tracks(const char* fname = "topside/rec_multiple_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - 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/scripts/tracking_performance.py b/benchmarks/tracking/scripts/tracking_performance.py index 813f4d93b17909ca0c66925565a9c0e567f4c029..d5e29954aa2e34858bae3de1ec609b78631e5c59 100644 --- a/benchmarks/tracking/scripts/tracking_performance.py +++ b/benchmarks/tracking/scripts/tracking_performance.py @@ -47,7 +47,7 @@ def flatten_collection(rdf, collection, cols=None): dfp.loc[:, 'event'] = evns return dfp -def thrown_particles_figure(rdf, save, mcbranch="mcparticles"): +def thrown_particles_figure(rdf, save, mcbranch="MCParticles"): # define truth particle info dft = flatten_collection(rdf, mcbranch, ['genStatus', 'pdgID', 'ps.x', 'ps.y', 'ps.z', 'mass']) dft.rename(columns={c: c.replace(mcbranch + '.', '') for c in dft.columns}, inplace=True) @@ -112,7 +112,7 @@ if __name__ == '__main__': parser.add_argument('-t', '--nametag', type=str, default='tracking', help='Name tag for output files.') parser.add_argument('-m', '--macros', dest='macros', default='rootlogon.C', help='Macro files to be loaded by root, separated by \",\".') - parser.add_argument('--mc-collection', dest='mc', default='mcparticles', + parser.add_argument('--mc-collection', dest='mc', default='MCParticles', help='Collection name of MC particles truth info.') parser.add_argument('--tracking-collection', dest='coll', default='outputTrackParameters', help='Collection name of clusters to plot')