diff --git a/common-tools/cnuphys/magfield/src/main/java/cnuphys/magfield/CompositeField.java b/common-tools/cnuphys/magfield/src/main/java/cnuphys/magfield/CompositeField.java index c9b2820da7..7a279a6a75 100644 --- a/common-tools/cnuphys/magfield/src/main/java/cnuphys/magfield/CompositeField.java +++ b/common-tools/cnuphys/magfield/src/main/java/cnuphys/magfield/CompositeField.java @@ -69,13 +69,12 @@ public String getName() { * @return true if we have a torus */ public boolean hasTorus() { - for (IMagField field : this) { - if (field instanceof Torus) { - return true; - } - } - - return false; + for (int i=0; itrue if we have a solenoid */ public boolean hasSolenoid() { - for (IMagField field : this) { - if (field instanceof Solenoid) { + for (int i=0; itrue if we have a transverse solenoid */ public boolean hasTransverseSolenoid() { - for (IMagField field : this) { - if (field instanceof TransverseSolenoid) { + for (int i=0; i> 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,23 @@ 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)) { + 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 +293,22 @@ 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; + for (int i=0; i