diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt new file mode 100644 index 00000000..3c41ec67 --- /dev/null +++ b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt @@ -0,0 +1,67 @@ +package inr.numass.scripts.timeanalysis + +import hep.dataforge.data.DataSet +import hep.dataforge.fx.plots.PlotManager +import hep.dataforge.kodex.buildContext +import hep.dataforge.kodex.buildMeta +import inr.numass.NumassPlugin +import inr.numass.actions.TimeAnalyzerAction +import inr.numass.data.NumassDataUtils +import inr.numass.data.api.NumassPoint +import inr.numass.data.api.NumassSet +import inr.numass.data.api.SimpleNumassPoint +import inr.numass.data.storage.NumassStorageFactory +import java.util.stream.Collectors + +fun main(args: Array) { + + val context = buildContext("NUMASS", NumassPlugin::class.java, PlotManager::class.java) { + rootDir = "D:\\Work\\Numass\\sterile\\2017_11" + dataDir = "D:\\Work\\Numass\\data\\2017_11" + } + + val storage = NumassStorageFactory.buildLocal(context, "Fill_2", true, false); + + val meta = buildMeta { + "binNum" to 200 + "inverted" to true + node("window") { + "lo" to 500 + "up" to 3000 + } + "plot.showErrors" to false + } + + //def sets = ((2..14) + (22..31)).collect { "set_$it" } + val sets = (2..14).map { "set_$it" } + //def sets = (16..31).collect { "set_$it" } + //def sets = (20..28).collect { "set_$it" } + + val loaders = sets.map { set -> + storage.provide("loader::$set", NumassSet::class.java).orElse(null) + }.filter { it != null } + + val hvs = listOf(14000.0, 14200.0, 14600.0, 14800.0)//, 15000d, 15200d, 15400d, 15600d, 15800d] + + val all = NumassDataUtils.join("sum", loaders) + + val data = DataSet.builder(NumassPoint::class.java).apply { + hvs.forEach { hv -> + putStatic( + "point_${hv.toInt()}", + SimpleNumassPoint( + hv, + all.points.filter { + it.voltage == hv + }.collect(Collectors.toList()) + ) + ) + } + }.build() + + + val result = TimeAnalyzerAction().run(context, data, meta); + + result.computeAll(); + +} \ No newline at end of file