From 527d42eaac1e1fb1343039b5333b8f9ccf9a0313 Mon Sep 17 00:00:00 2001 From: Veronique Ziegler Date: Tue, 5 Nov 2024 11:03:05 -0500 Subject: [PATCH] Iss153 cvt straight trk angle (#351) * The updating of the cross position is shifted by -yB because the trajectory was using the helix method to compute the position at the cylinder radius and it was not accounting for the beam spot. Actually this computation was not needed because the KF already reports the trajectory. Both these issues have been fixed. The hemisphere was wrong in the making of the surfaces, as it took the middle of the cluster strip which for BMT C gives the wrong hemisphere for events in a particular phi range. This has been fixed by using the afore mentioned method to get the point from the seed and get the hemisphere from there. * version bump * Modified getMeasurements to account for hemisphere. --------- Co-authored-by: ziegler Co-authored-by: raffaelladevita --- .../rec/cvt/measurement/Measurements.java | 53 +++++++++++++------ .../rec/cvt/services/TracksFromTargetRec.java | 7 ++- .../java/org/jlab/rec/cvt/track/Track.java | 2 +- 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java index dcefd1f33..b00ca82c4 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/measurement/Measurements.java @@ -16,6 +16,7 @@ import org.jlab.rec.cvt.Constants; import org.jlab.rec.cvt.Geometry; import org.jlab.rec.cvt.bmt.BMTGeometry; +import org.jlab.rec.cvt.bmt.BMTType; import org.jlab.rec.cvt.cluster.Cluster; import org.jlab.rec.cvt.svt.SVTGeometry; import org.jlab.rec.cvt.track.Seed; @@ -37,7 +38,7 @@ public class Measurements { private boolean cosmic = false; private Surface[] cvtSurfaces; private boolean debug = false; - + private Seed _seed; public Measurements(double xbeam, double ybeam, boolean beamSpot) { this.initTargetSurfaces(xbeam, ybeam, beamSpot); } @@ -254,12 +255,12 @@ public List getActiveMeasurements(StraightTrack cosmic) { } private void addClusters(Seed seed) { - this.addClusters(DetectorType.BST, this.getClusterSurfaces(DetectorType.BST, seed.getClusters())); - this.addClusters(DetectorType.BMT, this.getClusterSurfaces(DetectorType.BMT, seed.getClusters())); + this.addClusters(DetectorType.BST, this.getClusterSurfaces(DetectorType.BST, seed.getClusters(), seed)); + this.addClusters(DetectorType.BMT, this.getClusterSurfaces(DetectorType.BMT, seed.getClusters(), seed)); } private void addClusters(StraightTrack cosmic) { - this.addClusters(DetectorType.BST, this.getClusterSurfaces(DetectorType.BST, cosmic.getClusters())); + this.addClusters(DetectorType.BST, this.getClusterSurfaces(DetectorType.BST, cosmic.getClusters(), cosmic.getRay())); this.addClusters(DetectorType.BMT, this.getClusterSurfaces(DetectorType.BMT, cosmic.getClusters(), cosmic.getRay())); } @@ -283,27 +284,33 @@ private void addClusters(DetectorType type, List clusters) { private List getClusterSurfaces(DetectorType type, List clusters, Ray ray) { - List surfaces = this.getClusterSurfaces(type, clusters); + List surfaces = this.getClusterSurfaces(type, clusters, ray); for(Surface surf : surfaces) { - surf.hemisphere = this.getHemisphere(ray, surf); + surf.hemisphere = this.getHemisphere(ray, surf); } return surfaces; } - private List getClusterSurfaces(DetectorType type, List clusters) { - List surfaces = new ArrayList<>(); + private List getClusterSurfaces(DetectorType type, List clusters, Seed seed) { + List surfaces = new ArrayList<>(); for(Cluster cluster : clusters) { - if(cluster.getDetector()!=type) continue; - int layer = MLayer.getType(type, cluster.getLayer()).getCVTLayer(); - Surface measure = cluster.measurement(); - measure.hemisphere = Math.signum(cluster.center().y()); - if((int)Constants.getInstance().getUsedLayers().get(layer)<1) - measure.passive=true; - surfaces.add(measure); + Surface surf = this.getClusterSurface(type, cluster); + if(surf!=null) { + surf.hemisphere = this.getHemisphere(cluster, seed, surf); + surfaces.add(surf); + } } return surfaces; } + private Surface getClusterSurface(DetectorType type, Cluster cluster) { + if(cluster.getDetector()!=type) return null; + int layer = MLayer.getType(type, cluster.getLayer()).getCVTLayer(); + Surface surface = cluster.measurement(); + if((int)Constants.getInstance().getUsedLayers().get(layer)<1) + surface.passive=true; + return surface; + } private void addMissing(Seed seed) { for(int i=0; i getTracks(DataEvent event, boolean initFromMc, boolean kfFilt List surfaces = measure.getMeasurements(seed); if(pid==0) pid = this.getTrackPid(event, seed.getId()); - Point3D v = seed.getHelix().getVertex(); + Point3D v = seed.getHelix().getVertex(); Vector3D p = seed.getHelix().getPXYZ(solenoidValue); + if(Constants.getInstance().seedingDebugMode) + System.out.println("Seed vtx = "+v.toString()+" Seed p = "+p.toString()); + if(Constants.getInstance().preElossCorrection && pid!=Constants.DEFAULTPID) { double pcorr = measure.getELoss(p.mag(), PDGDatabase.getParticleMass(pid)); p.scale(pcorr/p.mag()); @@ -238,6 +241,8 @@ public List getTracks(DataEvent event, boolean initFromMc, boolean kfFilt c.getCluster2().setAssociatedTrackID(0); } } + if(Constants.getInstance().seedingDebugMode) + System.out.println("KF vtx = "+fittedTrack.getSecondaryHelix().getVertex().toString()); if (searchMissingCls) { //refit adding missing clusters List clsOnTrack = recUtil.findClustersOnTrk(this.SVTclusters, seed.getClusters(), fittedTrack, swimmer); //VZ: finds missing clusters; RDV fix 0 error 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 4d173b247..eea7abe5e 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 @@ -224,7 +224,7 @@ public void update_Crosses(int trackId, double xb, double yb) { cross.setAssociatedTrackID(trackId); Point3D trackPos = null; Vector3D trackDir = null; - if(this.getKFTrajectories()!=null && Math.abs(this.getHelix().B)>0.0001) { + if(this.getKFTrajectories()!=null ) { int layer = cross.getCluster1().getLayer(); int index = MLayer.getType(cross.getDetector(), layer).getIndex(); HitOnTrack traj = this.getKFTrajectories().get(index);