merge heads

This commit is contained in:
Alexander Nozik 2017-08-03 10:14:40 +03:00
commit 8dd7870220
3 changed files with 49 additions and 36 deletions

View File

@ -6,25 +6,26 @@
package inr.numass.scripts package inr.numass.scripts
import hep.dataforge.maths.integration.GaussRuleIntegrator; import hep.dataforge.maths.integration.GaussRuleIntegrator
import hep.dataforge.maths.integration.UnivariateIntegrator; import hep.dataforge.maths.integration.UnivariateIntegrator
import inr.numass.models.LossCalculator; import inr.numass.models.LossCalculator
import org.apache.commons.math3.analysis.UnivariateFunction import org.apache.commons.math3.analysis.UnivariateFunction
UnivariateIntegrator integrator = new GaussRuleIntegrator(400); UnivariateIntegrator integrator = new GaussRuleIntegrator(400);
def exPos = 12.878;
def ionPos = 13.86;
def exW = 1.32;
def ionW = 12.47;
def exIonRatio = 3.96;
def cutoff = 25d def exPos = 12.587;
def ionPos = 11.11;
def exW = 1.20;
def ionW = 11.02;
def exIonRatio = 2.43;
def cutoff = 20d
UnivariateFunction loss = LossCalculator.getSingleScatterFunction(exPos, ionPos, exW, ionW, exIonRatio); UnivariateFunction loss = LossCalculator.getSingleScatterFunction(exPos, ionPos, exW, ionW, exIonRatio);
println integrator.integrate(loss,0,600); println integrator.integrate(loss,0,600);
println integrator.integrate(loss,0,cutoff); println integrator.integrate(loss,0, cutoff);
println integrator.integrate(loss,cutoff,600d); println integrator.integrate(loss,cutoff,600d);
println (integrator.integrate(loss,0,cutoff) + integrator.integrate(loss,cutoff,3000d)); println (integrator.integrate(loss,0,cutoff) + integrator.integrate(loss,cutoff,3000d));

View File

@ -8,39 +8,53 @@ package inr.numass.scripts
import inr.numass.models.LossCalculator import inr.numass.models.LossCalculator
LossCalculator loss = new LossCalculator(); LossCalculator loss = LossCalculator.instance()
def X = 0.6 def X = 0.34
def lossProbs = loss.getGunLossProbabilities(X); def lossProbs = loss.getGunLossProbabilities(X);
printf("%8s\t%8s\t%8s\t%8s\t%n", printf("%8s\t%8s\t%8s\t%8s\t%n",
"eps", "eps",
"p1", "p1",
"p2", "p2",
"p3" "p3"
) )
def singleScatter = loss.getSingleScatterFunction(); /*
'exPos' = 12.587 ± 0.049
'ionPos' = 11.11 ± 0.50
'exW' = 1.20 ± 0.12
'ionW' = 11.02 ± 0.68
'exIonRatio' = 2.43 ± 0.42
*/
for(double d = 0; d < 30; d += 0.3){ def singleScatter = loss.getSingleScatterFunction(
12.587,
11.11,
1.20,
11.02,
2.43
);
for (double d = 0; d < 30; d += 0.3) {
double ei = 18500; double ei = 18500;
double ef = ei-d; double ef = ei - d;
printf("%8f\t%8f\t%8f\t%8f\t%n", printf("%8f\t%8f\t%8f\t%8f\t%n",
d, d,
lossProbs[1]*loss.getLossValue(1,ei,ef), lossProbs[1] * singleScatter.value(ei - ef),
lossProbs[2]*loss.getLossValue(2,ei,ef), lossProbs[2] * loss.getLossValue(2, ei, ef),
lossProbs[3]*loss.getLossValue(3,ei,ef) lossProbs[3] * loss.getLossValue(3, ei, ef)
) )
} }
for(double d = 30; d < 100; d += 1){ for (double d = 30; d < 100; d += 1) {
double ei = 18500; double ei = 18500;
double ef = ei-d; double ef = ei - d;
printf("%8f\t%8f\t%8f\t%8f\t%n", printf("%8f\t%8f\t%8f\t%8f\t%n",
d, d,
lossProbs[1]*loss.getLossValue(1,ei,ef), lossProbs[1] * singleScatter.value(ei - ef),
lossProbs[2]*loss.getLossValue(2,ei,ef), lossProbs[2] * loss.getLossValue(2, ei, ef),
lossProbs[3]*loss.getLossValue(3,ei,ef) lossProbs[3] * loss.getLossValue(3, ei, ef)
) )
} }

View File

@ -178,12 +178,12 @@ public class LossCalculator {
final LossCalculator loss = LossCalculator.instance; final LossCalculator loss = LossCalculator.instance;
final List<Double> probs = loss.getGunLossProbabilities(set.getDouble("X")); final List<Double> probs = loss.getGunLossProbabilities(set.getDouble("X"));
UnivariateFunction single = (double e) -> probs.get(1) * scatterFunction.value(e); UnivariateFunction single = (double e) -> probs.get(1) * scatterFunction.value(e);
frame.add(PlottableXYFunction.plotFunction("Single scattering", x -> single.value(x), 0, 100, 1000)); frame.add(PlottableXYFunction.plotFunction("Single scattering", single::value, 0, 100, 1000));
for (int i = 2; i < probs.size(); i++) { for (int i = 2; i < probs.size(); i++) {
final int j = i; final int j = i;
UnivariateFunction scatter = (double e) -> probs.get(j) * loss.getLossValue(j, e, 0d); UnivariateFunction scatter = (double e) -> probs.get(j) * loss.getLossValue(j, e, 0d);
frame.add(PlottableXYFunction.plotFunction(j + " scattering", x -> scatter.value(x), 0, 100, 1000)); frame.add(PlottableXYFunction.plotFunction(j + " scattering", scatter::value, 0, 100, 1000));
} }
UnivariateFunction total = (eps) -> { UnivariateFunction total = (eps) -> {
@ -197,11 +197,11 @@ public class LossCalculator {
return sum; return sum;
}; };
frame.add(PlottableXYFunction.plotFunction("Total loss", x -> total.value(x), 0, 100, 1000)); frame.add(PlottableXYFunction.plotFunction("Total loss", total::value, 0, 100, 1000));
} else { } else {
frame.add(PlottableXYFunction.plotFunction("Differential crosssection", x -> scatterFunction.value(x), 0, 100, 2000)); frame.add(PlottableXYFunction.plotFunction("Differential crosssection", scatterFunction::value, 0, 100, 2000));
} }
} }
@ -261,9 +261,7 @@ public class LossCalculator {
public BivariateFunction getLossFunction(int order) { public BivariateFunction getLossFunction(int order) {
assert order > 0; assert order > 0;
return (double Ei, double Ef) -> { return (double Ei, double Ef) -> getLossValue(order, Ei, Ef);
return getLossValue(order, Ei, Ef);
};
} }
public List<Double> getLossProbDerivs(double X) { public List<Double> getLossProbDerivs(double X) {