From 402832f40befbab980ff09fc9db97d72f10060c1 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 5bd91ed..a471a14 100644 --- a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc +++ b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc @@ -368,16 +368,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 02eaeb02a54a21d03e716a211078c89945667edb 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 a471a14..e412815 100644 --- a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc +++ b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc @@ -376,11 +376,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 8fc3f36f37b166e7c2e2d79d615e6cab7f6fc79b 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 e412815..76aff5a 100644 --- a/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc +++ b/src/nusystematics/systproviders/MECq0q3InterpWeighting_tool.cc @@ -375,14 +375,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});