diff --git a/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy b/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy index 109b4dce..58043af0 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy @@ -8,6 +8,7 @@ package inr.numass.scripts import hep.dataforge.grind.Grind import hep.dataforge.values.Values +import inr.numass.data.NumassPoint import inr.numass.data.NumassPointImpl import inr.numass.data.RawNMPoint import inr.numass.storage.NumassDataLoader @@ -43,18 +44,18 @@ def data = NumassDataLoader.fromLocalDir(null, dataDir).getNMPoints() //) //Simulation process -Map> res = [:] +Map> res = [:] -List generated = new ArrayList<>(); -List registered = new ArrayList<>(); -List firstIteration = new ArrayList<>(); -List secondIteration = new ArrayList<>(); -List pileup = new ArrayList<>(); +List generated = new ArrayList<>(); +List registered = new ArrayList<>(); +List firstIteration = new ArrayList<>(); +List secondIteration = new ArrayList<>(); +List pileup = new ArrayList<>(); lowerChannel = 400; upperChannel = 1800; -PileUpSimulator buildSimulator(NumassPointImpl point, double cr, NumassPointImpl reference = null, boolean extrapolate = true, double scale = 1d) { +PileUpSimulator buildSimulator(NumassPointImpl point, double cr, NumassPoint reference = null, boolean extrapolate = true, double scale = 1d) { def cfg = Grind.buildMeta(cr: cr) { pulser(mean: 3450, sigma: 86.45, freq: 66.43) } @@ -88,7 +89,7 @@ PileUpSimulator buildSimulator(NumassPointImpl point, double cr, NumassPointImpl return new PileUpSimulator(point.length * scale, rnd, generator).withUset(point.voltage).generate(); } -static double adjustCountRate(PileUpSimulator simulator, NumassPointImpl point) { +double adjustCountRate(PileUpSimulator simulator, NumassPointImpl point) { double generatedInChannel = simulator.generated().getCountInWindow(lowerChannel, upperChannel); double registeredInChannel = simulator.registered().getCountInWindow(lowerChannel, upperChannel); return (generatedInChannel / registeredInChannel) * (point.getCountInWindow(lowerChannel, upperChannel) / point.getLength()); @@ -100,7 +101,7 @@ data.forEach { point -> PileUpSimulator simulator = buildSimulator(point, cr); //second iteration to exclude pileup overlap - NumassPointImpl pileupPoint = simulator.pileup(); + NumassPoint pileupPoint = simulator.pileup(); firstIteration.add(simulator.registered()); //updating count rate diff --git a/numass-main/src/main/java/inr/numass/actions/MergeDataAction.java b/numass-main/src/main/java/inr/numass/actions/MergeDataAction.java index 2e3101db..a7dc7d67 100644 --- a/numass-main/src/main/java/inr/numass/actions/MergeDataAction.java +++ b/numass-main/src/main/java/inr/numass/actions/MergeDataAction.java @@ -124,7 +124,7 @@ public class MergeDataAction extends ManyToOneAction { ValueMap.Builder map = new ValueMap(parnames, Uset, Uread, time, total, wind, cr, crErr).builder(); - if (dp1.names().contains("relCR") && dp2.names().contains("relCR")) { + if (dp1.getNames().contains("relCR") && dp2.getNames().contains("relCR")) { double relCR = (dp1.getDouble("relCR") + dp2.getDouble("relCR")) / 2; map.putValue("relCR", relCR); map.putValue("relCRerr", crErr * relCR / cr); @@ -137,7 +137,7 @@ public class MergeDataAction extends ManyToOneAction { //Сливаем все точки в один набор данных Map> points = new LinkedHashMap<>(); for (Table d : ds) { - if (!d.getFormat().names().contains(parnames)) { + if (!d.getFormat().getNames().contains(parnames)) { throw new IllegalArgumentException(); } for (Values dp : d) { diff --git a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java index 9ef47c53..1a0ca6af 100644 --- a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java +++ b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java @@ -98,7 +98,7 @@ public class MonitorCorrectAction extends OneToOneAction { double pointErr = dp.getValue("CRerr").doubleValue() / getCR(dp); double err = Math.sqrt(corrErr * corrErr + pointErr * pointErr) * getCR(dp); - if (dp.names().contains("Monitor")) { + if (dp.getNames().contains("Monitor")) { pb.putValue("Monitor", Value.of(dp.getValue("Monitor").doubleValue() / corrFactor)); } else { pb.putValue("Monitor", corrFactor); @@ -109,7 +109,7 @@ public class MonitorCorrectAction extends OneToOneAction { pb.putValue("CRerr", Value.of(err)); } else { double corrFactor = dp.getValue("CR").doubleValue() / norm; - if (dp.names().contains("Monitor")) { + if (dp.getNames().contains("Monitor")) { pb.putValue("Monitor", Value.of(dp.getValue("Monitor").doubleValue() / corrFactor)); } else { pb.putValue("Monitor", corrFactor); diff --git a/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java b/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java index 87fb1050..de8bb565 100644 --- a/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java +++ b/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java @@ -62,8 +62,8 @@ public class SpectrumInformation { if (names.length == 0) { names = source.namesAsArray(); } - assert source.names().contains(set.namesAsArray()); - assert source.names().contains(names); + assert source.getNames().contains(set.namesAsArray()); + assert source.getNames().contains(names); RealMatrix res = new Array2DRowRealMatrix(names.length, names.length); for (Values dp : data) { @@ -84,14 +84,14 @@ public class SpectrumInformation { } public NamedMatrix getPointInfoMatrix(Values set, double x, double t, String... parNames) { - assert source.names().contains(set.namesAsArray()); + assert source.getNames().contains(set.namesAsArray()); String[] names = parNames; if (names.length == 0) { names = set.namesAsArray(); } - assert source.names().contains(names); + assert source.getNames().contains(names); RealMatrix res = new Array2DRowRealMatrix(names.length, names.length); diff --git a/numass-main/src/main/java/inr/numass/models/GaussResolution.java b/numass-main/src/main/java/inr/numass/models/GaussResolution.java index 1d678bb8..d772c9fd 100644 --- a/numass-main/src/main/java/inr/numass/models/GaussResolution.java +++ b/numass-main/src/main/java/inr/numass/models/GaussResolution.java @@ -25,7 +25,7 @@ import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; import org.apache.commons.math3.analysis.integration.UnivariateIntegrator; -import static hep.dataforge.names.NamedUtils.combineNamesWithEquals; +import static hep.dataforge.names.NamesUtils.combineNamesWithEquals; import static java.lang.Double.isNaN; import static java.lang.Math.*; diff --git a/numass-main/src/main/java/inr/numass/models/GaussSourceSpectrum.java b/numass-main/src/main/java/inr/numass/models/GaussSourceSpectrum.java index b944eb4b..e4606d05 100644 --- a/numass-main/src/main/java/inr/numass/models/GaussSourceSpectrum.java +++ b/numass-main/src/main/java/inr/numass/models/GaussSourceSpectrum.java @@ -81,7 +81,7 @@ public class GaussSourceSpectrum extends AbstractParametricFunction implements R @Override public boolean providesDeriv(String name) { - return this.names().contains(name); + return this.getNames().contains(name); } @Override diff --git a/numass-main/src/main/java/inr/numass/models/GunSpectrum.java b/numass-main/src/main/java/inr/numass/models/GunSpectrum.java index 7a72b025..7a2fde67 100644 --- a/numass-main/src/main/java/inr/numass/models/GunSpectrum.java +++ b/numass-main/src/main/java/inr/numass/models/GunSpectrum.java @@ -93,7 +93,7 @@ public class GunSpectrum extends AbstractParametricFunction { @Override public boolean providesDeriv(String name) { // return false; - return this.names().contains(name); + return this.getNames().contains(name); } double transmissionValue(double U, double E, double resA, double resB) { diff --git a/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java b/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java index 915ec5b4..c465bd2d 100644 --- a/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java +++ b/numass-main/src/main/java/inr/numass/models/GunTailSpectrum.java @@ -45,7 +45,7 @@ public class GunTailSpectrum implements RangedNamedSetSpectrum { } @Override - public Names names() { + public Names getNames() { return Names.of(list); } 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 6aa033fa..de7e506c 100644 --- a/numass-main/src/main/java/inr/numass/models/LossCalculator.java +++ b/numass-main/src/main/java/inr/numass/models/LossCalculator.java @@ -174,7 +174,7 @@ public class LossCalculator { UnivariateFunction scatterFunction = getSingleScatterFunction(exPos, ionPos, exW, ionW, exIonRatio); - if (set.names().contains("X")) { + if (set.getNames().contains("X")) { final LossCalculator loss = LossCalculator.instance; final List probs = loss.getGunLossProbabilities(set.getDouble("X")); UnivariateFunction single = (double e) -> probs.get(1) * scatterFunction.value(e); diff --git a/numass-main/src/main/java/inr/numass/models/ModularSpectrum.java b/numass-main/src/main/java/inr/numass/models/ModularSpectrum.java index 639951d6..4ea1e4a1 100644 --- a/numass-main/src/main/java/inr/numass/models/ModularSpectrum.java +++ b/numass-main/src/main/java/inr/numass/models/ModularSpectrum.java @@ -15,7 +15,7 @@ */ package inr.numass.models; -import hep.dataforge.names.NamedUtils; +import hep.dataforge.names.NamesUtils; import hep.dataforge.stat.parametric.AbstractParametricFunction; import hep.dataforge.stat.parametric.ParametricFunction; import hep.dataforge.values.ValueProvider; @@ -54,7 +54,7 @@ public class ModularSpectrum extends AbstractParametricFunction { * @param cacheMax - верхняя граница кэширования. */ public ModularSpectrum(RangedNamedSetSpectrum source, BivariateFunction resolution, double cacheMin, double cacheMax) { - super(NamedUtils.combineNamesWithEquals(list, source.namesAsArray())); + super(NamesUtils.combineNamesWithEquals(list, source.namesAsArray())); if (cacheMin >= cacheMax) { throw new IllegalArgumentException(); } @@ -163,7 +163,7 @@ public class ModularSpectrum extends AbstractParametricFunction { case "trap": return this.trappingCache.value(U, set); default: - if (sourceSpectrum.names().contains(parName)) { + if (sourceSpectrum.getNames().contains(parName)) { List probs = calculator.getLossProbabilities(X); updateScatterCache(probs.size() - 1); double sum = 0; diff --git a/numass-main/src/main/java/inr/numass/models/NBkgSpectrum.java b/numass-main/src/main/java/inr/numass/models/NBkgSpectrum.java index 83e45183..04416cda 100644 --- a/numass-main/src/main/java/inr/numass/models/NBkgSpectrum.java +++ b/numass-main/src/main/java/inr/numass/models/NBkgSpectrum.java @@ -21,7 +21,7 @@ import hep.dataforge.utils.MultiCounter; import hep.dataforge.values.ValueProvider; import hep.dataforge.values.Values; -import static hep.dataforge.names.NamedUtils.combineNamesWithEquals; +import static hep.dataforge.names.NamesUtils.combineNamesWithEquals; /** * diff --git a/numass-main/src/main/java/inr/numass/models/NamedSpectrumCaching.java b/numass-main/src/main/java/inr/numass/models/NamedSpectrumCaching.java index 02e19eaf..65d73aa3 100644 --- a/numass-main/src/main/java/inr/numass/models/NamedSpectrumCaching.java +++ b/numass-main/src/main/java/inr/numass/models/NamedSpectrumCaching.java @@ -110,7 +110,7 @@ public class NamedSpectrumCaching extends AbstractParametricFunction { } protected boolean sameSet(Values set1, Values set2) { - for (String name : this.names()) { + for (String name : this.getNames()) { if (!Objects.equals(set1.getDouble(name), set2.getDouble(name))) { return false; } diff --git a/numass-main/src/main/java/inr/numass/tasks/NumassTableFilterTask.java b/numass-main/src/main/java/inr/numass/tasks/NumassTableFilterTask.java index 67ee23aa..f01259f9 100644 --- a/numass-main/src/main/java/inr/numass/tasks/NumassTableFilterTask.java +++ b/numass-main/src/main/java/inr/numass/tasks/NumassTableFilterTask.java @@ -70,7 +70,7 @@ public class NumassTableFilterTask extends SingleActionTask { private Map unbox(Values dp) { Map res = new HashMap<>(); - for (String field : dp.names()) { + for (String field : dp.getNames()) { Value val = dp.getValue(field); Object obj; switch (val.valueType()) { diff --git a/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java b/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java index 30d41747..8ffd31ae 100644 --- a/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java +++ b/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java @@ -148,7 +148,7 @@ public class MspViewController implements Encapsulated { private Collection joinNames(List loaders) { Set nameSet = new TreeSet<>(new AlphanumComparator()); for (PointLoader loader : loaders) { - nameSet.addAll(loader.getFormat().names().asList()); + nameSet.addAll(loader.getFormat().getNames().asList()); } return nameSet;