Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iss153 cvt straight trk angle #351

Merged
merged 5 commits into from
Nov 5, 2024
Merged
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
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -254,12 +255,12 @@ public List<Surface> 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()));
}

Expand All @@ -283,27 +284,33 @@ private void addClusters(DetectorType type, List<Surface> clusters) {

private List<Surface> getClusterSurfaces(DetectorType type, List<Cluster> clusters, Ray ray) {

List<Surface> surfaces = this.getClusterSurfaces(type, clusters);
List<Surface> 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<Surface> getClusterSurfaces(DetectorType type, List<Cluster> clusters) {
List<Surface> surfaces = new ArrayList<>();
private List<Surface> getClusterSurfaces(DetectorType type, List<Cluster> clusters, Seed seed) {

List<Surface> 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<cvtSurfaces.length; i++) {
Expand Down Expand Up @@ -437,7 +444,19 @@ private int getHemisphere(Ray ray, Surface surface){
else
return 0;
}

private int getHemisphere(Cluster cluster, Seed seed, Surface surface) {
if(surface.cylinder==null)
return 0;
if(cluster.getType()==BMTType.C) {
if(seed==null)
return 0;
double r = cluster.getRadius();
Point3D vAtR = seed.getHelix().getPointAtRadius(r);
return (int) Math.signum(vAtR.y());
} else {
return (int) Math.signum(cluster.center().y());
}
}
private void reset() {
for(int i=0; i<cvtSurfaces.length; i++) {
int hemisphere = MLayer.getHemisphere(i);
Expand All @@ -450,4 +469,6 @@ private void reset() {
}
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,11 @@ public List<Track> getTracks(DataEvent event, boolean initFromMc, boolean kfFilt
List<Surface> 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());
Expand Down Expand Up @@ -238,6 +241,8 @@ public List<Track> 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<Cluster> clsOnTrack = recUtil.findClustersOnTrk(this.SVTclusters, seed.getClusters(), fittedTrack, swimmer); //VZ: finds missing clusters; RDV fix 0 error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down