From e0117936ffd1740fd9aebee6e46ce8c7bd449fec Mon Sep 17 00:00:00 2001 From: MathieuOuillon Date: Tue, 8 Apr 2025 13:17:06 -0400 Subject: [PATCH] Change geometry for the hits to match reality. (90 shift + conterclock) --- .../detector/alert/AHDC/AlertDCFactory.java | 56 +++++++++---------- .../main/java/org/jlab/rec/ahdc/Hit/Hit.java | 4 +- .../org/jlab/rec/ahdc/KalmanFilter/Hit.java | 24 ++++---- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/alert/AHDC/AlertDCFactory.java b/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/alert/AHDC/AlertDCFactory.java index 0a9bd13026..05c5ced61d 100644 --- a/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/alert/AHDC/AlertDCFactory.java +++ b/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/alert/AHDC/AlertDCFactory.java @@ -132,13 +132,13 @@ public AlertDCLayer createLayer(ConstantProvider cp, int sectorId, int superlaye for (int wireId = 0; wireId < numWires; wireId++) { // The point given by (wx, wy, wz) is the midpoint of the current wire. - double wx = -R_layer * Math.sin(alphaW_layer * wireId); - double wy = -R_layer * Math.cos(alphaW_layer * wireId); + double wx = R_layer * Math.cos(alphaW_layer * wireId); + double wy = R_layer * Math.sin(alphaW_layer * wireId); // Find the interesection of the current wire with the end-plate // planes by construciting a long line that passes through the midpoint - double wx_end = -R_layer * Math.sin(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); - double wy_end = -R_layer * Math.cos(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); + double wx_end = R_layer * Math.cos(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); + double wy_end = R_layer * Math.sin(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); Line3D line = new Line3D(wx, wy, 0, wx_end, wy_end, zl); Point3D lPoint = new Point3D(); @@ -150,31 +150,31 @@ public AlertDCLayer createLayer(ConstantProvider cp, int sectorId, int superlaye // Do not change the code above. It is for signal wires positioning // Construct the cell around the signal wires created above top - double px_0 = -(R_layer + 2) * Math.sin(alphaW_layer * wireId); - double py_0 = -(R_layer + 2) * Math.cos(alphaW_layer * wireId); - double px_1 = -(R_layer + 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2); - double py_1 = -(R_layer + 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2); - double px_2 = -(R_layer - 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2); - double py_2 = -(R_layer - 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2); - double px_3 = -(R_layer - 2) * Math.sin(alphaW_layer * wireId); - double py_3 = -(R_layer - 2) * Math.cos(alphaW_layer * wireId); - double px_4 = -(R_layer - 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2); - double py_4 = -(R_layer - 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2); - double px_5 = -(R_layer + 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2); - double py_5 = -(R_layer + 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2); + double px_0 = (R_layer + 2) * Math.cos(alphaW_layer * wireId); + double py_0 = (R_layer + 2) * Math.sin(alphaW_layer * wireId); + double px_1 = (R_layer + 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2); + double py_1 = (R_layer + 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2); + double px_2 = (R_layer - 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2); + double py_2 = (R_layer - 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2); + double px_3 = (R_layer - 2) * Math.cos(alphaW_layer * wireId); + double py_3 = (R_layer - 2) * Math.sin(alphaW_layer * wireId); + double px_4 = (R_layer - 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2); + double py_4 = (R_layer - 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2); + double px_5 = (R_layer + 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2); + double py_5 = (R_layer + 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2); // bottom (do not forget to add the +20 deg. twist respect to the "straight" version) - double px_6 = -(R_layer + 2) * Math.sin(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); - double py_6 = -(R_layer + 2) * Math.cos(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); - double px_7 = -(R_layer + 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); - double py_7 = -(R_layer + 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); - double px_8 = -(R_layer - 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); - double py_8 = -(R_layer - 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); - double px_9 = -(R_layer - 2) * Math.sin(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); - double py_9 = -(R_layer - 2) * Math.cos(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); - double px_10 = -(R_layer - 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); - double py_10 = -(R_layer - 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); - double px_11 = -(R_layer + 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); - double py_11 = -(R_layer + 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double px_6 = (R_layer + 2) * Math.cos(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); + double py_6 = (R_layer + 2) * Math.sin(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); + double px_7 = (R_layer + 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double py_7 = (R_layer + 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double px_8 = (R_layer - 2) * Math.cos(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double py_8 = (R_layer - 2) * Math.sin(alphaW_layer * wireId + alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double px_9 = (R_layer - 2) * Math.cos(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); + double py_9 = (R_layer - 2) * Math.sin(alphaW_layer * wireId + thster * (Math.pow(-1, superlayerId))); + double px_10 = (R_layer - 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double py_10 = (R_layer - 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double px_11 = (R_layer + 2) * Math.cos(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); + double py_11 = (R_layer + 2) * Math.sin(alphaW_layer * wireId - alphaW_layer / 2 + thster * (Math.pow(-1, superlayerId))); // Group into points with (x,y,z) coordinates List firstF = new ArrayList<>(); diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Hit/Hit.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Hit/Hit.java index 109e8920a0..4347da8eb2 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Hit/Hit.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Hit/Hit.java @@ -68,8 +68,8 @@ private void wirePosition() { R_layer = R_layer + DR_layer * (this.layerId-1); double alphaW_layer = Math.toRadians(round / (numWires)); //should it be at z = 0? in which case, we need to account for the positive or negative stereo angle... - double wx = -R_layer * Math.sin(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1))); - double wy = -R_layer * Math.cos(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1))); + double wx = R_layer * Math.cos(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1))); + double wy = R_layer * Math.sin(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1))); //System.out.println(" superlayer " + this.superLayerId + " layer " + this.layerId + " wire " + this.wireId + " R_layer " + R_layer + " wx " + wx + " wy " + wy); diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/Hit.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/Hit.java index a07e4299df..b97c982950 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/Hit.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/Hit.java @@ -88,11 +88,11 @@ public Hit(int superLayer, int layer, int wire, int numWire, double r, double do R_layer = R_layer + DR_layer * (this.layer-1);//OK double alphaW_layer = Math.toRadians(round / (numWires));//OK - double wx = -R_layer * Math.sin(alphaW_layer * (this.wire-1));//OK - double wy = -R_layer * Math.cos(alphaW_layer * (this.wire-1));//OK + double wx = R_layer * Math.cos(alphaW_layer * (this.wire-1));//OK + double wy = R_layer * Math.sin(alphaW_layer * (this.wire-1));//OK - double wx_end = -R_layer * Math.sin(alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)));//OK - double wy_end = -R_layer * Math.cos(alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)));//OK + double wx_end = R_layer * Math.cos(alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)));//OK + double wy_end = R_layer * Math.sin(alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)));//OK this.phi = Math.atan2( (wy+wy_end)*0.5, (wx+wx_end)*0.5 ); //System.out.println(" superlayer " + this.superLayer + " layer " + this.layer + " wire " + this.wire + " wx " + wx + " wy " + wy + " wx_end " + wx_end + " wy_end " + wy_end + " phi " + this.phi); @@ -113,11 +113,11 @@ public Hit(int superLayer, int layer, int wire, int numWire, double r, double do //calculate the "virtual" left and right wires accounting for the DOCA double deltaphi = Math.asin(this.doca/R_layer); - double wx_plus = -R_layer * Math.sin( alphaW_layer * (this.wire-1) - deltaphi );//OK - double wy_plus = -R_layer * Math.cos( alphaW_layer * (this.wire-1) - deltaphi );//OK + double wx_plus = R_layer * Math.cos( alphaW_layer * (this.wire-1) - deltaphi );//OK + double wy_plus = R_layer * Math.sin( alphaW_layer * (this.wire-1) - deltaphi );//OK - double wx_plus_end = -R_layer * Math.sin( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) - deltaphi );//OK - double wy_plus_end = -R_layer * Math.cos( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) - deltaphi );//OK + double wx_plus_end = R_layer * Math.cos( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) - deltaphi );//OK + double wy_plus_end = R_layer * Math.sin( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) - deltaphi );//OK line = new Line3D(wx_plus, wy_plus, -zl/2, wx_plus_end, wy_plus_end, zl/2); lPoint = new Point3D(); @@ -128,11 +128,11 @@ public Hit(int superLayer, int layer, int wire, int numWire, double r, double do wireLine = new Line3D(lPoint, rPoint); this.line3D_plus = wireLine; - double wx_minus = -R_layer * Math.sin( alphaW_layer * (this.wire-1) + deltaphi );//OK - double wy_minus = -R_layer * Math.cos( alphaW_layer * (this.wire-1) + deltaphi );//OK + double wx_minus = R_layer * Math.cos( alphaW_layer * (this.wire-1) + deltaphi );//OK + double wy_minus = R_layer * Math.sin( alphaW_layer * (this.wire-1) + deltaphi );//OK - double wx_minus_end = -R_layer * Math.sin( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) + deltaphi );//OK - double wy_minus_end = -R_layer * Math.cos( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) + deltaphi );//OK + double wx_minus_end = R_layer * Math.cos( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) + deltaphi );//OK + double wy_minus_end = R_layer * Math.sin( alphaW_layer * (this.wire-1) + thster * (Math.pow(-1, this.superLayer-1)) + deltaphi );//OK line = new Line3D(wx_minus, wy_minus, -zl/2, wx_minus_end, wy_minus_end, zl/2); lPoint = new Point3D();