hps-java/src/main/java/org/lcsim/hps/recon/tracking/gbl
diff -u -r1.3 -r1.4
--- GBLFileIO.java 21 Aug 2013 02:44:57 -0000 1.3
+++ GBLFileIO.java 21 Aug 2013 20:13:58 -0000 1.4
@@ -194,15 +194,19 @@
addLine(String.format("Strip stereo angle %f", stereoAngle));
}
- void printStripMeas(double ures, double uresErr) {
+ void printStripMeas(double u) {
+ addLine(String.format("Strip u %f", u));
+ }
+
+ void printStripMeasRes(double ures, double uresErr) {
addLine(String.format("Strip ures %f %f", ures, uresErr));
}
- void printStripMeasTruth(double ures, double uresErr) {
+ void printStripMeasResTruth(double ures, double uresErr) {
addLine(String.format("Strip truth ures %f %f", ures, uresErr));
}
- void printStripMeasSimHit(double ures, double uresErr) {
+ void printStripMeasResSimHit(double ures, double uresErr) {
addLine(String.format("Strip simhit ures %f %f", ures, uresErr));
}
hps-java/src/main/java/org/lcsim/hps/recon/tracking/gbl
diff -u -r1.4 -r1.5
--- GBLOutput.java 21 Aug 2013 02:44:57 -0000 1.4
+++ GBLOutput.java 21 Aug 2013 20:13:58 -0000 1.5
@@ -119,9 +119,6 @@
file.printPerTrackParam(perPar);
file.printClTrackParam(clPar);
- // Use the sim tracker hits to find the truth particle
- // this would give me the particle kinematics responsible for the track
- // but it might have scattered in the target
Map<MCParticle, List<SimTrackerHit>> MCParticleHitMap = new HashMap<MCParticle, List<SimTrackerHit>>();
for (SimTrackerHit hit : simTrackerHits) {
@@ -133,18 +130,23 @@
hitList.add(hit);
}
+ // Use the sim tracker hits to find the truth particle
+ // this would give me the particle kinematics responsible for the track
+
MCParticle mcp = null;
for(Map.Entry<MCParticle, List<SimTrackerHit>> part : MCParticleHitMap.entrySet()) {
-
- System.out.printf("%s: %d p=%s parents ",this.getClass().getSimpleName(),part.getKey().getPDGID(),part.getKey().getMomentum().toString());
- for(MCParticle parent : part.getKey().getParents()) {
- System.out.printf(" [%d p=%s]",parent.getPDGID(),parent.getMomentum().toString());
+ if(_debug>0) {
+ System.out.printf("%s: %d p=%s parents ",this.getClass().getSimpleName(),part.getKey().getPDGID(),part.getKey().getMomentum().toString());
+ for(MCParticle parent : part.getKey().getParents()) {
+ System.out.printf(" [%d p=%s]",parent.getPDGID(),parent.getMomentum().toString());
+ }
+ System.out.printf(" with simhits:\n");
+ for(SimTrackerHit simhit : part.getValue()) {
+ System.out.printf("%s: sim hit at %s\n",this.getClass().getSimpleName(),simhit.getPositionVec().toString());
+ }
}
- System.out.printf(" with simhits:\n");
- for(SimTrackerHit simhit : part.getValue()) {
- System.out.printf("%s: sim hit at %s\n",this.getClass().getSimpleName(),simhit.getPositionVec().toString());
- }
// check charge and type
+ // Note that charge is screwy because of lcsim wanting positive z bfield in the fit
if(Math.abs(part.getKey().getPDGID()) == 11) {
if((trk.getCharge() * part.getKey().getPDGID()) > 0) {
if(mcp != null) {
@@ -189,7 +191,7 @@
// use only the truth particle that should've given the track
List<SimTrackerHit> simHits = MCParticleHitMap.get(mcp);
- if(_debug>-1) {
+ if(_debug>0) {
System.out.printf("%s: %d sim tracker hits to MC particle with p = %f (trk p = %f q=%f):\n",this.getClass().getSimpleName(),simHits.size(),mcp.getMomentum().magnitude(),htf.p(this._B.magnitude()),Math.signum(htf.R()));
for(SimTrackerHit sh : simHits) System.out.printf("%s: sim hit at layer %d and pos %s \n",this.getClass().getSimpleName(),sh.getIdentifierFieldValue("layer"),sh.getPositionVec().toString());
}
@@ -255,7 +257,6 @@
//Find intercept point with sensor in tracking frame
Hep3Vector trkpos = TrackUtils.getHelixPlaneIntercept(htf, strip, Math.abs(_B.z()));
-
if(_debug>0) {
System.out.printf("trkpos at intercept %s\n",trkpos.toString());
}
@@ -288,6 +289,8 @@
//print the track direction
file.printStripPathLen(s);
+ //file.addLine(String.format("trkpos at s=%f is %s",88.7866518242,HelixUtils.PointOnHelix(htf, 88.7866518242).toString()));
+
//print stereo angle in YZ plane
if(_debug>0) System.out.printf("u = %s v = %s w = %s \n",strip.u().toString(),strip.v().toString(), strip.w().toString());
file.printMeasDir(strip.u());
@@ -328,6 +331,8 @@
// measurement in measurement frame
Hep3Vector m_meas = new BasicHep3Vector(umeas,vmeas,wmeas);
+ file.printStripMeas(strip.umeas());
+
// residual in measurement frame
Hep3Vector res_meas = VecOp.sub(m_meas, trkpos_meas);
Hep3Vector resTruth_meas = VecOp.sub(m_meas, trkposTruth_meas);
@@ -339,8 +344,8 @@
Hep3Vector resSimHit_err_meas = new BasicHep3Vector(uError,vError,wError);
// print measurement to file
- file.printStripMeas(res_meas.x(),res_err_meas.x());
- file.printStripMeasTruth(resTruth_meas.x(),resTruth_err_meas.x());
+ file.printStripMeasRes(res_meas.x(),res_err_meas.x());
+ file.printStripMeasResTruth(resTruth_meas.x(),resTruth_err_meas.x());
if(simHit!=null) {
Hep3Vector simHitPos = null;simHitPos = this._hpstrans.transformVectorToTracking(simHit.getPositionVec());
if(_debug>0) {
@@ -349,9 +354,9 @@
Hep3Vector vdiffSimHit = VecOp.sub(simHitPos, trkpos);
Hep3Vector simHitPos_meas = VecOp.mult(trkToStripRot, vdiffSimHit);
Hep3Vector resSimHit_meas = simHitPos_meas; //VecOp.sub(m_meas, simHitPos_meas);
- file.printStripMeasSimHit(resSimHit_meas.x(),resSimHit_err_meas.x());
+ file.printStripMeasResSimHit(resSimHit_meas.x(),resSimHit_err_meas.x());
} else {
- file.printStripMeasSimHit(-999999.9,-999999.9);
+ file.printStripMeasResSimHit(-999999.9,-999999.9);
}