Skip to content

Commit 63ac086

Browse files
authored
Merge pull request #48 from JeffersonLab/iss47
changes to tuple maker
2 parents c9a2cad + 5357e97 commit 63ac086

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

analysis/src/main/java/org/hps/analysis/tuple/TupleDriver.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import hep.physics.vec.HepLorentzVector;
77
import hep.physics.vec.VecOp;
88

9+
import hep.physics.matrix.Matrix;
10+
import hep.physics.matrix.MatrixOp;
11+
912
import java.io.FileNotFoundException;
1013
import java.io.PrintWriter;
1114
import java.util.ArrayList;
@@ -79,7 +82,12 @@ public abstract class TupleDriver extends Driver {
7982
private final double[] botPos = {54.5,107.5,207.5};
8083
protected final BasicHep3Matrix beamAxisRotation = BasicHep3Matrix.identity();
8184
protected double ebeam = Double.NaN;
85+
private int nLay = 6;
8286

87+
public void setNLay(int nLay) {
88+
this.nLay = nLay;
89+
}
90+
8391
public void setApplyBeamRotation(boolean applyBeamRotation) {
8492
this.applyBeamRotation = applyBeamRotation;
8593
}
@@ -269,6 +277,9 @@ protected void addVertexVariables() {
269277
"tarVX/D", "tarVY/D", "tarVZ/D", "tarChisq/D", "tarM/D",
270278
"vzcPX/D", "vzcPY/D", "vzcPZ/D", "vzcP/D",
271279
"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",
272283
"uncElePX/D", "uncElePY/D", "uncElePZ/D", "uncPosPX/D", "uncPosPY/D", "uncPosPZ/D", "uncEleP/D", "uncPosP/D",
273284
"bscElePX/D", "bscElePY/D", "bscElePZ/D", "bscPosPX/D", "bscPosPY/D", "bscPosPZ/D", "bscEleP/D", "bscPosP/D",
274285
"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
678689
TrackState tweakedTrackState = new BaseTrackState(param, trackState.getReferencePoint(), trackState.getCovMatrix(), trackState.getLocation(), bfield);
679690
Hep3Vector pRot = VecOp.mult(beamAxisRotation, CoordinateTransformations.transformVectorToDetector(new BasicHep3Vector(tweakedTrackState.getMomentum())));
680691

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);
682693
double minPositiveIso = 9999;
683694
double minPositiveIsoL2 = 9999;
684695
double minNegativeIso = 9999;
685696
double minNegativeIsoL2 = 9999;
686697
double isoStereo = -9999, isoAxial = -9999;
687698
double isoStereoL2 = -9999, isoAxialL2 = -9999;
688-
for (int i = 0; i < 6; i++) {
699+
for (int i = 0; i < nLay; i++) {
689700
if (iso[2 * i] != null) {
690701
if (pRot.y() < 0) {
691702
isoStereo = iso[2 * i];
@@ -762,10 +773,10 @@ protected TrackState fillParticleVariables(EventHeader event, ReconstructedParti
762773
}
763774

764775
//////////////////////////////////////////////////////////////////////////
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];
769780
int nTrackHits = 0;
770781
List <TrackerHit> allTrackHits = track.getTrackerHits();
771782
for (TrackerHit iTrackHit : allTrackHits){
@@ -948,6 +959,7 @@ protected void fillVertexVariables(EventHeader event, List<BilliorTrack> billior
948959
ReconstructedParticle bscV0 = HpsReconParticleDriver.makeReconstructedParticle(electron, positron, bsconVertex);
949960
Hep3Vector bscMomRot = VecOp.mult(beamAxisRotation, bscV0.getMomentum());
950961
Hep3Vector bscVtx = VecOp.mult(beamAxisRotation, bscV0.getStartVertex().getPosition());
962+
Matrix uncCov = MatrixOp.mult(MatrixOp.mult(beamAxisRotation,uncV0.getStartVertex().getCovMatrix()),MatrixOp.transposed(beamAxisRotation));
951963

952964
vtxFitter.doTargetConstraint(true);
953965
BilliorVertex tarVertex = vtxFitter.fitVertex(billiorTracks);
@@ -981,6 +993,15 @@ protected void fillVertexVariables(EventHeader event, List<BilliorTrack> billior
981993
tupleMap.put("uncPosPZ/D", uncV0.getStartVertex().getParameters().get("p2Z"));
982994
tupleMap.put("uncPosP/D", Math.sqrt(Math.pow(uncV0.getStartVertex().getParameters().get("p2X"), 2) + Math.pow(uncV0.getStartVertex().getParameters().get("p2Y"), 2)
983995
+ 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));
9841005

9851006
tupleMap.put("bscPX/D", bscMomRot.x());
9861007
tupleMap.put("bscPY/D", bscMomRot.y());

0 commit comments

Comments
 (0)