diff --git a/numass-main/src/main/groovy/inr/numass/scripts/Underflow.groovy b/numass-main/src/main/groovy/inr/numass/scripts/Underflow.groovy index 0a22fff4..60578c96 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/Underflow.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/Underflow.groovy @@ -10,6 +10,8 @@ import hep.dataforge.io.ColumnedDataWriter import hep.dataforge.storage.commons.StorageUtils import hep.dataforge.tables.Table import inr.numass.data.NumassDataUtils +import inr.numass.data.api.NumassPoint +import inr.numass.data.api.NumassSet import inr.numass.data.storage.NumassStorage import inr.numass.data.storage.NumassStorageFactory import inr.numass.utils.UnderflowCorrection @@ -21,13 +23,14 @@ File rootDir = new File("D:\\Work\\Numass\\data\\2017_05\\Fill_1") NumassStorage storage = NumassStorageFactory.buildLocal(rootDir); -Collection data = NumassDataUtils.joinSpectra( +NumassSet data = NumassDataUtils.join( + "data", StorageUtils.loaderStream(storage) .filter { it.key.matches("set_.{1,3}") } .map { - println "loading ${it.key}" - it.value - }.map { (NumassData) it } + println "loading ${it.key}" + it.value + }.collect { (NumassSet) it } ) data = NumassDataUtils.substractReferencePoint(data, 18600d); @@ -53,8 +56,8 @@ data = NumassDataUtils.substractReferencePoint(data, 18600d); // } //} -def printPoint(Iterable data, List us, int binning = 20, normalize = true) { - List points = data.findAll { it.voltage in us }.sort { it.voltage } +def printPoint(Iterable data, List us, int binning = 20, normalize = true) { + List points = data.findAll { it.voltage in us }.sort { it.voltage } Map spectra = points.first().getMap(binning, normalize).collectEntries { key, value -> [key, [value]] diff --git a/numass-main/src/main/groovy/inr/numass/scripts/times/MultiPointHistogram.groovy b/numass-main/src/main/groovy/inr/numass/scripts/times/MultiPointHistogram.groovy index 1f8b34a6..dae24e69 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/times/MultiPointHistogram.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/times/MultiPointHistogram.groovy @@ -2,12 +2,14 @@ package inr.numass.scripts.times import hep.dataforge.context.Context import hep.dataforge.context.Global +import hep.dataforge.grind.Grind import hep.dataforge.grind.GrindShell import hep.dataforge.grind.helpers.PlotHelper import hep.dataforge.plots.fx.FXPlotManager import inr.numass.NumassPlugin import inr.numass.data.PointAnalyzer import inr.numass.data.analyzers.TimeAnalyzer +import inr.numass.data.api.MetaBlock import inr.numass.data.api.NumassPoint import inr.numass.data.storage.NumassDataLoader import inr.numass.data.storage.NumassStorage @@ -30,19 +32,21 @@ new GrindShell(ctx).eval { def pattern = "set_.{1,2}" - List loaders = storage.loaders().findAll{it.name.matches(pattern)}.collect{it as NumassDataLoader} + List loaders = storage.loaders().findAll { it.name.matches(pattern) }.collect { + it as NumassDataLoader + } println "Found ${loaders.size()} loaders matching pattern" def hv = 16000.toString(); - List points = loaders.collect { loader -> loader.optPoint(hv).get()} + List points = loaders.collect { loader -> loader.optPoint(hv).get() } def loChannel = 400; def upChannel = 800; - def chain = new TimeAnalyzer().timeChain(loChannel,upChannel, points as NumassPoint[]) + def chain = new TimeAnalyzer().timeChain(new MetaBlock(points), Grind.buildMeta("window.lo": loChannel, "window.up": upChannel)) - def histogram = PointAnalyzer.histogram(chain, 5e-6,500).asTable(); + def histogram = PointAnalyzer.histogram(chain, 5e-6, 500).asTable(); println "finished histogram calculation..." diff --git a/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java b/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java index 73649b82..a0da00c9 100644 --- a/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java +++ b/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java @@ -13,6 +13,7 @@ import hep.dataforge.server.storage.StorageRatpackHandler; import hep.dataforge.storage.api.ObjectLoader; import hep.dataforge.storage.api.PointLoader; import hep.dataforge.storage.api.Storage; +import inr.numass.data.api.NumassSet; import org.slf4j.LoggerFactory; import ratpack.handling.Context; @@ -45,7 +46,7 @@ public class NumassStorageHandler extends StorageRatpackHandler { @Override @SuppressWarnings("unchecked") protected void renderObjects(Context ctx, ObjectLoader loader) { - if (loader instanceof NumassData) { + if (loader instanceof NumassSet) { } else if (NumassRun.RUN_NOTES.equals(loader.getName())) { try {