|
16 | 16 | import org.hps.recon.vertexing.BilliorVertex; |
17 | 17 | import org.hps.recon.vertexing.BilliorVertexer; |
18 | 18 | import org.hps.record.StandardCuts; |
| 19 | +import org.hps.recon.tracking.TrackStateUtils; |
19 | 20 | import org.lcsim.detector.tracker.silicon.HpsSiSensor; |
20 | 21 | import org.lcsim.event.EventHeader; |
21 | 22 | import org.lcsim.event.RawTrackerHit; |
@@ -509,12 +510,22 @@ private BilliorVertex fitVertex(Constraint constraint, ReconstructedParticle ele |
509 | 510 | BilliorTrack electronBTrack = toBilliorTrack(electron.getTracks().get(0)); |
510 | 511 | BilliorTrack positronBTrack = toBilliorTrack(positron.getTracks().get(0)); |
511 | 512 |
|
512 | | - // Create a vertex fitter from the magnetic field. |
| 513 | + // Create a vertex fitter from the magnetic field. |
513 | 514 | // Note that the vertexing code uses the tracking frame coordinates |
514 | 515 | // HPS X => TRACK Y |
515 | 516 | // HPS Y => TRACK Z |
516 | 517 | // HPS Z => TRACK X |
517 | | - BilliorVertexer vtxFitter = new BilliorVertexer(bField); |
| 518 | + //first get the field @ perigee reference from the first tracks state (doesn't matter which one) |
| 519 | + // double bLocal=(electron.getTracks().get(0)).getTrackStates().get(TrackState.AtPerigee).getBLocal(); |
| 520 | + double bLocal=TrackStateUtils.getTrackStatesAtLocation(electron.getTracks().get(0),TrackState.AtPerigee).get(0).getBLocal(); |
| 521 | + // System.out.println("For Vertexer: "+TrackStateUtils.getTrackStatesAtLocation(electron.getTracks().get(0),TrackState.AtPerigee).get(0).toString()); |
| 522 | + // if we are using GBL tracks (trackType=0), set bLocal to bField (i.e. at SVT center) |
| 523 | + if(trackType==0) |
| 524 | + bLocal=bField; |
| 525 | + |
| 526 | + //set up vertexer with field |
| 527 | + // System.out.println("track type = "+trackType+"; setting vertex field = "+bLocal); |
| 528 | + BilliorVertexer vtxFitter = new BilliorVertexer(bLocal); |
518 | 529 | // TODO: The beam size should come from the conditions database. |
519 | 530 | vtxFitter.setBeamSize(beamSize); |
520 | 531 | vtxFitter.setBeamPosition(beamPositionToUse); |
@@ -880,11 +891,13 @@ private List<BilliorTrack> shiftTracksToVertex(List<ReconstructedParticle> parti |
880 | 891 | double[] newRef = {vtxPos.z(), vtxPos.x(), 0.0};//the TrackUtils.getParametersAtNewRefPoint method only shifts in xy tracking frame |
881 | 892 | List<BilliorTrack> newTrks = new ArrayList<BilliorTrack>(); |
882 | 893 | for (ReconstructedParticle part : particles) { |
883 | | - BaseTrackState oldTS = (BaseTrackState) part.getTracks().get(0).getTrackStates().get(0); |
| 894 | + BaseTrackState oldTS=(BaseTrackState)TrackStateUtils.getTrackStatesAtLocation(part.getTracks().get(0),TrackState.AtPerigee).get(0); |
| 895 | + // BaseTrackState oldTS = (BaseTrackState) part.getTracks().get(0).getTrackStates().get(TrackState.AtPerigee); |
884 | 896 | double[] newParams = TrackUtils.getParametersAtNewRefPoint(newRef, oldTS); |
885 | 897 | SymmetricMatrix newCov = TrackUtils.getCovarianceAtNewRefPoint(newRef, oldTS.getReferencePoint(), oldTS.getParameters(), new SymmetricMatrix(5, oldTS.getCovMatrix(), true)); |
886 | 898 | //mg...I don't like this re-casting, but toBilliorTrack only takes Track as input |
887 | | - BaseTrackState newTS = new BaseTrackState(newParams, newRef, newCov.asPackedArray(true), TrackState.AtIP, bField); |
| 899 | + //make the state with bfield = field at original z-position because TrackUtils.getParametersAtNewRefPoint does not change curvature! |
| 900 | + BaseTrackState newTS = new BaseTrackState(newParams, newRef, newCov.asPackedArray(true), TrackState.AtPerigee, oldTS.getBLocal()); |
888 | 901 | BilliorTrack electronBTrackShift = this.toBilliorTrack(newTS); |
889 | 902 | newTrks.add(electronBTrackShift); |
890 | 903 | } |
|
0 commit comments