From b9a79f200f88798a54f54c4add3b24d29dd67a92 Mon Sep 17 00:00:00 2001 From: Jaesung Kim Date: Tue, 23 Jun 2026 21:43:44 +0000 Subject: [PATCH 1/3] Update GetZeroWeightResponse to properly calculate RW with RW(+1)=0 --- .../systproviders/MECq0q3InterpWeighting_tool.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc index 2df894c..8fc3b9f 100644 --- a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc +++ b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc @@ -363,16 +363,21 @@ MECq0q3InterpWeighting::GetEventResponse(genie::EventRecord const& ev) ComputeQ0Q3(ev, q0, q3, Enu); // Helper lambda to create zero-weight response (suppress events) + // Same as setting w_eff_cv = 0 or one_sigma = -1.0 auto GetZeroWeightResponse = [this]() { auto const& smd = this->GetSystMetaData(); systtools::event_unit_response_t resp; resp.reserve(smd.size()); for(auto const& sph : smd) { - // Create zero-weight response for this parameter if (sph.isCorrection) { - resp.push_back({sph.systParamId, std::vector{0.0}}); + double this_rw = 1.0 + (sph.centralParamValue) * (-1.); + resp.push_back({sph.systParamId, std::vector{this_rw}}); } else { - resp.push_back({sph.systParamId, std::vector(sph.paramVariations.size(), 0.0)}); + std::vector arr_rw; + for (double d : sph.paramVariations) { + arr_rw.push_back(1.0 + d * (-1.)); + } + resp.push_back({sph.systParamId, arr_rw}); } } return resp; From d1bf92124ae8680dbf17d24f82432a1096c77b16 Mon Sep 17 00:00:00 2001 From: Jaesung Kim Date: Tue, 23 Jun 2026 22:03:25 +0000 Subject: [PATCH 2/3] Run std::clamp in GetEventResponse, but with min = 0 --- .../systproviders/MECq0q3InterpWeighting_tool.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc index 8fc3b9f..4f7f02a 100644 --- a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc +++ b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc @@ -371,11 +371,14 @@ MECq0q3InterpWeighting::GetEventResponse(genie::EventRecord const& ev) for(auto const& sph : smd) { if (sph.isCorrection) { double this_rw = 1.0 + (sph.centralParamValue) * (-1.); + this_rw = std::clamp(this_rw, 0., fWmax); resp.push_back({sph.systParamId, std::vector{this_rw}}); } else { std::vector arr_rw; for (double d : sph.paramVariations) { - arr_rw.push_back(1.0 + d * (-1.)); + double this_rw = 1.0 + d * (-1.); + this_rw = std::clamp(this_rw, 0., fWmax); + arr_rw.push_back(this_rw); } resp.push_back({sph.systParamId, arr_rw}); } From ecfe1beee89622c8bafa98bbd2bcdc767bdc5657 Mon Sep 17 00:00:00 2001 From: Jaesung Kim Date: Tue, 23 Jun 2026 22:09:26 +0000 Subject: [PATCH 3/3] reserve arr_rw vector in GetZeroWeightResponse --- .../systproviders/MECq0q3InterpWeighting_tool.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc index 4f7f02a..d5539aa 100644 --- a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc +++ b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc @@ -370,14 +370,13 @@ MECq0q3InterpWeighting::GetEventResponse(genie::EventRecord const& ev) resp.reserve(smd.size()); for(auto const& sph : smd) { if (sph.isCorrection) { - double this_rw = 1.0 + (sph.centralParamValue) * (-1.); - this_rw = std::clamp(this_rw, 0., fWmax); + const double this_rw = std::clamp(1.0 + (sph.centralParamValue) * (-1.), 0., fWmax); resp.push_back({sph.systParamId, std::vector{this_rw}}); } else { std::vector arr_rw; + arr_rw.reserve(sph.paramVariations.size()); for (double d : sph.paramVariations) { - double this_rw = 1.0 + d * (-1.); - this_rw = std::clamp(this_rw, 0., fWmax); + const double this_rw = std::clamp(1.0 + d * (-1.), 0., fWmax); arr_rw.push_back(this_rw); } resp.push_back({sph.systParamId, arr_rw});