From ae18bb66ec936cd8a025d2c400a8b53273aec453 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 2 Aug 2017 14:54:19 +0300 Subject: [PATCH] site update --- .../numass/scripts/LossTailCalculation.groovy | 21 ++++---- .../numass/scripts/PrintLossFunctions.groovy | 52 ++++++++++++------- .../inr/numass/models/LossCalculator.java | 12 ++--- 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy b/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy index 776daf7a..147d00ad 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy @@ -6,25 +6,26 @@ package inr.numass.scripts -import hep.dataforge.maths.integration.GaussRuleIntegrator; -import hep.dataforge.maths.integration.UnivariateIntegrator; -import inr.numass.models.LossCalculator; +import hep.dataforge.maths.integration.GaussRuleIntegrator +import hep.dataforge.maths.integration.UnivariateIntegrator +import inr.numass.models.LossCalculator import org.apache.commons.math3.analysis.UnivariateFunction 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); 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,0,cutoff) + integrator.integrate(loss,cutoff,3000d)); diff --git a/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy b/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy index 14e54d92..54293e9e 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy @@ -8,39 +8,53 @@ package inr.numass.scripts 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); printf("%8s\t%8s\t%8s\t%8s\t%n", - "eps", - "p1", - "p2", - "p3" + "eps", + "p1", + "p2", + "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 ef = ei-d; + double ef = ei - d; printf("%8f\t%8f\t%8f\t%8f\t%n", - d, - lossProbs[1]*loss.getLossValue(1,ei,ef), - lossProbs[2]*loss.getLossValue(2,ei,ef), - lossProbs[3]*loss.getLossValue(3,ei,ef) + d, + lossProbs[1] * singleScatter.value(ei - ef), + lossProbs[2] * loss.getLossValue(2, 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 ef = ei-d; + double ef = ei - d; printf("%8f\t%8f\t%8f\t%8f\t%n", - d, - lossProbs[1]*loss.getLossValue(1,ei,ef), - lossProbs[2]*loss.getLossValue(2,ei,ef), - lossProbs[3]*loss.getLossValue(3,ei,ef) + d, + lossProbs[1] * singleScatter.value(ei - ef), + lossProbs[2] * loss.getLossValue(2, ei, ef), + lossProbs[3] * loss.getLossValue(3, ei, ef) ) } diff --git a/numass-main/src/main/java/inr/numass/models/LossCalculator.java b/numass-main/src/main/java/inr/numass/models/LossCalculator.java index de7e506c..91a72f44 100644 --- a/numass-main/src/main/java/inr/numass/models/LossCalculator.java +++ b/numass-main/src/main/java/inr/numass/models/LossCalculator.java @@ -178,12 +178,12 @@ public class LossCalculator { final LossCalculator loss = LossCalculator.instance; final List probs = loss.getGunLossProbabilities(set.getDouble("X")); 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++) { final int j = i; 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) -> { @@ -197,11 +197,11 @@ public class LossCalculator { 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 { - 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) { assert order > 0; - return (double Ei, double Ef) -> { - return getLossValue(order, Ei, Ef); - }; + return (double Ei, double Ef) -> getLossValue(order, Ei, Ef); } public List getLossProbDerivs(double X) {