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

Updates of forward tracking since November of 2022 #107

Open
wants to merge 104 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
32f76ba
Refactor and move KF tracking package from dc to common-tools and upd…
tongtongcao Jan 9, 2023
c95ea47
small update for KFitter::calcFinalChisq()
tongtongcao Jan 17, 2023
a1f0dc4
adjust code format and add author for source files
tongtongcao Feb 3, 2023
0eeb540
further adjust code format
tongtongcao Feb 3, 2023
613ca23
futher code format adjustments
tongtongcao Feb 7, 2023
4fdf52c
first version of forward tracking with uRWell
tongtongcao Feb 13, 2023
6fc9d12
add pseudo segments for missed track candidates
tongtongcao Feb 14, 2023
f044691
add AI services for forward tracking with uRWell
tongtongcao Feb 15, 2023
c9c0af7
change uRWELL resolution setup
tongtongcao Feb 24, 2023
a83e4e3
reset uRWell resolution
tongtongcao Feb 27, 2023
e8c9b2e
fix issue for the FastMath package
tongtongcao Mar 1, 2023
d65561f
fix issue in the FastMath package
tongtongcao Mar 1, 2023
3cfc641
cache some sine and cosine calculations in DC reconstruction and forw…
tongtongcao Mar 6, 2023
0d3bec1
Merge branch 'issueFastMathPackage' into upgradeTrackingWithuRWELL
tongtongcao Mar 6, 2023
b7883c8
use math library to assign values for constant parameters
tongtongcao Mar 8, 2023
aa508e0
Merge branch 'issueFastMathPackage' into upgradeTrackingWithuRWELL
tongtongcao Mar 8, 2023
52c6d81
switch to new CCDB
tongtongcao Mar 8, 2023
b57b71c
re-design pattern recognition for FD tracking
tongtongcao Mar 27, 2023
17f0c63
reset covaraince matrix for initial state
tongtongcao Mar 30, 2023
e937fc6
tiny change
tongtongcao Mar 30, 2023
20ba059
tiny change
tongtongcao Mar 30, 2023
d39473d
change conditions for stopping forward tracking iteration
tongtongcao Apr 3, 2023
ab49f65
Merge branch 'upgradeTrackingWithuRWELL' into redesignPatternRecognition
tongtongcao Apr 3, 2023
9edbc8a
update overlap of tracks with uRWell crosses
tongtongcao Apr 5, 2023
886382e
Version 2 of DC-uRWell tracking
tongtongcao May 26, 2023
d96c634
fix conflicts when merging with branch development
tongtongcao May 26, 2023
582118a
fix issue that some information for states in trajectory is missed
tongtongcao Jul 19, 2023
6682a41
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Jul 19, 2023
4692bd0
tiny change
tongtongcao Jul 19, 2023
b707d09
update pom file
tongtongcao Jul 19, 2023
0484aa5
change uRWell resolution setup in TB tracking
tongtongcao Aug 8, 2023
39dd887
fix an issue for writting KF fit doca
tongtongcao Aug 18, 2023
6d45e37
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Aug 31, 2023
670e0d1
blow up initial covariance matrix starting from the second iteration
tongtongcao Sep 15, 2023
acb9924
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Sep 18, 2023
9fea9d9
change limit for inverse calculation of covariance matrix
tongtongcao Oct 12, 2023
b9b7bfb
reset limit since CI test failed
tongtongcao Oct 12, 2023
a2c71d8
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Oct 12, 2023
5053091
modify reconstruction/dc/pom.xml for version of tracking package
tongtongcao Oct 12, 2023
a0d8fb6
Issue for CI test was fixed. Reset limit to proper value.
tongtongcao Oct 12, 2023
55fd5dd
apply DAF into DC-only tracking
tongtongcao Oct 19, 2023
ee56b5e
redefine NDF and remove codes for fail tracking judge
tongtongcao Nov 7, 2023
723bced
update projected doca for double hits
tongtongcao Nov 29, 2023
352c964
fix conflict for definition of LR ambiguity between DC hits and measu…
tongtongcao Dec 1, 2023
0624c53
Merge branch 'upgradeTrackingWithuRWELL' into applyDAF
tongtongcao Dec 1, 2023
f64c764
apply DAF into DC-uRWell tracking
tongtongcao Dec 1, 2023
a45a392
update calcFinalChisq() in org.jlab.clas.tracking.kalmanfilter.zRefer…
tongtongcao Dec 1, 2023
c1e1363
fix merge conflicts
tongtongcao Dec 1, 2023
25f77c3
modify fitResidual in TB hit banks
tongtongcao Dec 5, 2023
c7b9f33
Merge branch 'upgradeTrackingWithuRWELL' into applyDAF
tongtongcao Dec 5, 2023
4651800
update trajectory projected doca
tongtongcao Dec 5, 2023
d7d264e
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Dec 7, 2023
6f3043d
Merge branch 'upgradeTrackingWithuRWELL' of https://github.com/Jeffer…
tongtongcao Dec 7, 2023
93044b1
add KF package for straight tracking
tongtongcao Dec 8, 2023
b841721
Merge branch 'upgradeTrackingWithuRWELL' into applyDAF
tongtongcao Dec 8, 2023
f9e18b6
update filter_DAF function
tongtongcao Dec 19, 2023
a2419f4
fix issue to judge if zero field in DCTBEngine
tongtongcao Dec 19, 2023
46ffd46
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Dec 19, 2023
52eff35
update pom file for DC reconstruction for version of clas-tracking
tongtongcao Dec 19, 2023
68a47a0
Merge branch 'upgradeTrackingWithuRWELL' into applyDAF
tongtongcao Dec 19, 2023
a83a064
Merge branch 'applyDAF' into studyHitLR
tongtongcao Dec 19, 2023
28c6e86
add DAF weight into TB hit banks
tongtongcao Dec 20, 2023
4c4fe70
fix a bug in function matchHits()
tongtongcao Jan 3, 2024
f80df3f
Merge branch 'upgradeTrackingWithuRWELL' into applyDAF
tongtongcao Jan 3, 2024
86bd280
Merge branch 'applyDAF' into studyHitLR
tongtongcao Jan 3, 2024
9daeb40
add ndfDAF for NDF weighted by DAF
tongtongcao Jan 31, 2024
ee87d04
Merge branch 'studyHitLR' into applyDAF
tongtongcao Jan 31, 2024
0a0df89
store final weight for DAF in DC-uRWell tracking
tongtongcao Jan 31, 2024
55e6f37
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Feb 9, 2024
469bf95
update pom file in DC package for version of clas-tracking
tongtongcao Feb 9, 2024
43e5216
Merge branch 'upgradeTrackingWithuRWELL' into applyDAF
tongtongcao Feb 9, 2024
6006a41
fix merge conflicts and update uRWell reader with 2 regions of uRWells
tongtongcao Feb 23, 2024
f789f16
Merge branch 'upgradeTrackingWithuRWELL' into applyDAF
tongtongcao Feb 23, 2024
d4921c8
set configuration for option of DAF application
tongtongcao Mar 6, 2024
5a47f52
set configuration for option of DAF parameters
tongtongcao Mar 7, 2024
71b3492
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Mar 7, 2024
a742314
update dc pom file for tracking package version
tongtongcao Mar 7, 2024
42a9f6d
Merge branch 'applyDAF' into upgradeTrackingWithuRWELL
tongtongcao Mar 7, 2024
d1a2c29
loose limit for Vtx0_y in DC reconstruction test
tongtongcao Mar 7, 2024
4c32fae
Merge branch 'development' into applyDAF
tongtongcao Mar 13, 2024
1bcc0e6
update DC reconstruction pom file for version of tracking
tongtongcao Mar 13, 2024
9c35c38
fix merge conflict
tongtongcao Mar 13, 2024
540aa85
update configuration setup for options of DAF implementation and DAF …
tongtongcao Mar 20, 2024
2d9b8bb
update for configuration of DAF annealing factor
tongtongcao Mar 25, 2024
d27a668
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Mar 26, 2024
84f7422
update DC reconstruction pom file for version of tracking
tongtongcao Mar 26, 2024
07cbf20
set lower limit for DAF weight to avoid overflow
tongtongcao Mar 27, 2024
d4d0909
fine updates
tongtongcao Mar 28, 2024
6f35a35
tiny change
tongtongcao Mar 28, 2024
5239f52
Update TB hit status, whose first bit indicates that a hit is belong …
tongtongcao Mar 29, 2024
78b1557
update for NDF
tongtongcao Apr 1, 2024
b25c04a
apply DAF for uRWell measurements
tongtongcao Apr 4, 2024
55d68b0
add state inforamtion from tracking into banks for uRWell
tongtongcao Apr 5, 2024
b430b27
update org.jlab.service.dc.DCURWellHBPostClusterAI
tongtongcao Apr 5, 2024
3f28d40
Update org.jlab.service.dc.DCURWellHBPostClusterAI to take clusters o…
tongtongcao Apr 8, 2024
052e186
fix HB cluster bank issue in org.jlab.service.dc.DCURWellHBPostClusterAI
tongtongcao Apr 9, 2024
c4db38e
fix merge conflicts
tongtongcao Apr 12, 2024
f0c8cae
Merge branch 'upgradeTrackingWithuRWELL' into applyDAFAIURWell2
tongtongcao Apr 12, 2024
4a9dbcb
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Apr 22, 2024
6b1823e
update status of uRWell cross
tongtongcao Apr 25, 2024
8d86beb
update uRWell reader for uRWell clusters
tongtongcao Apr 26, 2024
def71e6
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao May 2, 2024
dc687c7
Merge branch 'development' into upgradeTrackingWithuRWELL
tongtongcao Aug 21, 2024
5777a52
Merge branch 'development' into upgradeTrackingWithuRWELL
raffaelladevita Aug 22, 2024
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 @@ -14,6 +14,7 @@
/**
*
* @author ziegler
* @author Tongtong Cao
*/

public abstract class AMeasVecs {
Expand All @@ -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
Copy link
Collaborator

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"

Collections.sort(measSurfaces);
for(int i = 0; i < measSurfaces.size(); i++) {
MeasVec mvec = new MeasVec();
mvec.k = i ;
Expand All @@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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};
Copy link
Collaborator

Choose a reason for hiding this comment

The 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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The 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) {

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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();;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/**
*
* @author ziegler
* @author Tongtong Cao
*/
public class Surface implements Comparable<Surface> {

Expand All @@ -40,6 +41,57 @@ public class Surface implements Comparable<Surface> {
public boolean passive = false;
public double hemisphere = 1;

// For DC
public double z;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The 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;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Collaborator

Choose a reason for hiding this comment

The 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) {
Expand Down
Loading