diff --git a/numass-core/src/main/java/inr/numass/storage/NumassDataLoader.java b/numass-core/src/main/java/inr/numass/storage/NumassDataLoader.java index 4ccd13a4..48a49a2d 100644 --- a/numass-core/src/main/java/inr/numass/storage/NumassDataLoader.java +++ b/numass-core/src/main/java/inr/numass/storage/NumassDataLoader.java @@ -15,7 +15,6 @@ */ package inr.numass.storage; -import hep.dataforge.context.Global; import hep.dataforge.data.Data; import hep.dataforge.exceptions.StorageException; import hep.dataforge.io.ColumnedDataReader; @@ -136,7 +135,7 @@ public class NumassDataLoader extends AbstractLoader implements ObjectLoader { @Override protected DataNode run(TaskModel model, DataNode data) { DataSet.Builder
builder = DataSet.builder(Table.class); - Action action = new FitSummaryAction(); - DataNode input = data.getCheckedNode("fitscan", FitState.class); + Action action = new FitSummaryAction(); + DataNode input = data.getCheckedNode("fitscan", FitResult.class); input.nodeStream().filter(it -> it.dataSize(false) > 0).forEach(node -> builder.putData(node.getName(), action.run(model.getContext(), node, model.meta()).getData()) ); @@ -54,11 +54,11 @@ public class NumassFitScanSummaryTask extends AbstractTask
{ return "scansum"; } - @TypedActionDef(name = "sterileSummary", inputType = FitState.class, outputType = Table.class) - private class FitSummaryAction extends ManyToOneAction { + @TypedActionDef(name = "sterileSummary", inputType = FitResult.class, outputType = Table.class) + private class FitSummaryAction extends ManyToOneAction { @Override - protected Table execute(Context context, String nodeName, Map input, Laminate meta) { + protected Table execute(Context context, String nodeName, Map input, Laminate meta) { ListTable.Builder builder = new ListTable.Builder("m", "U2", "U2err", "U2limit", "E0", "trap"); input.forEach((key, fitRes) -> { ParamSet pars = fitRes.getParameters(); diff --git a/numass-main/src/main/java/inr/numass/tasks/NumassFitScanTask.java b/numass-main/src/main/java/inr/numass/tasks/NumassFitScanTask.java index 3e89265c..29e41882 100644 --- a/numass-main/src/main/java/inr/numass/tasks/NumassFitScanTask.java +++ b/numass-main/src/main/java/inr/numass/tasks/NumassFitScanTask.java @@ -17,6 +17,7 @@ import hep.dataforge.values.Value; import hep.dataforge.workspace.AbstractTask; import hep.dataforge.workspace.TaskModel; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -56,16 +57,18 @@ public class NumassFitScanTask extends AbstractTask { for (int i = 0; i < scanValues.listValue().size(); i++) { Value val = scanValues.listValue().get(i); MetaBuilder overrideMeta = new MetaBuilder(fitConfig); - overrideMeta.setValue("@resultName", String.format("%s[%s=%s]", table.getName(), scanParameter, val.stringValue())); + + String resultName = String.format("%s[%s=%s]", table.getName(), scanParameter, val.stringValue()); +// overrideMeta.setValue("@resultName", String.format("%s[%s=%s]", table.getName(), scanParameter, val.stringValue())); if (overrideMeta.hasMeta("params." + scanParameter)) { overrideMeta.setValue("params." + scanParameter + ".value", val); } else { overrideMeta.getMetaList("params.param").stream() - .filter(par -> par.getString("name") == scanParameter).forEach(par -> par.setValue("value", val)); + .filter(par -> Objects.equals(par.getString("name"), scanParameter)).forEach(par -> par.setValue("value", val)); } // Data
newData = new Data
(data.getGoal(),data.type(),overrideMeta); - DataNode node = action.run(model.getContext(), DataNode.of("fit_" + i, table, Meta.empty()), overrideMeta); + DataNode node = action.run(model.getContext(), DataNode.of(resultName, table, Meta.empty()), overrideMeta); resultBuilder.putData(table.getName() + ".fit_" + i, node.getData()); } }); @@ -80,6 +83,8 @@ public class NumassFitScanTask extends AbstractTask { MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("fit").removeNode("scan"); if (model.meta().hasMeta("filter")) { model.dependsOn("filter", metaBuilder.build(), "prepare"); + } else if (model.meta().hasMeta("empty")) { + model.dependsOn("substractEmpty", metaBuilder.build(), "prepare"); } else { model.dependsOn("prepare", metaBuilder.build(), "prepare"); }