From 6cd3ef7846748742a9520e6e49f8926c2dc7f84a Mon Sep 17 00:00:00 2001 From: darksnake Date: Mon, 19 Dec 2016 17:37:59 +0300 Subject: [PATCH] fixed plugin resolution pattern for fx plugin in plots --- .../workspace/NumassFitScanSummaryTask.java | 13 +++++++------ .../inr/numass/storage/NumassDataLoader.java | 1 + .../inr/numass/storage/NumassDataReader.java | 17 ++++++----------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java b/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java index 339b029f..164753d7 100644 --- a/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java +++ b/numass-main/src/main/java/inr/numass/workspace/NumassFitScanSummaryTask.java @@ -23,6 +23,7 @@ import hep.dataforge.tables.TableTransform; import hep.dataforge.workspace.AbstractTask; import hep.dataforge.workspace.TaskModel; +import java.io.IOException; import java.io.OutputStream; import java.util.Map; @@ -81,12 +82,12 @@ public class NumassFitScanSummaryTask extends AbstractTask { Table res = TableTransform.sort(builder.build(), "msterile2", true); - OutputStream stream = buildActionOutput(context, nodeName); - - String head = "Sterile neutrino mass scan summary\n" + meta.toString(); - - - ColumnedDataWriter.writeDataSet(stream, res, head); + try (OutputStream stream = buildActionOutput(context, nodeName)) { + String head = "Sterile neutrino mass scan summary\n" + meta.toString(); + ColumnedDataWriter.writeDataSet(stream, res, head); + } catch (IOException e) { + getLogger(meta).error("Failed to close output stream", e); + } return res; } diff --git a/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java b/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java index 79a78a48..134dfc8f 100644 --- a/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java +++ b/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java @@ -242,6 +242,7 @@ public class NumassDataLoader extends AbstractLoader implements ObjectLoader MAX_EVENTS_PER_POINT) { pointTime = events.get(events.size() - 1).getTime() - events.get(0).getTime(); } + return new RawNMPoint(u, u, events, pointTime, diff --git a/numass-storage/src/main/java/inr/numass/storage/NumassDataReader.java b/numass-storage/src/main/java/inr/numass/storage/NumassDataReader.java index e5763a11..b2cc84ff 100644 --- a/numass-storage/src/main/java/inr/numass/storage/NumassDataReader.java +++ b/numass-storage/src/main/java/inr/numass/storage/NumassDataReader.java @@ -15,18 +15,11 @@ */ package inr.numass.storage; -import inr.numass.storage.NMEvent; -import inr.numass.storage.RawNMFile; -import inr.numass.storage.RawNMPoint; import hep.dataforge.data.FileDataFactory; import hep.dataforge.data.binary.Binary; import hep.dataforge.meta.Meta; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; + +import java.io.*; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; @@ -38,8 +31,8 @@ import java.util.Scanner; */ public class NumassDataReader { - private String name; private final InputStream stream; + private String name; private double HVdev = 2.468555393226049; private boolean noUset = false; @@ -66,7 +59,9 @@ public class NumassDataReader { } public RawNMFile read() throws IOException { - return readFile(name); + RawNMFile res = readFile(name); + stream.close(); + return res; } private int[] readBlock(int length) throws IOException {