lcsim/src/org/lcsim/event/base
diff -u -r1.1 -r1.2
--- BaseRawCalorimeterHit.java 21 Mar 2012 01:25:57 -0000 1.1
+++ BaseRawCalorimeterHit.java 30 Apr 2012 22:54:11 -0000 1.2
@@ -1,34 +1,52 @@
package org.lcsim.event.base;
+import org.lcsim.detector.IDetectorElement;
import org.lcsim.event.RawCalorimeterHit;
/**
* This is a basic implementation of {@link org.lcsim.event.RawCalorimeterHit}.
+ *
* @author Jeremy McCormick <[log in to unmask]>
*/
-public class BaseRawCalorimeterHit implements RawCalorimeterHit {
-
- long id;
- int amplitude;
- int timestamp;
-
- protected BaseRawCalorimeterHit() {}
-
- public BaseRawCalorimeterHit(long id, int amplitude, int timestamp) {
- this.id = id;
- this.amplitude = amplitude;
- this.timestamp = timestamp;
- }
-
- public long getCellID() {
- return id;
- }
-
- public int getAmplitude() {
- return amplitude;
- }
-
- public int getTimeStamp() {
- return timestamp;
- }
-}
+public class BaseRawCalorimeterHit extends BaseHitWithPosition implements RawCalorimeterHit {
+
+ long id;
+ int amplitude;
+ int timestamp;
+
+ protected BaseRawCalorimeterHit() {
+ }
+
+ public BaseRawCalorimeterHit(long id, int amplitude, int timestamp) {
+ this.id = id;
+ this.amplitude = amplitude;
+ this.timestamp = timestamp;
+ }
+
+ public BaseRawCalorimeterHit(long id, int amplitude, int timestamp, IDetectorElement de) {
+ this.id = id;
+ this.amplitude = amplitude;
+ this.timestamp = timestamp;
+ this.de = de;
+ }
+
+ public long getCellID() {
+ return id;
+ }
+
+ public int getAmplitude() {
+ return amplitude;
+ }
+
+ public int getTimeStamp() {
+ return timestamp;
+ }
+
+ /**
+ * The default position is that of the associated DetectorElement.
+ * @return The position as a size 3 double array.
+ */
+ public double[] getPosition() {
+ return getDetectorElement().getGeometry().getPosition().v();
+ }
+}
\ No newline at end of file