hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.2 -r1.3
--- StripMPAlignmentInput.java 27 Nov 2012 02:17:29 -0000 1.2
+++ StripMPAlignmentInput.java 9 Feb 2013 00:33:32 -0000 1.3
@@ -364,7 +364,25 @@
private void CalculateResidual(HelicalTrackStrip strip, double msdrdphi, double msdz) {
if(_DEBUG) System.out.printf("%s: --- CalculateResidual ---\n",this.getClass().getSimpleName());
+
+ double bfield = Math.abs(this._bfield.z());
+
+ Map<String,Double> res_local = TrackUtils.calculateLocalTrackHitResiduals(_trk, strip, msdrdphi, msdz, bfield);
+
+ _resid[0] = res_local.get("ures");
+ _resid[1] = res_local.get("vres");
+ _resid[2] = res_local.get("wres");
+ _error[0] = res_local.get("ureserr");
+ _error[1] = res_local.get("vreserr");
+ _error[2] = res_local.get("wreserr");
+
+ double vdiffy = res_local.get("vdiffTrky");
+ String side = SvtUtils.getInstance().isTopLayer((SiSensor)((RawTrackerHit)strip.rawhits().get(0)).getDetectorElement()) ? "top" : "bottom";
+ //Fill residuals vs distrance from center of plane in the v directions
+ aida.profile1D("res_u_vs_ydiff_layer_" + strip.layer() + "_" + side).fill(vdiffy,_resid[0]);
+
+ /*
Hep3Vector u = strip.u();
Hep3Vector v = strip.v();
Hep3Vector w = strip.w();
@@ -372,7 +390,7 @@
Hep3Vector corigin = strip.origin();
String side = SvtUtils.getInstance().isTopLayer((SiSensor)((RawTrackerHit)strip.rawhits().get(0)).getDetectorElement()) ? "top" : "bottom";
- double bfield = Math.abs(this._bfield.z());
+
// if(_DEBUG) {
// System.out.printf("%s: Finding interception point for residual calculation (B=%s)\n",this.getClass().getSimpleName(),this._bfield.toString());
// Hep3Vector trkpos_wrong= TrackUtils.helixPositionAtPlaneApprox(_trk, strip);
@@ -428,11 +446,13 @@
_resid[2] = wmeas - wmc;
_error[2] = wError;
-
-
- //Fill residuals vs distrance from center of plane in the v directions
- aida.profile1D("res_u_vs_ydiff_layer_" + strip.layer() + "_" + side).fill(vdiffTrk.y(),_resid[0]);
-
+ if(res_local.get("ures")!=_resid[0] || res_local.get("vres")!=_resid[1] || res_local.get("wres")!=_resid[2] ||
+ res_local.get("ureserr")!=_error[0] || res_local.get("vreserr")!=_error[1] || res_local.get("wreserr")!=_error[2] ) {
+ System.out.printf("%s: resu is different? %f vs %f \n",res_local.get("ures"),_resid[0]);
+ System.out.printf("%s: resv is different? %f vs %f \n",res_local.get("vres"),_resid[1]);
+ System.out.printf("%s: resw is different? %f vs %f \n",res_local.get("wres"),_resid[2]);
+ System.exit(1);
+ }
if (_DEBUG) {
System.out.printf("%s: CalculateResidual Result ----\n",this.getClass().getSimpleName());
System.out.printf("%s: Strip layer %d Origin: %s\n",this.getClass().getSimpleName(),strip.layer(),corigin.toString());
@@ -446,6 +466,9 @@
System.out.printf("%s: MS: phi=%.4f => msvec=%s\n",this.getClass().getSimpleName(),phi,mserr.toString());
System.out.printf("%s: MS: msuError = %.4f (msvec*u = %s * %s\n",this.getClass().getSimpleName(),msuError,mserr.toString(),u.toString());
}
+ */
+
+
}