Commit in hps-java/src/main/java/org/lcsim/hps/recon/ecal on MAIN
HPSEcalClusterer.java+2-21.9 -> 1.10
HPSEcalTimeEvolutionReadoutDriver.java+20-21.1 -> 1.2
HPSEcalReadoutDriver.java+4-11.7 -> 1.8
HPSEcal1BitClusterer.java+6-61.10 -> 1.11
ECalReadout.java-301.2 removed
+32-41
1 removed + 4 modified, total 5 files
time evolution readout works

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalClusterer.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- HPSEcalClusterer.java	28 Jul 2011 23:32:38 -0000	1.9
+++ HPSEcalClusterer.java	24 Aug 2011 17:26:42 -0000	1.10
@@ -26,7 +26,7 @@
  * @author Jeremy McCormick <[log in to unmask]>
  * @author Tim Nelson <[log in to unmask]>
  * 
- * @version $Id: HPSEcalClusterer.java,v 1.9 2011/07/28 23:32:38 jeremy Exp $
+ * @version $Id: HPSEcalClusterer.java,v 1.10 2011/08/24 17:26:42 meeg Exp $
  */
 public class HPSEcalClusterer extends Driver 
 {
@@ -109,7 +109,7 @@
         // Get the list of ECal hits.
         List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
         if (hits == null)
-            throw new RuntimeException("Event is missing ECal hits collection!");
+            throw new RuntimeException("Event is missing ECal raw hits collection!");
                     
         // Get the decoder for the ECal IDs.
         IDDecoder dec = ecal.getIDDecoder();

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalTimeEvolutionReadoutDriver.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- HPSEcalTimeEvolutionReadoutDriver.java	23 Aug 2011 23:46:13 -0000	1.1
+++ HPSEcalTimeEvolutionReadoutDriver.java	24 Aug 2011 17:26:42 -0000	1.2
@@ -17,23 +17,33 @@
  */
 public class HPSEcalTimeEvolutionReadoutDriver extends HPSEcalReadoutDriver {
     //buffer for deposited energy
+
     Map<Long, RingBuffer> eDepMap = null;
     //length of ring buffer (in readout cycles)
-    int bufferLength = 1;
+    int bufferLength = 20;
     //minimum readout value to write a hit
     double threshold = 0.0;
+    //bunch spacing in ns
+    double dt = 2.0;
+    //shaper time constant in ns
+    double t0 = 18.0;
 
     public HPSEcalTimeEvolutionReadoutDriver() {
     }
 
     public void setBufferLength(int bufferLength) {
         this.bufferLength = bufferLength;
+        eDepMap = new HashMap<Long, RingBuffer>();
     }
 
     public void setThreshold(double threshold) {
         this.threshold = threshold;
     }
 
+    public void setDt(double dt) {
+        this.dt = dt;
+    }
+
     public List<CalorimeterHit> readHits() {
         IDDecoder dec = ecal.getIDDecoder();
         List<CalorimeterHit> hitList = new ArrayList<CalorimeterHit>();
@@ -56,7 +66,9 @@
                 eDepBuffer = new RingBuffer(bufferLength);
                 eDepMap.put(hit.getCellID(), eDepBuffer);
             }
-            eDepBuffer.addToCell(0, hit.getRawEnergy()); //TODO: put actual pulse shape here
+            for (int i = 0; i < bufferLength; i++) {
+                eDepBuffer.addToCell(i, hit.getRawEnergy() * pulseAmplitude(i * dt * readoutCycle - hit.getTime()));
+            }
         }
     }
 
@@ -66,4 +78,10 @@
         //initialize buffers
         eDepMap = new HashMap<Long, RingBuffer>();
     }
+
+    private double pulseAmplitude(double time) {
+        if (time < 0.0)
+            return 0.0;
+        return (time / t0) * java.lang.Math.exp(1.0 - time / t0);
+    }
 }
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalReadoutDriver.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- HPSEcalReadoutDriver.java	23 Aug 2011 23:46:13 -0000	1.7
+++ HPSEcalReadoutDriver.java	24 Aug 2011 17:26:42 -0000	1.8
@@ -1,5 +1,6 @@
 package org.lcsim.hps.recon.ecal;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.lcsim.event.CalorimeterHit;
@@ -19,6 +20,7 @@
     String ecalCollectionName;
     String ecalName;
     String ecalRawCollectionName = "EcalRawHits";
+    //hit type as in CalorimeterHitTypeValues
     int hitType = 11;
     //counts bunches for readout clock
     int clock;
@@ -74,7 +76,8 @@
         //if at the end of a readout cycle, write buffers to hits
         if (clock % readoutCycle == 0) {
             event.put(ecalRawCollectionName, readHits(), CalorimeterHit.class, 0);
-        }
+        } else
+            event.put(ecalRawCollectionName, new ArrayList<CalorimeterHit>(), CalorimeterHit.class, 0);
     }
 
     //read analog signal out of buffers and make hits; reset buffers

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcal1BitClusterer.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- HPSEcal1BitClusterer.java	23 Aug 2011 22:08:29 -0000	1.10
+++ HPSEcal1BitClusterer.java	24 Aug 2011 17:26:42 -0000	1.11
@@ -30,6 +30,7 @@
  * @author Sho Uemura <[log in to unmask]>
  */
 public class HPSEcal1BitClusterer extends Driver implements Clusterer {
+
     HPSEcal ecal;
     String ecalName;
     String ecalCollectionName;
@@ -95,13 +96,12 @@
 
         // Get the list of raw ECal hits.
         List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
+        if (hits == null)
+            throw new RuntimeException("Event is missing ECal raw hits collection!");
 
-        //if there are raw hits, run clustering
-        if (hits != null) {
-            // Put Cluster collection into event.
-            int flag = 1 << LCIOConstants.CLBIT_HITS;
-            event.put(clusterCollectionName, createClusters(hits), Cluster.class, flag);
-        }
+        // Put Cluster collection into event.
+        int flag = 1 << LCIOConstants.CLBIT_HITS;
+        event.put(clusterCollectionName, createClusters(hits), Cluster.class, flag);
     }
 
     public List<Cluster> createClusters(List<CalorimeterHit> hits) {

hps-java/src/main/java/org/lcsim/hps/recon/ecal
ECalReadout.java removed after 1.2
diff -N ECalReadout.java
--- ECalReadout.java	23 Aug 2011 22:27:28 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
-/*
- * SiDigitizer.java
- *
- * Created on August 22, 2011, 9:20 AM
- *
- * To change this template, choose Tools | Template Manager
- * and open the template in the editor.
- */
-
-package org.lcsim.hps.recon.ecal;
-
-import java.util.List;
-import org.lcsim.event.CalorimeterHit;
-
-
-/**
- * converts MC energy deposition to raw hits
- * @author meeg
- */
-public interface ECalReadout
-{
-    //read analog signal out of buffers and make hits; reset buffers
-    public List<CalorimeterHit> readHits();
-    
-    //add deposited energy to buffers
-    public void putHits(List<CalorimeterHit> hits);
-    
-    //initialize buffers
-    public void initReadout();
-}
CVSspam 0.2.8