diff --git a/numass-main/src/main/java/inr/numass/NumassPlugin.java b/numass-main/src/main/java/inr/numass/NumassPlugin.java index 8b594dc9..438240fe 100644 --- a/numass-main/src/main/java/inr/numass/NumassPlugin.java +++ b/numass-main/src/main/java/inr/numass/NumassPlugin.java @@ -202,12 +202,17 @@ public class NumassPlugin extends BasicPlugin { return res; }); - manager.addModel("sterile-polina", (context, an) -> { - double A = an.getDouble("resolution", 8.3e-5);//8.3e-5 + manager.addModel("sterile", (context, an) -> { + double A = an.getDouble("resolution", an.getDouble("resolution.width", 8.3e-5));//8.3e-5 double from = an.getDouble("from", 13900d); double to = an.getDouble("to", 18700d); context.getReport().report("Setting up tritium model with real transmission function"); - BivariateFunction resolutionTail = ResolutionFunction.getRealTail(); + BivariateFunction resolutionTail; + if (an.hasValue("resolution.tailAlpha")) { + resolutionTail = ResolutionFunction.getAngledTail(an.getDouble("resolution.tailAlpha"), an.getDouble("resolution.tailBeta", 0)); + } else { + resolutionTail = ResolutionFunction.getRealTail(); + } RangedNamedSetSpectrum beta = new BetaSpectrum(context.io().getFile("FS.txt")); ModularSpectrum sp = new ModularSpectrum(beta, new ResolutionFunction(A, resolutionTail), from, to); if (an.getBoolean("caching", false)) { @@ -218,10 +223,10 @@ public class NumassPlugin extends BasicPlugin { //Intercept = 4.95745, B1 = -0.36879, B2 = 0.00827 //sp.setTrappingFunction((Ei,Ef)->LossCalculator.getTrapFunction().value(Ei, Ef)*(4.95745-0.36879*Ei+0.00827*Ei*Ei)); sp.setTrappingFunction((Ei, Ef) -> { - return 7.12e-5 * FastMath.exp(-(Ei - Ef) / 350d) + 0.1564 * (0.00123-4.2e-8*Ei); + return 6.2e-5 * FastMath.exp(-(Ei - Ef) / 350d) + 1.97e-4 - 6.818e-9 * Ei; }); context.getReport().report("Using folowing trapping formula: {}", - "7.12e-5 * FastMath.exp(-(Ei - Ef) / 350d) + 0.1564 * (0.00123-4.2e-8*Ei)"); + "6.2e-5 * FastMath.exp(-(Ei - Ef) / 350d) + 1.97e-4 - 6.818e-9 * Ei"); NBkgSpectrum spectrum = new NBkgSpectrum(sp); return new XYModel(spectrum, getAdapter(an)); diff --git a/numass-main/src/main/java/inr/numass/models/ResolutionFunction.java b/numass-main/src/main/java/inr/numass/models/ResolutionFunction.java index 03400088..063b47ed 100644 --- a/numass-main/src/main/java/inr/numass/models/ResolutionFunction.java +++ b/numass-main/src/main/java/inr/numass/models/ResolutionFunction.java @@ -33,6 +33,39 @@ import org.apache.commons.math3.analysis.UnivariateFunction; */ public class ResolutionFunction implements BivariateFunction { + public static BivariateFunction getRealTail() { + InputStream transmissionPointStream = ResolutionFunction.class.getResourceAsStream("/numass/models/transmission"); + Scanner scanner = new Scanner(transmissionPointStream); + + Map values = new HashMap<>(); + + while (scanner.hasNextDouble()) { + values.put((18.5 - scanner.nextDouble()) * 1000, scanner.nextDouble()); + } + + UnivariateFunction f = Interpolation.interpolate(values, Interpolation.InterpolationType.LINE, Double.NaN, Double.NaN); + + return (double x, double y) -> f.value(x - y); + } + + public static BivariateFunction getAngledTail(double dropPerKv) { + return (double E, double U) -> 1 - (E - U) * dropPerKv / 1000d; + } + + /** + * (E, U) -> 1 - (E - U) * (alpha + E * beta) / 1000d + * @param alpha drop per kV at E = 0 + * @param beta dependence of drop per kV on E (in kV) + * @return + */ + public static BivariateFunction getAngledTail(double alpha, double beta) { + return (double E, double U) -> 1 - (E - U) * (alpha + E /1000d * beta) / 1000d; + } + + public static BivariateFunction getConstantTail() { + return new ConstantTailFunction(); + } + private final double resA; private double resB = Double.NaN; private BivariateFunction tailFunction = new ConstantTailFunction(); @@ -89,29 +122,6 @@ public class ResolutionFunction implements BivariateFunction { } } - public static BivariateFunction getRealTail() { - InputStream transmissionPointStream = ResolutionFunction.class.getResourceAsStream("/numass/models/transmission"); - Scanner scanner = new Scanner(transmissionPointStream); - - Map values = new HashMap<>(); - - while (scanner.hasNextDouble()) { - values.put((18.5 - scanner.nextDouble()) * 1000, scanner.nextDouble()); - } - - UnivariateFunction f = Interpolation.interpolate(values, Interpolation.InterpolationType.LINE, Double.NaN, Double.NaN); - - return (double x, double y) -> f.value(x - y); - } - - public static BivariateFunction getAngledTail(double dropPerKv) { - return (double E, double U) -> 1 - (E - U) * dropPerKv/1000d; - } - - public static BivariateFunction getConstantTail() { - return new ConstantTailFunction(); - } - private static class ConstantTailFunction implements BivariateFunction { @Override