diff --git a/common-tools/clara-io/pom.xml b/common-tools/clara-io/pom.xml index 6b3b0e59c0..1c3a50f9b6 100644 --- a/common-tools/clara-io/pom.xml +++ b/common-tools/clara-io/pom.xml @@ -52,12 +52,11 @@ org.jlab.clas clas-utils 14.2.1-SNAPSHOT - + org.apache.commons commons-text - 1.15.0 diff --git a/common-tools/clas-io/pom.xml b/common-tools/clas-io/pom.xml index 32aa1e67c2..d51e553d66 100644 --- a/common-tools/clas-io/pom.xml +++ b/common-tools/clas-io/pom.xml @@ -18,7 +18,6 @@ org.jlab.coda xmsg - 2.3 @@ -45,7 +44,6 @@ org.jlab.coda et - 14.0 diff --git a/common-tools/clas-jcsg/pom.xml b/common-tools/clas-jcsg/pom.xml index 623abdfa82..03531bcc43 100644 --- a/common-tools/clas-jcsg/pom.xml +++ b/common-tools/clas-jcsg/pom.xml @@ -47,7 +47,6 @@ java3d vecmath - 1.3.1 org.slf4j diff --git a/common-tools/clas-reco/pom.xml b/common-tools/clas-reco/pom.xml index 9a84fdb676..cd69073c41 100644 --- a/common-tools/clas-reco/pom.xml +++ b/common-tools/clas-reco/pom.xml @@ -36,12 +36,6 @@ jar-with-dependencies - - org.jlab.coda - jtools - 2.2 - - cnuphys magfield diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/Clas12Types.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/Clas12Types.java index 4daf8a9c13..656d9b9211 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/Clas12Types.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/Clas12Types.java @@ -5,8 +5,6 @@ import org.jlab.clara.base.error.ClaraException; import org.jlab.clara.engine.ClaraSerializer; import org.jlab.clara.engine.EngineDataType; -import org.jlab.clas12.tools.MimeType; -import org.jlab.clas12.tools.property.JPropertyList; import org.jlab.jnp.hipo4.data.Event; @@ -30,22 +28,9 @@ public Object read(ByteBuffer buffer) throws ClaraException { } } - public static final EngineDataType EVIO = new EngineDataType(MimeType.EVIO.type(), EngineDataType.BYTES.serializer()); + public static final EngineDataType EVIO = new EngineDataType("binary/data-evio", EngineDataType.BYTES.serializer()); public static final EngineDataType HIPO = new EngineDataType("binary/data-hipo", new HipoSerializer()); - public static final EngineDataType PROPERTY_LIST = new EngineDataType(MimeType.PROPERTY_LIST.type(), new ClaraSerializer() { - - @Override - public ByteBuffer write(Object data) throws ClaraException { - JPropertyList pl = (JPropertyList) data; - return ByteBuffer.wrap(pl.getStringRepresentation(true).getBytes()); - } - - @Override - public Object read(ByteBuffer buffer) throws ClaraException { - return new JPropertyList(new String(buffer.array())); - } - }); } diff --git a/common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/utilities/ProbChi2perNDF.java b/common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/utilities/ProbChi2perNDF.java new file mode 100644 index 0000000000..0a67deb03a --- /dev/null +++ b/common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/utilities/ProbChi2perNDF.java @@ -0,0 +1,23 @@ +package org.jlab.clas.tracking.utilities; + +import org.apache.commons.math3.special.Gamma; + +/** Chi-square probability utilities */ +public class ProbChi2perNDF { + + /** + * Returns the upper-tail probability (survival function, or p-value) of the + * chi-square distribution: P(X >= chi2) for X ~ χ²(ndf). + * @param chi2 the chi-square statistic + * @param ndf the number of degrees of freedom + * @return the probability of observing a chi-square value at least as large as {@code chi2}, in the range [0, 1] + */ + public static double prob(double chi2, int ndf) { + if(ndf <= 0) + return 0.0; + if(chi2 <= 0.0) { // edge cases follow ROOT's `TMath::Prob` conventions + return chi2 < 0.0 ? 0.0 : 1.0; + } + return Gamma.regularizedGammaQ(0.5 * ndf, 0.5 * chi2); + } +} diff --git a/common-tools/clas-utils/pom.xml b/common-tools/clas-utils/pom.xml index 4057106f8a..57208d53ee 100644 --- a/common-tools/clas-utils/pom.xml +++ b/common-tools/clas-utils/pom.xml @@ -17,7 +17,6 @@ org.apache.commons commons-text - 1.15.0 org.jlab.clas diff --git a/common-tools/coat-libs/pom.xml b/common-tools/coat-libs/pom.xml index e9a5384fed..098bce4112 100644 --- a/common-tools/coat-libs/pom.xml +++ b/common-tools/coat-libs/pom.xml @@ -24,7 +24,6 @@ org.jlab.coda et - 14.0 @@ -37,24 +36,6 @@ j4ml-clas12 - - org.jama - jamapack - 1.0 - - - - org.jlab.plugins - trackfitter - 1.0 - - - - org.jlab.plugins - jMath - 1.0 - - org.jlab.clas clas-io @@ -145,26 +126,10 @@ 14.2.1-SNAPSHOT - - org.freehep - jminuit - - - - de.erichseifert - vectorgraphics2d - 1.0 - - - - net.objecthunter - exp4j - - - + src/main/resources diff --git a/pom.xml b/pom.xml index e1fee795a0..7ac4c897ac 100644 --- a/pom.xml +++ b/pom.xml @@ -20,13 +20,37 @@ - code.jlab.org-hipo-java + code.jlab.org-hipo-java https://code.jlab.org/api/v4/projects/919/packages/maven - code.jlab.org-clara-java + code.jlab.org-clara-java https://code.jlab.org/api/v4/projects/243/packages/maven + + code.jlab.org-xmsg-java + https://code.jlab.org/api/v4/projects/959/packages/maven + + + code.jlab.org-ccdbrcdb-java + https://code.jlab.org/api/v4/projects/245/packages/maven + + + + + + + + + + + code.jlab.org-groot + https://code.jlab.org/api/v4/projects/388/packages/maven + + + freehep-SLAC + https://srs.slac.stanford.edu/nexus/content/groups/freehep-maven2-public + clasweb-clas12maven https://clasweb.jlab.org/.clas12maven @@ -106,6 +130,12 @@ linux + + java3d + vecmath + 1.3.1 + + org.slf4j slf4j-api @@ -124,29 +154,41 @@ 3.20.0 + + org.apache.commons + commons-text + 1.15.0 + + org.jlab groot - 4.0.5 + 5.0.0 org.freehep - jminuit - 1.0 + freehep-jminuit + 1.0.2 org.jlab.coda jclara - 4.3 + 6.2 + + + + org.jlab.coda + xmsg + 2.5 org.jlab.coda jevio jar-with-dependencies - 6.2-SNAPSHOT + 6.2-SNAPSHOT net.jpountz.lz4 @@ -167,6 +209,12 @@ + + org.jlab.coda + et + 14.0 + + org.jlab.jnp jnp-hipo @@ -176,7 +224,24 @@ org.jlab.jnp jnp-hipo4 - 4.5 + 4.5 + + + + org.jlab.ccdbrcdb + ccdbrcdb + 2.1 + + + + com.google.protobuf + protobuf-java + + @@ -197,12 +262,6 @@ 0.9-SNAPSHOT - - org.jlab.ccdbrcdb - ccdbrcdb - 2.0 - - gov.nist.math jama @@ -212,36 +271,29 @@ ai.djl bom - 0.38.0 + 0.38.0 pom import - + net.objecthunter exp4j 0.4.8 - - - com.google.code.gson - gson - 2.13.1 - - @@ -389,12 +441,7 @@ - - - - com.google.protobuf:protobuf-java - - + diff --git a/reconstruction/alert/pom.xml b/reconstruction/alert/pom.xml index c4baa62486..025d2aaa81 100644 --- a/reconstruction/alert/pom.xml +++ b/reconstruction/alert/pom.xml @@ -137,7 +137,7 @@ ${project.build.directory}/lib/services - ai.djl + ai.djl,com.google.code.gson diff --git a/reconstruction/cvt/pom.xml b/reconstruction/cvt/pom.xml index 9e84e203fd..4f49cd1f7e 100644 --- a/reconstruction/cvt/pom.xml +++ b/reconstruction/cvt/pom.xml @@ -17,7 +17,6 @@ java3d vecmath - 1.3.1 org.jlab @@ -86,11 +85,6 @@ test jar - - org.jlab.plugins - trackfitter - 1.0 - junit junit diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/CosmicFitter.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/CosmicFitter.java index e8032d2aa4..7c15982be8 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/CosmicFitter.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/CosmicFitter.java @@ -6,7 +6,7 @@ import org.jlab.geom.prim.Point3D; import org.jlab.geom.prim.Vector3D; import org.jlab.rec.cvt.trajectory.Ray; -import trackfitter.fitter.utilities.ProbChi2perNDF; +import org.jlab.clas.tracking.utilities.ProbChi2perNDF; /** * A fitter which does sequential fit (for x, y coordinates) and then (for r, z diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/LineFitPars.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/LineFitPars.java index 78aa9c5f56..200e95154d 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/LineFitPars.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/fit/LineFitPars.java @@ -1,7 +1,7 @@ package org.jlab.rec.cvt.fit; import org.jlab.rec.cvt.trajectory.Ray; -import trackfitter.fitter.utilities.ProbChi2perNDF; +import org.jlab.clas.tracking.utilities.ProbChi2perNDF; /** * The fit parameters of a line fit returned by LineFitter diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Track.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Track.java index eea7abe5e6..12fa0704ab 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Track.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Track.java @@ -3,7 +3,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -24,7 +23,7 @@ import org.jlab.rec.cvt.trajectory.Helix; import org.jlab.rec.cvt.trajectory.StateVec; import org.jlab.rec.cvt.trajectory.Trajectory; -import trackfitter.fitter.utilities.ProbChi2perNDF; +import org.jlab.clas.tracking.utilities.ProbChi2perNDF; /** * A class representing track candidates in the CVT. A track has a trajectory diff --git a/reconstruction/dc/pom.xml b/reconstruction/dc/pom.xml index 4e7f4562b3..60aa46f6ac 100644 --- a/reconstruction/dc/pom.xml +++ b/reconstruction/dc/pom.xml @@ -97,11 +97,6 @@ snr 14.2.1-SNAPSHOT - - org.jlab.plugins - trackfitter - 1.0 - org.jlab.clas swim-tools diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/RecoBankWriter.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/RecoBankWriter.java index d018dd3c8d..9029c777eb 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/RecoBankWriter.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/RecoBankWriter.java @@ -13,7 +13,7 @@ import org.jlab.rec.dc.segment.Segment; import org.jlab.rec.dc.track.Track; -import trackfitter.fitter.utilities.*; +import org.jlab.clas.tracking.utilities.ProbChi2perNDF; /** * A class to fill the reconstructed DC banks diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cross/CrossListFinder.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cross/CrossListFinder.java index 5399b2dadb..968139284b 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cross/CrossListFinder.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cross/CrossListFinder.java @@ -15,7 +15,7 @@ import org.jlab.rec.dc.segment.Segment; import org.jlab.rec.dc.timetodistance.TimeToDistanceEstimator; import org.jlab.utils.groups.IndexedTable; -import trackfitter.fitter.LineFitter; +import org.jlab.rec.dc.track.fit.basefit.LineFitter; /** * A class with methods used to find lists of crosses. This is the Pattern Recognition step used in track seeding, to diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/TrackCandListFinder.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/TrackCandListFinder.java index b643cfccc7..ac296a27f1 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/TrackCandListFinder.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/TrackCandListFinder.java @@ -24,8 +24,8 @@ import org.jlab.rec.dc.trajectory.Trajectory; import org.jlab.rec.dc.trajectory.TrajectoryFinder; -import trackfitter.fitter.LineFitPars; -import trackfitter.fitter.LineFitter; +import org.jlab.rec.dc.track.fit.basefit.LineFitter; +import org.jlab.rec.dc.track.fit.basefit.LineFitPars; import org.jlab.clas.tracking.kalmanfilter.Surface; import org.jlab.clas.tracking.kalmanfilter.zReference.KFitter; diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitPars.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitPars.java index 46d078eb01..d6414be29d 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitPars.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitPars.java @@ -1,6 +1,6 @@ package org.jlab.rec.dc.track.fit.basefit; -import trackfitter.fitter.utilities.ProbChi2perNDF; +import org.jlab.clas.tracking.utilities.ProbChi2perNDF; /** * The fit parameters of a line fit returned by LineFitter diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitter.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitter.java index 443db3eb7d..28f3aa6c40 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitter.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/track/fit/basefit/LineFitter.java @@ -1,6 +1,5 @@ package org.jlab.rec.dc.track.fit.basefit; -import java.util.ArrayList; import java.util.List; /** A least square fitting method @@ -15,9 +14,9 @@ public class LineFitter { // the constructor public LineFitter() { } - private final List w = new ArrayList(); + // fit status - public boolean fitStatus(List x, List y, List sigma_x, List sigma_y, int nbpoints) { + public boolean fitStatus(double[] x, double[] y, double[] sigma_x, double[] sigma_y, int nbpoints) { boolean fitStat = false; if (nbpoints>=2) { // must have enough points to do the fit @@ -25,22 +24,21 @@ public boolean fitStatus(List x, List y, List sigma_x, L // initialize weight-sum and moments double Sw, Sx, Sy, Sxx, Sxy; Sw = Sx = Sy = Sxx = Sxy =0.; + double[] w = new double[nbpoints]; - w.clear(); - ((ArrayList) w).ensureCapacity(nbpoints); for (int i = 0; i0 @@ -61,8 +59,8 @@ public boolean fitStatus(List x, List y, List sigma_x, L double chi_2 = 0.; double pointchi_2[] = new double[nbpoints]; //individual chi2 for each fitted point for (int j = 0; j x, List y, List sigma_x, L // if there is a fit return true return fitStat; } + + // fit status (overload) + public boolean fitStatus(List x, List y, List sigma_x, List sigma_y, int nbpoints) { + return fitStatus( + x.stream().mapToDouble(Double::doubleValue).toArray(), + y.stream().mapToDouble(Double::doubleValue).toArray(), + sigma_x.stream().mapToDouble(Double::doubleValue).toArray(), + sigma_y.stream().mapToDouble(Double::doubleValue).toArray(), + nbpoints); + } + // return the fit result public LineFitPars getFit() { return _linefitresult; diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/trajectory/TrajectoryFinder.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/trajectory/TrajectoryFinder.java index 9fa71474d4..320d87e5c1 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/trajectory/TrajectoryFinder.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/trajectory/TrajectoryFinder.java @@ -7,7 +7,7 @@ import org.jlab.geom.prim.Vector3D; import org.jlab.rec.dc.Constants; import org.jlab.rec.dc.cross.Cross; -import trackfitter.fitter.LineFitter; +import org.jlab.rec.dc.track.fit.basefit.LineFitter; import Jama.Matrix; /** diff --git a/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCCluster.java b/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCCluster.java index f6a91e0bf3..1ccc7d5534 100644 --- a/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCCluster.java +++ b/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCCluster.java @@ -7,7 +7,6 @@ import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; -//import org.jMath.Vector.threeVec; import java.util.List; import java.util.ArrayList; import org.jlab.geom.prim.Vector3D; diff --git a/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCClusterCorrection.java b/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCClusterCorrection.java index 086038d90d..59eebc1f8f 100644 --- a/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCClusterCorrection.java +++ b/reconstruction/ltcc/src/main/java/org/jlab/service/ltcc/LTCCClusterCorrection.java @@ -5,8 +5,6 @@ */ package org.jlab.service.ltcc; -//import org.jMath.Vector.threeVec; - import org.jlab.geom.prim.Vector3D; @@ -27,13 +25,13 @@ public class LTCCClusterCorrection { /* * static member function calcPosition * arguments: - - threeVec clusterPos: estimated cluster position from the + - Vector3D clusterPos: estimated cluster position from the reconstruction - double p: track momentum - int charge: track charge - double torus: torus field setting - double solenoid: solenoid field setting - * returns (threeVec): a vector with a more accurate cluster position + * returns (Vector3D): a vector with a more accurate cluster position */ public static Vector3D calcPosition(Vector3D clusterPos, double p, int charge, double torus, double solenoid) { diff --git a/reconstruction/rich/pom.xml b/reconstruction/rich/pom.xml index ec70fcfb6e..99b0df7413 100644 --- a/reconstruction/rich/pom.xml +++ b/reconstruction/rich/pom.xml @@ -16,7 +16,7 @@ org.freehep - jminuit + freehep-jminuit org.jlab.clas diff --git a/reconstruction/rtpc/src/main/java/org/jlab/rec/rtpc/Geometry.java b/reconstruction/rtpc/src/main/java/org/jlab/rec/rtpc/Geometry.java index 9652c3b283..d3d43e8805 100644 --- a/reconstruction/rtpc/src/main/java/org/jlab/rec/rtpc/Geometry.java +++ b/reconstruction/rtpc/src/main/java/org/jlab/rec/rtpc/Geometry.java @@ -4,11 +4,6 @@ import java.io.FileNotFoundException; import java.io.PrintWriter; -/*import org.jMath.Vector.threeVec; - -import trackfitter.surface.Line; -import trackfitter.track.Helix;*/ - public class Geometry { public Geometry() {