Commit in hps-java/src/main/java/org/lcsim/hps/recon/ecal on MAIN
HPSRawCalorimeterHit.java+45-221.5 -> 1.6
override getDetectorElement for compatibility with lcsim 2.2

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSRawCalorimeterHit.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- HPSRawCalorimeterHit.java	19 Nov 2011 00:52:55 -0000	1.5
+++ HPSRawCalorimeterHit.java	7 Aug 2012 23:10:08 -0000	1.6
@@ -1,6 +1,8 @@
 package org.lcsim.hps.recon.ecal;
 
 import java.util.Comparator;
+import org.lcsim.detector.IDetectorElement;
+import org.lcsim.detector.IDetectorElementContainer;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.base.BaseCalorimeterHit;
 
@@ -9,30 +11,51 @@
  * for use in ECalReadout
  *
  * @author Sho Uemura
- * @version $Id: HPSRawCalorimeterHit.java,v 1.5 2011/11/19 00:52:55 meeg Exp $
+ * @version $Id: HPSRawCalorimeterHit.java,v 1.6 2012/08/07 23:10:08 meeg Exp $
  */
 public class HPSRawCalorimeterHit extends BaseCalorimeterHit {
 
-	/**
-	 * Fully qualified constructor that sets rawEnergy
-	 *
-	 * @param energy   Raw energy for this cell
-	 * @param position Global Cartesian coordinate for this cell
-	 * @param time     Time of energy deposition
-	 * @param id       Cell ID
-	 * @param type     Type
-	 */
-	public HPSRawCalorimeterHit(double energy, double[] position, double time, long id, int type) {
-		this.rawEnergy = energy;
-		this.position = position;
-		this.time = time;
-		this.id = id;
-		this.type = type;
-	}
+    /**
+     * Fully qualified constructor that sets rawEnergy
+     *
+     * @param energy   Raw energy for this cell
+     * @param position Global Cartesian coordinate for this cell
+     * @param time     Time of energy deposition
+     * @param id       Cell ID
+     * @param type     Type
+     */
+    public HPSRawCalorimeterHit(double energy, double[] position, double time, long id, int type) {
+        this.rawEnergy = energy;
+//        if (position != null) {
+//            this.positionVec = new BasicHep3Vector(position);
+//        } else {
+//            positionVec = null;
+//        }
+        this.time = time;
+        this.id = id;
+        this.type = type;
+    }
 
-	static class TimeComparator implements Comparator<CalorimeterHit> {
-		public int compare(CalorimeterHit o1, CalorimeterHit o2) {
-			return Double.compare(o1.getTime(), o2.getTime());
-		}
-	}
+    @Override
+    public IDetectorElement getDetectorElement() {
+        if (de == null) {
+//            findDetectorElementByPosition();
+            IDetectorElementContainer detectorElements = HPSEcalConditions.getSubdetector().getDetectorElement().findDetectorElement(getIdentifier());
+            if (detectorElements.size() != 1) {
+                throw new RuntimeException("Expected exactly one DetectorElement matching ID " + getIdentifier() + ", got " + detectorElements.size());
+            } else {
+                de = detectorElements.get(0);
+            }
+        }
+        // setupDetectorElement();
+        return de;
+    }
+
+    static class TimeComparator implements Comparator<CalorimeterHit> {
+
+        @Override
+        public int compare(CalorimeterHit o1, CalorimeterHit o2) {
+            return Double.compare(o1.getTime(), o2.getTime());
+        }
+    }
 }
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