numass show spectrum script
This commit is contained in:
parent
0f981818dc
commit
01c5419c32
@ -0,0 +1,65 @@
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.grind.Grind
|
||||
import hep.dataforge.meta.Meta
|
||||
import hep.dataforge.stat.fit.FitPlugin
|
||||
import hep.dataforge.stat.fit.ParamSet
|
||||
import hep.dataforge.stat.models.XYModel
|
||||
import inr.numass.NumassPlugin
|
||||
|
||||
/**
|
||||
* Created by darksnake on 14-Dec-16.
|
||||
*/
|
||||
|
||||
|
||||
Locale.setDefault(Locale.US);
|
||||
new NumassPlugin().startGlobal();
|
||||
|
||||
|
||||
def fm = Global.instance().provide("fitting", FitPlugin.class).getFitManager();
|
||||
def mm = fm.modelManager
|
||||
|
||||
|
||||
Meta modelMeta = Grind.buildMeta(modelName: "sterile") {
|
||||
resolution(width: 8.3e-5, tailAlpha: 3e-3)
|
||||
transmission(trapping: "function::numass.trap.nominal") // numass.trap.nominal = 1.2e-4 - 4.5e-9 * Ei
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
'N' = 2.76515e+06 ± 2.4e+03 (0.00000,Infinity)
|
||||
'bkg' = 41.195 ± 0.053
|
||||
'E0' = 18576.35 ± 0.32
|
||||
'mnu2' = 0.00 ± 0.010
|
||||
'msterile2' = 1000000.00 ± 1.0
|
||||
'U2' = 0.00314 ± 0.0010
|
||||
'X' = 0.12000 ± 0.010 (0.00000,Infinity)
|
||||
'trap' = 1.089 ± 0.026
|
||||
*/
|
||||
|
||||
Meta paramMeta = Grind.buildMeta("params") {
|
||||
N(value: 2.76515e+06, err: 30, lower: 0)
|
||||
bkg(value: 41.195, err: 0.1)
|
||||
E0(value: 18576.35, err: 0.1)
|
||||
mnu2(value: 0, err: 0.01)
|
||||
msterile2(value: 1000**2, err: 1)
|
||||
U2(value: 0.00314, err: 1e-3)
|
||||
X(value: 0.12000, err: 0.01, lower: 0)
|
||||
trap(value: 1.089, err: 0.05)
|
||||
}
|
||||
|
||||
XYModel model = mm.buildModel(modelMeta)
|
||||
|
||||
ParamSet allPars = ParamSet.fromMeta(paramMeta);
|
||||
|
||||
def a = 16000;
|
||||
def b = 18600;
|
||||
def step = 50;
|
||||
|
||||
|
||||
for (double x = a; x < b; x += step) {
|
||||
println "${x}\t${model.value(x, allPars)}"
|
||||
}
|
||||
|
||||
Global.terminate()
|
@ -27,7 +27,10 @@ import hep.dataforge.io.ColumnedDataWriter;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.plots.XYPlotFrame;
|
||||
import hep.dataforge.plots.data.*;
|
||||
import hep.dataforge.plots.data.PlotDataUtils;
|
||||
import hep.dataforge.plots.data.PlottableData;
|
||||
import hep.dataforge.plots.data.TimePlottable;
|
||||
import hep.dataforge.plots.data.TimePlottableGroup;
|
||||
import hep.dataforge.plots.fx.FXPlotFrame;
|
||||
import hep.dataforge.plots.fx.PlotContainer;
|
||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
||||
@ -81,7 +84,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
|
||||
private PlotContainer detectorPlot;
|
||||
private PlotContainer spectrumPlot;
|
||||
private PlotContainer hvPlot;
|
||||
private ChangeablePlottableData spectrumData;
|
||||
private PlottableData spectrumData;
|
||||
private List<NMPoint> points;
|
||||
private ChoiceBox<Integer> detectorBinningSelector;
|
||||
private CheckBox detectorNormalizeSwitch;
|
||||
@ -287,7 +290,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
|
||||
|
||||
private void setupSpectrumPane(List<NMPoint> points) {
|
||||
if (spectrumData == null) {
|
||||
spectrumData = new ChangeablePlottableData("spectrum");
|
||||
spectrumData = new PlottableData("spectrum");
|
||||
spectrumPlot.getPlot().add(spectrumData);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user