numass integrator density correction

This commit is contained in:
Alexander Nozik 2017-01-11 11:56:30 +03:00
parent 0959a609bb
commit 20dad21887
8 changed files with 32 additions and 27 deletions

View File

@ -40,9 +40,9 @@ import hep.dataforge.tables.MapPoint;
import hep.dataforge.tables.Table; import hep.dataforge.tables.Table;
import hep.dataforge.tables.XYAdapter; import hep.dataforge.tables.XYAdapter;
import hep.dataforge.values.NamedValueSet; import hep.dataforge.values.NamedValueSet;
import inr.numass.NumassIntegrator;
import inr.numass.models.ExperimentalVariableLossSpectrum; import inr.numass.models.ExperimentalVariableLossSpectrum;
import inr.numass.models.LossCalculator; import inr.numass.models.LossCalculator;
import inr.numass.utils.NumassIntegrator;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; import org.apache.commons.math3.analysis.interpolation.LinearInterpolator;
import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator;

View File

@ -7,8 +7,7 @@ package inr.numass.models;
import hep.dataforge.stat.parametric.ParametricFunction; import hep.dataforge.stat.parametric.ParametricFunction;
import hep.dataforge.values.NamedValueSet; import hep.dataforge.values.NamedValueSet;
import inr.numass.NumassIntegrator; import inr.numass.utils.NumassIntegrator;
import inr.numass.Numass;
import inr.numass.utils.TritiumUtils; import inr.numass.utils.TritiumUtils;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;

View File

@ -16,15 +16,13 @@
package inr.numass.models; package inr.numass.models;
import hep.dataforge.exceptions.NotDefinedException; import hep.dataforge.exceptions.NotDefinedException;
import hep.dataforge.stat.parametric.AbstractParametricFunction;
import hep.dataforge.maths.integration.UnivariateIntegrator; import hep.dataforge.maths.integration.UnivariateIntegrator;
import hep.dataforge.stat.parametric.AbstractParametricFunction;
import hep.dataforge.values.NamedValueSet; import hep.dataforge.values.NamedValueSet;
import inr.numass.NumassIntegrator; import inr.numass.utils.NumassIntegrator;
import static java.lang.Math.exp;
import static java.lang.Math.sqrt;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;
import static java.lang.Math.abs;
import static java.lang.Math.abs; import static java.lang.Math.*;
/** /**
* *

View File

@ -15,7 +15,7 @@
*/ */
package inr.numass.models; package inr.numass.models;
import inr.numass.NumassIntegrator; import inr.numass.utils.NumassIntegrator;
import org.apache.commons.math3.analysis.BivariateFunction; import org.apache.commons.math3.analysis.BivariateFunction;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;

View File

@ -18,8 +18,7 @@ package inr.numass.models;
import hep.dataforge.stat.parametric.AbstractParametricFunction; import hep.dataforge.stat.parametric.AbstractParametricFunction;
import hep.dataforge.stat.parametric.ParametricFunction; import hep.dataforge.stat.parametric.ParametricFunction;
import hep.dataforge.values.NamedValueSet; import hep.dataforge.values.NamedValueSet;
import inr.numass.NumassIntegrator; import inr.numass.utils.NumassIntegrator;
import inr.numass.Numass;
import org.apache.commons.math3.analysis.BivariateFunction; import org.apache.commons.math3.analysis.BivariateFunction;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;

View File

@ -16,17 +16,17 @@
package inr.numass.models; package inr.numass.models;
import hep.dataforge.exceptions.NotDefinedException; import hep.dataforge.exceptions.NotDefinedException;
import hep.dataforge.maths.integration.UnivariateIntegrator;
import hep.dataforge.stat.parametric.AbstractParametricFunction; import hep.dataforge.stat.parametric.AbstractParametricFunction;
import hep.dataforge.stat.parametric.ParametricFunction; import hep.dataforge.stat.parametric.ParametricFunction;
import hep.dataforge.maths.integration.UnivariateIntegrator;
import hep.dataforge.values.NamedValueSet; import hep.dataforge.values.NamedValueSet;
import hep.dataforge.values.ValueProvider; import hep.dataforge.values.ValueProvider;
import inr.numass.NumassIntegrator; import inr.numass.utils.NumassIntegrator;
import inr.numass.Numass;
import java.util.List;
import org.apache.commons.math3.analysis.BivariateFunction; import org.apache.commons.math3.analysis.BivariateFunction;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;
import java.util.List;
/** /**
* *
* @author Darksnake * @author Darksnake

View File

@ -16,8 +16,8 @@ import hep.dataforge.stat.parametric.AbstractParametricBiFunction;
import hep.dataforge.stat.parametric.AbstractParametricFunction; import hep.dataforge.stat.parametric.AbstractParametricFunction;
import hep.dataforge.stat.parametric.ParametricBiFunction; import hep.dataforge.stat.parametric.ParametricBiFunction;
import hep.dataforge.values.NamedValueSet; import hep.dataforge.values.NamedValueSet;
import inr.numass.NumassIntegrator;
import inr.numass.models.FSS; import inr.numass.models.FSS;
import inr.numass.utils.NumassIntegrator;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -148,10 +148,17 @@ public class SterileNeutrinoSpectrum extends AbstractParametricFunction {
} }
UnivariateIntegrator integrator; UnivariateIntegrator integrator;
if (fast && eMax - u < 500) { if(fast){
integrator = NumassIntegrator.getFastInterator(); if (eMax - u < 300) {
} else { integrator = NumassIntegrator.getFastInterator();
integrator = NumassIntegrator.getDefaultIntegrator(); } else if(eMax - u > 2000){
integrator = NumassIntegrator.getHighDensityIntegrator();
} else {
integrator = NumassIntegrator.getDefaultIntegrator();
}
} else {
integrator = NumassIntegrator.getHighDensityIntegrator();
} }
return integrator.integrate(eIn -> fsSource.value(eIn) * transResFunction.value(eIn, u, set), u, eMax); return integrator.integrate(eIn -> fsSource.value(eIn) * transResFunction.value(eIn, u, set), u, eMax);
@ -196,9 +203,9 @@ public class SterileNeutrinoSpectrum extends AbstractParametricFunction {
double secondPart; double secondPart;
if (eIn > border) { if (eIn > border) {
if (fast) { if (fast) {
secondPart = NumassIntegrator.getFastInterator().integrate(integrand, border, eIn);
} else {
secondPart = NumassIntegrator.getDefaultIntegrator().integrate(integrand, border, eIn); secondPart = NumassIntegrator.getDefaultIntegrator().integrate(integrand, border, eIn);
} else {
secondPart = NumassIntegrator.getHighDensityIntegrator().integrate(integrand, border, eIn);
} }
} else { } else {
secondPart = 0; secondPart = 0;

View File

@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package inr.numass; package inr.numass.utils;
import hep.dataforge.maths.integration.GaussRuleIntegrator; import hep.dataforge.maths.integration.GaussRuleIntegrator;
import hep.dataforge.maths.integration.UnivariateIntegrator; import hep.dataforge.maths.integration.UnivariateIntegrator;
@ -14,27 +14,29 @@ import hep.dataforge.maths.integration.UnivariateIntegrator;
*/ */
public class NumassIntegrator { public class NumassIntegrator {
private static double mult = 1.0;
private static UnivariateIntegrator fastInterator; private static UnivariateIntegrator fastInterator;
private static UnivariateIntegrator defaultIntegrator; private static UnivariateIntegrator defaultIntegrator;
private static UnivariateIntegrator highDensityIntegrator; private static UnivariateIntegrator highDensityIntegrator;
public static UnivariateIntegrator getFastInterator() { public static UnivariateIntegrator getFastInterator() {
if (fastInterator == null) { if (fastInterator == null) {
fastInterator = new GaussRuleIntegrator(100); fastInterator = new GaussRuleIntegrator((int) (mult*100));
} }
return fastInterator; return fastInterator;
} }
public static UnivariateIntegrator getDefaultIntegrator() { public static UnivariateIntegrator getDefaultIntegrator() {
if (defaultIntegrator == null) { if (defaultIntegrator == null) {
defaultIntegrator = new GaussRuleIntegrator(300); defaultIntegrator = new GaussRuleIntegrator((int) (mult*300));
} }
return defaultIntegrator; return defaultIntegrator;
} }
public static UnivariateIntegrator getHighDensityIntegrator() { public static UnivariateIntegrator getHighDensityIntegrator() {
if (highDensityIntegrator == null) { if (highDensityIntegrator == null) {
highDensityIntegrator = new GaussRuleIntegrator(500); highDensityIntegrator = new GaussRuleIntegrator((int) (mult*500));
} }
return highDensityIntegrator; return highDensityIntegrator;
} }