Skip to content

Commit 8e5ec1e

Browse files
committed
make the track state at target use the target z from the supplied beamspot; add getters for track states at perigee and target
1 parent b894841 commit 8e5ec1e

2 files changed

Lines changed: 21 additions & 33 deletions

File tree

tracking/src/main/java/org/hps/recon/tracking/TrackStateUtils.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@
1919
*/
2020
public class TrackStateUtils {
2121

22+
23+
public static TrackState getTrackStateAtTarget(Track track){
24+
25+
for(TrackState ts: track.getTrackStates()){
26+
if(ts.getLocation() == TrackState.AtTarget)
27+
return ts;
28+
}
29+
return null;
30+
}
31+
32+
public static TrackState getTrackStateAtPerigee(Track track){
33+
34+
for(TrackState ts: track.getTrackStates()){
35+
if(ts.getLocation() == TrackState.AtPerigee)
36+
return ts;
37+
}
38+
return null;
39+
}
40+
2241
public static TrackState getTrackStateAtLayer(Track track, List<HpsSiSensor> sensors, int layer) {
2342
TrackState atIP = getTrackStateAtIP(track);
2443

tracking/src/main/java/org/hps/recon/tracking/kalman/KalmanInterface.java

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public class KalmanInterface {
101101
private int nBigEvents;
102102
private int eventNumber;
103103
private static double target_pos = -999.9;
104-
private static boolean addTrackStateAtTarget = false;
104+
private static boolean addTrackStateAtTarget = true;
105105
private double[] beamPosition = null;
106106

107107
private static final boolean debug = false;
@@ -698,41 +698,10 @@ public BaseTrack createTrack(KalTrack kT, boolean storeTrackStates) {
698698
double BAtEcal = BfieldAtEcal.mag();
699699
double alphaAtEcal = conFac/ BAtEcal;
700700

701-
/*
702-
703-
DMatrixRMaj ecalCov = new DMatrixRMaj(getCovarianceFromHelix(helixAtEcal));
704-
double[] ecalParams = helixAtEcal.a.v.clone();
705-
double[] ecalLCSimParams = getLCSimParams(ecalParams, alphaAtEcal);
706-
double[] ecalLCSimCov = getLCSimCov(ecalCov, alphaAtEcal).asPackedArray(true);
707-
double[] refAtEcal = localKalToHps(helixAtEcal.origin);
708-
if(debug)System.out.println(this.getClass().getName()+":: reference to TrackState @ ecal = "+
709-
+refAtEcal[0]+", "+refAtEcal[1]+","+ refAtEcal[2]);
710-
TrackState ts_ecal_helix = new BaseTrackState(ecalLCSimParams,refAtEcal, ecalLCSimCov, TrackState.AtCalorimeter, BAtEcal);
711-
if(debug)System.out.println(this.getClass().getName()+":: Uncorrected track state: curvature = "+ts_ecal_helix.getOmega()
712-
+" bField = "+ts_ecal_helix.getBLocal()+" momentum z = "+ts_ecal_helix.getMomentum()[0]);
713-
System.out.println("Helix at ECal from kT.getHelixAtPlane and by hand conversions ");
714-
System.out.println(ts_ecal_helix.toString());
715-
*/
716-
//newTrack.getTrackStates().add(ts_ecal_helix);
717-
718-
719-
// this is how createTrackState (above) goes from measurement to TrackState
720-
// from the measurements. It calls toHPShelix.
721-
// the helix state here must already be propagated
722-
// helix.toTrackState(alphaCenter, ms.m.p, loc);
723-
724701
TrackState ts_ecal=helixAtEcal.toTrackState(alphaAtEcal, ecalPlane, TrackState.AtCalorimeter, saveTrackStateAtIntercept);
725702
newTrack.getTrackStates().add(ts_ecal);
726-
//if(debug)System.out.println("Helix at ECal from helix.toTrackState");
727-
// if(debug)System.out.println(ts_toTrackState.toString());
728-
// System.out.println("Helix at ECal from helix.toTrackState");
729-
// System.out.println(ts_toTrackState.toString());
730-
731-
// Extrapolate to the ECAL and make a new trackState there.
732-
//BaseTrackState ts_ecal = new BaseTrackState();
733-
//ts_ecal = TrackUtils.getTrackExtrapAtEcalRK(newTrack, fM, runNumber);
734703

735-
Vec targetFace=origin;
704+
Vec targetFace=new Vec(kPar.beamSpot[0], kPar.beamSpot[1], kPar.beamSpot[2]);
736705
Plane targetPlane = new Plane(targetFace, new Vec(0., 1., 0.));
737706
HelixState helixAtTarget=kT.getHelixAtPlane(targetPlane,saveTrackStateAtIntercept); // this propagates (via RK) the helix to the plane
738707
Vec BfieldAtTarget = KalmanInterface.getField(helixAtTarget.origin, kT.SiteList.get(0).m.Bfield);

0 commit comments

Comments
 (0)