diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterFitter.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterFitter.java index 3744a3ff65..e259025272 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterFitter.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterFitter.java @@ -3,36 +3,33 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.jlab.clas.clas.math.FastMath; import org.jlab.detector.geant4.v2.DCGeant4Factory; import org.jlab.geom.prim.Line3D; import org.jlab.geom.prim.Point3D; import org.jlab.geom.prim.Vector3D; -import org.jlab.rec.dc.hit.FittedHit; import org.jlab.rec.dc.track.fit.basefit.LineFitPars; import org.jlab.rec.dc.track.fit.basefit.LineFitter; import org.jlab.rec.dc.Constants; public class ClusterFitter { - /** * Fits a cluster to a line * */ private LineFitPars FitPars; - private final List> FitArray = new ArrayList>(); - private final List x = new ArrayList(); - private final List y = new ArrayList(); - private final List ex = new ArrayList(); - private final List ey = new ArrayList(); + private final List> FitArray = new ArrayList<>(); + private final List x = new ArrayList<>(); + private final List y = new ArrayList<>(); + private final List ex = new ArrayList<>(); + private final List ey = new ArrayList<>(); private final double stereo = Constants.COS6; private String CoordinateSystem; // LC= local, TSC = tilted Sector - public ClusterFitter() { - // TODO Auto-generated constructor stub - } + + public ClusterFitter() {} + public void reset() { for(int i =0; i) ex); FitArray.add((ArrayList) y); FitArray.add((ArrayList) ey); - } + /** * * @param clus fitted cluster @@ -242,23 +232,26 @@ public void SetResidualDerivedParams(FittedCluster clus, boolean calcTimeResidua * @return the fitted cluster with the best fit chi2 */ public FittedCluster BestClusterSelector(List clusters, String system) { - //init + FittedCluster BestCluster = null; double bestChisq = 999999999.; - // double bestClusx0=0; - for (FittedCluster clusCand : clusters) { - if(isBrickWall(clusCand)) { + int size = clusters.size(); + for (int i=0; i clusters, String sy if (chisq < bestChisq) { bestChisq = chisq; - BestCluster = clusCand; - // bestClusx0 = FitArray[0][0]; + BestCluster = clusters.get(i); } } - //SetSegmentLineParameters(bestClusx0, BestCluster) ; return BestCluster; - } /** @@ -306,19 +296,23 @@ private Point3D get_PointOnLine(double d, double the_slope, */ private boolean isBrickWall(FittedCluster clusCand) { boolean isBW = true; - int sumWireNum = 0; - if(clusCand.size()!=6) - isBW=false; - - for(FittedHit hit : clusCand) { - sumWireNum+=hit.get_Wire(); + if (clusCand.size() != 6) { + isBW = false; + } + else { + int sumWireNum = 0; + int size = clusCand.size(); + for (int i=0; i