hps-java/src/main/resources/org/lcsim/hps/steering
diff -u -r1.6 -r1.7
--- MultScatAna.lcsim 22 Aug 2012 18:43:13 -0000 1.6
+++ MultScatAna.lcsim 27 Aug 2012 18:40:10 -0000 1.7
@@ -9,6 +9,7 @@
<driver name="EventMarkerDriver"/>
<driver name="HPSCalibrationDriver"/>
+
<!--
<driver name="RawTrackerHitSensorSetup"/>
<driver name="RawTrackerHitFitterDriver" />
@@ -24,7 +25,7 @@
<driver name="TrackingReconstructionPlots"/>
<driver name="MultScatAnaDriver"/>
<driver name="GainCalibrationDriver"/>
--->
+-->
<driver name="TrigRateDriver"/>
<driver name="CleanupDriver"/>
<!--
@@ -37,10 +38,6 @@
<driver name="MultScatAnaDriver"
type="org.lcsim.hps.users.phansson.MultScatAnalysis">
<debug>false</debug>
-<!-- <outputPlotFileName>/Users/phansson/work/HPS/software/reco/run/multscatana_1351_508851.aida</outputPlotFileName> -->
-<!-- <outputPlotFileName>/Users/phansson/work/HPS/software/reco/run/multscatana_1353_0_682913.aida</outputPlotFileName> -->
-<!-- <outputPlotFileName>/Users/phansson/work/HPS/software/reco/run/multscatana_1353_1_328525.aida</outputPlotFileName> -->
-<!-- <outputPlotFileName>/Users/phansson/work/HPS/software/reco/run/multscatana_1354_0_692635.aida</outputPlotFileName> -->
<outputPlotFileName>multscatana.aida</outputPlotFileName>
</driver>
@@ -48,7 +45,6 @@
type="org.lcsim.hps.users.phansson.TrigRateDriver">
<debug>false</debug>
<hideFrame>false</hideFrame>
- <!--<outputPlotFileName>/Users/phansson/work/HPS/software/reco/run/trigratefile.aida</outputPlotFileName>-->
<outputPlotFileName>/Users/phansson/work/HPS/software/reco/run/trigratefile.aida</outputPlotFileName>
</driver>
hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.1 -r1.2
--- AlignmentUtils.java 25 Aug 2012 01:29:18 -0000 1.1
+++ AlignmentUtils.java 27 Aug 2012 18:40:10 -0000 1.2
@@ -5,6 +5,7 @@
package org.lcsim.hps.users.phansson;
import hep.physics.matrix.BasicMatrix;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
/**
@@ -18,13 +19,50 @@
}
- public BasicMatrix calculateLocalHelixDerivatives(HelicalTrackStrip strip) {
-
+ public BasicMatrix calculateLocalHelixDerivatives(HelicalTrackFit trk, HelicalTrackStrip strip) {
+ // Calculate the derivative w.r.t. to the track parameters (in order/index):
+ // d0, z0, slope, phi0, R
+ // for a change in x,y,z
+ //
+ // All the below is in the tracking coordonates:
+ // x-axis is beamline direction
+ // y-axis is bend direction
+ // z-axis is non-bend direction
+ //
+ // The return object is a 3-by-5 matrix with the derivatives.
+ //
+ // Input:
+ double xint = strip.origin().x(); // the position along the beam axis (x-axis) for the strip.
+ double xr = 0.0; // reference position - typically set top PCA i.e. (x0,y0)
+ double yr = 0.0; // reference position - typically set top PCA i.e. (x0,y0)
+ double d0 = trk.dca();
+ double phi0 = trk.phi0();
+ double R = trk.R();
+ double slope = trk.slope();
BasicMatrix dfdq = new BasicMatrix(3,5); //3-dim,ntrackparams
+ dfdq.setElement(0, 0, dx_dd0(xint,xr,d0,phi0,R));
+ dfdq.setElement(0, 1, dx_dz0());
+ dfdq.setElement(0, 2, dx_dslope());
+ dfdq.setElement(0, 3, dx_dphi0(xint,xr,yr,d0,phi0,R));
+ dfdq.setElement(0, 4, dx_dR(xint,xr,yr,d0,phi0,R));
+
+
+ dfdq.setElement(1, 0, dy_dd0(xint,xr,d0,phi0,R));
+ dfdq.setElement(1, 1, dy_dz0());
+ dfdq.setElement(1, 2, dy_dslope());
+ dfdq.setElement(1, 3, dy_dphi0(xint,xr,d0,phi0,R));
+ dfdq.setElement(1, 4, dy_dR(xint,xr,d0,phi0,R));
+
+
+ dfdq.setElement(2, 0, dz_dd0(xint,xr,yr,d0,phi0,slope,R));
+ dfdq.setElement(2, 1, dz_dz0());
+ dfdq.setElement(2, 2, dz_dslope(xint,xr,yr,d0,phi0,slope,R));
+ dfdq.setElement(2, 3, dz_ddphi(xint,xr,yr,d0,phi0,slope,R));
+ dfdq.setElement(2, 4, dz_dR(xint,xr,yr,d0,phi0,slope,R));
return dfdq;
@@ -62,13 +100,6 @@
//-----------------------------------
// Derivatives of y
-
- public double dy_dz0() {
- return 0.0;
- }
- public double dy_dslope() {
- return 0.0;
- }
public double dy_dd0(double x, double xr,double d0, double phi0, double R) {
//double num = sign(R)*Math.sin(phi0)*( x - xr + (d0-R)*Math.sin(phi0) );
//double den = Math.sqrt( R*R - Math.pow(x-xr+(d0-R)*Math.sin(phi0),2) );
@@ -77,6 +108,13 @@
double den = Math.sqrt( R*R - Math.pow(x-xc(xr,d0,phi0,R),2) );
return Math.cos(phi0) - num/den;
}
+ public double dy_dz0() {
+ return 0.0;
+ }
+ public double dy_dslope() {
+ return 0.0;
+ }
+
public double dy_dphi0(double x, double xr,double d0, double phi0, double R) {
//simplify using xc
double num = Math.cos(phi0)*sign(R)*( x - xc(xr,d0,phi0,R) );
@@ -94,7 +132,7 @@
//-----------------------------------
// Derivatives of z
-
+
public double dz_dd0(double x, double xr, double yr, double d0, double phi0, double slope, double R) {
return -R*slope*dtmpdphi_dd0(x, xr, yr, d0, phi0, R);
hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.4 -r1.5
--- MPAlignmentParameters.java 21 Aug 2012 19:34:18 -0000 1.4
+++ MPAlignmentParameters.java 27 Aug 2012 18:40:10 -0000 1.5
@@ -72,6 +72,7 @@
boolean _DEBUG=false;
double smax = 1e3;
ResLimit _resLimits = new ResLimit();
+ AlignmentUtils _alignUtils = new AlignmentUtils();
private AIDAFrame plotterFrame;
private AIDA aida = AIDA.defaultInstance();
@@ -246,6 +247,7 @@
}
BasicMatrix dfdqGlobal = FillMatrix(dfdq, 3, 5);
+ BasicMatrix dfdqGlobalNew = _alignUtils.calculateLocalHelixDerivatives(_trk, strip);
Hep3Matrix trkToStrip = getTrackToStripRotation(strip);
_dfdq = (BasicMatrix) MatrixOp.mult(trkToStrip, dfdqGlobal);
@@ -257,6 +259,19 @@
System.out.println(trkToStrip.toString());
printDerivatives(trackpars, dfdq);
}
+ double[] trackpars = {d0, z0, slope, phi0, R, s, xint};
+ System.out.println("-----------------------------------------------------");
+ System.out.println("Compare local derivatives for strip at ");
+ System.out.println(strip.origin());
+ System.out.println("s xint");
+ System.out.printf("%5.5f %5.5f\n", s, xint);
+ System.out.println(" d0 z0 slope phi0 R");
+ System.out.printf("Values %5.5f %5.5f %5.5f %5.5f %5.5f\n", d0, z0, slope, phi0, R);
+ System.out.println("dfdqGlobal:");
+ System.out.println(dfdqGlobal.toString());
+ System.out.println("dfdqGlobalNew:");
+ System.out.println(dfdqGlobalNew.toString());
+
}
private void CalculateGlobalDerivatives(HelicalTrackStrip strip) {