Commit in lcsim/src/org/lcsim/event/base on lcio_v2_branch | |||
BaseTrackState.java | +37 | -27 | 1.1.2.1 -> 1.1.2.2 |
minor refactoring of private attributes added fully qualified constructor
diff -u -r1.1.2.1 -r1.1.2.2 --- BaseTrackState.java 14 Feb 2012 21:51:37 -0000 1.1.2.1 +++ BaseTrackState.java 21 Feb 2012 23:19:10 -0000 1.1.2.2 @@ -10,7 +10,7 @@
/** * Implementation of the org.lcsim.event.TrackState interface. * @author Jeremy McCormick
- * @version $Id: BaseTrackState.java,v 1.1.2.1 2012/02/14 21:51:37 jeremy Exp $
+ * @version $Id: BaseTrackState.java,v 1.1.2.2 2012/02/21 23:19:10 ngraf Exp $
*/ public class BaseTrackState implements TrackState {
@@ -20,17 +20,27 @@
public static final int COV_MATRIX_SIZE = 15; // Size of covariance matrix array. // Initialization here is wasteful, but it protects against users leaving these null.
- private double[] parameters = new double[PARAMETERS_SIZE]; // Parameters array. - private double[] referencePoint = new double[REF_POINT_SIZE]; // Reference point. - private double[] covMatrix = new double[COV_MATRIX_SIZE]; // Covariance matrix.
+ private double[] _parameters = new double[PARAMETERS_SIZE]; // Parameters array. + private double[] _referencePoint = new double[REF_POINT_SIZE]; // Reference point. + private double[] _covMatrix = new double[COV_MATRIX_SIZE]; // Covariance matrix. + //TODO what is momentum doing here?
private double[] momentum; // Location encoding.
- private int location = TrackState.AtIP; // default location
+ private int _location = TrackState.AtIP; // default location
public BaseTrackState() {}
+ //fully qualified constructor + public BaseTrackState(double[] trackParameters, double[] covarianceMatrix, double[] position, int location) + { + _location = location; + System.arraycopy(trackParameters, 0, _parameters, 0, PARAMETERS_SIZE); + System.arraycopy(covarianceMatrix, 0, _covMatrix, 0, COV_MATRIX_SIZE); + System.arraycopy(position,0, _referencePoint, 0, REF_POINT_SIZE); + } +
// Ctor with parameters and B-field. // The reference point, covariance matrix, and location can be set later. public BaseTrackState(double[] parameters, double bfield)
@@ -49,88 +59,88 @@
public int getLocation() {
- return location;
+ return _location;
} public double[] getReferencePoint() {
- return referencePoint;
+ return _referencePoint;
} public double[] getCovMatrix() {
- return covMatrix;
+ return _covMatrix;
} public double getD0() {
- return parameters[BaseTrack.D0];
+ return _parameters[BaseTrack.D0];
} public double getPhi() {
- return parameters[BaseTrack.PHI];
+ return _parameters[BaseTrack.PHI];
} public double getZ0() {
- return parameters[BaseTrack.Z0];
+ return _parameters[BaseTrack.Z0];
} public double getOmega() {
- return parameters[BaseTrack.OMEGA];
+ return _parameters[BaseTrack.OMEGA];
} public double getTanLambda() {
- return parameters[BaseTrack.TANLAMBDA];
+ return _parameters[BaseTrack.TANLAMBDA];
} public void setD0(double d0) {
- parameters[BaseTrack.D0] = d0;
+ _parameters[BaseTrack.D0] = d0;
} public void setPhi(double phi) {
- parameters[BaseTrack.PHI] = phi;
+ _parameters[BaseTrack.PHI] = phi;
} public void setZ0(double z0) {
- parameters[BaseTrack.Z0] = z0;
+ _parameters[BaseTrack.Z0] = z0;
} public void setOmega(double d) {
- parameters[BaseTrack.OMEGA] = d;
+ _parameters[BaseTrack.OMEGA] = d;
} public void setTanLambda(double d) {
- parameters[BaseTrack.TANLAMBDA] = d;
+ _parameters[BaseTrack.TANLAMBDA] = d;
} public void setLocation(int location) { if (location < 0 || location > TrackState.LastLocation) throw new IllegalArgumentException("The location must be between 0 and " + TrackState.LastLocation);
- this.location = location;
+ this._location = location;
} // FIXME Should be array copy? public void setReferencePoint(double[] referencePoint) { if (referencePoint.length != REF_POINT_SIZE) throw new IllegalArgumentException("referencePoint.length != " + REF_POINT_SIZE);
- this.referencePoint = referencePoint;
+ this._referencePoint = referencePoint;
} // FIXME Should be array copy? public void setCovMatrix(double[] covMatrix) { if (covMatrix.length != COV_MATRIX_SIZE) throw new IllegalArgumentException("covMatrix.length != " + COV_MATRIX_SIZE);
- this.covMatrix = covMatrix;
+ this._covMatrix = covMatrix;
} // If setParameters or a qualified constructor was not called, this could be null.
@@ -144,14 +154,14 @@
{ if (param < 0 || param > (PARAMETERS_SIZE - 1)) throw new IllegalArgumentException("Parameter ordinal " + param + " is invalid.");
- return parameters[param];
+ return _parameters[param];
} // Get the parameters as a double array. // Use ordinals in BaseTrack for the index into the array. public double[] getParameters() {
- return parameters;
+ return _parameters;
} /**
@@ -161,7 +171,7 @@
*/ public void setParameters(double[] p, double bfield) {
- copyParameters(p, parameters);
+ copyParameters(p, _parameters);
computeMomentum(bfield); }
@@ -216,11 +226,11 @@
buff.append("Z0 = " + getZ0() + "\n"); buff.append("tanLambda = " + getTanLambda() + "\n"); buff.append("omega = " + getOmega() + "\n");
- buff.append("referencePoint = " + referencePoint[0] + " " + referencePoint[1] + " " + referencePoint[2] + "\n");
+ buff.append("referencePoint = " + _referencePoint[0] + " " + _referencePoint[1] + " " + _referencePoint[2] + "\n");
buff.append("covarianceMatrix = ");
- for (int i=0; i<covMatrix.length; i++)
+ for (int i=0; i<_covMatrix.length; i++)
{
- buff.append(covMatrix[i] + " ");
+ buff.append(_covMatrix[i] + " ");
} buff.append("\n"); buff.append("momentum = ");
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1