From 2db8d2fd8f45aedfacc45019f86fe85cf3898889 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Sat, 4 Jun 2022 05:04:05 +0000 Subject: [PATCH] Improved handling of sciglass ecal --- .../scripts/emcal_barrel_pi0_analysis.cxx | 41 ++++++++++++------- .../scripts/emcal_barrel_pions_analysis.cxx | 38 +++++++++++------ .../hcal_barrel_energy_scan_analysis.cxx | 15 +++++-- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx index c0ed9ae3..ba5b7c6e 100644 --- a/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx +++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_pi0_analysis.cxx @@ -98,17 +98,30 @@ void emcal_barrel_pi0_analysis( }; // Define variables - 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("dE", eResol, {"Esim","Ethr"}) - .Define("dE_rel", eResol_rel, {"Esim","Ethr"}) - ; + auto d1 = ROOT::RDF::RNode( + d0.Define("Ethr", Ethr, {"MCParticles"}) + .Define("pid", getpid, {"MCParticles"}) + .Define("dau", getdau, {"MCParticles"}) + .Define("nhits", nhits, {"EcalBarrelHits"}) + ); + + auto Ethr_max = 7.5; + auto fsam_est = 1.0; + if (d1.HasColumn("EcalBarrelScFiHits")) { + d1 = d1.Define("EsimImg", Esim, {"EcalBarrelHits"}) + .Define("EsimScFi", Esim, {"EcalBarrelScFiHits"}) + .Define("Esim", "EsimImg+EsimScFi") + .Define("fsamImg", fsam, {"EsimImg", "Ethr"}) + .Define("fsamScFi", fsam, {"EsimScFi", "Ethr"}) + .Define("fsam", fsam, {"Esim", "Ethr"}); + fsam_est = 0.1; + } else { + d1 = d1.Define("Esim", Esim, {"EcalBarrelHits"}) + .Define("fsam", fsam, {"Esim", "Ethr"}); + fsam_est = 1.0; + } + d1 = d1.Define("dE", eResol, {"Esim","Ethr"}) + .Define("dE_rel", eResol_rel, {"Esim","Ethr"}); // Define Histograms std::vector <std::string> titleStr = { @@ -118,7 +131,7 @@ void emcal_barrel_pi0_analysis( "dE Relative; dE Relative; Events" }; - std::vector<std::vector<double>> range = {{0, 7.5}, {0, 2000}, {0, 2}, {-3, 3}}; + std::vector<std::vector<double>> range = {{0, Ethr_max}, {0, 2000}, {0, fsam_est * Ethr_max}, {-3, 3}}; std::vector<std::string> col = {"Ethr", "nhits", "Esim", "dE_rel"}; double meanE = 5; @@ -145,11 +158,11 @@ void emcal_barrel_pi0_analysis( "Sampling Fraction; Sampling Fraction; Events", "dE; dE[GeV]; Events" }; - range = {{0,0.15}, {-3, 3}}; + range = {{0,fsam_est}, {-3, 3}}; col = {"fsam", "dE"}; nCol = range.size(); std::printf("Here %d\n", 10); - std::vector<std::vector<double>> fitRange = {{0.005, 0.1}, {-3, 3}}; + std::vector<std::vector<double>> fitRange = {{0.005, fsam_est}, {-3, 3}}; double sigmaOverE = 0; auto hr = d1.Histo1D({"histr", titleStr[0].c_str(), 150, range[0][0], range[0][1]}, col[0].c_str()); diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx index 3e61c8e1..1fff8811 100644 --- a/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx +++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx @@ -87,20 +87,34 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal }; // Define variables - 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"}); + auto d1 = ROOT::RDF::RNode( + d0.Define("Ethr", Ethr, {"MCParticles"}) + .Define("nhits", nhits, {"EcalBarrelHits"}) + .Define("pid", getpid, {"MCParticles"}) + ); + + auto Ethr_max = 7.5; + auto fsam_est = 1.0; + if (d1.HasColumn("EcalBarrelScFiHits")) { + d1 = d1.Define("EsimImg", Esim, {"EcalBarrelHits"}) + .Define("EsimScFi", Esim, {"EcalBarrelScFiHits"}) + .Define("Esim", "EsimImg+EsimScFi") + .Define("fsamImg", fsam, {"EsimImg", "Ethr"}) + .Define("fsamScFi", fsam, {"EsimScFi", "Ethr"}) + .Define("fsam", fsam, {"Esim", "Ethr"}); + fsam_est = 0.1; + } else { + d1 = d1.Define("Esim", Esim, {"EcalBarrelHits"}) + .Define("fsam", fsam, {"Esim", "Ethr"}); + fsam_est = 1.0; + } // Define Histograms - auto hEthr = d1.Histo1D({"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, 7.5}, "Ethr"); - auto hNhits = d1.Histo1D({"hNhits", "Number of hits per events; Number of hits; Events", 100, 0.0, 2000.0}, "nhits"); - auto hEsim = d1.Histo1D({"hEsim", "Energy Deposit; Energy Deposit [GeV]; Events", 100, 0.0, 1.0}, "Esim"); - auto hfsam = d1.Histo1D({"hfsam", "Sampling Fraction; Sampling Fraction; Events", 100, 0.0, 0.1}, "fsam"); - auto hpid = d1.Histo1D({"hpid", "PID; PID; Count", 100, -220, 220}, "pid"); + auto hEthr = d1.Histo1D({"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, Ethr_max}, "Ethr"); + auto hNhits = d1.Histo1D({"hNhits", "Number of hits per events; Number of hits; Events", 100, 0.0, 2000.0}, "nhits"); + auto hEsim = d1.Histo1D({"hEsim", "Energy Deposit; Energy Deposit [GeV]; Events", 100, 0.0, 1.0}, "Esim"); + auto hfsam = d1.Histo1D({"hfsam", "Sampling Fraction; Sampling Fraction; Events", 100, 0.0, fsam_est}, "fsam"); + auto hpid = d1.Histo1D({"hpid", "PID; PID; Count", 100, -220, 220}, "pid"); // Event Counts auto nevents_thrown = d1.Count(); 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 8446d0c1..7226b7fd 100644 --- a/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx +++ b/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx @@ -80,19 +80,28 @@ std::tuple <double, double, double, double> extract_sampling_fraction_parameters .Define("Esim", Esim, {"EcalBarrelHits"}) .Define("fsam", fsam, {"Esim", "Ethr"}); + // Define assumptions + auto Ethr_max = 25.0; + auto fsam_estimate = 1.0; + if (d1.HasColumn("EcalBarrelScFiHits")) { + fsam_estimate = 0.1; + } else { + fsam_estimate = 1.0; + } + // Define Histograms auto hEthr = d1.Histo1D( - {"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, 25.0}, + {"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, Ethr_max}, "Ethr"); auto hNhits = d1.Histo1D({"hNhits", "Number of hits per events; Number of hits; Events", 100, 0.0, 2000.0}, "nhits"); auto hEsim = d1.Histo1D( - {"hEsim", "Energy Deposit; Energy Deposit [GeV]; Events", 500, 0.0, 0.5}, + {"hEsim", "Energy Deposit; Energy Deposit [GeV]; Events", 500, 0.0, fsam_estimate * Ethr_max}, "Esim"); auto hfsam = d1.Histo1D( - {"hfsam", "Sampling Fraction; Sampling Fraction; Events", 200, 0.0, 0.05}, + {"hfsam", "Sampling Fraction; Sampling Fraction; Events", 200, 0.0, 2.0 * fsam_estimate}, "fsam"); // Event Counts -- GitLab