[no commit message]
This commit is contained in:
parent
3d6d5f7688
commit
ca15fa8eeb
@ -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));
|
||||
|
@ -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<Number, Number> 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<Number, Number> 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
|
||||
|
Loading…
Reference in New Issue
Block a user