From 27b0072582c6dc040d0bc5c50be797f82cd14aa6 Mon Sep 17 00:00:00 2001
From: Jonas Rembser <jonas.rembser@cern.ch>
Date: Wed, 22 Mar 2023 12:49:12 +0100
Subject: [PATCH] [RF][HS3] Put exported `histosys` in the correct vector

They should be stored in a vector corresponding to the sample, not in a
local variable that will not be reused later.
---
 roofit/hs3/src/JSONFactories_HistFactory.cxx | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/roofit/hs3/src/JSONFactories_HistFactory.cxx b/roofit/hs3/src/JSONFactories_HistFactory.cxx
index 67ea7988c66..0184c954cda 100644
--- a/roofit/hs3/src/JSONFactories_HistFactory.cxx
+++ b/roofit/hs3/src/JSONFactories_HistFactory.cxx
@@ -718,7 +718,6 @@ bool tryExportHistFactory(RooWorkspace *ws, const std::string &pdfname, const st
 
       // sort and configure the histosys
       if (pip) {
-         std::vector<HistoSys> histosys;
          for (size_t i = 0; i < pip->paramList().size(); ++i) {
             RooAbsArg *var = pip->paramList().at(i);
             std::string sysname(var->GetName());
@@ -727,7 +726,7 @@ bool tryExportHistFactory(RooWorkspace *ws, const std::string &pdfname, const st
             }
             if (auto lo = dynamic_cast<RooHistFunc *>(pip->lowList().at(i))) {
                if (auto hi = dynamic_cast<RooHistFunc *>(pip->highList().at(i))) {
-                  histosys.emplace_back(HistoSys(sysname, lo, hi, findConstraint(var)->IsA()));
+                  sample.histosys.emplace_back(sysname, lo, hi, findConstraint(var)->IsA());
                }
             }
          }
-- 
GitLab