Print

Print


Commit in lcsim/src/org/lcsim/event/base on MAIN
BaseSimTrackerHit.java+53-11.1 -> 1.2
JM: add constructors to BaseSimTrackerHit so subclassing is not required

lcsim/src/org/lcsim/event/base
BaseSimTrackerHit.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- BaseSimTrackerHit.java	15 May 2008 01:14:00 -0000	1.1
+++ BaseSimTrackerHit.java	15 May 2008 01:41:56 -0000	1.2
@@ -15,7 +15,7 @@
 import org.lcsim.event.SimTrackerHit;
 
 /**
- * An abstract implementation of SimTrackerHit.
+ * An concrete implementation of SimTrackerHit.
  * @author jeremym
  */
 public abstract class BaseSimTrackerHit implements SimTrackerHit
@@ -32,6 +32,58 @@
     private IIdentifier compactId;
     private IExpandedIdentifier expId;
     private Hep3Vector startPoint, endPoint;
+    
+    /**
+     * Constructor for subclasses
+     */
+    protected BaseSimTrackerHit()
+    {}
+    
+    /**
+     * Fully qualified constructor
+     * @param position The center point of the hit in Cartesian coordinates (x,y,z).
+     * @param momentum The momentum of the hit in GeV (px,py,pz).
+     * @param mcparticle The associated MCParticle. (may be null)
+     * @param time The time of the hit in nanoseconds.
+     * @param dEdx The energy deposited over the path in GeV.
+     * @param cellID The 32-bit identifier.
+     * @param pathLength The path length from start to end point.
+     * @param meta The LCMetaData associated to this hit. (may be null)
+     * @param de The DetectorElement associated to this hit. (may be null)
+     */
+    public BaseSimTrackerHit(
+            double[] position, 
+            double dEdx, 
+            double[] momentum, 
+            double pathLength, 
+            double time, 
+            int cellID, 
+            MCParticle mcparticle,
+            LCMetaData meta,
+            IDetectorElement de)
+    {
+        if (position == null)
+            throw new IllegalArgumentException("The position points to null!");
+        for (int i=0, n=this.position.length; i < n; i++)
+        {
+            this.position[i] = position[i];
+        }
+        
+        if (momentum == null)
+            throw new IllegalArgumentException("The momentum points to null!");
+        for (int i=0, n=this.momentum.length; i < n; i++)
+        {
+            this.momentum[i] = momentum[i];
+        }
+        
+        this.mcparticle = mcparticle;
+        this.time = time;
+        this.dEdx = dEdx;
+        this.cellID = cellID;
+        this.pathLength = pathLength;
+        this.meta = meta;
+        this.de = de;        
+    }
 
     public int getLayer()
     {
CVSspam 0.2.8