Skip to content

Commit ce031b3

Browse files
committed
Fix Data axes sorting Bug
1 parent 26a15ec commit ce031b3

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

roofit/hs3/src/RooJSONFactoryWSTool.cxx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,13 @@ void exportAttributes(const RooAbsArg *arg, JSONNode &rootnode)
483483
*
484484
* @param ws The RooWorkspace in which the observables will be created.
485485
* @param node The JSONNode containing information about the observables to be created.
486-
* @param out The RooArgSet to which the created observables will be added.
486+
* @param out The RooAbsCollection to which the created observables will be added.
487487
* @return void
488488
*/
489-
void getObservables(RooWorkspace const &ws, const JSONNode &node, RooArgSet &out)
489+
void getObservables(RooWorkspace const &ws, const JSONNode &node, RooAbsCollection &out)
490490
{
491-
std::map<std::string, Var> vars;
492491
for (const auto &p : node["axes"].children()) {
493-
vars.emplace(RooJSONFactoryWSTool::name(p), Var(p));
494-
}
495-
496-
for (auto v : vars) {
497-
std::string name(v.first);
492+
std::string name(RooJSONFactoryWSTool::name(p));
498493
if (ws.var(name)) {
499494
out.add(*ws.var(name));
500495
} else {
@@ -528,9 +523,9 @@ std::unique_ptr<RooAbsData> loadData(const JSONNode &p, RooWorkspace &workspace)
528523
return RooJSONFactoryWSTool::readBinnedData(p, name, RooJSONFactoryWSTool::readAxes(p));
529524
} else if (type == "unbinned") {
530525
// unbinned
531-
RooArgSet vars;
532-
getObservables(workspace, p, vars);
533-
RooArgList varlist(vars);
526+
RooArgList varlist;
527+
getObservables(workspace, p, varlist);
528+
RooArgSet vars(varlist);
534529
auto data = std::make_unique<RooDataSet>(name, name, vars, RooFit::WeightVar());
535530
auto &coords = p["entries"];
536531
if (!coords.is_seq()) {

0 commit comments

Comments
 (0)