Print

Print


Commit in lcsim/src/org/lcsim/event/base on MAIN
BaseTrack.java+226added 1.1
First release of base implementation of Track. Work in progress.

lcsim/src/org/lcsim/event/base
BaseTrack.java added at 1.1
diff -N BaseTrack.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ BaseTrack.java	25 Mar 2006 06:22:41 -0000	1.1
@@ -0,0 +1,226 @@
+/*
+ * BaseTrack.java
+ *
+ * Created on March 24, 2006, 9:18 PM
+ *
+ * $Id: BaseTrack.java,v 1.1 2006/03/25 06:22:41 ngraf Exp $
+ */
+
+package org.lcsim.event.base;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class BaseTrack  implements Track
+{
+    protected double[] _refPoint = new double[3];
+    protected boolean _refPointIsDCA = true;
+    protected double[] _parameters = new double[5];
+    protected double[][] _covMatrix = new double[5][5];
+    protected double[] _momentum = new double[3];
+    protected int _charge;
+    protected boolean _fitSuccess;
+    protected double _chi2;
+    protected int _ndf;
+    protected double _dEdx;
+    protected double _dEdxErr;
+    protected double _innermostHitRadius = 9999.;
+    protected int[] _subdetId;
+    protected List<Track> _tracks;
+    protected List<TrackerHit> _hits;
+    protected int _type;
+    
+    /** Creates a new instance of BaseTrack */
+    public BaseTrack()
+    {
+    }
+    
+    // add following setters for subclasses.
+    
+    public void setCharge(int charge)
+    {
+        _charge = charge;
+    }
+    
+    // TODO replace this with a SpacePoint
+    public void setReferencePoint(double[] point)
+    {
+        _refPoint = point;
+    }
+    
+    public void setRefPointIsDCA(boolean isDCA)
+    {
+        _refPointIsDCA = isDCA;
+    }
+    
+    public void setMomentum( double[] p)
+    {
+        _momentum = p;
+    }
+    
+    public void setFitSuccess( boolean success)
+    {
+        _fitSuccess = success;
+    }
+    
+    public void setTrackParameters(double[] params)
+    {
+        _parameters = params;
+    }
+    
+    public void setCovarianceMatrix( double[][] cov)
+    {
+        _covMatrix = cov;
+    }
+    
+    public void setChisq( double chisq)
+    {
+        _chi2 = chisq;
+    }
+    
+    public void setNDF( int n)
+    {
+        _ndf = n;
+    }
+    
+    public void setTrackType(int type)
+    {
+        _type = type;
+    }
+    
+    public void addHit(TrackerHit hit)
+    {
+        _hits.add(hit);
+        double[] pos = hit.getPosition();
+        double radius = pos[0]*pos[0]+pos[1]*pos[1];
+        if(radius < _innermostHitRadius*_innermostHitRadius)
+        {
+            _innermostHitRadius = Math.sqrt(radius);
+        }
+        _dEdx += hit.getdEdx();
+    }
+    
+    public void addHits(List<TrackerHit> hits)
+    {
+        _hits.addAll(hits);
+        for(TrackerHit hit : hits)
+        {
+            double[] pos = hit.getPosition();
+            double radius = pos[0]*pos[0]+pos[1]*pos[1];
+            if(radius < _innermostHitRadius*_innermostHitRadius)
+            {
+                _innermostHitRadius = Math.sqrt(radius);
+            }
+            _dEdx += hit.getdEdx();
+        }
+    }
+    
+    // TODO add convenience methods to replace clunky interface
+    // Track interface
+    
+    public int getCharge()
+    {
+        return _charge;
+    }
+    
+    public double[] getReferencePoint()
+    {
+        return _refPoint;
+    }
+    public double getReferencePointX()
+    {
+        return _refPoint[0];
+    }
+    public double getReferencePointY()
+    {
+        return _refPoint[1];
+    }
+    public double getReferencePointZ()
+    {
+        return _refPoint[2];
+    }
+    public boolean isReferencePointPCA()
+    {
+        return false;
+    }
+    public double[] getMomentum()
+    {
+        return _momentum;
+    }
+    public double getPX()
+    {
+        return _momentum[0];
+    }
+    public double getPY()
+    {
+        return _momentum[1];
+    }
+    public double getPZ()
+    {
+        return _momentum[2];
+    }
+    
+    public boolean fitSuccess()
+    {
+        return _fitSuccess;
+    }
+    public double getTrackParameter(int i)
+    {
+        return _parameters[i];
+    }
+    public double[] getTrackParameters()
+    {
+        return _parameters;
+    }
+    public double getErrorMatrixElement(int i, int j)
+    {
+        return _covMatrix[i][j];
+    }
+    public double[][] getErrorMatrix()
+    {
+        return _covMatrix;
+    }
+    public double getChi2()
+    {
+        return _chi2;
+    }
+    public int getNDF()
+    {
+        return _ndf;
+    }
+    
+    public double getdEdx()
+    {
+        return _dEdx;
+    }
+    public double getdEdxError()
+    {
+        return _dEdxErr;
+    }
+    public double getRadiusOfInnermostHit()
+    {
+        return _innermostHitRadius;
+    }
+    public int[] getSubdetectorHitNumbers()
+    {
+        return _subdetId;
+    }
+    public List<Track> getTracks()
+    {
+        return _tracks;
+    }
+    public List<TrackerHit> getTrackerHits()
+    {
+        return _hits;
+    }
+    public int getType()
+    {
+        return _type;
+    }
+}
\ No newline at end of file
CVSspam 0.2.8