1 added + 1 removed + 7 modified, total 9 files
lcsim/src/org/lcsim/contrib/KFFitter
diff -N KFVertex.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ KFVertex.java 13 Apr 2007 20:32:06 -0000 1.1
@@ -0,0 +1,139 @@
+package org.lcsim.contrib.KFFitter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import Jama.Matrix;
+
+/**
+ * Define a vertex used in the Kalman filter fit
+ * A vertex is a point, with a given resolution
+ * The class handles the filtering step of the Kalman filter.
+ * @author Fred Blanc and Steve Wagner
+ * @version $Id: KFVertex.java,v 1.1 2007/04/13 20:32:06 fblanc Exp $
+ */
+
+public class KFVertex
+{
+
+ public KFVertex()
+ {
+ }
+
+ public KFTrackParameters filter(KFTrackParameters trk)
+ {
+
+ double[][] vals = {{4e-08,0.},{0.,4e-08}};
+ Matrix errMat = new Matrix(vals);
+ _DZErrorMatrix = errMat;
+ _DZErrorMatrixInverse = _DZErrorMatrix.inverse();
+
+
+ double[] tpp = trk.getFitParameters();
+ Matrix stateVect = new Matrix(tpp,5);
+ if(_cst.debug()) {
+ System.out.println("KFVertex: initial stateVect:");
+ stateVect.print(15,12);
+ System.out.println("KFVertex: initial stateVect in point parameter space:");
+ trk.printPointParams();
+ }
+
+ double d0 = tpp[0];
+ double phi0 = tpp[1];
+ double omega = tpp[2];
+ double z0 = tpp[3];
+ double tanl = tpp[4];
+ double l = 0.;
+
+ Matrix trkCov = trk.getErrorMatrix();
+ if(_cst.debug()) {
+ System.out.println("KFVertex: trkCov:");
+ trkCov.print(15,12);
+ }
+
+ // define matrix relating the measured parameters (d,z) and the
+ // state vector (fit parameters). In the current setup, the state vector is
+ // given by the fit parameters (d0,phi0,omega,z0,s)
+
+ double[][] valsErr = {{1.,0.,0.,0.,0.},{0.,0.,0.,1.,0.}};
+ Matrix H = new Matrix(valsErr);
+
+ Matrix HT = H.transpose();
+ if(_cst.debug()) {
+ System.out.println("KFVertex: H:");
+ H.print(12,10);
+ System.out.println("KFVertex: HT:");
+ HT.print(12,10);
+ }
+
+ Matrix trkCovInverse = trkCov.inverse();
+
+ if(_cst.debug()) {
+ System.out.println("KFVertex: trkCovInverse:");
+ trkCovInverse.print(15,12);
+ }
+
+ double refD = trk.getFitParameters()[0];
+ double refZ = trk.getFitParameters()[3];
+ double[] mp = {-refD,-refZ};
+ Matrix measVect = new Matrix(mp,2);
+
+ if(_cst.debug()) {
+ System.out.println("KFVertex: measVect:");
+ measVect.print(12,10);
+ System.out.println("KFVertex: PhiZ cov matrix inverted:");
+ _DZErrorMatrixInverse.print(12,10);
+ }
+
+ Matrix cv1 = _DZErrorMatrixInverse.times(H);
+ Matrix cv2 = HT.times(cv1);
+ if(_cst.debug()) {
+ System.out.println("KFVertex: measCovInverse:");
+ cv2.print(15,12);
+ }
+ Matrix filteredCovInv = trkCovInverse.plus(cv2);
+ Matrix filteredCov = filteredCovInv.inverse();
+
+ if(_cst.debug()) {
+ System.out.println("KFVertex: Filtered Cov:");
+ filteredCov.print(15,12);
+ }
+
+ Matrix tmp1 = filteredCovInv.times(stateVect);
+ Matrix tmp2 = HT.times(_DZErrorMatrixInverse).times(measVect);
+ Matrix tmp3 = tmp1.plus(tmp2);
+ Matrix filteredTrkPar = filteredCov.times(tmp3);
+
+ if(_cst.debug()) {
+ System.out.println("KFVertex: Filtered State Vector:");
+ filteredTrkPar.print(15,12);
+ }
+
+ double[][] par = filteredTrkPar.getArrayCopy();
+ d0 = par[0][0];
+ phi0 = par[1][0];
+ omega = par[2][0];
+ z0 = par[3][0];
+ tanl = par[4][0];
+
+ if(_cst.debug()) {
+ System.out.println("KFVertex: Fitted Pt = "+_cst.pointThreeTimesB()/Math.abs(omega));
+ System.out.println("KFVertex: pars = "+d0+" "+phi0+" "+omega+" "+z0+" "+tanl);
+ }
+
+ KFTrackParameters filtTrk = new KFTrackParameters();
+ filtTrk.setTrackFitParameters(d0,phi0,omega,z0,tanl,l);
+ filtTrk.setErrorMatrix(filteredCov);
+
+ return filtTrk;
+ }
+
+ public KFPoint getVertexLocation() {return _vtxLocation;}
+
+ private KFPoint _vtxLocation = new KFPoint();
+
+ private Matrix _DZErrorMatrix = new Matrix(2,2);
+ private Matrix _DZErrorMatrixInverse = new Matrix(2,2);
+
+ private KFConstants _cst = new KFConstants();
+}
lcsim/src/org/lcsim/contrib/KFFitter
diff -u -r1.3 -r1.4
--- History 10 Mar 2007 00:27:25 -0000 1.3
+++ History 13 Apr 2007 20:32:06 -0000 1.4
@@ -3,6 +3,21 @@
## Please summarize changes to the KFFitter code here.
## Most recent first please.
+13 April 2007 Fred Blanc V01-01-02
+
+ - Added KFVertex class to handle a vertex constraint.
+ The constraint is applied to d0=0 and z0=0, with an uncertainty
+ of +-2 microns
+ The constraint it applied at the end of the outside-in fit, in the KFTrack class.
+
+ - Account for the uncertainty on the dE/dx correction, in the 'filter' function
+ of KFSite
+
+ - removed from package the unused KFMatrix class
+
+ - cleaned up several obsolete debugging statements and a few debugging functions
+
+
09 March 2007 Fred Blanc V01-01-01
(this version of the code was used to produce the results presented at the
lcsim/src/org/lcsim/contrib/KFFitter
diff -u -r1.3 -r1.4
--- KFConstants.java 10 Mar 2007 00:27:25 -0000 1.3
+++ KFConstants.java 13 Apr 2007 20:32:06 -0000 1.4
@@ -3,7 +3,7 @@
/**
* Definition of constants in KFFitter package
* @author Fred Blanc and Steve Wagner
- * @version $Id: KFConstants.java,v 1.3 2007/03/10 00:27:25 fblanc Exp $
+ * @version $Id: KFConstants.java,v 1.4 2007/04/13 20:32:06 fblanc Exp $
*/
public class KFConstants
@@ -20,6 +20,7 @@
public double pointThreeTimesB() {return ptconst;}
public double pionMass() {return piMass;}
public double muonMass() {return muMass;}
+ public double electronMass() {return eMass;}
public boolean debug() {return DeBug;}
@@ -31,6 +32,7 @@
private static double piMass = 0.13957018;
private static double muMass = 0.105658369;
+ private static double eMass = 0.000510998;
private static boolean DeBug = false;
lcsim/src/org/lcsim/contrib/KFFitter
diff -u -r1.4 -r1.5
--- KFFitterDriver.java 10 Mar 2007 00:27:25 -0000 1.4
+++ KFFitterDriver.java 13 Apr 2007 20:32:06 -0000 1.5
@@ -25,7 +25,7 @@
/**
* Driver for KFFitter package
* @author Fred Blanc and Steve Wagner
- * @version $Id: KFFitterDriver.java,v 1.4 2007/03/10 00:27:25 fblanc Exp $
+ * @version $Id: KFFitterDriver.java,v 1.5 2007/04/13 20:32:06 fblanc Exp $
*/
public class KFFitterDriver extends Driver
@@ -38,11 +38,6 @@
add(new SODTrackFinderDriver());
gtor = new java.util.Random(10101);
- //IAnalysisFactory af = IAnalysisFactory.create();
- //ITree tree = af.createTreeFactory().create();
- //IHistogramFactory hf = af.createHistogramFactory(tree);
- //IHistogram1D histo1 = hf.createHistogram1D("histo1", 25, -5.0, 5.0);
-
}
public void process(EventHeader event)
@@ -59,31 +54,17 @@
double trkPT = SODtrk.getPT();
aida.cloud1D("SODPt").fill(trkPT);
- /*
- System.out.println("Driver: trk pT = "+trkPT);
- System.out.print("Driver: SOD track = ");
- System.out.print(SODtrk.getTrackParameter(0)+" ");
- System.out.print(SODtrk.getTrackParameter(1)+" ");
- System.out.print(SODtrk.getTrackParameter(2)+" ");
- System.out.print(SODtrk.getTrackParameter(3)+" ");
- System.out.print(SODtrk.getTrackParameter(4)+" ");
- System.out.println(SODtrk.getCharge());
- */
// create new KFTrack and initialize it to the SODTrack fit parameters
KFTrack track = new KFTrack();
track.defineSeedTrack(SODtrk);
- //track.defineSeedTrackDebug(); // For testing purpose
List<SimTrackerHit> hits = (List<SimTrackerHit>) SODtrk.getHits();
int nbHits = hits.size();
- //System.out.println("Driver: SOD hit list size = "+nbHits);
double chi2 = SODtrk.getChi2();
- //System.out.println("Driver: SOD chi2 = "+chi2);
double ndf = nbHits;
- //if(ndf>0.) { double r = chi2/ndf; aida.cloud1D("chi2 per ndf").fill(r); }
double genPtot = 0.;
double genPt = 0.;
@@ -94,9 +75,7 @@
if(chi2<100.) { // run fitter only if good track seed
for ( SimTrackerHit hit : hits ) {
// assign hits to KFTrack
- //track.addHit(hit,0.,0.);
track.addHit(hit,gtor.nextGaussian(),gtor.nextGaussian());
- //track.addHitDebug(hit);
genPtot = hit.getMCParticle().getMomentum().magnitude();
double genPx = hit.getMCParticle().getPX();
@@ -104,22 +83,16 @@
double genPz = hit.getMCParticle().getPZ();
genPt = Math.sqrt(genPx*genPx+genPy*genPy);
if(genPt>0) {genTanl = genPz/genPt;}
- //if(genPt>0) {genTanl = Math.abs(genPz/genPt);}
double genX0 = hit.getMCParticle().getOriginX();
double genY0 = hit.getMCParticle().getOriginY();
genD0 = Math.sqrt(genX0*genX0+genY0+genY0);
genZ0 = hit.getMCParticle().getOriginZ();
}
- //System.out.print("Driver: track params before fit = ");
- //track.getSeedTrackParameters().printFitParams();
+
// *************************
// run Kalman Filter Fit
// *************************
track.fit();
- //System.out.println();
-
- //System.out.print("Driver: track params after fit = ");
- //track.getKFTrackParameters().printFitParams();
// *****************************
// add track in event record
@@ -139,6 +112,7 @@
fittedTrack.setFitSuccess(true);
double[] fitPar = kalmanTrack.getFitParameters();
+ // unit convertion from cm -> mm
fitPar[0] *= 10.;
fitPar[2] *= -0.1;
fitPar[3] *= 10.;
@@ -147,6 +121,7 @@
fittedTrack.setTrackParameters(fitPar, magfield);
Matrix covMat = kalmanTrack.getErrorMatrix();
+
// setup unit-conversion matrix (cm -> mm)
double[][] diag = new double[5][5];
diag[0][0] = 10.; // d0
lcsim/src/org/lcsim/contrib/KFFitter
diff -u -r1.4 -r1.5
--- KFPoint.java 10 Mar 2007 00:27:25 -0000 1.4
+++ KFPoint.java 13 Apr 2007 20:32:06 -0000 1.5
@@ -6,7 +6,7 @@
* Define a point in the KFFitter package
* Used for holding 3D coordinates and error matrix
* @author Fred Blanc and Steve Wagner
- * @version $Id: KFPoint.java,v 1.4 2007/03/10 00:27:25 fblanc Exp $
+ * @version $Id: KFPoint.java,v 1.5 2007/04/13 20:32:06 fblanc Exp $
*/
public class KFPoint
@@ -32,22 +32,18 @@
_z = Z;
_r = Math.sqrt(_x*_x+_y*_y);
- //System.out.print("KFPoint: hit radius = "); System.out.println(_r);
_phi = Math.atan2(_y,_x);
- _rphiErr = 0.0007; if(_r<10.){_rphiErr = 0.0005;}
+ _rphiErr = 0.0007;
+ if(_r<10.){_rphiErr = 0.0005;};
+
_zErr = 0.0005;
if(_r>10.){_zErr = 1000.;}
- //System.out.print("KFPoint: phi, rphiErr = ");
- //System.out.print(_phi); System.out.print(" ");
- //System.out.println(_rphiErr);
-
}
public void smearRPhiPoint(double rdm1, double rdm2)
{
- //System.out.println("KFPoint: Smearing "+rdm1+" "+rdm2);
_phi = _phi+(_rphiErr/_r)*rdm1;
_x = _r*Math.cos(_phi);
_y = _r*Math.sin(_phi);
@@ -85,16 +81,9 @@
double zz = _zErr*_zErr;
- //System.out.print("KFPoint: calc Cov = ");
- //System.out.print(_phi); System.out.print(" ");
- //System.out.print(_rphiErr); System.out.print(" ");
- //System.out.print(xx); System.out.print(" ");
- //System.out.println(xy);
-
double[][] vals = {{xx,xy,0.},{yx,yy,0.},{0.,0.,zz}};
Matrix errMat = new Matrix(vals);
- //System.out.println("KFPoint: XYZ cov matrix");
- //errMat.print(6,10);
+
return errMat;
}
lcsim/src/org/lcsim/contrib/KFFitter
diff -u -r1.4 -r1.5
--- KFSite.java 10 Mar 2007 00:27:25 -0000 1.4
+++ KFSite.java 13 Apr 2007 20:32:06 -0000 1.5
@@ -14,7 +14,7 @@
* or a B-field discontinuity. The class handles the filtering step
* of the Kalman filter.
* @author Fred Blanc and Steve Wagner
- * @version $Id: KFSite.java,v 1.4 2007/03/10 00:27:25 fblanc Exp $
+ * @version $Id: KFSite.java,v 1.5 2007/04/13 20:32:06 fblanc Exp $
*/
public class KFSite
@@ -44,31 +44,6 @@
}
}
- public void setLocation(double x, double y, double z)
- {
- // ************************
- // For testing purpose only
- // ************************
- System.out.println(" ************************");
- System.out.println("KFSite: setLocation ** DEBUG MODE **");
- System.out.println(" ************************");
-
- _siteLocation.makePoint(x,y,z);
-
- System.out.print("KFSite: Add Pt at coord = ");
- System.out.println(x+" "+y+" "+z);
-
- _PhiZErrorMatrix = _siteLocation.getPhiZErrorMatrix();
-
- _PhiZErrorMatrixInverse = _PhiZErrorMatrix.inverse();
-
- System.out.println("KFSite: PhiZ cov matrix:");
- _PhiZErrorMatrix.print(12,10);
-
- //System.out.println("KFSite: PhiZ cov matrix inverted:");
- //_PhiZErrorMatrixInverse.print(12,10);
- }
-
public KFTrackParameters filter(KFTrackParameters trk)
{
@@ -290,9 +265,6 @@
filteredCov.print(15,12);
}
- //Matrix tmp1 = trkCovInverse.times(stateVect);
- //Matrix tmp2 = HT.times(_PhiZErrorMatrixInverse).times(measVect);
- //Matrix tmp3 = tmp1.plus(tmp2);
Matrix tmp1 = filteredCovInv.times(stateVect);
Matrix tmp2 = HT.times(_PhiZErrorMatrixInverse).times(measVect);
Matrix tmp3 = tmp1.plus(tmp2);
@@ -319,14 +291,14 @@
KFTrackParameters tmpTrk = new KFTrackParameters();
tmpTrk.setTrackFitParameters(d0,phi0,omega,z0,tanl,l);
- //System.out.print("KFSite: fitPar 1:"); tmpTrk.printFitParams();
tmpTrk.setPointToRadius(_siteLocation.getR());
- //double tmpRad = _siteLocation.getR();
- //System.out.println("KFSite: site radius ="+tmpRad);
- //System.out.print("KFSite: fitPar 2:"); tmpTrk.printFitParams();
- //System.out.print("KFSite: pointPar 2:"); tmpTrk.printPointParams();
+
+ double[] tmpPar = tmpTrk.getPointParameters();
+ int tmpCh = tmpTrk.getCharge();
+
double tmpPtot = tmpTrk.getPtot();
double ratioCorr = 1.;
+ Matrix QE = new Matrix(5,5,0.);
if(_materialSite && _applyDEDXCorrection) {
double dEdx = dEdx(tmpPtot);
if(_cst.debug()) {
@@ -346,10 +318,50 @@
tmpEtotCorr += dEdx*_thickness/cosEntranceAngle; // apply energy _gain_ when fitting outside-in
}
ratioCorr = tmpEtotCorr/tmpEtot;
- }
- double[] tmpPar = tmpTrk.getPointParameters();
- int tmpCh = tmpTrk.getCharge();
+ // Determine uncertainty on dEdx. Use value from
+ // H. Bicshel, Rev.Mod.Phys. 60 (1988) 663, table VI, p.682:
+ // w = 31.54keV for 320um Si => 0.000985625GeV/cm
+ double dESig = 0.000985625*_thickness/cosEntranceAngle;
+ if(_cst.debug()) System.out.println("KFSite: dEdx sigma = "+dESig);
+
+ Matrix sigDEDX = new Matrix(1,1,dESig*dESig);
+ double deltadEdx = dEdx/1000.;
+ double ratioCorrPlus = (tmpEtot+(dEdx+deltadEdx)*_thickness/cosEntranceAngle)/tmpEtot;
+ double ratioCorrMinus = (tmpEtot+(dEdx-deltadEdx)*_thickness/cosEntranceAngle)/tmpEtot;
+
+ KFTrackParameters trkVardEdxPlus = new KFTrackParameters();
+ trkVardEdxPlus.setTrackPointParameters(tmpCh,
+ tmpPar[0],
+ tmpPar[1],
+ tmpPar[2],
+ ratioCorrPlus*tmpPar[3],
+ ratioCorrPlus*tmpPar[4],
+ ratioCorrPlus*tmpPar[5]);
+ double[] fitPardEdxPlus = trkVardEdxPlus.getFitParameters();
+ KFTrackParameters trkVardEdxMinus = new KFTrackParameters();
+ trkVardEdxMinus.setTrackPointParameters(tmpCh,
+ tmpPar[0],
+ tmpPar[1],
+ tmpPar[2],
+ ratioCorrMinus*tmpPar[3],
+ ratioCorrMinus*tmpPar[4],
+ ratioCorrMinus*tmpPar[5]);
+ double[] fitPardEdxMinus = trkVardEdxMinus.getFitParameters();
+ double[] jacdEdx = new double[5];
+ for(int i=0;i<5;i++) {jacdEdx[i]=(fitPardEdxPlus[i]-fitPardEdxMinus[i])/(2.*deltadEdx);}
+ Matrix DEDXderiv = new Matrix(jacdEdx,1);
+ if(_cst.debug()) {
+ System.out.println("KFSite: DEDXderiv:");
+ DEDXderiv.print(15,12);
+ }
+ Matrix DEDXderivT = DEDXderiv.transpose();
+ if(_cst.debug()) {
+ System.out.println("KFSite: DEDXderivT:");
+ DEDXderivT.print(15,12);
+ }
+ QE = DEDXderivT.times(sigDEDX).times(DEDXderiv);
+ }
KFTrackParameters filtTrk = new KFTrackParameters();
@@ -361,10 +373,15 @@
ratioCorr*tmpPar[4],
ratioCorr*tmpPar[5]);
+ if(_cst.debug()) {
+ System.out.println("KFSite: QE:");
+ QE.print(15,12);
+ }
+
if(_measurementSite) {
- filtTrk.setErrorMatrix(filteredCov);
+ filtTrk.setErrorMatrix(filteredCov.plus(QE));
} else {
- filtTrk.setErrorMatrix(trkCov);
+ filtTrk.setErrorMatrix(trkCov.plus(QE));
}
filtTrk.setPointToRadius(_siteLocation.getR());
@@ -403,11 +420,11 @@
double beta = p/Math.sqrt(p*p+_cst.muonMass()*_cst.muonMass());
double gamma = 1./Math.sqrt(1-beta*beta);
double eta = beta*gamma;
- double s = 0.000510998/_cst.muonMass();
- double Wmax = 2.*0.000510998*eta*eta/(1.+2.*s*Math.sqrt(1+eta*eta)+s*s);
+ double s = _cst.electronMass()/_cst.muonMass();
+ double Wmax = 2.*_cst.electronMass()*eta*eta/(1.+2.*s*Math.sqrt(1+eta*eta)+s*s);
double I = 0.000000172;
- double frac = 2.*0.000510998*eta*eta*Wmax/(I*I);
+ double frac = 2.*_cst.electronMass()*eta*eta*Wmax/(I*I);
double delta = 0.;
double C = 0.;
lcsim/src/org/lcsim/contrib/KFFitter
diff -u -r1.4 -r1.5
--- KFTrack.java 10 Mar 2007 00:27:25 -0000 1.4
+++ KFTrack.java 13 Apr 2007 20:32:06 -0000 1.5
@@ -16,7 +16,7 @@
* A track is a collection of KFSites.
* The KFTrack class handles the loop over sites to apply the Kalman fit
* @author Fred Blanc and Steve Wagner
- * @version $Id: KFTrack.java,v 1.4 2007/03/10 00:27:25 fblanc Exp $
+ * @version $Id: KFTrack.java,v 1.5 2007/04/13 20:32:06 fblanc Exp $
*/
public class KFTrack
@@ -55,42 +55,6 @@
}
- public void addHitDebug(SimTrackerHit hit)
- {
-
- System.out.println(" ************************");
- System.out.println("KFTrack: addHitDebug ** DEBUG MODE **");
- System.out.println(" ************************");
-
-
- double[] pos = hit.getPoint();
- // convert to cm
- for(int i=0; i<3; i++) {pos[i]*=0.1;}
- double radius = Math.sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
-
- KFTrackParameters seedExtrap = _seedTrack.makePredictionAtRadius(radius);
- double[] p = seedExtrap.getPointParameters();
-
- // define site for this hit
- KFSite kfhit = new KFSite();
- kfhit.setLocation(p[0],p[1],p[2]);
-
- kfhit.isMeasurementSite(true);
- double radThickness = 0.00107;
- if (radius>10.) {radThickness=0.00532;}
- double thickness = 0.01;
- if (radius>10.) {thickness = 0.03;}
- kfhit.isMaterialSite(false,radThickness,thickness);
- _siteList.add(kfhit);
-
- kfhit.applyMSCorrection(false);
- kfhit.applyDEDXCorrection(false);
-
- //System.out.print("KFTrack: read back radius = ");
- //System.out.println(kfhit.getSiteLocation().getR());
-
- }
-
private void sortSiteList()
{
if(_cst.debug()) System.out.println("KFTrack sortSiteList");
@@ -154,33 +118,6 @@
}
- public void defineSeedTrackDebug()
- {
- // ************************
- // For testing purpose only
- // ************************
-
- System.out.println(" ************************");
- System.out.println("KFTrack: defineSeedTrack ** DEBUG MODE **");
- System.out.println(" ************************");
-
- // load track parameters d0,omega,...
- double d = 0.;
- double phi = 0;
- //double omega = 0.00300; // 5GeV
- double omega = 0.00075; // 20GeV
- //double omega = 0.00015; // 100GeV
- double z = 0.;
- double s = 0.;
-
- double l = 0.0; // path length set to zero (=POCA)
-
- System.out.println("KFTrack: define track par = "+d+" "+phi+" "+omega+" "+z+" "+s);
-
- _seedTrack.setTrackFitParameters(d,phi,omega,z,s,l);
-
- }
-
public void fit()
{
// sort list of hits by distance from origin
@@ -195,7 +132,6 @@
diag[4][4] = 1.; // tanl
Matrix initCov = new Matrix(diag);
- //Matrix initCov = initDiag.times(initCor).times(initDiag);
if(_cst.debug()) {
System.out.println("KFTrack: init cov matrix");
initCov.print(6,2);
@@ -210,19 +146,19 @@
//***************
if(_cst.debug()) System.out.println("KFTrack: Fitting Track outward");
- // Determine seed track parameters from 3 innermost hits
+ // initialize track parameters for outward fit
+ KFTrackParameters currentTrackOut = new KFTrackParameters(_seedTrack);
+
/*
+ // Determine seed track parameters from 3 innermost hits
KFTrackParameters inOutSeedTrk =
seedTrkFromHits(_seedTrack.getCharge(),
(KFSite)_orderedSiteList.get(0),
(KFSite)_orderedSiteList.get(1),
(KFSite)_orderedSiteList.get(2));
- KFTrackParameters currentTrackOut = new KFTrackParameters(inOutSeedTrk);
+ currentTrackOut = inOutSeedTrk;
*/
- // initialize track parameters for outward fit
- KFTrackParameters currentTrackOut = new KFTrackParameters(_seedTrack);
-
// determine track params at fixed small radius
//_seedTrack.setPointToPOCA();
double refRadius = 1.0;
@@ -237,9 +173,6 @@
for (; hits.hasNext();){
KFSite hit = (KFSite)hits.next();
- //KFPoint siteLocation = new KFPoint();
- //siteLocation = hit.getSiteLocation();
- //double R = siteLocation.getR();
double R = hit.getSiteLocation().getR();
if(_cst.debug()) System.out.println("KFTrack: hit radius = "+R);
@@ -272,6 +205,7 @@
// initialize track parameters for inward fit
KFTrackParameters currentTrackIn = new KFTrackParameters(currentTrackOut);
+
// determine track params at fixed small radius
refRadius = 130.0;
currentTrackIn.setPointToRadius(refRadius);
@@ -286,9 +220,6 @@
for (; hits.hasPrevious();){
KFSite hit = (KFSite)hits.previous();
- //KFPoint siteLocation = new KFPoint();
- //siteLocation = hit.getSiteLocation();
- //double R = siteLocation.getR();
double R = hit.getSiteLocation().getR();
if(_cst.debug()) {
System.out.println("KFTrack: hit radius = "+R);
@@ -313,6 +244,11 @@
}
+ if(_applyVertexConstraint) {
+ KFVertex origin = new KFVertex();
+ currentTrackIn = origin.filter(currentTrackIn);
+ }
+
_KFTrackAtPOCA = currentTrackIn;
_fittedPtAtPOCA = currentTrackIn.getPt();
@@ -388,6 +324,8 @@
private double _fittedPtAtPOCA;
+ private boolean _applyVertexConstraint = true;
+
private KFConstants _cst = new KFConstants();
}
lcsim/src/org/lcsim/contrib/KFFitter
diff -u -r1.4 -r1.5
--- KFTrackParameters.java 10 Mar 2007 00:27:25 -0000 1.4
+++ KFTrackParameters.java 13 Apr 2007 20:32:06 -0000 1.5
@@ -7,7 +7,7 @@
* Allows multiple representations, and the transformation from one to the other.
* Holds the covariance matrix in the standrd (d0,phi0,omega,z0,tanl) representation
* @author Fred Blanc and Steve Wagner
- * @version $Id: KFTrackParameters.java,v 1.4 2007/03/10 00:27:25 fblanc Exp $
+ * @version $Id: KFTrackParameters.java,v 1.5 2007/04/13 20:32:06 fblanc Exp $
*/
public class KFTrackParameters
{
@@ -59,16 +59,9 @@
_l = pathLength;
_alpha = _l*_omega;
- //System.out.print("KFTrackParameters: setting fit pars = ");
- //this.printFitParams();
-
makePointFromFitRepresentation();
//makeHelixFromFitRepresentation();
- //makeFitFromPointRepresentation();
- //System.out.print("KFTrackParameters: control fit pars = ");
- //this.printFitParams();
-
}
public void setTrackPointParameters(int ch, double x, double y, double z, double px, double py, double pz)
@@ -93,9 +86,6 @@
makeFitFromPointRepresentation();
//makeHelixFromPointRepresentation();
- //System.out.print("KFTrackParameters: control fit pars = ");
- //this.printFitParams();
-
}
private void makePointFromFitRepresentation()
@@ -137,12 +127,6 @@
_helixParams[3] = _z0;
_helixParams[4] = _s;
- //System.out.print("KFTrackParameters: helix par = ");
- //System.out.print(_xc+" ");
- //System.out.print(_yc+" ");
- //System.out.print(_rc+" ");
- //System.out.print(_z0+" ");
- //System.out.println(_s);
}
private void makeHelixFromPointRepresentation()
@@ -161,12 +145,6 @@
_helixParams[3] = _z0;
_helixParams[4] = _s;
- //System.out.print("KFTrackParameters: helix par = ");
- //System.out.print(_xc+" ");
- //System.out.print(_yc+" ");
- //System.out.print(_rc+" ");
- //System.out.print(_z0+" ");
- //System.out.println(_s);
}
private void makeFitFromPointRepresentation()
@@ -180,12 +158,6 @@
_alpha = Math.atan2(-_charge*(_x*_px+_y*_py),
tmpPt*tmpPt/_cst.pointThreeTimesB()+_charge*(_x*_py-_y*_px));
_z0 = _z+_alpha*_pz/(_charge*_cst.pointThreeTimesB());
- //double t1=_y*_py+_x*_px;
- //double t2=_charge*tmpPt*tmpPt/_cst.pointThreeTimesB()+_x*_py-_y*_px;
- //System.out.println("Trk: atan("+t1+" ; "+t2);
- //System.out.println("Trk: x= "+_x+" "+_y+" "+_z+" "+_px+" "+_py+" "+_pz);
- //System.out.println("Trk: "+tmpPt+" "+_charge+" "+_cst.pointThreeTimesB());
- //System.out.println("Trk: alpha = "+_alpha+" z0 = "+_z0);
_s = _pz/tmpPt;
_l = _alpha/_omega;
@@ -222,8 +194,6 @@
newTrack.setTrackFitParameters(_d0,_phi0,_omega,_z0,_s,newPathLength);
newTrack.setErrorMatrix(_FitErrorMatrix);
- //System.out.print("KFTrackParameters: propagated "); newTrack.printFitParams();
-
return newTrack;
}
@@ -290,7 +260,6 @@
System.out.print(_fitParams[2]+" ");
System.out.print(_fitParams[3]+" ");
System.out.print(_fitParams[4]+" ");
- //System.out.print(_alpha);
System.out.println(_l);
}
@@ -302,7 +271,6 @@
System.out.print(_pointParams[3]+" ");
System.out.print(_pointParams[4]+" ");
System.out.print(_pointParams[5]+" ");
- //System.out.print(_alpha);
System.out.println(getPhi());
}
}
lcsim/src/org/lcsim/contrib/KFFitter
diff -N KFMatrix.java
--- KFMatrix.java 10 Mar 2007 00:27:25 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-package org.lcsim.contrib.KFFitter;
-
-//import org.lcsim.spacegeom.Matrix;
-import Jama.Matrix;
-
-/**
- * Matrix class in KFFitter package
- * (unused)
- * @author Fred Blanc and Steve Wagner
- * @version $Id: KFMatrix.java,v 1.2 2007/03/10 00:27:25 fblanc Exp $
- */
-
-public class KFMatrix
-{
-
- public KFMatrix(int n)
- {
- _order = n;
- }
-
- public void invert()
- {
- }
-
- public KFMatrix multiply(KFMatrix mat2)
- {
- KFMatrix prod = new KFMatrix(5);
- return prod;
- }
-
- private int _order;
- private Matrix _matrix;
-
-}
CVSspam 0.2.8