Skip to content

Commit 9aaa256

Browse files
committed
convenient use of PID in RK4
1 parent 948878d commit 9aaa256

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter

‎reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/RungeKutta4.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ public void doOneStep(Stepper stepper) {
103103
}
104104

105105
private double[] f(double[] y) {
106-
double charge = 1.0; // the charge should by given by the particle object
107-
// for now, we assume it is a proton
106+
double charge = particle.charge();
108107
double pModuleInverse = 1.0 / Math.sqrt(y[3] * y[3] + y[4] * y[4] + y[5] * y[5]);
109108
double k = charge * PhysicsConstants.speedOfLight() * 10 * pModuleInverse;
110109

@@ -133,13 +132,14 @@ private double[] f(double[] y) {
133132
private void energyLoss(
134133
double[] yIn, double h, org.jlab.clas.tracking.kalmanfilter.Material material) {
135134
double mass = particle.mass() * 1000; //particle mass defined in GeV, converted to MeV
135+
int charge = particle.charge();
136136

137137
h /= 10; // h defined in mm, converted to cm
138138
double mom = Math.sqrt(yIn[3] * yIn[3] + yIn[4] * yIn[4] + yIn[5] * yIn[5]);
139139
double E = Math.sqrt(mom * mom + mass * mass);
140140
//material::getEloss(double p, double m) uses GeV and cm
141141
//see common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/kalmanfilter/Material.java
142-
double dedx = material.getEloss(mom/1000, mass/1000) * 1000;//Momentum, mass input in GeV, output in GeV/cm, converted to MeV/cm
142+
double dedx = material.getEloss(mom/1000, mass/1000, charge) * 1000;//Momentum, mass input in GeV, output in GeV/cm, converted to MeV/cm
143143
double DeltaE = dedx * h;
144144

145145
stepper.dEdx += DeltaE;

0 commit comments

Comments
 (0)