Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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);
}
}
6 changes: 0 additions & 6 deletions common-tools/coat-libs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@
<artifactId>j4ml-clas12</artifactId>
</dependency>

<dependency>
<groupId>org.jlab.plugins</groupId>
<artifactId>trackfitter</artifactId>
<version>1.0</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-io</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions reconstruction/cvt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.jlab.plugins</groupId>
<artifactId>trackfitter</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public static double getRCUT() {
return RCUT;
}

public static void setRCUT(double r) {
private static void setRCUT(double r) {
RCUT = r;
}

Expand All @@ -281,7 +281,7 @@ public static double getZRANGE() {
return ZRANGE;
}

public static void setZRANGE(double zr) {
private static void setZRANGE(double zr) {
ZRANGE = zr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,7 +21,6 @@ public class CosmicFitter {
private CosmicFitPars _rayfitoutput;

private LineFitPars _linefitparsRhoZ;
private LineFitPars _linefitparsYX;
/**
* Status of the HelicalTrackFit
*/
Expand Down Expand Up @@ -164,7 +163,7 @@ public FitStatus fit2(List<Double> X, List<Double> Y, List<Double> Z, List<Doubl

//Line fits
_linefitYX = new LineFitter();
boolean linefitstatusXYOK = _linefitYX.fitStatus(Y, X, errRt, new ArrayList<>(X.size()), X.size());
_linefitYX.fitStatus(Y, X, errRt, new ArrayList<>(X.size()), X.size());

_linefitRhoZ = new LineFitter();
boolean linefitstatusOK = _linefitRhoZ.fitStatus(Rho, Z, errRho, ErrZ, Z.size());
Expand All @@ -174,7 +173,6 @@ public FitStatus fit2(List<Double> X, List<Double> Y, List<Double> Z, List<Doubl
}
// Get the results of the fits
_linefitparsRhoZ = _linefitRhoZ.getFit();
_linefitparsYX = _linefitYX.getFit();

double fit_tandip = _linefitparsRhoZ.slope();
double fit_Z0 = _linefitparsRhoZ.intercept();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -328,9 +327,9 @@ else if(this.getChi2() > Constants.CHI2CUT * (this.getNDF() + 5))
return false;
if(this.getNDF() < Constants.NDFCUT)
return false;
if(this.getHelix().radius() < Constants.getInstance().getRCUT())
if(this.getHelix().radius() < Constants.getRCUT())
return false;
if(Math.abs(Geometry.getInstance().getTargetZOffset()-this.getHelix().getZ0()) > Geometry.getInstance().getTargetHalfLength()+Constants.getInstance().getZRANGE())
if(Math.abs(Geometry.getInstance().getTargetZOffset()-this.getHelix().getZ0()) > Geometry.getInstance().getTargetHalfLength()+Constants.getZRANGE())
return false;
else
return true;
Expand Down
5 changes: 0 additions & 5 deletions reconstruction/dc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@
<artifactId>snr</artifactId>
<version>14.2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jlab.plugins</groupId>
<artifactId>trackfitter</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>swim-tools</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,8 +36,8 @@ public RecoBankWriter(Banks names) {

public void updateListsWithClusterInfo(List<FittedHit> fhits,
List<FittedCluster> clusters) {
ArrayList rmHits = new ArrayList<FittedHit>();
ArrayList addHits = new ArrayList<FittedHit>();
List<FittedHit> rmHits = new ArrayList<>();
List<FittedHit> addHits = new ArrayList<>();
for (int i = 0; i < clusters.size(); i++) {
clusters.get(i).set_Id(i + 1);
for (int j = 0; j < clusters.get(i).size(); j++) {
Expand Down Expand Up @@ -204,8 +204,6 @@ public DataBank fillHBClustersBank(DataEvent event, List<FittedCluster> cluslist
DataBank bank = event.createBank(name, cluslist.size());

int[] hitIdxArray = new int[12];
if(cluslist==null)
return bank;
for (int i = 0; i < cluslist.size(); i++) {
if (cluslist.get(i) == null || cluslist.get(i).get_Id() == -1) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading