Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1f21a44
use the same time2distance for simu and real data
ftouchte Nov 4, 2025
5818e7c
define KFMonitor
ftouchte Nov 6, 2025
d7ecc36
store kalman filter steps in a list of KFMonitor
ftouchte Nov 6, 2025
6b0350b
add a new bank structure for AHDC KF track monitoring
ftouchte Nov 6, 2025
b8d4213
add trackid in KFMonitor
ftouchte Nov 6, 2025
cc8aa0e
add AHDC::kftrack:mon in AHDCEngine
ftouchte Nov 6, 2025
174a881
optional routine to use mc bank as input of the Kalman filter
ftouchte Nov 12, 2025
6452cb1
save error caovariance in AHDC::kftrack:mon
ftouchte Nov 12, 2025
3c09450
fix kfmonitor id for the initial state
ftouchte Nov 12, 2025
b715c5a
add some comments
ftouchte Nov 20, 2025
8a5843f
remove everything related to sign ambiguity
ftouchte Nov 21, 2025
e8c1fa5
fix indentation
ftouchte Nov 21, 2025
6b459f3
unify ahdc.Hit.Hit and ahdc.KalmanFilter.Hit
ftouchte Nov 21, 2025
58ad6c5
fix indentation
ftouchte Nov 21, 2025
8192716
Merge pull request #8 from JeffersonLab/development
ftouchte Nov 24, 2025
0ab72d1
implement a better comparable method for Hit
ftouchte Nov 24, 2025
82d0d68
fix distance for the beamline
ftouchte Nov 24, 2025
8d20ed5
update maesurement noise
ftouchte Nov 24, 2025
a5093c8
fix residual and update Niter
ftouchte Nov 24, 2025
e04f4ef
tmp: remove banks before addign new ones
ftouchte Nov 24, 2025
43bf801
fix hit beam id
ftouchte Nov 24, 2025
b368e26
fix indicator unique
ftouchte Nov 24, 2025
491a7db
add debug test for hit comparison
ftouchte Nov 24, 2025
fc49c2d
update test
ftouchte Nov 24, 2025
ec63ad7
feat!: The Kalman Filter uses all available hits
ftouchte Nov 25, 2025
987e5fd
use electron vertex
ftouchte Nov 26, 2025
7af331f
do not use the electron vertex yet
ftouchte Dec 9, 2025
72b955c
Fix the Kalmam Filter propagator
ftouchte Dec 11, 2025
94e578e
uncomment error status
ftouchte Dec 15, 2025
7f7a625
try to optimize the propagator
ftouchte Dec 15, 2025
f3cdf31
increase initial covariance errors
ftouchte Dec 16, 2025
155a513
remove KFMonitor
ftouchte Dec 16, 2025
ca9cd48
Merge branch 'development' into feat/new-kfilter
ftouchte Dec 16, 2025
48dc5b0
Update comments
ftouchte Dec 16, 2025
045081a
reduce number of iterations
ftouchte Dec 16, 2025
1545c85
Reset submodule etc/data/magfield to development version
ftouchte Dec 16, 2025
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 @@ -8,6 +8,8 @@
import org.jlab.rec.ahdc.Hit.Hit;
import org.jlab.rec.ahdc.PreCluster.PreCluster;
import org.jlab.rec.ahdc.Track.Track;
import org.apache.commons.math3.linear.RealVector;
import org.apache.commons.math3.linear.RealMatrix;

import java.util.ArrayList;

Expand Down
84 changes: 69 additions & 15 deletions reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Hit/Hit.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package org.jlab.rec.ahdc.Hit;

import org.apache.commons.math3.linear.Array2DRowRealMatrix;
import org.apache.commons.math3.linear.ArrayRealVector;
import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.RealVector;
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.geom.detector.alert.AHDC.AlertDCDetector;
import org.jlab.geom.prim.Line3D;
import org.jlab.geom.prim.Point3D;
import org.jlab.geom.detector.alert.AHDC.AlertDCFactory;

public class Hit implements Comparable<Hit> {

private final double thster = Math.toRadians(20.0);
private final int id;
private final int superLayerId;
private final int layerId;
Expand All @@ -15,7 +20,7 @@ public class Hit implements Comparable<Hit> {
private final double adc;
private final double time;

private Line3D wireLine;
private Line3D wireLine;
private double phi;
private double radius;
private int nbOfWires;
Expand All @@ -26,7 +31,7 @@ public class Hit implements Comparable<Hit> {
private double residual;
private int trackId;

//updated constructor with ADC
//updated constructor with ADC
public Hit(int _Id, int _Super_layer, int _Layer, int _Wire, double _Doca, double _ADC, double _Time) {
this.id = _Id;
this.superLayerId = _Super_layer;
Expand All @@ -45,7 +50,7 @@ public void setWirePosition(AlertDCDetector factory) {
//System.out.println(" superlayer " + this.superLayerId + " layer " + this.layerId + " wire " + this.wireId + " R_layer " + R_layer + " wx " + wx + " wy " + wy);
wireLine = factory.getSector(1).getSuperlayer(superLayerId).getLayer(layerId).getComponent(wireId).getLine();
Point3D end = wireLine.end();
this.nbOfWires = factory.getSector(1).getSuperlayer(superLayerId).getLayer(layerId).getNumComponents();
this.nbOfWires = factory.getSector(1).getSuperlayer(superLayerId).getLayer(layerId).getNumComponents();
this.phi = end.vectorFrom(0, 0, 0).phi();
this.radius = end.distance(0, 0, end.z());
this.x = end.x();
Expand All @@ -57,12 +62,27 @@ public String toString() {
return "Hit{" + "_Super_layer=" + superLayerId + ", _Layer=" + layerId + ", _Wire=" + wireId + ", _Doca=" + doca + ", _Phi=" + phi + '}';
}

// Should return
// 0 if equality
// +1 if this is bigger than arg0
// -1 if this is lower than arg0
@Override
public int compareTo(Hit arg0) {
if (this.superLayerId == arg0.superLayerId && this.layerId == arg0.layerId && this.wireId == arg0.wireId) {
return 0;
} else {
return 1;
if (this.superLayerId == arg0.superLayerId && this.layerId == arg0.layerId) { // same layer, so they have the same nbOfWires
if (this.wireId == 1 && arg0.wireId == this.nbOfWires) {
return 1;
}
else if (this.wireId == this.nbOfWires && arg0.wireId == 1) {
return -1;
}
else {
return Integer.compare(this.wireId, arg0.wireId);
}
}
else {
int this_value = 10*this.superLayerId + this.layerId;
int value = 10*arg0.superLayerId + arg0.layerId;
return Integer.compare(this_value, value);
}
}

Expand All @@ -86,13 +106,13 @@ public double getDoca() {
return doca;
}

public Line3D getLine() {
return wireLine;
}
public double getRadius() {
return radius;
}
public Line3D getLine() {
return wireLine;
}

public double getRadius() {
return radius;
}

public int getNbOfWires() {
return nbOfWires;
Expand Down Expand Up @@ -146,4 +166,38 @@ public void setTrackId(int _trackId) {
this.trackId = _trackId;
}

public RealVector get_Vector() {
return new ArrayRealVector(new double[]{this.doca});
}

public RealMatrix get_MeasurementNoise() {
return new Array2DRowRealMatrix(new double[][]{{0.09}});
}

// a signature for KalmanFilter.Hit_beam
public RealVector get_Vector_beam() {
return null;
}

public double distance(Point3D point3D) {
return this.wireLine.distance(point3D).length();
}

public static void main(String[] args) {
AlertDCDetector factory = (new AlertDCFactory()).createDetectorCLAS(new DatabaseConstantProvider());
System.out.println("Run test: comparison between two hits.");
Hit h1 = new Hit(1,1,1,1,0,0,0);
Hit h2 = new Hit(1,1,1,47,0,0,0);
Hit h3 = new Hit(1,2,1,47,0,0,0);
h1.setWirePosition(factory);
h2.setWirePosition(factory);
System.out.println("h1 : " + h1);
System.out.println("h2 : " + h2);
System.out.println("h3 : " + h3);
System.out.println("numWires : " + h1.getNbOfWires());
System.out.println("h1 compare to h2 : " + h1.compareTo(h2));
System.out.println("h2 compare to h1 : " + h2.compareTo(h1));
System.out.println("h1 compare to h3 : " + h1.compareTo(h3));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final void fetch_AHDCHits(DataEvent event, AlertDCDetector detector) {
}

RawDataBank bankDGTZ = new RawDataBank("AHDC::adc");
bankDGTZ.read(event);
bankDGTZ.read(event);

for (int i = 0; i < bankDGTZ.rows(); i++) {
int id = bankDGTZ.trueIndex(i) + 1;
Expand Down Expand Up @@ -82,8 +82,8 @@ public final void fetch_AHDCHits(DataEvent event, AlertDCDetector detector) {
double doca = p0 + p1*Math.pow(time,1.0) + p2*Math.pow(time,2.0) + p3*Math.pow(time,3.0) + p4*Math.pow(time,4.0) + p5*Math.pow(time, 5.0);
if (time < 0) doca = 0;
Hit h = new Hit(id, superlayer, layer, wire, doca, adc, time);
h.setWirePosition(detector);
hits.add(h);
h.setWirePosition(detector);
hits.add(h);
}
}
}
Expand Down

This file was deleted.

Loading