Commit in lcsim/src/org/lcsim/event/base on MAIN
BaseCalorimeterHit.java+87-501.17 -> 1.18
add some set methods to BaseCalorimeterHit class

lcsim/src/org/lcsim/event/base
BaseCalorimeterHit.java 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- BaseCalorimeterHit.java	1 Feb 2013 01:55:51 -0000	1.17
+++ BaseCalorimeterHit.java	5 Feb 2013 00:18:00 -0000	1.18
@@ -15,90 +15,113 @@
  * 
  * @author tonyj
  * @author jeremym
- * @version $Id: BaseCalorimeterHit.java,v 1.17 2013/02/01 01:55:51 jeremy Exp $
+ * @version $Id: BaseCalorimeterHit.java,v 1.18 2013/02/05 00:18:00 jeremy Exp $
  */
-public abstract class BaseCalorimeterHit extends BaseHitWithPosition implements CalorimeterHit {
+public class BaseCalorimeterHit extends BaseHitWithPosition implements CalorimeterHit
+{
 
     private static final double UNSET_ENERGY = -1;
     protected double rawEnergy = UNSET_ENERGY;
-    protected double corrEnergy = UNSET_ENERGY;
+    protected double correctedEnergy = UNSET_ENERGY;
     protected double energyError;
     protected double time;
     protected long id;
     protected int type;
-    
-    protected BaseCalorimeterHit() 
-    {        
+
+    protected BaseCalorimeterHit()
+    {
     }
     
     public BaseCalorimeterHit(
-            double rawEnergy,
-            double corrEnergy,
-            double energyError,
-            double time,
             long id,
-            int type) {
+            double correctedEnergy,
+            double time)
+    {
+        this.correctedEnergy = correctedEnergy;
+        this.time = time;
+        this.id = id;
+    }
+
+    public BaseCalorimeterHit(
+            double rawEnergy, 
+            double correctedEnergy, 
+            double energyError, 
+            double time, 
+            long id, 
+            Hep3Vector positionVec,
+            int type)
+    {
         this.rawEnergy = rawEnergy;
-        this.corrEnergy = corrEnergy;
+        this.correctedEnergy = correctedEnergy;
         this.energyError = energyError;
         this.time = time;
         this.id = id;
+        this.positionVec = positionVec;
         this.type = type;
     }
 
-    public double getTime() {
+    public double getTime()
+    {
         return time;
     }
 
-    public int getType() {
+    public int getType()
+    {
         return type;
     }
 
-    public double getRawEnergy() {
+    public double getRawEnergy()
+    {
         if (rawEnergy == UNSET_ENERGY) {
             throw new RuntimeException("No raw energy available for CalorimeterHit.");
         }
         return rawEnergy;
     }
-    
-    @Override
-    public double[] getPosition() {
-    	if (positionVec == null) {
-    		calculatePosition();
-    	}
-    	return super.getPosition();
+
+    public double[] getPosition()
+    {
+        if (positionVec == null) {
+            calculatePosition();
+        }
+        return super.getPosition();
     }
-    
-    public Hep3Vector getPositionVec() {
-    	if (positionVec == null) {
-    		calculatePosition();
-    	}
-    	return super.getPositionVec();
+
+    public Hep3Vector getPositionVec()
+    {
+        if (positionVec == null) {
+            calculatePosition();
+        }
+        return super.getPositionVec();
     }
 
-    public double getCorrectedEnergy() {
-        if (corrEnergy == UNSET_ENERGY) {
+    public double getCorrectedEnergy()
+    {
+        if (correctedEnergy == UNSET_ENERGY) {
             calculateCorrectedEnergy();
         }
-        return corrEnergy;
+        return correctedEnergy;
     }
 
-    public long getCellID() {
+    public long getCellID()
+    {
         return id;
     }
 
-    public int getLayerNumber() {
+    public int getLayerNumber()
+    {
         IDDecoder decoder = getIDDecoder();
         decoder.setID(id);
         return decoder.getLayer();
     }
 
-    private void calculateCorrectedEnergy() {
+    private void calculateCorrectedEnergy()
+    {
         getIDDecoder().setID(id);
-        corrEnergy = SamplingFractionManager.defaultInstance().getCorrectedEnergy(rawEnergy, getIDDecoder().getLayer(), getSubdetector());
+        correctedEnergy = SamplingFractionManager.defaultInstance().getCorrectedEnergy(rawEnergy, getIDDecoder().getLayer(), getSubdetector());
     }
 
-    private void calculatePosition() {
+    private void calculatePosition()
+    {
         if (getMetaData() != null) {
             IDDecoder decoder = getIDDecoder();
             decoder.setID(id);
@@ -108,35 +131,50 @@
         }
     }
 
-    public IIdentifier getIdentifier() {
+    public IIdentifier getIdentifier()
+    {
         if (compactId == null)
             compactId = new Identifier(id);
         return compactId;
     }
 
-    public double getEnergyError() {
+    public double getEnergyError()
+    {
         return energyError;
     }
 
-    public void setType(int type) {
+    public void setType(int type)
+    {
         this.type = type;
     }
 
-    public IDetectorElement getDetectorElement() {
+    public IDetectorElement getDetectorElement()
+    {
         if (de == null)
             findDetectorElementByPosition();
         // setupDetectorElement();
         return de;
     }
-   
+
+    public void setCorrectedEnergy(double correctedEnergy)
+    {
+        this.correctedEnergy = correctedEnergy;
+    }
+
+    public void addCorrectedEnergy(double addEnergy)
+    {
+        this.correctedEnergy += addEnergy;
+    }
+
     /**
      * Conversion to String for printout.
      * 
      * @return String output.
      */
-    public String toString() {
+    public String toString()
+    {
         StringBuffer sb = new StringBuffer("CalorimeterHitImpl: \n");
-        sb.append("type: " + type + " energy: " + corrEnergy + " energyError: " + energyError + "\n");
+        sb.append("type: " + type + " energy: " + correctedEnergy + " energyError: " + energyError + "\n");
         sb.append("position: " + positionVec.x() + " " + positionVec.y() + " " + positionVec.z() + "\n");
         sb.append("id: " + id + " time: " + time);
         return sb.toString();
@@ -150,14 +188,13 @@
  * (stripFields == null) throw new RuntimeException("stripFields is null"); IIdentifierDictionary dict =
  * helper.getIdentifierDictionary(); int nfields = dict.getNumberOfFields(); IExpandedIdentifier expId =
  * helper.unpack(getIdentifier()); for (int i=0; i<nfields; i++) { int idx =
- * dict.getFieldIndex(stripFields[i]); expId.setValue(idx, 0); } de =
- * findDetectorElement(dict.pack(expId)); if (de == null) throw new
- * RuntimeException("DetectorElement not found."); }
+ * dict.getFieldIndex(stripFields[i]); expId.setValue(idx, 0); } de = findDetectorElement(dict.pack(expId));
+ * if (de == null) throw new RuntimeException("DetectorElement not found."); }
  * 
  * private static IDetectorElement findDetectorElement(IIdentifier id) {
  * System.out.println("findDetectorElement - " + id.toHexString()); IDetectorElement de = null;
- * IDetectorElementContainer srch = DetectorElementStore.getInstance().find(id); if (srch.size() == 0) {
- * throw new RuntimeException("No DetectorElement found with id <" + id.toHexString() + ">."); } else if
- * (srch.size() == 1) { de = srch.get(0); } else if (srch.size() > 1) { for (IDetectorElement xde : srch)
- * { if (!xde.hasChildren()) { de = xde; break; } } } return de; }
+ * IDetectorElementContainer srch = DetectorElementStore.getInstance().find(id); if (srch.size() == 0) { throw
+ * new RuntimeException("No DetectorElement found with id <" + id.toHexString() + ">."); } else if
+ * (srch.size() == 1) { de = srch.get(0); } else if (srch.size() > 1) { for (IDetectorElement xde : srch) { if
+ * (!xde.hasChildren()) { de = xde; break; } } } return de; }
  */
\ No newline at end of file
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