This commit is contained in:
darksnake 2017-05-10 17:03:24 +03:00
parent 0ebe97b18e
commit 10fc68461f
3 changed files with 16 additions and 12 deletions

View File

@ -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<Env
private static Envelope readFile(FileObject file) {
//VFS file reading seems to work badly in parallel
synchronized (Global.instance()) {
//synchronized (Global.instance()) {
String fileName = file.getName().getBaseName();
if (fileName.equals(META_FRAGMENT_NAME)
|| fileName.equals(HV_FRAGMENT_NAME)
@ -150,7 +149,7 @@ public class NumassDataLoader extends AbstractLoader implements ObjectLoader<Env
} else {
return null;
}
}
//}
}
/**

View File

@ -13,7 +13,7 @@ import hep.dataforge.data.DataSet;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.io.ColumnedDataWriter;
import hep.dataforge.meta.Laminate;
import hep.dataforge.stat.fit.FitState;
import hep.dataforge.stat.fit.FitResult;
import hep.dataforge.stat.fit.ParamSet;
import hep.dataforge.stat.fit.UpperLimitGenerator;
import hep.dataforge.tables.ListTable;
@ -34,8 +34,8 @@ public class NumassFitScanSummaryTask extends AbstractTask<Table> {
@Override
protected DataNode<Table> run(TaskModel model, DataNode<?> data) {
DataSet.Builder<Table> builder = DataSet.builder(Table.class);
Action<FitState, Table> action = new FitSummaryAction();
DataNode<FitState> input = data.getCheckedNode("fitscan", FitState.class);
Action<FitResult, Table> action = new FitSummaryAction();
DataNode<FitResult> 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<Table> {
return "scansum";
}
@TypedActionDef(name = "sterileSummary", inputType = FitState.class, outputType = Table.class)
private class FitSummaryAction extends ManyToOneAction<FitState, Table> {
@TypedActionDef(name = "sterileSummary", inputType = FitResult.class, outputType = Table.class)
private class FitSummaryAction extends ManyToOneAction<FitResult, Table> {
@Override
protected Table execute(Context context, String nodeName, Map<String, FitState> input, Laminate meta) {
protected Table execute(Context context, String nodeName, Map<String, FitResult> input, Laminate meta) {
ListTable.Builder builder = new ListTable.Builder("m", "U2", "U2err", "U2limit", "E0", "trap");
input.forEach((key, fitRes) -> {
ParamSet pars = fitRes.getParameters();

View File

@ -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<FitResult> {
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<Table> newData = new Data<Table>(data.getGoal(),data.type(),overrideMeta);
DataNode<FitResult> node = action.run(model.getContext(), DataNode.of("fit_" + i, table, Meta.empty()), overrideMeta);
DataNode<FitResult> 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<FitResult> {
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");
}