This commit is contained in:
darksnake 2017-05-04 15:49:57 +03:00
parent d5a04116e1
commit de5e302f76
4 changed files with 40 additions and 19 deletions

View File

@ -17,17 +17,18 @@ String cfgPath = cli.parse(args).c;
println "Loading config file from $cfgPath"
println "Starting Grind shell"
if (cfgPath) {
try {
GrindTerminal.system().launch {
try {
GrindTerminal.system().launch {
if (cfgPath) {
GrindWorkspaceBuilder numass = new GrindWorkspaceBuilder(context).read(new File(cfgPath))
bind("numass", numass)
} else {
println "No configuration path. Provide path via --config option"
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
Global.terminate();
}
} else {
println "No configuration path. Provide path via --config option"
} catch (Exception ex) {
ex.printStackTrace();
} finally {
Global.terminate();
}

View File

@ -15,8 +15,8 @@ import inr.numass.storage.NumassStorage
import inr.numass.utils.UnderflowCorrection
//File rootDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1")
//File rootDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_2_wide")
File rootDir = new File("D:\\Work\\Numass\\data\\2017_01\\Fill_2_wide")
File rootDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_2_wide")
//File rootDir = new File("D:\\Work\\Numass\\data\\2017_01\\Fill_2_wide")
NumassStorage storage = NumassStorage.buildLocalNumassRoot(rootDir, true);

View File

@ -5,16 +5,21 @@
*/
package inr.numass.models.sterile;
import hep.dataforge.context.Context;
import hep.dataforge.maths.MathPlugin;
import hep.dataforge.meta.Meta;
import hep.dataforge.stat.parametric.AbstractParametricBiFunction;
import hep.dataforge.values.NamedValueSet;
import inr.numass.models.ResolutionFunction;
import inr.numass.utils.ExpressionUtils;
import org.apache.commons.math3.analysis.BivariateFunction;
import java.util.HashMap;
import java.util.Map;
import static java.lang.Math.sqrt;
/**
*
* @author <a href="mailto:altavir@gmail.com">Alexander Nozik</a>
*/
public class NumassResolution extends AbstractParametricBiFunction {
@ -25,13 +30,28 @@ public class NumassResolution extends AbstractParametricBiFunction {
private double resB = 0;
private BivariateFunction tailFunction = ResolutionFunction.getConstantTail();
public NumassResolution(Meta meta) {
public NumassResolution(Context context, Meta meta) {
super(list);
this.resA = meta.getDouble("A", 8.3e-5);
this.resB = meta.getDouble("B", 0);
if (meta.hasValue("tailAlpha")) {
//add polinomial function here
tailFunction = ResolutionFunction.getAngledTail(meta.getDouble("tailAlpha"), meta.getDouble("tailBeta", 0));
double alpha = meta.getDouble("tailAlpha");
double beta = meta.getDouble("tailBeta", 0);
tailFunction = (double E, double U) -> 1 - (E - U) * (alpha + E / 1000d * beta) / 1000d;
} else if (meta.hasValue("tail")) {
String tailFunctionStr = meta.getString("tail");
if (tailFunctionStr.startsWith("function::")) {
tailFunction = MathPlugin.buildFrom(context).buildBivariateFunction(tailFunctionStr.substring(10));
} else {
tailFunction = (E, U) -> {
Map<String, Object> binding = new HashMap<>();
binding.put("E", E);
binding.put("U", U);
binding.put("D", U - E);
return ExpressionUtils.function(tailFunctionStr, binding);
};
}
} else {
tailFunction = ResolutionFunction.getConstantTail();
}

View File

@ -73,7 +73,7 @@ public class SterileNeutrinoSpectrum extends AbstractParametricFunction {
}
transmission = new NumassTransmission(context, configuration.getMetaOrEmpty("transmission"));
resolution = new NumassResolution(configuration.getMeta("resolution", Meta.empty()));
resolution = new NumassResolution(context, configuration.getMeta("resolution", Meta.empty()));
this.fast = configuration.getBoolean("fast", true);
transRes = new TransRes();
}
@ -148,16 +148,16 @@ public class SterileNeutrinoSpectrum extends AbstractParametricFunction {
}
UnivariateIntegrator integrator;
if(fast){
if (fast) {
if (eMax - u < 300) {
integrator = NumassIntegrator.getFastInterator();
} else if(eMax - u > 2000){
} else if (eMax - u > 2000) {
integrator = NumassIntegrator.getHighDensityIntegrator();
} else {
integrator = NumassIntegrator.getDefaultIntegrator();
}
} else {
} else {
integrator = NumassIntegrator.getHighDensityIntegrator();
}