hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.1 -r1.2
--- ECalReadout.java 23 Aug 2011 17:08:10 -0000 1.1
+++ ECalReadout.java 23 Aug 2011 22:27:28 -0000 1.2
@@ -14,14 +14,17 @@
/**
- * converts energy deposition from MC to raw hits
+ * converts MC energy deposition to raw hits
* @author meeg
*/
public interface ECalReadout
{
- public String getName();
-
+ //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();
}
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.4 -r1.5
--- HPSEcalReadoutDriver.java 23 Aug 2011 22:18:10 -0000 1.4
+++ HPSEcalReadoutDriver.java 23 Aug 2011 22:27:28 -0000 1.5
@@ -9,8 +9,7 @@
import org.lcsim.event.EventHeader;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.subdetector.HPSEcal;
-import org.lcsim.geometry.subdetector.HPSEcal2;
+import org.lcsim.geometry.Subdetector;
import org.lcsim.util.Driver;
/**
@@ -20,16 +19,17 @@
*/
public class HPSEcalReadoutDriver extends Driver implements ECalReadout {
- HPSEcal ecal;
+ Subdetector ecal;
String ecalCollectionName;
String ecalName;
String ecalRawCollectionName = "EcalRawHits";
+ //buffer for deposited energy
Map<Long, Double> eDepMap = null;
int hitType = 11;
//counts bunches for trigger clock
int clock;
//number of bunches in trigger cycle
- int triggerCycle = 4;
+ int triggerCycle = 1;
public HPSEcalReadoutDriver() {
}
@@ -57,15 +57,12 @@
if (ecalName == null)
throw new RuntimeException("The parameter ecalName was not set!");
- //initialize clock
- clock = 0;
- //initialize buffers
- eDepMap = new HashMap<Long, Double>();
+ initReadout();
}
public void detectorChanged(Detector detector) {
// Get the Subdetector.
- ecal = (HPSEcal2) detector.getSubdetector(ecalName);
+ ecal = detector.getSubdetector(ecalName);
}
public void process(EventHeader event) {
@@ -76,6 +73,8 @@
List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
if (hits == null)
throw new RuntimeException("Event is missing ECal hits collection!");
+
+ //write hits into buffers
putHits(hits);
//if at the end of a readout cycle, write buffers to hits
@@ -107,4 +106,11 @@
}
}
}
+
+ public void initReadout() {
+ //initialize clock
+ clock = 0;
+ //initialize buffers
+ eDepMap = new HashMap<Long, Double>();
+ }
}
\ No newline at end of file