hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -N HPSFittedRawTrackerHit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSFittedRawTrackerHit.java 24 Apr 2012 15:38:45 -0000 1.1
@@ -0,0 +1,78 @@
+package org.lcsim.hps.recon.tracking;
+
+import org.lcsim.event.GenericObject;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.base.BaseLCRelation;
+
+/**
+ *
+ * @author meeg
+ * @version $Id: HPSFittedRawTrackerHit.java,v 1.1 2012/04/24 15:38:45 meeg Exp $
+ */
+public class HPSFittedRawTrackerHit extends BaseLCRelation {
+
+ public HPSFittedRawTrackerHit(RawTrackerHit hit, TrackerFit fit) {
+ super(hit, fit);
+ }
+
+ public HPSFittedRawTrackerHit(RawTrackerHit hit, double t0, double amplitude) {
+ super(hit, new TrackerFit(t0, amplitude));
+ }
+
+ public RawTrackerHit getRawTrackerHit() {
+ return (RawTrackerHit) getFrom();
+ }
+
+ public double getT0() {
+ return ((TrackerFit)getTo()).getDoubleVal(0);
+ }
+
+ public double getAmplitude() {
+ return ((TrackerFit)getTo()).getDoubleVal(1);
+ }
+
+ public static class TrackerFit implements GenericObject {
+
+ private double t0, amplitude;
+
+ public TrackerFit(double t0, double amplitude) {
+ this.t0 = t0;
+ this.amplitude = amplitude;
+ }
+
+ public int getNInt() {
+ return 0;
+ }
+
+ public int getNFloat() {
+ return 0;
+ }
+
+ public int getNDouble() {
+ return 2;
+ }
+
+ public int getIntVal(int i) {
+ throw new UnsupportedOperationException("TrackerFit only holds two doubles.");
+ }
+
+ public float getFloatVal(int i) {
+ throw new UnsupportedOperationException("TrackerFit only holds two doubles.");
+ }
+
+ public double getDoubleVal(int i) {
+ switch (i) {
+ case 0:
+ return t0;
+ case 1:
+ return amplitude;
+ default:
+ throw new RuntimeException("blargh!");
+ }
+ }
+
+ public boolean isFixedSize() {
+ return true;
+ }
+ }
+}