Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN
HPSFittedRawTrackerHit.java+78added 1.1
new LCRelation-based class for RawTrackerHit with fitted T0 and amplitude

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSFittedRawTrackerHit.java added at 1.1
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;
+		}
+	}
+}
CVSspam 0.2.12


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