numass analysis fix
This commit is contained in:
parent
79336be1da
commit
931c880259
@ -112,10 +112,10 @@ public class TritiumUtils {
|
||||
double res;
|
||||
if (deadTime > 0) {
|
||||
double total = p.getEventsCount();
|
||||
double time = p.getLength();
|
||||
res = wind / (1 - total * deadTime / time);
|
||||
// double timeRatio = deadTime / p.getLength();
|
||||
// res = wind / total * (1d - Math.sqrt(1d - 4d * total * timeRatio)) / 2d / timeRatio;
|
||||
// double time = p.getLength();
|
||||
// res = wind / (1 - total * deadTime / time);
|
||||
double timeRatio = deadTime / p.getLength();
|
||||
res = wind / total * (1d - Math.sqrt(1d - 4d * total * timeRatio)) / 2d / timeRatio;
|
||||
} else {
|
||||
res = wind;
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ public class NumassFitTask extends SingleActionTask<Table, FitState> {
|
||||
MetaBuilder metaBuilder = new MetaBuilder(model.meta()).removeNode("fit");
|
||||
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");
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import hep.dataforge.data.*;
|
||||
import hep.dataforge.description.DescriptorBuilder;
|
||||
import hep.dataforge.description.NodeDescriptor;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.meta.Template;
|
||||
import hep.dataforge.storage.api.Loader;
|
||||
import hep.dataforge.storage.commons.StorageUtils;
|
||||
@ -60,9 +59,9 @@ public class NumassPrepareTask extends AbstractTask<Table> {
|
||||
Meta dataMeta = config.getMeta("data");
|
||||
URI storageUri = input.getCheckedData("dataRoot", URI.class).get();
|
||||
DataSet.Builder<NumassData> dataBuilder = readData(callback, context, storageUri, dataMeta);
|
||||
if (config.hasMeta("empty")) {
|
||||
dataBuilder.putNode("empty", readData(callback, context, storageUri, config.getMeta("empty")).build());
|
||||
}
|
||||
// if (config.hasMeta("empty")) {
|
||||
// dataBuilder.putNode("empty", readData(callback, context, storageUri, config.getMeta("empty")).build());
|
||||
// }
|
||||
|
||||
DataNode<NumassData> data = dataBuilder.build();
|
||||
|
||||
@ -80,13 +79,13 @@ public class NumassPrepareTask extends AbstractTask<Table> {
|
||||
DataTree.Builder<Table> resultBuilder = DataTree.builder(Table.class);
|
||||
DataTree.Builder<Table> tablesForMerge = new DataTree.Builder<>(tables);
|
||||
|
||||
//extracting empty data
|
||||
if (config.hasMeta("empty")) {
|
||||
DataNode<Table> emptySourceNode = tables.getCheckedNode("empty", Table.class);
|
||||
Meta emptyMergeMeta = new MetaBuilder("emptySource").setValue("mergeName", "emptySource");
|
||||
resultBuilder.putData("merge.empty", runAction(new MergeDataAction(), callback, context, emptySourceNode, emptyMergeMeta).getData());
|
||||
tablesForMerge.removeNode("empty");
|
||||
}
|
||||
// //extracting empty data
|
||||
// if (config.hasMeta("empty")) {
|
||||
// DataNode<Table> emptySourceNode = tables.getCheckedNode("empty", Table.class);
|
||||
// Meta emptyMergeMeta = new MetaBuilder("emptySource").setValue("mergeName", "emptySource");
|
||||
// resultBuilder.putData("merge.empty", runAction(new MergeDataAction(), callback, context, emptySourceNode, emptyMergeMeta).getData());
|
||||
// tablesForMerge.removeNode("empty");
|
||||
// }
|
||||
|
||||
config.getMetaList("merge").forEach(mergeNode -> {
|
||||
Meta mergeMeta = Template.compileTemplate(mergeNode, config);
|
||||
|
@ -22,6 +22,8 @@ import hep.dataforge.data.DataNode;
|
||||
import hep.dataforge.data.DataTree;
|
||||
import hep.dataforge.data.DataUtils;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.tables.DataPoint;
|
||||
import hep.dataforge.tables.ListTable;
|
||||
import hep.dataforge.tables.MapPoint;
|
||||
@ -45,26 +47,30 @@ public class NumassSubstractEmptySourceTask extends AbstractTask<Table> {
|
||||
protected DataNode<Table> run(TaskModel model, ProgressCallback callback, DataNode<?> data) {
|
||||
DataTree.Builder<Table> builder = DataTree.builder(Table.class);
|
||||
DataNode<Table> rootNode = data.getCheckedNode("prepare", Table.class);
|
||||
Data<Table> emptySource = rootNode.getCheckedData("merge.empty", Table.class);
|
||||
Data<? extends Table> emptySource = data.getCheckedNode("empty", Table.class).getData();
|
||||
rootNode.forEachDataWithType(Table.class, input -> {
|
||||
if (!input.getName().startsWith("merge.empty")) {
|
||||
Data<? extends Table> res = subtractBackground(input, emptySource);
|
||||
res.getGoal().onComplete((r, err) -> {
|
||||
if (r != null) {
|
||||
OutputStream out = model.getContext().io().out("merge", input.getName());
|
||||
ColumnedDataWriter.writeDataSet(out, r, input.meta().toString());
|
||||
}
|
||||
});
|
||||
Data<? extends Table> res = subtractBackground(input, emptySource);
|
||||
res.getGoal().onComplete((r, err) -> {
|
||||
if (r != null) {
|
||||
OutputStream out = model.getContext().io().out("merge", input.getName());
|
||||
ColumnedDataWriter.writeDataSet(out, r, input.meta().toString());
|
||||
}
|
||||
});
|
||||
|
||||
builder.putData(input.getName(), res);
|
||||
}
|
||||
builder.putData(input.getName(), res);
|
||||
});
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskModel transformModel(TaskModel model) {
|
||||
model.dependsOn("prepare", model.meta(), "prepare");
|
||||
Meta modelMeta = model.meta();
|
||||
model.dependsOn("prepare", modelMeta, "prepare");
|
||||
MetaBuilder emptyCfg = new MetaBuilder("prepare")
|
||||
.setNode(modelMeta.getMeta("prepare"))
|
||||
.setNode("data", modelMeta.getMeta("empty"))
|
||||
.setNode(new MetaBuilder("merge").setValue("mergeName", model.meta().getName() + ".empty"));
|
||||
model.dependsOn("prepare", emptyCfg, "empty");
|
||||
return model;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user