diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx
index 61edb15d1dc4f33ac82e3e4158f918f0fa3bee79..a9613072ceba195c7c0604d49ffce88a87f0588e 100644
--- a/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx
+++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_particles_analysis.cxx
@@ -5,6 +5,7 @@
 
 #include "ROOT/RDataFrame.hxx"
 #include <iostream>
+#include <fstream>
 #include <fmt/core.h>
 
 #include "dd4pod/Geant4ParticleCollection.h"
@@ -55,6 +56,9 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo
   double fSam_mean;
   double fSam_img_mean;
   double fSam_scfi_mean;
+  double fSam_mean_err;
+  double fSam_img_mean_err;
+  double fSam_scfi_mean_err;
 
   ROOT::EnableImplicitMT();
   std::string input_fname = fmt::format("sim_output/sim_emcal_barrel_{}.root", particle_name);
@@ -181,6 +185,7 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo
     h->GetXaxis()->SetRangeUser(down_fit,up_fit);
     TF1 *gaus = h->GetFunction("gaus");
     fSam_mean = gaus->GetParameter(1);
+    fSam_mean_err = gaus->GetParError(1);
     gaus->SetLineWidth(2);
     gaus->SetLineColor(kRed); 
     save_canvas(c4,"fsam",particle_name);
@@ -197,6 +202,7 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo
     h->GetXaxis()->SetRangeUser(down_fit,up_fit);
     TF1 *gaus = h->GetFunction("gaus");
     fSam_img_mean = gaus->GetParameter(1);
+    fSam_img_mean_err = gaus->GetParError(1);
     gaus->SetLineWidth(2);
     gaus->SetLineColor(kRed); 
     save_canvas(c5,"fsamImg",particle_name);
@@ -213,6 +219,7 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo
     h->GetXaxis()->SetRangeUser(down_fit,up_fit);
     TF1 *gaus = h->GetFunction("gaus");
     fSam_scfi_mean = gaus->GetParameter(1);
+    fSam_scfi_mean_err = gaus->GetParError(1);
     gaus->SetLineWidth(2);
     gaus->SetLineColor(kRed); 
     save_canvas(c6,"fsamScFi",particle_name);
@@ -222,8 +229,11 @@ void emcal_barrel_particles_analysis(std::string particle_name = "electron", boo
     {"particle_name", particle_name},
     {"thrown_energy", Ethr_mean},
     {"sampling_fraction", fSam_mean},
+    {"sampling_fraction_error", fSam_mean_err},
     {"sampling_fraction_img", fSam_img_mean},
-    {"sampling_fraction_scfi", fSam_scfi_mean}      
+    {"sampling_fraction_error_img", fSam_img_mean_err},
+    {"sampling_fraction_scfi", fSam_scfi_mean},
+    {"sampling_fraction_error_scfi", fSam_scfi_mean_err}      
   };
   if (save_calib) {
     std::string calib_output_path = "results/emcal_barrel_calibration.json";
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 8ac13ba13750571492f29b32b7c960a05644a984..1d66a9819fdc05a31e420bbe0c2e3218bb4e852d 100644
--- a/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx
+++ b/benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx
@@ -5,6 +5,7 @@
 
 #include "ROOT/RDataFrame.hxx"
 #include <iostream>
+#include <fstream>
 #include <fmt/core.h>
 
 #include "dd4pod/Geant4ParticleCollection.h"
diff --git a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx
index 1ae105d396b399b3d4226e02cd86837a7928632e..fbe72c2a1b3daf700f256679099e87ed82d04e29 100644
--- a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx
+++ b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx
@@ -5,6 +5,7 @@
 
 #include "ROOT/RDataFrame.hxx"
 #include <iostream>
+#include <fstream>
 #include <fmt/core.h>
 
 #include "dd4pod/Geant4ParticleCollection.h"
diff --git a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_gen.cxx b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_gen.cxx
index 5c9142e08ac5acc48fe3b217db0c403d0145982f..297a74f554ed4b48a52acb9415ecc4c950e272dd 100644
--- a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_gen.cxx
+++ b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_gen.cxx
@@ -15,6 +15,7 @@
 
 #include <cmath>
 #include <iostream>
+#include <fstream>
 #include <math.h>
 #include <random>
 #include <fmt/core.h>
diff --git a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_reader.cxx b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_reader.cxx
index 6c16a91f29d76c6cd6ecd1998bd92d656f74d4d7..c21db831cd198a640ea74d08a1f2e5d30a8ea7d5 100644
--- a/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_reader.cxx
+++ b/benchmarks/barrel_hcal/scripts/hcal_barrel_particles_reader.cxx
@@ -18,6 +18,7 @@
 #include "TMath.h"
 
 #include <iostream>
+#include <fstream>
 #include <fmt/core.h>
 
 #include "hcal_barrel_common_functions.h"