-
Notifications
You must be signed in to change notification settings - Fork 21
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
Updates of forward tracking since November of 2022 #107
base: development
Are you sure you want to change the base?
Changes from 83 commits
32f76ba
c95ea47
a1f0dc4
0eeb540
613ca23
4fdf52c
6fc9d12
f044691
c9c0af7
a83e4e3
e8c9b2e
d65561f
3cfc641
0d3bec1
b7883c8
aa508e0
52c6d81
b57b71c
17f0c63
e937fc6
20ba059
d39473d
ab49f65
9edbc8a
886382e
d96c634
582118a
6682a41
4692bd0
b707d09
0484aa5
39dd887
6d45e37
670e0d1
acb9924
9fea9d9
b9b7bfb
a2c71d8
5053091
a0d8fb6
55fd5dd
ee56b5e
723bced
352c964
0624c53
f64c764
a45a392
c1e1363
25f77c3
c7b9f33
4651800
d7d264e
6f3043d
93044b1
b841721
f9e18b6
a2419f4
46ffd46
52eff35
68a47a0
a83a064
28c6e86
4c4fe70
f80df3f
86bd280
9daeb40
ee87d04
0a0df89
55e6f37
469bf95
43e5216
6006a41
f789f16
d4921c8
5a47f52
71b3492
a742314
42a9f6d
d1a2c29
4c32fae
1bcc0e6
9c35c38
540aa85
2d9b8bb
d27a668
84f7422
07cbf20
d4d0909
6f35a35
5239f52
78b1557
b25c04a
55d68b0
b430b27
3f28d40
052e186
c4db38e
f0c8cae
4a9dbcb
6b1823e
8d86beb
def71e6
dc687c7
5777a52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
/** | ||
* | ||
* @author ziegler | ||
* @author Tongtong Cao | ||
*/ | ||
|
||
public abstract class AMeasVecs { | ||
|
@@ -22,7 +23,8 @@ public abstract class AMeasVecs { | |
|
||
public void setMeasVecs(List<Surface> measSurfaces) { | ||
measurements = new ArrayList<>(); | ||
Collections.sort(measSurfaces); | ||
if(measSurfaces.get(0).type != Type.LINEDOCA && measSurfaces.get(0).type != Type.PLANEURWELL) // Measurements from URWell and DC has been sorted | ||
Collections.sort(measSurfaces); | ||
for(int i = 0; i < measSurfaces.size(); i++) { | ||
MeasVec mvec = new MeasVec(); | ||
mvec.k = i ; | ||
|
@@ -33,9 +35,62 @@ public void setMeasVecs(List<Surface> measSurfaces) { | |
mvec.skip = mvec.surface.passive; | ||
mvec.hemisphere = measSurfaces.get(i).hemisphere; | ||
measurements.add(mvec); | ||
if(measSurfaces.get(i).type == Type.LINEDOCA) { | ||
mvec.region = measSurfaces.get(i).region; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if FD surfaces were assigned a proper index, this would become unnecessary |
||
mvec.sector = measSurfaces.get(i).getSector(); | ||
mvec.superlayer = measSurfaces.get(i).getSuperLayer(); | ||
mvec.layer = measSurfaces.get(i).getLayer(); | ||
} | ||
else if(measSurfaces.get(i).type == Type.PLANEURWELL){ | ||
mvec.region = measSurfaces.get(i).region; | ||
mvec.layer = measSurfaces.get(i).getLayer(); | ||
mvec.sector = measSurfaces.get(i).getSector(); | ||
} | ||
} | ||
} | ||
|
||
// For DC, there could be two hits at a measurement | ||
public double[] dhDoca(int k, StateVec stateVec) { | ||
double value[] = {Double.NaN, Double.NaN}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An alternative to redefining "h" for doublets would be to create a new surface with two lines |
||
|
||
Surface surf = this.measurements.get(stateVec.k).surface; | ||
Point3D point = new Point3D(stateVec.x, stateVec.y, stateVec.z); | ||
double h = hDoca(point, surf.wireLine[0]); | ||
|
||
double signMeas = 1; | ||
double sign = 1; | ||
if(surf.doca[1]!=-99 || !(Math.abs(surf.doca[0])<0.5 && surf.doca[1]==-99 ) ) { //use LR only for double hits or large enough doca for one hit | ||
signMeas = Math.signum(surf.doca[0]); | ||
sign = Math.signum(h); | ||
} else { | ||
signMeas = Math.signum(h); | ||
sign = Math.signum(h); | ||
} | ||
|
||
value[0] = signMeas*Math.abs(surf.doca[0]) - sign*Math.abs(h); | ||
|
||
//USE THE DOUBLE HIT | ||
if(surf.doca[1]!=-99) { | ||
h = hDoca(point, surf.wireLine[1]); | ||
|
||
signMeas = Math.signum(surf.doca[1]); | ||
sign = Math.signum(h); | ||
|
||
value[1]= signMeas*Math.abs(surf.doca[1]) - sign*Math.abs(h); | ||
} | ||
|
||
return value; | ||
} | ||
|
||
// Return a signed doca for DC | ||
public double hDoca(Point3D point, Line3D wireLine) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should go in the method dh |
||
|
||
Line3D WL = new Line3D(); | ||
WL.copy(wireLine); | ||
WL.copy(WL.distance(point)); | ||
|
||
return WL.length()*Math.signum(WL.direction().x()); | ||
} | ||
|
||
public double dh(int k, StateVec stateVec) { | ||
|
||
|
@@ -209,6 +264,10 @@ public class MeasVec implements Comparable<MeasVec> { | |
public boolean skip = false; | ||
public double hemisphere = 1; | ||
|
||
//For DC | ||
public int region = -1; | ||
public int sector = -1; | ||
public int superlayer = -1; | ||
|
||
@Override | ||
public int compareTo(MeasVec arg) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,14 @@ | |
import org.jlab.clas.tracking.kalmanfilter.helical.KFitter; | ||
import org.jlab.clas.tracking.trackrep.Helix; | ||
import org.jlab.geom.prim.Point3D; | ||
import org.jlab.jnp.matrix.Matrix; | ||
import org.jlab.jnp.matrix.Matrix5x5; | ||
|
||
/** | ||
* | ||
* @author ziegler | ||
* @author Tongtong Cao | ||
*/ | ||
|
||
public abstract class AStateVecs { | ||
|
||
|
@@ -245,6 +253,79 @@ public class StateVec { | |
public double energyLoss; | ||
public double dx; | ||
public double path; | ||
|
||
/////////////////////// extra variables for forward tracking /////////////////////// | ||
// tx = px/pz | ||
public double ty; //=py/pz | ||
public double Q; //q/p | ||
public double B; | ||
public double deltaPath; | ||
public Matrix CM = new Matrix();; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should eventually unify covMat and CM |
||
private double _PathLength; | ||
|
||
/////////////////////// For DAF /////////////////////// | ||
private double weightDAF_single = 1; | ||
private double[] weightDAF_double = {0.5, 0.5}; | ||
|
||
public double getWeightDAF_singleHit(){ | ||
return weightDAF_single; | ||
} | ||
public void setWeightDAF_singleHit(double weight){ | ||
this.weightDAF_single = weight; | ||
} | ||
|
||
public double[] getWeightDAF_doubleHits(){ | ||
return weightDAF_double; | ||
} | ||
public void setWeightDAF_doubleHits(double[] weight){ | ||
this.weightDAF_double = weight; | ||
} | ||
|
||
private double finalDAFWeight = -999; | ||
public double getFinalDAFWeight(){ | ||
return finalDAFWeight; | ||
} | ||
public void setFinalDAFWeight(double weight){ | ||
this.finalDAFWeight = weight; | ||
} | ||
|
||
private int SorDHit = -1; // 1 : single hit; 0: double hit for DC | ||
public int getSorDHit(){ | ||
return SorDHit; | ||
} | ||
public void setSorDHit(int SorDHit){ | ||
this.SorDHit = SorDHit; | ||
} | ||
|
||
public double getPathLength() { | ||
return _PathLength; | ||
} | ||
|
||
public void setPathLength(double _PathLength) { | ||
this._PathLength = _PathLength; | ||
} | ||
|
||
// KF projector --> get Wire midPoint match | ||
private double hw; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hw and h are related to the measurement and should not be members of the state vector class |
||
|
||
public double getProjector() { | ||
return hw; | ||
} | ||
|
||
public void setProjector(double h) { | ||
this.hw = h; | ||
} | ||
// KF projector --> get fit doca | ||
private double h; | ||
|
||
public double getProjectorDoca() { | ||
return h; | ||
} | ||
|
||
public void setProjectorDoca(double h) { | ||
this.h = h; | ||
} | ||
/////////////////////// extra variables for forward tracking /////////////////////// | ||
|
||
public StateVec(int k) { | ||
this.k = k; | ||
|
@@ -294,8 +375,18 @@ public final void copy(StateVec s) { | |
this.energyLoss = s.energyLoss; | ||
this.dx = s.dx; | ||
this.path = s.path; | ||
this.covMat = this.copyMatrix(s.covMat); | ||
this.F = this.copyMatrix(s.F); | ||
if(s.covMat != null) | ||
this.covMat = this.copyMatrix(s.covMat); | ||
if(s.F != null) | ||
this.F = this.copyMatrix(s.F); | ||
this.ty = s.ty; | ||
this.Q = s.Q; | ||
this.B = s.B; | ||
this.deltaPath = s.deltaPath; | ||
if(s.CM != null) | ||
Matrix5x5.copy(s.CM, this.CM); | ||
this.weightDAF_single = s.weightDAF_single; | ||
this.weightDAF_double = s.weightDAF_double; | ||
} | ||
|
||
public void copyCovMat(double[][] c) { | ||
|
@@ -414,8 +505,7 @@ public Helix getHelix(double xref, double yref) { | |
if (Math.abs(phi0) > Math.PI) phi0 -= Math.signum(phi0) * 2 * Math.PI; | ||
double tanDip = vec.tanL; | ||
double z0 = vec.z0 + vec.dz; | ||
//double omega = turningSign * KFitter.polarity / R; | ||
double omega = Math.signum(vec.kappa) / R; | ||
double omega = -turningSign / R; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this tested for both kfitter polarities? |
||
double d0 = -vec.d_rho; | ||
|
||
Helix helix = new Helix(d0, phi0, omega, z0, tanDip, turningSign, bfield, xref, yref, units); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
/** | ||
* | ||
* @author ziegler | ||
* @author Tongtong Cao | ||
*/ | ||
public class Surface implements Comparable<Surface> { | ||
|
||
|
@@ -40,6 +41,57 @@ public class Surface implements Comparable<Surface> { | |
public boolean passive = false; | ||
public double hemisphere = 1; | ||
|
||
// For DC | ||
public double z; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems to me some of this may be redundant and already existing members of the class could be used, e.g. refPoint or passive for reject. Also, I would not add wires since this is not even used in tracking |
||
public double x; | ||
public double[] unc = new double[2]; | ||
public double tilt; | ||
public double[] doca = new double[2]; | ||
public double wireMaxSag; | ||
public Line3D[] wireLine = new Line3D[2]; | ||
public boolean reject = false; | ||
public int region; | ||
public int superlayer; | ||
public int nMeas = 1; | ||
|
||
// For URWell | ||
public double y; | ||
public double x_err; | ||
public double y_err; | ||
|
||
public void setNMeas(int n) { | ||
nMeas = n; | ||
} | ||
|
||
public int getNMeas() { | ||
return nMeas; | ||
} | ||
|
||
// For URWell | ||
public Surface(int sector, double x, double y, double z, double x_err, double y_err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't the measurement a line? can we use the existing PLANESTRIP? |
||
type = Type.PLANEURWELL; | ||
this.sector = sector; | ||
this.x = x; | ||
this.y = y; | ||
this.z = z; | ||
this.x_err = x_err; | ||
this.y_err = y_err; | ||
} | ||
|
||
// For DC | ||
public Surface(int region, double z, double x, double tilt, double wireMaxSag, double[] doca, double[] unc, double error, Line3D[] wireLine) { | ||
type = Type.LINEDOCA; | ||
this.region = region; | ||
this.z = z; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are all these variables really used? for example, wiremaxsag is not really used in reconstruction |
||
this.x = x; | ||
this.tilt = tilt; | ||
this.wireMaxSag = wireMaxSag; | ||
this.doca = doca; | ||
this.unc = unc; | ||
this.error = error; | ||
this.wireLine = wireLine; | ||
} | ||
|
||
public Surface(Plane3D plane3d, Point3D refrPoint, Point3D c1, Point3D c2, double accuracy) { | ||
type = Type.PLANEWITHPOINT; | ||
plane = plane3d; | ||
|
@@ -184,6 +236,20 @@ public int getLayer() { | |
public void setLayer(int layer) { | ||
this.layer = layer; | ||
} | ||
|
||
/** | ||
* @return the superlayer | ||
*/ | ||
public int getSuperLayer() { | ||
return superlayer; | ||
} | ||
|
||
/** | ||
* @param superlayer the superlayer to set | ||
*/ | ||
public void setSuperLayer(int superlayer) { | ||
this.superlayer = superlayer; | ||
} | ||
|
||
/** | ||
* @return the sector | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,12 @@ | |
/** | ||
* | ||
* @author ziegler | ||
* @author Tongtong Cao | ||
*/ | ||
public enum Type { | ||
UDF(-1), PLANEWITHPOINT(0), PLANEWITHLINE(1), PLANEWITHSTRIP(2), | ||
CYLINDERWITHPOINT(3), CYLINDERWITHLINE(4), CYLINDERWITHARC(5), | ||
CYLINDERWITHSTRIP(6), LINE(7); | ||
CYLINDERWITHSTRIP(6), LINE(7), LINEDOCA(8), PLANEURWELL(9); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think PLANEWITH STRIP could be used for URWell |
||
private final int value; | ||
|
||
Type(int value) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CVT has a similar issue and, for this reason, surfaces have "index"