Skip to content

Commit 0aacaee

Browse files
committed
Revert "DC v2: includes TFLight fix and new dc beta time walk with constants from /calibration/dc/v2 (#494)"
This reverts commit 73bd1ef.
1 parent f2b5ec0 commit 0aacaee

File tree

11 files changed

+385
-759
lines changed

11 files changed

+385
-759
lines changed

common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/kalmanfilter/zReference/KFitter.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,7 @@ private boolean filter(int k, boolean forward, double annealingFactor) {
708708
return false;
709709
}
710710
}
711-
712-
// Since no vertex inforamtion, the starting point for path length is the final point at the last layer.
713-
// After vertex information is obtained, transition for the starting point from the final point to vertex will be taken.
711+
714712
private boolean filter(int k, boolean forward) {
715713
StateVec sVec = sv.transported(forward).get(k);
716714
org.jlab.clas.tracking.kalmanfilter.AMeasVecs.MeasVec mVec = mv.measurements.get(k);
@@ -859,9 +857,7 @@ public Matrix filterCovMat(double[] H, Matrix Ci, double V) {
859857
private void calcFinalChisq(int sector) {
860858
calcFinalChisq(sector, false);
861859
}
862-
863-
// Since no vertex inforamtion, the starting point for path length is the final point at the last layer.
864-
// After vertex information is obtained, transition for the starting point from the final point to vertex will be taken.
860+
865861
private void calcFinalChisq(int sector, boolean nofilter) {
866862
int k = svzLength - 1;
867863
this.chi2 = 0;
@@ -884,9 +880,9 @@ private void calcFinalChisq(int sector, boolean nofilter) {
884880
sv.transport(sector, k, 0, sVec, mv, this.getSwimmer(), forward);
885881

886882
StateVec svc = sv.transported(forward).get(0);
887-
path += (forward ? 1 : -1) * svc.deltaPath;
883+
path += svc.deltaPath;
888884
svc.setPathLength(path);
889-
885+
890886
double V0 = mv.measurements.get(0).surface.unc[0];
891887

892888
Point3D point = new Point3D(svc.x, svc.y, mv.measurements.get(0).surface.measPoint.z());
@@ -926,7 +922,7 @@ private void calcFinalChisq(int sector, boolean nofilter) {
926922

927923
double h = mv.hDoca(point, mv.measurements.get(k1 + 1).surface.wireLine[0]);
928924
svc = sv.transported(forward).get(k1 + 1);
929-
path += (forward ? 1 : -1) * svc.deltaPath;
925+
path += svc.deltaPath;
930926
svc.setPathLength(path);
931927
svc.setProjector(mv.measurements.get(k1 + 1).surface.wireLine[0].origin().x());
932928
svc.setProjectorDoca(h);
@@ -979,7 +975,7 @@ private void calcFinalChisqDAF(int sector, boolean nofilter) {
979975
sv.transport(sector, k, 0, sVec, mv, this.getSwimmer(), forward);
980976

981977
StateVec svc = sv.transported(forward).get(0);
982-
path += (forward ? 1 : -1) * svc.deltaPath;
978+
path += svc.deltaPath;
983979
svc.setPathLength(path);
984980

985981
Point3D point = new Point3D(svc.x, svc.y, mv.measurements.get(0).surface.measPoint.z());
@@ -1051,7 +1047,7 @@ private void calcFinalChisqDAF(int sector, boolean nofilter) {
10511047
}
10521048

10531049
svc = sv.transported(forward).get(k1 + 1);
1054-
path += (forward ? 1 : -1) * svc.deltaPath;
1050+
path += svc.deltaPath;
10551051
svc.setPathLength(path);
10561052

10571053
point = new Point3D(sv.transported(forward).get(k1 + 1).x, sv.transported(forward).get(k1 + 1).y, mv.measurements.get(k1 + 1).surface.measPoint.z());
@@ -1120,10 +1116,6 @@ private void calcFinalChisqDAF(int sector, boolean nofilter) {
11201116
public Matrix propagateToVtx(int sector, double Zf) {
11211117
return sv.transport(sector, finalStateVec.k, Zf, finalStateVec, mv, this.getSwimmer());
11221118
}
1123-
1124-
public double getDeltaPathToVtx(int sector, double Zf) {
1125-
return sv.getDeltaPath(sector, finalStateVec.k, Zf, finalStateVec, mv, this.getSwimmer());
1126-
}
11271119

11281120
//Todo: apply the common funciton to replace current function above
11291121
@Override

common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/kalmanfilter/zReference/KFitterStraight.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,6 @@ private void calcFinalChisq(int sector) {
406406
calcFinalChisq(sector, false);
407407
}
408408

409-
// Since no vertex inforamtion, the starting point for path length is the final point at the last layer.
410-
// After vertex information is obtained, transition for the starting point from the final point to vertex will be taken.
411409
private void calcFinalChisq(int sector, boolean nofilter) {
412410
int k = svzLength - 1;
413411
this.chi2 = 0;
@@ -428,11 +426,11 @@ private void calcFinalChisq(int sector, boolean nofilter) {
428426
kfStateVecsAlongTrajectory = new ArrayList<>();
429427
if (sVec != null && sVec.CM != null) {
430428

431-
boolean forward = false;
429+
boolean forward = false;
432430
sv.transport(sector, k, 0, sVec, mv, this.getSwimmer(), forward);
433431

434432
StateVec svc = sv.transported(forward).get(0);
435-
path += (forward ? 1 : -1) * svc.deltaPath;
433+
path += svc.deltaPath;
436434
svc.setPathLength(path);
437435

438436
double V0 = mv.measurements.get(0).surface.unc[0];
@@ -475,7 +473,7 @@ private void calcFinalChisq(int sector, boolean nofilter) {
475473

476474
double h = mv.hDoca(point, mv.measurements.get(k1 + 1).surface.wireLine[0]);
477475
svc = sv.transported(forward).get(k1+1);
478-
path += (forward ? 1 : -1) * svc.deltaPath;
476+
path += svc.deltaPath;
479477
svc.setPathLength(path);
480478
svc.setProjector(mv.measurements.get(k1 + 1).surface.wireLine[0].origin().x());
481479
svc.setProjectorDoca(h);
@@ -506,10 +504,6 @@ public Matrix propagateToVtx(int sector, double Zf) {
506504
return sv.transport(sector, finalStateVec.k, Zf, finalStateVec, mv, this.getSwimmer());
507505
}
508506

509-
public double getDeltaPathToVtx(int sector, double Zf) {
510-
return sv.getDeltaPath(sector, finalStateVec.k, Zf, finalStateVec, mv, this.getSwimmer());
511-
}
512-
513507
@Override
514508
public void runFitter(AStateVecs sv, AMeasVecs mv) {
515509
throw new UnsupportedOperationException("Not supported yet.");

common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/kalmanfilter/zReference/StateVecs.java

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void initFromHB(StateVec initSV, double beta) {
5353
this.trackTrajS.clear();
5454
this.trackTrajT.put(0, new StateVec(initSV));
5555
}
56-
56+
5757
/**
5858
*
5959
* @param sector
@@ -150,104 +150,6 @@ public Matrix transport(int sector, int i, double Zf, StateVec iVec, AMeasVecs m
150150

151151
return fVec.CM;
152152

153-
}
154-
155-
/**
156-
*
157-
* @param sector
158-
* @param i initial state vector index
159-
* @param Zf
160-
* @param iVec state vector at the initial index
161-
* @param mv measurements
162-
*/
163-
public double getDeltaPath(int sector, int i, double Zf, StateVec iVec, AMeasVecs mv, Swim swimmer) { // s = signed step-size
164-
165-
double stepSize = 1.0;
166-
StateVec fVec = new StateVec(0);
167-
fVec.x = iVec.x;
168-
fVec.y = iVec.y;
169-
fVec.z = iVec.z;
170-
fVec.tx = iVec.tx;
171-
fVec.ty = iVec.ty;
172-
fVec.Q = iVec.Q;
173-
fVec.B = iVec.B;
174-
Matrix5x5.copy(iVec.CM, fVec.CM);
175-
176-
double s = 0;
177-
double zInit = mv.measurements.get(i).surface.measPoint.z();
178-
double BatMeas = iVec.B;
179-
180-
double z = zInit;
181-
182-
while (Math.signum(Zf - zInit) * z < Math.signum(Zf - zInit) * Zf) {
183-
z = fVec.z;
184-
if (z == Zf) {
185-
break;
186-
}
187-
188-
double x = fVec.x;
189-
double y = fVec.y;
190-
double tx = fVec.tx;
191-
double ty = fVec.ty;
192-
double Q = fVec.Q;
193-
double dPath = fVec.deltaPath;
194-
Matrix cMat = new Matrix();
195-
Matrix5x5.copy(fVec.CM, cMat);
196-
s = Math.signum(Zf - zInit) * stepSize;
197-
198-
// LOGGER.log(Level.FINE, " from "+(float)Z[i]+" to "+(float)Z[f]+" at "+(float)z+" By is "+bf[1]+" B is "+Math.sqrt(bf[0]*bf[0]+bf[1]*bf[1]+bf[2]*bf[2])/Bmax+" stepSize is "+s);
199-
if (Math.signum(Zf - zInit) * (z + s) > Math.signum(Zf - zInit) * Zf) {
200-
s = Math.signum(Zf - zInit) * Math.abs(Zf - z);
201-
}
202-
203-
//rk.RK4transport(sector, Q, x, y, z, tx, ty, s, swimmer, cMat, fVec, dPath);
204-
rk.RK4transport(sector, s, swimmer, cMat, fVec);
205-
206-
// Q process noise matrix estimate
207-
double p = Math.abs(1. / iVec.Q);
208-
209-
double X0 = this.getX0(mv.measurements.get(i).surface, z, Z);
210-
double t_ov_X0 = Math.abs(s) / X0;//path length in radiation length units = t/X0 [true path length/ X0] ; Ar radiation length = 14 cm
211-
212-
double beta = this.beta;
213-
if (beta > 1.0 || beta <= 0) {
214-
beta = 1.0;
215-
}
216-
217-
double sctRMS = 0;
218-
219-
////// Todo: Modify multi-scattering or remove it; After update, some parameters, like iteration termintion chonditions, may need to be updated.
220-
// Speed of light should be 1
221-
// From one measurement site to another, F and Q should be calculated separaetely with multiple steps; and then C' = FTCF + Q
222-
if (Math.abs(s) > 0) {
223-
sctRMS = ((0.0136) / (beta * PhysicsConstants.speedOfLight() * p)) * Math.sqrt(t_ov_X0)
224-
* (1 + 0.038 * Math.log(t_ov_X0));
225-
}
226-
227-
double cov_txtx = (1 + tx * tx) * (1 + tx * tx + ty * ty) * sctRMS * sctRMS;
228-
double cov_tyty = (1 + ty * ty) * (1 + tx * tx + ty * ty) * sctRMS * sctRMS;
229-
double cov_txty = tx * ty * (1 + tx * tx + ty * ty) * sctRMS * sctRMS;
230-
231-
fMS.set(
232-
0, 0, 0, 0, 0,
233-
0, 0, 0, 0, 0,
234-
0, 0, cov_txtx, cov_txty, 0,
235-
0, 0, cov_txty, cov_tyty, 0,
236-
0, 0, 0, 0, 0
237-
);
238-
239-
Matrix5x5.copy(fVec.CM, copyMatrix);
240-
Matrix5x5.add(copyMatrix, fMS, fVec.CM);
241-
242-
if (Math.abs(fVec.B - BatMeas) < 0.0001) {
243-
stepSize *= 2;
244-
}
245-
246-
BatMeas = fVec.B;
247-
}
248-
249-
return fVec.deltaPath;
250-
251153
}
252154

253155
/**

reconstruction/dc/src/main/java/org/jlab/rec/dc/Constants.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static Constants getInstance() {
9494
public int SECTORSELECT = 0;
9595
public int NSUPERLAYERTRACKING = 5;
9696
private boolean USETSTART = true;
97-
//private boolean USETIMETBETA = false;
97+
private boolean USETIMETBETA = false;
9898
private boolean CHECKBETA = false;
9999
private int T2D = 1; // 1=polynomial, 0=exponential
100100
private boolean USEDOUBLETS = false;
@@ -105,10 +105,10 @@ public static Constants getInstance() {
105105
public static final String TT = "/daq/tt/dc";
106106
public static final String DOCARES = "/calibration/dc/signal_generation/doca_resolution";
107107
public static final String TIME2DIST = "/calibration/dc/time_to_distance/time2dist";
108-
public static final String T2DPRESSURE = "/calibration/dc/v2/t2d_pressure";
108+
public static final String T2DPRESSURE = "/calibration/dc/time_to_distance/t2d_pressure";
109109
public static final String PRESSURE = "/hall/weather/pressure";
110-
public static final String T2DPRESSUREREF = "/calibration/dc/v2/ref_pressure";
111-
public static final String T0CORRECTION = "/calibration/dc/v2/t0";
110+
public static final String T2DPRESSUREREF = "/calibration/dc/time_to_distance/ref_pressure";
111+
public static final String T0CORRECTION = "/calibration/dc/time_corrections/T0Corrections";
112112
public static final String TDCTCUTS = "/calibration/dc/time_corrections/tdctimingcuts";
113113
public static final String WIRESTAT = "/calibration/dc/tracking/wire_status";
114114
public static final String TIMEJITTER = "/calibration/dc/time_jitter";
@@ -296,13 +296,13 @@ public void setUSETSTART(boolean usetstart) {
296296
USETSTART = usetstart;
297297
}
298298

299-
// public boolean useUSETIMETBETA() {
300-
// return USETIMETBETA;
301-
// }
302-
//
303-
// public void setUSETIMETBETA(boolean usetimebeta) {
304-
// USETIMETBETA = usetimebeta;
305-
// }
299+
public boolean useUSETIMETBETA() {
300+
return USETIMETBETA;
301+
}
302+
303+
public void setUSETIMETBETA(boolean usetimebeta) {
304+
USETIMETBETA = usetimebeta;
305+
}
306306

307307
public double getWIREDIST() {
308308
return WIREDIST;
@@ -429,7 +429,7 @@ public void printConfig(String engine) {
429429
LOGGER.log(Level.INFO, "["+engine+"] run with wire ministagger = " + MINISTAGGERSTATUS.getName());
430430
LOGGER.log(Level.INFO, "["+engine+"] run with wire feedthroughs = " + FEEDTHROUGHSSTATUS.getName());
431431
LOGGER.log(Level.INFO, "["+engine+"] run with wire distortions = " + ENDPLATESBOWING);
432-
//LOGGER.log(Level.INFO, "["+engine+"] run with with time Beta correction (is false for doca Beta correction) = " + USETIMETBETA);
432+
LOGGER.log(Level.INFO, "["+engine+"] run with with time Beta correction (is false for doca Beta correction) = " + USETIMETBETA);
433433
LOGGER.log(Level.INFO, "["+engine+"] run with with Beta cut = " + CHECKBETA);
434434
LOGGER.log(Level.INFO, "["+engine+"] run with time to distance function set to exponential/polynomial (0/1) = " + T2D);
435435
LOGGER.log(Level.INFO, "["+engine+"] run with with hit doublets recovery = " + USEDOUBLETS);

reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ private double[] getT0(int sector, int superlayer,
745745
int cable = this.getCableID1to6(layer, wire);
746746
int slot = this.getSlotID1to7(wire);
747747

748-
double t0 = t0Table.getDoubleValue("t0correction", sector, superlayer, slot, cable);
749-
double t0E = t0Table.getDoubleValue("t0error", sector, superlayer, slot, cable);
748+
double t0 = t0Table.getDoubleValue("T0Correction", sector, superlayer, slot, cable);
749+
double t0E = t0Table.getDoubleValue("T0Error", sector, superlayer, slot, cable);
750750

751751
T0Corr[0] = t0;
752752
T0Corr[1] = t0E;

reconstruction/dc/src/main/java/org/jlab/rec/dc/hit/FittedHit.java

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -385,28 +385,27 @@ public void set_TimeToDistance(DataEvent event, double trkAngle, double B, Index
385385
double deltatime_beta = 0;
386386
double deltadoca_beta = 0;
387387

388-
// if(Constants.getInstance().useUSETIMETBETA()==true) {
389-
// deltatime_beta = calcDeltaTimeBetaTFCN(this.get_Time(), tab, beta);
390-
// }
391-
//
392-
// if(event.hasBank("MC::Particle")==false) {
393-
// distance = tde.interpolateOnGrid(B, Math.toDegrees(ralpha),
394-
// this.getCorrectedTime(this.get_Time(), deltatime_beta),
395-
// secIdx, slIdx);
396-
// } else {
397-
// distance = tde.interpolateOnGrid(B, Math.toDegrees(ralpha),
398-
// this.getCorrectedTime(this.get_Time(), 0),
399-
// secIdx, slIdx) ;
400-
// }
401-
// //get deltadoca
402-
// if(Constants.getInstance().useUSETIMETBETA()==false) {
403-
// deltadoca_beta = calcDeltaDocaBeta(distance, tab, beta);
404-
// }
405-
//
406-
// distance -=deltadoca_beta;
407-
//this.set_DeltaTimeBeta(deltatime_beta);
408-
//this.set_DeltaDocaBeta(deltadoca_beta);
409-
distance = tde.interpolateOnGrid(B, Math.toDegrees(ralpha), beta, this.get_Time(), secIdx, slIdx);
388+
if(Constants.getInstance().useUSETIMETBETA()==true) {
389+
deltatime_beta = calcDeltaTimeBetaTFCN(this.get_Time(), tab, beta);
390+
}
391+
392+
if(event.hasBank("MC::Particle")==false) {
393+
distance = tde.interpolateOnGrid(B, Math.toDegrees(ralpha),
394+
this.getCorrectedTime(this.get_Time(), deltatime_beta),
395+
secIdx, slIdx);
396+
} else {
397+
distance = tde.interpolateOnGrid(B, Math.toDegrees(ralpha),
398+
this.getCorrectedTime(this.get_Time(), 0),
399+
secIdx, slIdx) ;
400+
}
401+
//get deltadoca
402+
if(Constants.getInstance().useUSETIMETBETA()==false) {
403+
deltadoca_beta = calcDeltaDocaBeta(distance, tab, beta);
404+
}
405+
406+
distance -=deltadoca_beta;
407+
this.set_DeltaTimeBeta(deltatime_beta);
408+
this.set_DeltaDocaBeta(deltadoca_beta);
410409

411410
}
412411

reconstruction/dc/src/main/java/org/jlab/rec/dc/timetodistance/T2DFunctions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public static double polyFcnMac(double x, double alpha, double bfield, double v_
321321
double time = 0;
322322
// alpha correction
323323
double cos30minusalpha=Math.cos(Math.toRadians(30.-alpha));
324-
double dmaxalpha = dmax*cos30minusalpha;
324+
double dmaxalpha = dmax*cos30minusalpha;
325325
double xhatalpha = x/dmaxalpha;
326326
// rcapital is an intermediate parameter
327327
double rcapital = R*dmax;

0 commit comments

Comments
 (0)