|
6 | 6 | import hep.physics.vec.HepLorentzVector; |
7 | 7 | import hep.physics.vec.VecOp; |
8 | 8 |
|
| 9 | +import hep.physics.matrix.Matrix; |
| 10 | +import hep.physics.matrix.MatrixOp; |
| 11 | + |
9 | 12 | import java.io.FileNotFoundException; |
10 | 13 | import java.io.PrintWriter; |
11 | 14 | import java.util.ArrayList; |
@@ -79,7 +82,12 @@ public abstract class TupleDriver extends Driver { |
79 | 82 | private final double[] botPos = {54.5,107.5,207.5}; |
80 | 83 | protected final BasicHep3Matrix beamAxisRotation = BasicHep3Matrix.identity(); |
81 | 84 | protected double ebeam = Double.NaN; |
| 85 | + private int nLay = 6; |
82 | 86 |
|
| 87 | + public void setNLay(int nLay) { |
| 88 | + this.nLay = nLay; |
| 89 | + } |
| 90 | + |
83 | 91 | public void setApplyBeamRotation(boolean applyBeamRotation) { |
84 | 92 | this.applyBeamRotation = applyBeamRotation; |
85 | 93 | } |
@@ -269,6 +277,9 @@ protected void addVertexVariables() { |
269 | 277 | "tarVX/D", "tarVY/D", "tarVZ/D", "tarChisq/D", "tarM/D", |
270 | 278 | "vzcPX/D", "vzcPY/D", "vzcPZ/D", "vzcP/D", |
271 | 279 | "vzcVX/D", "vzcVY/D", "vzcVZ/D", "vzcChisq/D", "vzcM/D", |
| 280 | + "uncCovXX/D","uncCovXY/D","uncCovXZ/D", |
| 281 | + "uncCovYX/D","uncCovYY/D","uncCovYZ/D", |
| 282 | + "uncCovZX/D","uncCovZY/D","uncCovZZ/D", |
272 | 283 | "uncElePX/D", "uncElePY/D", "uncElePZ/D", "uncPosPX/D", "uncPosPY/D", "uncPosPZ/D", "uncEleP/D", "uncPosP/D", |
273 | 284 | "bscElePX/D", "bscElePY/D", "bscElePZ/D", "bscPosPX/D", "bscPosPY/D", "bscPosPZ/D", "bscEleP/D", "bscPosP/D", |
274 | 285 | "tarElePX/D", "tarElePY/D", "tarElePZ/D", "tarPosPX/D", "tarPosPY/D", "tarPosPZ/D", "tarEleP/D", "tarPosP/D", |
@@ -678,14 +689,14 @@ protected TrackState fillParticleVariables(EventHeader event, ReconstructedParti |
678 | 689 | TrackState tweakedTrackState = new BaseTrackState(param, trackState.getReferencePoint(), trackState.getCovMatrix(), trackState.getLocation(), bfield); |
679 | 690 | Hep3Vector pRot = VecOp.mult(beamAxisRotation, CoordinateTransformations.transformVectorToDetector(new BasicHep3Vector(tweakedTrackState.getMomentum()))); |
680 | 691 |
|
681 | | - Double[] iso = TrackUtils.getIsolations(track, TrackUtils.getHitToStripsTable(event), TrackUtils.getHitToRotatedTable(event)); |
| 692 | + Double[] iso = TrackUtils.getIsolations(track, TrackUtils.getHitToStripsTable(event), TrackUtils.getHitToRotatedTable(event), nLay); |
682 | 693 | double minPositiveIso = 9999; |
683 | 694 | double minPositiveIsoL2 = 9999; |
684 | 695 | double minNegativeIso = 9999; |
685 | 696 | double minNegativeIsoL2 = 9999; |
686 | 697 | double isoStereo = -9999, isoAxial = -9999; |
687 | 698 | double isoStereoL2 = -9999, isoAxialL2 = -9999; |
688 | | - for (int i = 0; i < 6; i++) { |
| 699 | + for (int i = 0; i < nLay; i++) { |
689 | 700 | if (iso[2 * i] != null) { |
690 | 701 | if (pRot.y() < 0) { |
691 | 702 | isoStereo = iso[2 * i]; |
@@ -762,10 +773,10 @@ protected TrackState fillParticleVariables(EventHeader event, ReconstructedParti |
762 | 773 | } |
763 | 774 |
|
764 | 775 | ////////////////////////////////////////////////////////////////////////// |
765 | | - double rawHitTime[] = new double[6]; |
766 | | - double rawHitTDiff[] = new double[6]; |
767 | | - double rawHitMaxAmpl[] = new double[6]; |
768 | | - double rawHitChisq[] = new double[6]; |
| 776 | + double rawHitTime[] = new double[nLay]; |
| 777 | + double rawHitTDiff[] = new double[nLay]; |
| 778 | + double rawHitMaxAmpl[] = new double[nLay]; |
| 779 | + double rawHitChisq[] = new double[nLay]; |
769 | 780 | int nTrackHits = 0; |
770 | 781 | List <TrackerHit> allTrackHits = track.getTrackerHits(); |
771 | 782 | for (TrackerHit iTrackHit : allTrackHits){ |
@@ -948,6 +959,7 @@ protected void fillVertexVariables(EventHeader event, List<BilliorTrack> billior |
948 | 959 | ReconstructedParticle bscV0 = HpsReconParticleDriver.makeReconstructedParticle(electron, positron, bsconVertex); |
949 | 960 | Hep3Vector bscMomRot = VecOp.mult(beamAxisRotation, bscV0.getMomentum()); |
950 | 961 | Hep3Vector bscVtx = VecOp.mult(beamAxisRotation, bscV0.getStartVertex().getPosition()); |
| 962 | + Matrix uncCov = MatrixOp.mult(MatrixOp.mult(beamAxisRotation,uncV0.getStartVertex().getCovMatrix()),MatrixOp.transposed(beamAxisRotation)); |
951 | 963 |
|
952 | 964 | vtxFitter.doTargetConstraint(true); |
953 | 965 | BilliorVertex tarVertex = vtxFitter.fitVertex(billiorTracks); |
@@ -981,6 +993,15 @@ protected void fillVertexVariables(EventHeader event, List<BilliorTrack> billior |
981 | 993 | tupleMap.put("uncPosPZ/D", uncV0.getStartVertex().getParameters().get("p2Z")); |
982 | 994 | tupleMap.put("uncPosP/D", Math.sqrt(Math.pow(uncV0.getStartVertex().getParameters().get("p2X"), 2) + Math.pow(uncV0.getStartVertex().getParameters().get("p2Y"), 2) |
983 | 995 | + Math.pow(uncV0.getStartVertex().getParameters().get("p2Z"), 2))); |
| 996 | + tupleMap.put("uncCovXX/D", uncCov.e(0,0)); |
| 997 | + tupleMap.put("uncCovXY/D", uncCov.e(0,1)); |
| 998 | + tupleMap.put("uncCovXZ/D", uncCov.e(0,2)); |
| 999 | + tupleMap.put("uncCovYX/D", uncCov.e(1,0)); |
| 1000 | + tupleMap.put("uncCovYY/D", uncCov.e(1,1)); |
| 1001 | + tupleMap.put("uncCovYZ/D", uncCov.e(1,2)); |
| 1002 | + tupleMap.put("uncCovZX/D", uncCov.e(2,0)); |
| 1003 | + tupleMap.put("uncCovZY/D", uncCov.e(2,1)); |
| 1004 | + tupleMap.put("uncCovZZ/D", uncCov.e(2,2)); |
984 | 1005 |
|
985 | 1006 | tupleMap.put("bscPX/D", bscMomRot.x()); |
986 | 1007 | tupleMap.put("bscPY/D", bscMomRot.y()); |
|
0 commit comments