From 0a18e10275041b14998f4e9c4e2cb84f46a5eca3 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 15 May 2018 16:56:15 +0300 Subject: [PATCH] minor fixes --- .../kotlin/inr/numass/actions/TimeAnalyzerAction.kt | 9 +++++++++ .../inr/numass/scripts/timeanalysis/TestAnalyzer.kt | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt index 56205432..20180317 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/TimeAnalyzerAction.kt @@ -7,6 +7,7 @@ import hep.dataforge.kodex.configure import hep.dataforge.maths.histogram.UnivariateHistogram import hep.dataforge.meta.Laminate import hep.dataforge.plots.PlotPlugin +import hep.dataforge.plots.XYFunctionPlot import hep.dataforge.plots.data.DataPlot import hep.dataforge.tables.Adapters import hep.dataforge.tables.Table @@ -82,6 +83,14 @@ class TimeAnalyzerAction : OneToOneAction() { }.fillData(histogram) histPlot.add(histogramPlot) + + //val cr = input.events.count().toDouble() / input.length.toMillis() *1000 + + histPlot.add( + XYFunctionPlot.plot(name + "_theory", 0.0, binSize * binNum) { + trueCR * Math.exp(- it * trueCR / 1e6) + } + ) } if (inputMeta.getBoolean("plotStat", true)) { diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt index d7341459..b24d2de9 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/TestAnalyzer.kt @@ -11,16 +11,15 @@ import inr.numass.data.api.timeOffset import inr.numass.data.generateBlock import org.apache.commons.math3.random.JDKRandomGenerator import org.apache.commons.math3.random.RandomGenerator -import java.lang.Math.exp import java.time.Instant fun main(args: Array) { FXPlotManager().startGlobal() NumassPlugin().startGlobal() - val cr = 10e3; - val length = 30e9.toLong(); - val num = 20; + val cr = 30e3 + val length = 30e9.toLong() + val num = 20 val dt = 6.5 val rnd = JDKRandomGenerator() @@ -35,7 +34,8 @@ fun main(args: Array) { val chain = MarkovChain(OrphanNumassEvent(1000, 0)) { event -> - val deltaT = rnd.nextDeltaTime(cr * exp(- event.timeOffset / 1e11)) + //val deltaT = rnd.nextDeltaTime(cr * exp(- event.timeOffset / 1e11)) + val deltaT = rnd.nextDeltaTime(cr) OrphanNumassEvent(1000, event.timeOffset + deltaT) }