From 7c418aaaf74033df7593eb4ba846f644d26e5d4a Mon Sep 17 00:00:00 2001 From: Veronique Ziegler Date: Fri, 1 Nov 2024 18:59:45 -0400 Subject: [PATCH] Iss117 cvt bmtc seed mv tar (#358) * Use Sla for straight tracks Add debug statement for RZ cross list finder * Fix to take the beam spot correctly into account at seeding level. * version bump * version bump * applying global CVT position shift to passive surfaces * Take into account beam spot in global track propagation to a given radius. * Take into account beam spot in updating the cross in seeding. --------- Co-authored-by: ziegler Co-authored-by: Raffaella De Vita --- .../detector/geant4/v2/SVT/SVTConstants.java | 13 +++- .../geant4/v2/SVT/SVTVolumeFactory.java | 3 +- .../org/jlab/rec/cvt/bmt/BMTConstants.java | 1 + .../org/jlab/rec/cvt/bmt/BMTGeometry.java | 2 + .../jlab/rec/cvt/bmt/CCDBConstantsLoader.java | 4 +- .../rec/cvt/services/CVTReconstruction.java | 4 ++ .../jlab/rec/cvt/services/RecUtilities.java | 19 +++--- .../rec/cvt/services/TracksFromTargetRec.java | 63 ++++++++++--------- .../org/jlab/rec/cvt/svt/SVTGeometry.java | 3 + .../java/org/jlab/rec/cvt/track/Seed.java | 14 +++-- .../rec/cvt/track/StraightTrackSeeder.java | 11 ++-- .../java/org/jlab/rec/cvt/track/Track.java | 6 +- .../org/jlab/rec/cvt/track/TrackSeeder.java | 17 ++--- .../org/jlab/rec/cvt/track/TrackSeederRZ.java | 2 +- .../org/jlab/rec/cvt/track/TrackSeederXY.java | 12 ++-- .../org/jlab/rec/cvt/trajectory/Helix.java | 8 +-- runtest.sh | 3 + 17 files changed, 114 insertions(+), 71 deletions(-) create mode 100644 runtest.sh diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java index a96bd20df..dd7c9275a 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTConstants.java @@ -40,6 +40,7 @@ public class SVTConstants { // data for alignment shifts // private static String filenameSectorShiftData = null; + private static double[] GLOBALSHIFTDATA = null; private static double[][][] LAYERSHIFTDATA = null; //private static double[][] LAYERSHIFTDATA = null; @@ -429,7 +430,8 @@ else if( value == "tube" ) // offset by boxNum to reset row for CCDB table double xpos = cp.getDouble(ccdbPath+"position/x", 0 ); double ypos = cp.getDouble(ccdbPath+"position/y", 0 ); double zpos = cp.getDouble(ccdbPath+"position/z", 0 ); - + GLOBALSHIFTDATA = new double[]{xpos, ypos, zpos, 0, 0, 1, 0}; + // double[] myShift = {0, 0, 0, -Math.toRadians(0), 0, 0, 0}; LAYERSHIFTDATA = new double[NSECTORS[3]][NLAYERS-2][]; for( int i = 0; i < (NTOTALSECTORS-NSECTORS[3])*2; i++ ) // layeralignment tables doesn't cover region 4 @@ -834,5 +836,14 @@ public static double[][][] getLayerSectorAlignmentData() { return LAYERSHIFTDATA; } + /** + * Returns the layer/sector alignment data + * @return + */ + public static double[] getGlobalAlignmentData() { + if(GLOBALSHIFTDATA == null ) { System.err.println("error: SVTConstants.getGlobalAlignmentData: GLOBALSHIFTDATA requested is null"); } + return GLOBALSHIFTDATA; + } + } diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTVolumeFactory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTVolumeFactory.java index dce713687..a30966c03 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTVolumeFactory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/SVT/SVTVolumeFactory.java @@ -223,7 +223,7 @@ public void makeVolumes() if( BUILDSENSORS ) System.out.println(" include sensor active and dead zones ? "+ BUILDSENSORZONES ); //System.out.println(" halve dimensions of boxes ? "+ HALFBOXES ); - this.makeCage(); + this.makeCage(); for( int region = regionMin-1; region < regionMax; region++ ) // NREGIONS { @@ -278,6 +278,7 @@ public void makeVolumes() }*/ // FIXME currently using shifts from bottom module of each region + // FIXME global shift should be applied to mother volume AlignmentFactory.applyShift( sectorVol, SVTConstants.getLayerSectorAlignmentData()[sector][region*2], fidTri3D.center(), scaleT, scaleR ); //System.out.println("S "+sectorVol.gemcString() ); } diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTConstants.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTConstants.java index 52e5064ab..8bd0bfb83 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTConstants.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTConstants.java @@ -83,6 +83,7 @@ private BMTConstants() { public static Line3D[][] AXES = new Line3D[NLAYERS][NSECTORS]; // detector AXES public static Transformation3D[][] TOLOCAL = new Transformation3D[NLAYERS][NSECTORS]; public static Transformation3D[][] TOGLOBAL = new Transformation3D[NLAYERS][NSECTORS]; + public static Transformation3D TOPOSITION = null; public static double[] ThetaL_grid = new double[405]; //Lorentz angle grid public static double[] E_grid = new double[405]; //Electric field value of the grid public static double[] B_grid = new double[405]; //Magnetic field value of the grid diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTGeometry.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTGeometry.java index 770b2d3e4..671c3b26a 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTGeometry.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/BMTGeometry.java @@ -954,6 +954,7 @@ public Surface getInnerTube() { Vector3D axis = new Vector3D(0,0,1); Arc3D base = new Arc3D(origin, center, axis, 2*Math.PI); Cylindrical3D tube = new Cylindrical3D(base, 2*INNERTUBEDIM[2]); + BMTConstants.TOPOSITION.apply(tube); Surface surface = new Surface(tube, new Strip(0,0,0), Constants.DEFAULTSWIMACC); surface.addMaterial("CarbonFiber", INNERTUBEDIM[1]-INNERTUBEDIM[0], TUBEMAT[0], TUBEMAT[1], TUBEMAT[2], TUBEMAT[3], Units.MM); @@ -967,6 +968,7 @@ public Surface getOuterTube() { Vector3D axis = new Vector3D(0,0,1); Arc3D base = new Arc3D(origin, center, axis, 2*Math.PI); Cylindrical3D tube = new Cylindrical3D(base, 2*OUTERTUBEDIM[2]); + BMTConstants.TOPOSITION.apply(tube); Surface surface = new Surface(tube, new Strip(0,0,0), Constants.DEFAULTSWIMACC); surface.addMaterial("CarbonFiber", OUTERTUBEDIM[1]-OUTERTUBEDIM[0], TUBEMAT[0], TUBEMAT[1], TUBEMAT[2], TUBEMAT[3], Units.MM); diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/CCDBConstantsLoader.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/CCDBConstantsLoader.java index 00a147908..3cfad3e2d 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/CCDBConstantsLoader.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/bmt/CCDBConstantsLoader.java @@ -224,13 +224,15 @@ public static final synchronized void Load(DatabaseConstantProvider dbprovider) gemcCenter.rotateY(Math.toRadians(gemcRot.y())); gemcCenter.rotateX(Math.toRadians(gemcRot.x())); gemcShift.translateXYZ(-gemcCenter.x(), -gemcCenter.y(), -gemcCenter.z()); + BMTConstants.TOPOSITION = new Transformation3D(); + BMTConstants.TOPOSITION.translateXYZ(xpos+gemcShift.x(), ypos+gemcShift.y(), zpos+gemcShift.z()); for (int row = 0; row reFit(List seedlist, Swim swimmer, StraightTrackSeeder trseed) { + public List reFit(List seedlist, Swim swimmer, StraightTrackSeeder trseed, double xb, double yb) { List filtlist = new ArrayList<>(); if(seedlist==null) return filtlist; for (Seed bseed : seedlist) { if(bseed == null) continue; - List fseeds = this.reFitSeed(bseed, trseed); + List fseeds = this.reFitSeed(bseed, trseed, xb, yb); if(fseeds!=null) { filtlist.addAll(fseeds); } @@ -435,7 +435,7 @@ public List reFit(List seedlist, Swim swimmer, StraightTrackSeeder return filtlist; } - public List reFitSeed(Seed bseed, StraightTrackSeeder trseed) { + public List reFitSeed(Seed bseed, StraightTrackSeeder trseed, double xb, double yb) { List refib = new ArrayList<>(); List refi = new ArrayList<>(); @@ -461,7 +461,7 @@ public List reFitSeed(Seed bseed, StraightTrackSeeder trseed) { } } Collections.sort(refi); - List seedlist = trseed.findSeed(refi, refib, false); + List seedlist = trseed.findSeed(refi, refib, false, xb, yb); return seedlist; } @@ -497,7 +497,7 @@ public boolean reFitCircle(Seed seed, int iter, double xb, double yb) { seed.getHelix().setCurvature(pars.rho()); seed.getHelix().setDCA(-pars.doca()); seed.getHelix().setPhiAtDCA(pars.phi()); - seed.update_Crosses(); + seed.update_Crosses(xb,yb); } } return fitStatus; @@ -762,7 +762,8 @@ public double[][] getCovMatInTrackRep(Track trk) { return tCov; } - public List findCrossesFromClustersOnTrk(List allCrosses, List clsOnTrack, Track track) { + public List findCrossesFromClustersOnTrk(List allCrosses, List clsOnTrack, + Track track, double xb, double yb) { CrossMaker cm = new CrossMaker(); List crosses = new ArrayList<>(); for (Cluster cl1 : clsOnTrack) {//inner layer @@ -799,7 +800,9 @@ public List findCrossesFromClustersOnTrk(List allCrosses, List clsOnTrack = this.findClustersOnTrk(SVTclusters, seed.getClusters(), fittedTrack, swimmer); //VZ: finds missing clusters; RDV fix 0 error - List crsOnTrack = this.findCrossesFromClustersOnTrk(SVTcrosses, clsOnTrack, fittedTrack); + List crsOnTrack = this.findCrossesFromClustersOnTrk(SVTcrosses, clsOnTrack, fittedTrack, xb, yb); if(clsOnTrack.size()>0) { seed.add_Clusters(clsOnTrack); diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/services/TracksFromTargetRec.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/services/TracksFromTargetRec.java index 7e78c191f..6848a631f 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/services/TracksFromTargetRec.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/services/TracksFromTargetRec.java @@ -57,7 +57,7 @@ public class TracksFromTargetRec { private double xb; private double yb; public int totTruthHits; - + public boolean oldStraightTrackSeeder=false; public TracksFromTargetRec(Swim swimmer, double[] beamPos) { this.swimmer = swimmer; @@ -75,9 +75,9 @@ public List getSeeds(List> clusters, List seeds = new ArrayList<>(); // make list of crosses consistent with a track candidate - if(solenoidValue<0.001) { + if(oldStraightTrackSeeder) { StraightTrackSeeder trseed = new StraightTrackSeeder(xb, yb); - seeds = trseed.findSeed(this.SVTcrosses, this.BMTcrosses, Constants.getInstance().svtOnly); + seeds = trseed.findSeed(this.SVTcrosses, this.BMTcrosses, Constants.getInstance().svtOnly, xb, yb); // RDV, disabled because it seems to create fake tracks, skipping measurement in KF // if(Constants.getInstance().EXCLUDELAYERS==true) { // seeds = recUtil.reFit(seeds, swimmer, trseed); // RDV can we juts refit? @@ -223,7 +223,7 @@ public List getTracks(DataEvent event, boolean initFromMc, boolean kfFilt if(solenoidValue>0.001 && seed.getHelix().radius() getTracks(DataEvent event, boolean initFromMc, boolean kfFilt System.out.println("KF status ... failed "+kf.setFitFailed+" ndf "+kf.NDF+" helix "+kf.getHelix()); if (kf.setFitFailed == false && kf.NDF>0 && kf.getHelix()!=null) { Track fittedTrack = new Track(seed, kf, pid); - fittedTrack.update_Crosses(seed.getId()); + fittedTrack.update_Crosses(seed.getId(), xb, yb); for(Cross c : fittedTrack) { if(c.getDetector()==DetectorType.BST) { c.getCluster1().setAssociatedTrackID(0); @@ -242,7 +242,7 @@ public List getTracks(DataEvent event, boolean initFromMc, boolean kfFilt //refit adding missing clusters List clsOnTrack = recUtil.findClustersOnTrk(this.SVTclusters, seed.getClusters(), fittedTrack, swimmer); //VZ: finds missing clusters; RDV fix 0 error - List crsOnTrack = recUtil.findCrossesFromClustersOnTrk(this.SVTcrosses, clsOnTrack, fittedTrack); + List crsOnTrack = recUtil.findCrossesFromClustersOnTrk(this.SVTcrosses, clsOnTrack, fittedTrack, xb, yb); List bmtclsOnTrack = recUtil.findBMTClustersOnTrk(this.BMTclusters, seed.getCrosses(), fittedTrack.getHelix(), fittedTrack.getP(), fittedTrack.getQ(), swimmer); //VZ: finds missing clusters @@ -299,37 +299,40 @@ public List getTracks(DataEvent event, boolean initFromMc, boolean kfFilt fittedTrack = recUtil.recovTrkMisClusSearch(seed, hlx, cov, kf2, kf, pid, surfaces, xb, yb, this.SVTclusters, this.SVTcrosses, swimmer, solenoidScale, solenoidValue, measure); -// if(fittedTrack!=null) { -// fittedTrack.setStatus(1); -// if(Constants.getInstance().seedingDebugMode) -// System.out.println("RECOVERED..."+fittedTrack.toString()); -// } - } - if((Constants.getInstance().KFfailRecovMisCls && fittedTrack==null) ){ - //dump seed - kf2.init(hlx, cov, xb, yb, 0, surfaces, PDGDatabase.getParticleMass(pid)); - kf2.runFitterNoFiltFailSafe(); - if(kf2.getHelix()!=null) { - fittedTrack = new Track(seed, kf2, pid); + + if(fittedTrack!=null) { + fittedTrack.setStatus(1); if(Constants.getInstance().seedingDebugMode) - System.out.println("RECOVERED SEED..."+fittedTrack.toString()); - //fittedTrack.setStatus(-1); - for(Cross c : fittedTrack) { - if(c.getDetector()==DetectorType.BST) { - c.getCluster1().setAssociatedTrackID(0); - c.getCluster2().setAssociatedTrackID(0); + System.out.println("RECOVERED..."+fittedTrack.toString()); + } else { + if(Constants.getInstance().seedingDebugMode) + System.out.println("FAILED..."+seed.toString()); + if(Constants.getInstance().seedingDebugMode) + System.out.println("TRYING TO RUN FAIL SAFE..."+hlx.toString()); + //dump seed + kf2.init(hlx, cov, xb, yb, 0, surfaces, PDGDatabase.getParticleMass(pid)); + kf2.runFitterNoFiltFailSafe(); + if(Constants.getInstance().seedingDebugMode) + System.out.println("RUN FAIL SAFE..."+seed.toString()+" OK "+kf2.getHelix()!=null); + if(kf2.getHelix()!=null) { + fittedTrack = new Track(seed, kf2, pid); + if(Constants.getInstance().seedingDebugMode) + System.out.println("RECOVERED SEED..."+fittedTrack.toString()); + //fittedTrack.setStatus(-1); + for(Cross c : fittedTrack) { + if(c.getDetector()==DetectorType.BST) { + c.getCluster1().setAssociatedTrackID(0); + c.getCluster2().setAssociatedTrackID(0); + } } } } + if(fittedTrack!=null && this.missingSVTCrosses(fittedTrack) == false) + tracks.add(fittedTrack); } - if(fittedTrack!=null && this.missingSVTCrosses(fittedTrack) == false) - tracks.add(fittedTrack); - } } } - - // reset cross and cluster IDs if(SVTcrosses!=null) { for(Cross c : this.SVTcrosses) { @@ -361,7 +364,7 @@ public List getTracks(DataEvent event, boolean initFromMc, boolean kfFilt int id = it + 1; tracks.get(it).setId(id); tracks.get(it).findTrajectory(swimmer, Geometry.getInstance().geOuterSurfaces()); - tracks.get(it).update_Crosses(id); + tracks.get(it).update_Crosses(id, xb, yb); tracks.get(it).update_Clusters(id); tracks.get(it).setTrackCovMat(recUtil.getCovMatInTrackRep(tracks.get(it))); if(Constants.getInstance().seedingDebugMode) System.out.println("Fit " + tracks.get(it).toString()); diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/svt/SVTGeometry.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/svt/SVTGeometry.java index 81fbeae34..9f2b529f5 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/svt/SVTGeometry.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/svt/SVTGeometry.java @@ -261,6 +261,9 @@ public Surface getFaradayCageSurfaces(int i) { Vector3D axis = new Vector3D(0,0,1); Arc3D base = new Arc3D(origin, center, axis, 2*Math.PI); Cylindrical3D fcCylinder = new Cylindrical3D(base, SVTConstants.FARADAYCAGELENGTH[i]); + fcCylinder.translateXYZ(SVTConstants.getGlobalAlignmentData()[0], + SVTConstants.getGlobalAlignmentData()[1], + SVTConstants.getGlobalAlignmentData()[2]); Surface fcSurface = new Surface(fcCylinder, new Strip(0, 0, 0), Constants.DEFAULTSWIMACC); fcSurface.addMaterial("FaradayCage"+i, SVTConstants.FARADAYCAGERMAX[i]-SVTConstants.FARADAYCAGERMIN[i], diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Seed.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Seed.java index 5b11f32d4..14da31acc 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Seed.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/Seed.java @@ -384,7 +384,7 @@ else if (c.getDetector()==DetectorType.BMT && c.getType()==BMTType.Z ) { if (fitTrk.getchisq()[0] < chisqMax) { chisqMax = fitTrk.getchisq()[0]; if(chisqMax crosses) { + public void update_Crosses(List crosses, double xb, double yb) { if (this.getHelix() != null && this.getHelix().getCurvature() != 0) { for (int i = 0; i < crosses.size(); i++) { Cross cross = crosses.get(i); - double R = Math.sqrt(cross.getPoint().x() * cross.getPoint().x() + cross.getPoint().y() * cross.getPoint().y()); + double Cx = cross.getPoint().x()-xb; + double Cy = cross.getPoint().y()-yb; + double R = Math.sqrt(Cx * Cx + Cy * Cy); Point3D trackPos = this.getHelix().getPointAtRadius(R); Vector3D trackDir = this.getHelix().getTrackDirectionAtRadius(R); cross.update(trackPos, trackDir); diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/StraightTrackSeeder.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/StraightTrackSeeder.java index 6450eef0d..e740e6d21 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/StraightTrackSeeder.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/StraightTrackSeeder.java @@ -219,7 +219,8 @@ private void findSeedCrossesFixedBin(List crosses, double phiShift) { List BMTmatches = new ArrayList<>(); - public List findSeed(List svt_crosses, List bmt_crosses, boolean isSVTOnly) { + public List findSeed(List svt_crosses, List bmt_crosses, boolean isSVTOnly, + double xb, double yb) { BMTmatches.clear(); seedScan.clear() ; List seedlist = new ArrayList<>(); @@ -302,7 +303,7 @@ public List findSeed(List svt_crosses, List bmt_crosses, boo List seedcrs = mseed.getCrosses(); Track cand = null; if(seedcrs.size()>=3) - cand = fitSeed(seedcrs, 5, false); + cand = fitSeed(seedcrs, 5, false, xb, yb); if (cand != null) { Seed seed = new Seed(); seed.setCrosses(seedcrs); @@ -319,7 +320,7 @@ public List findSeed(List svt_crosses, List bmt_crosses, boo for (Seed bseed : BMTmatches) { Collections.sort(bseed.getCrosses()); //refit using the BMT - Track bcand = fitSeed(bseed.getCrosses(), 5, false); + Track bcand = fitSeed(bseed.getCrosses(), 5, false, xb, yb); if (bcand != null) { seed = new Seed(); seed.setCrosses(bseed.getCrosses()); @@ -373,7 +374,7 @@ private List findCrossesInSameSectorAsSVTTrk(Seed seed, List bmt_c private final List SVTCrosses = new ArrayList<>(); public Track fitSeed(List VTCrosses, int fitIter, - boolean originConstraint) { + boolean originConstraint, double xb, double yb) { double chisqMax = Double.POSITIVE_INFINITY; Track cand = null; @@ -476,7 +477,7 @@ public Track fitSeed(List VTCrosses, int fitIter, //if(shift==0) // if(i==0) System.out.println(); // System.out.println(fitTrk.getChi2()[0] + " " + chisqMax + " " + Constants.CIRCLEFIT_MAXCHI2); - cand.update_Crosses(-1); + cand.update_Crosses(-1, xb, yb); if (fitTrk.getChi2()[0] < chisqMax) { chisqMax = fitTrk.getChi2()[0]; // if(chisqMax othercrs) { for (Cross c : othercrs ) { if(this.inSamePhiRange(seed, c)== true) { - double xi = c.getPoint().x(); - double yi = c.getPoint().y(); + double xi = c.getPoint().x()-xbeam; + double yi = c.getPoint().y()-ybeam; double ri = Math.sqrt(xi*xi+yi*yi); double fi = Math.atan2(yi,xi) ; @@ -96,7 +96,7 @@ public void fitSeed(List seedcrs) { Ys.add(c.getPoint().y()); Ws.add(1. / (c.getPointErr().x()*c.getPointErr().x()+c.getPointErr().y()*c.getPointErr().y())); - } + } CircleFitter circlefit = new CircleFitter(xbeam, ybeam); boolean circlefitstatusOK = circlefit.fitStatus(Xs, Ys, Ws, Xs.size()); CircleFitPars pars = circlefit.getFit(); @@ -108,14 +108,17 @@ public void fitSeed(List seedcrs) { boolean failed = false; for (Cross c : seedcrs ) { - double xi = c.getPoint().x(); - double yi = c.getPoint().y(); + double xi = c.getPoint().x()-xbeam; + double yi = c.getPoint().y()-ybeam; double ri = Math.sqrt(xi*xi+yi*yi); double fi = Math.atan2(yi,xi) ; double res = this.calcResi(r, ri, d, f, fi); if(Math.abs(res)>SVTParameters.RESIMAX) { failed = true; + if(Constants.getInstance().seedingDebugMode) { + System.out.println("SSA faailing on "+c.printInfo()+" with resi "+Math.abs(res)+" larger than "+SVTParameters.RESIMAX); + } return; } } @@ -295,8 +298,8 @@ public List findSeed(List bst_crosses, List bmt_crosses) { mseed.setRho(r); mseed.setPhi(f); for (Cross c : seedcrs) { - double xi = c.getPoint().x(); - double yi = c.getPoint().y(); + double xi = c.getPoint().x()-xbeam; + double yi = c.getPoint().y()-ybeam; double ri = Math.sqrt(xi * xi + yi * yi); double fi = Math.atan2(yi, xi); double res = this.calcResi(r, ri, d, f, fi); diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/TrackSeederRZ.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/TrackSeederRZ.java index 8c1e3bec3..ad41d64a6 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/TrackSeederRZ.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/track/TrackSeederRZ.java @@ -188,7 +188,7 @@ private boolean interceptOK(Cross c1, Cross c2) { if(Math.abs(targetCen-in) seedcrsrm = new ArrayList<>(); List seedcrs = seed.getCrosses(); for (Cross c : seedcrs) { - double xi = c.getPoint().x(); - double yi = c.getPoint().y(); + double xi = c.getPoint().x()-xbeam; + double yi = c.getPoint().y()-ybeam; double res = this.calcResi(r, d, f, xi, yi); if(res>worseResi) { worseResi = res; @@ -335,8 +335,8 @@ private void addMissingCrosses(List seedcrs, List crosses, CircleF double ave_resi =0; int[] L = new int[6]; for (Cross c : seedcrs) { - double xi = c.getPoint().x(); - double yi = c.getPoint().y(); + double xi = c.getPoint().x()-xbeam; + double yi = c.getPoint().y()-ybeam; double res = this.calcResi(r, d, f, xi, yi); ave_resi+=res; int rg = c.getRegion(); @@ -355,8 +355,8 @@ private void addMissingCrosses(List seedcrs, List crosses, CircleF if(L[rg-1] ==0) { //missing layer --> search for cross - double xi = c.getPoint().x(); - double yi = c.getPoint().y(); + double xi = c.getPoint().x()-xbeam; + double yi = c.getPoint().y()-ybeam; double res = this.calcResi(r, d, f, xi, yi); if(res 100 m, assume it's straight track - double x = -d0 * Math.sin(phi0) + r*Math.cos(phi0); - double y = d0 * Math.cos(phi0) + r*Math.sin(phi0); + double x = -d0 * Math.sin(phi0) + r*Math.cos(phi0)+xb; + double y = d0 * Math.cos(phi0) + r*Math.sin(phi0)+yb; double z = z0 + r*tandip; return new Point3D(x, y, z); } @@ -279,9 +279,9 @@ public Point3D getPointAtRadius(double r) { double alpha = -newPathLength * omega; double x = d0 * charge * Math.sin(phi0) + (charge / Math.abs(omega)) - * (Math.sin(phi0) - Math.cos(alpha) * Math.sin(phi0) - Math.sin(alpha) * Math.cos(phi0)); + * (Math.sin(phi0) - Math.cos(alpha) * Math.sin(phi0) - Math.sin(alpha) * Math.cos(phi0))+xb; double y = -d0 * charge * Math.cos(phi0) - (charge / Math.abs(omega)) - * (Math.cos(phi0) + Math.sin(alpha) * Math.sin(phi0) - Math.cos(alpha) * Math.cos(phi0)); + * (Math.cos(phi0) + Math.sin(alpha) * Math.sin(phi0) - Math.cos(alpha) * Math.cos(phi0))+yb; double z = z0 + newPathLength * tandip; return new Point3D(x, y, z); diff --git a/runtest.sh b/runtest.sh new file mode 100644 index 000000000..56ff212fb --- /dev/null +++ b/runtest.sh @@ -0,0 +1,3 @@ +rm ../../../../../Files/CVTDEBUG/rec_cvt1.hipo +./bin/recon-util -S etc/bankdefs/hipo4/ -i ../../../../../Files/CVTDEBUG/gen_cvt1.hipo -o ../../../../../Files/CVTDEBUG/rec_cvt1.hipo -y ../../../../../Files/CVTDEBUG/mc-fall2018-split.yaml -n 20 +