Print

Print


Commit in hps-java/src/main on MAIN
java/org/lcsim/hps/evio/ECalEvioWriter.java+15-31.7 -> 1.8
                       /TestRunTriggeredReconToEvio.java+27-11.11 -> 1.12
java/org/lcsim/hps/recon/ecal/TestRunTriggerDriver.java+62added 1.1
                             /HPSEcalFADCReadoutDriver.java+369-3581.12 -> 1.13
resources/org/lcsim/hps/steering/HPSTestRunReconToEvio.lcsim+60-551.6 -> 1.7
+533-417
1 added + 4 modified, total 5 files
update ECal readout and trigger to match test run data

hps-java/src/main/java/org/lcsim/hps/evio
ECalEvioWriter.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- ECalEvioWriter.java	31 May 2012 00:28:18 -0000	1.7
+++ ECalEvioWriter.java	7 Jun 2012 00:47:30 -0000	1.8
@@ -25,7 +25,7 @@
 /**
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: ECalEvioWriter.java,v 1.7 2012/05/31 00:28:18 meeg Exp $
+ * @version $Id: ECalEvioWriter.java,v 1.8 2012/06/07 00:47:30 meeg Exp $
  */
 public class ECalEvioWriter implements EvioWriter {
 
@@ -108,6 +108,10 @@
     }
 
     private void writeIntegralHitCollection(List<RawCalorimeterHit> hits, LCMetaData meta, int bankTag, EventBuilder builder) {
+        if (hits.isEmpty()) {
+            return;
+        }
+
         // Get the ID decoder.
         IDDecoder dec = meta.getIDDecoder();
 
@@ -218,6 +222,10 @@
     }
 
     private void writePulseHitCollection(List<RawTrackerHit> hits, LCMetaData meta, int bankTag, EventBuilder builder) {
+        if (hits.isEmpty()) {
+            return;
+        }
+
         // Get the ID decoder.
         IDDecoder dec = meta.getIDDecoder();
 
@@ -324,6 +332,10 @@
     }
 
     private void writeWindowHitCollection(List<RawTrackerHit> hits, LCMetaData meta, int bankTag, EventBuilder builder) {
+        if (hits.isEmpty()) {
+            return;
+        }
+
         // Get the ID decoder.
         IDDecoder dec = meta.getIDDecoder();
 
@@ -385,9 +397,9 @@
             // Add CompositeData to bank.
             try {
                 CompositeData cdata = new CompositeData(EventConstants.ECAL_WINDOW_FORMAT, 1, data, EventConstants.ECAL_WINDOW_BANK_TAG, 0);
- //                slotDataList.add(cdata);
+                //                slotDataList.add(cdata);
                 slotBank.appendCompositeData(cdata);
-           } catch (EvioException e) {
+            } catch (EvioException e) {
                 throw new RuntimeException(e);
             }
 

hps-java/src/main/java/org/lcsim/hps/evio
TestRunTriggeredReconToEvio.java 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- TestRunTriggeredReconToEvio.java	31 May 2012 00:28:18 -0000	1.11
+++ TestRunTriggeredReconToEvio.java	7 Jun 2012 00:47:30 -0000	1.12
@@ -62,6 +62,8 @@
         } catch (EvioException e) {
             throw new RuntimeException(e);
         }
+        
+        writePrestartEvent();
 
         writers = new ArrayList<EvioWriter>();
 
@@ -95,7 +97,7 @@
             EvioBank eventIDBank = new EvioBank(EventConstants.EVENTID_BANK_TAG, DataType.UINT32, 0);
             int[] eventID = new int[3];
             eventID[0] = eventsWritten;
-            eventID[1] = 0; //trigger type
+            eventID[1] = 1; //trigger type
             eventID[2] = 0; //status
 
             try {
@@ -150,6 +152,30 @@
         }
     }
 
+    private void writePrestartEvent() {
+        // Make a new EVIO event.
+        EventBuilder builder = new EventBuilder(EventConstants.PRESTART_EVENT_TAG, DataType.UINT32, EventConstants.EVENT_BANK_NUM);
+        int[] prestartData = new int[3];
+        prestartData[0] = 0; //Unix time in seconds - use 0 for MC data
+        prestartData[1] = 0; //run number
+        prestartData[2] = 0; //run type
+
+        try {
+            builder.appendIntData(builder.getEvent(), prestartData);
+        } catch (EvioException e) {
+            throw new RuntimeException(e);
+        }
+        builder.setAllHeaderLengths();
+        try {
+            writer.writeEvent(builder.getEvent());
+            ++eventsWritten;
+        } catch (EvioException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     private class QueuedEtEvent {
 
         private EventBuilder builder;

hps-java/src/main/java/org/lcsim/hps/recon/ecal
TestRunTriggerDriver.java added at 1.1
diff -N TestRunTriggerDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TestRunTriggerDriver.java	7 Jun 2012 00:47:31 -0000	1.1
@@ -0,0 +1,62 @@
+package org.lcsim.hps.recon.ecal;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Reads clusters and makes trigger decision using opposite quadrant criterion.
+ * Prints triggers to file if file path specified.
+ *
+ * @author Omar Moreno <[log in to unmask]>
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: TestRunTriggerDriver.java,v 1.1 2012/06/07 00:47:31 meeg Exp $
+ */
+public class TestRunTriggerDriver extends HPSTriggerDriver {
+
+    // A list to contain all cluster pairs in an event
+    List<HPSEcalCluster[]> clusterPairs;
+    int nTriggers;
+    int totalEvents;
+    private double clusterEnergyLow = 10;    //
+    int deadtimelessTriggerCount;
+
+    public TestRunTriggerDriver() {
+        clusterPairs = new LinkedList<HPSEcalCluster[]>();
+    }
+
+    @Override
+    public void startOfData() {
+        super.startOfData();
+
+        deadtimelessTriggerCount = 0;
+    }
+
+    @Override
+    public boolean testTrigger(List<HPSEcalCluster> clusters) {
+        boolean trigger = false;
+
+        for (HPSEcalCluster cluster : clusters) {
+            if (cluster.getEnergy() > clusterEnergyLow) {
+                trigger = true;
+            }
+        }
+        if (trigger) {
+            deadtimelessTriggerCount++;
+        }
+        return trigger;
+    }
+
+    @Override
+    public void endOfData() {
+        if (outputStream != null) {
+            outputStream.printf("Number of cluster pairs after successive trigger conditions:\n");
+            outputStream.printf("Trigger count without dead time: %d\n", deadtimelessTriggerCount);
+            outputStream.printf("Trigger count: %d\n", numTriggers);
+            outputStream.close();
+        }
+        System.out.printf("Number of cluster pairs after successive trigger conditions:\n");
+        System.out.printf("Trigger count without dead time: %d\n", deadtimelessTriggerCount);
+        System.out.printf("Trigger count: %d\n", numTriggers);
+        super.endOfData();
+    }
+}
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalFADCReadoutDriver.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- HPSEcalFADCReadoutDriver.java	7 Apr 2012 00:07:25 -0000	1.12
+++ HPSEcalFADCReadoutDriver.java	7 Jun 2012 00:47:30 -0000	1.13
@@ -26,375 +26,386 @@
  * Simulates time evolution of preamp output pulse.
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.12 2012/04/07 00:07:25 meeg Exp $
+ * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.13 2012/06/07 00:47:30 meeg Exp $
  */
 public class HPSEcalFADCReadoutDriver extends HPSEcalReadoutDriver<RawCalorimeterHit> {
 
-	//buffer for deposited energy
-	private Map<Long, RingBuffer> eDepMap = null;
-	//ADC pipeline for readout
-	private Map<Long, FADCPipeline> pipelineMap = null;
-	//buffer for window sums
-	private Map<Long, Double> sumMap = null;
-	//buffer for timestamps
-	private Map<Long, Integer> timeMap = null;
-	//queue for hits to be output to clusterer
-	private PriorityQueue<HPSFADCCalorimeterHit> outputQueue = null;
-	//length of ring buffer (in readout cycles)
-	private int bufferLength = 100;
-	//length of readout pipeline (in readout cycles)
-	private int pipelineLength = 2000;
-	//shaper time constant in ns; negative values generate square pulses of the given width
-	private double t0 = 18.0;
-	//delay (number of readout periods) between start of summing window and output of hit to clusterer
-	private int delay0 = 32;
-	//start of readout window relative to trigger time (in readout cycles)
-	//in FADC documentation, "Programmable Latency" or PL
-	private int readoutLatency = 200;
-	//number of ADC samples to read out
-	//in FADC documentation, "Programmable Trigger Window" or PTW
-	private int readoutWindow = 200;
-	//number of ADC samples to read out before each rising threshold crossing
-	//in FADC documentation, "number of samples before" or NSB
-	private int numSamplesBefore = 10;
-	//number of ADC samples to read out after each rising threshold crossing
-	//in FADC documentation, "number of samples before" or NSA
-	private int numSamplesAfter = 50;
-	private HPSEcalConverter converter = null;
-	//output buffer for hits
-	private LinkedList<HPSFADCCalorimeterHit> buffer = new LinkedList<HPSFADCCalorimeterHit>();
-	//number of readout periods for which a given hit stays in the buffer
-	private int coincidenceWindow = 2;
-	private double pulseIntegral;
-	//output collection name for hits read out from trigger
-	private String ecalReadoutCollectionName = "EcalReadoutHits";
-	private int mode = EventConstants.ECAL_PULSE_INTEGRAL_MODE;
-
-	public HPSEcalFADCReadoutDriver() {
-		flags = 0;
-		flags += 1 << LCIOConstants.RCHBIT_TIME; //store cell ID
-		hitClass = HPSFADCCalorimeterHit.class;
-		converter = new HPSEcalConverter(null);
-	}
-
-	public void setEcalReadoutCollectionName(String ecalReadoutCollectionName) {
-		this.ecalReadoutCollectionName = ecalReadoutCollectionName;
-	}
-
-	public void setNumSamplesAfter(int numSamplesAfter) {
-		this.numSamplesAfter = numSamplesAfter;
-	}
-
-	public void setNumSamplesBefore(int numSamplesBefore) {
-		this.numSamplesBefore = numSamplesBefore;
-	}
-
-	public void setReadoutLatency(int readoutLatency) {
-		this.readoutLatency = readoutLatency;
-	}
-
-	public void setReadoutWindow(int readoutWindow) {
-		this.readoutWindow = readoutWindow;
-	}
-
-	public void setCoincidenceWindow(int coincidenceWindow) {
-		this.coincidenceWindow = coincidenceWindow;
-	}
-
-	public void setPedestal(double pedestal) {
-		converter.setPedestal(pedestal);
-	}
-
-	public void setScale(double scale) {
-		converter.setScale(scale);
-	}
-
-	public void setT0(double t0) {
-		this.t0 = t0;
-	}
-
-	public void setDelay0(int delay0) {
-		this.delay0 = delay0;
-	}
-
-	public void setBufferLength(int bufferLength) {
-		this.bufferLength = bufferLength;
-		resetFADCBuffers();
-	}
-
-	public void setPipelineLength(int pipelineLength) {
-		this.pipelineLength = pipelineLength;
-		resetFADCBuffers();
-	}
-
-	public void setMode(int mode) {
-		this.mode = mode;
-		if (mode != EventConstants.ECAL_WINDOW_MODE && mode != EventConstants.ECAL_PULSE_MODE && mode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
-			throw new IllegalArgumentException("invalid mode " + mode);
-		}
-	}
-
-	@Override
-	protected void readHits(List<RawCalorimeterHit> hits) {
-
-		for (Long cellID : eDepMap.keySet()) {
-			RingBuffer eDepBuffer = eDepMap.get(cellID);
-
-			FADCPipeline pipeline = pipelineMap.get(cellID);
-			pipeline.step();
-			pipeline.writeValue(converter.AtoD(eDepBuffer.currentValue(), cellID));
-
-			Double sum = sumMap.get(cellID);
-			if (sum == null && eDepBuffer.currentValue() > threshold) {
-				timeMap.put(cellID, readoutCounter);
-				sumMap.put(cellID, eDepBuffer.currentValue());
-			}
-			if (sum != null) {
-				if (eDepBuffer.currentValue() < threshold || timeMap.get(cellID) + delay0 == readoutCounter) {
+    //buffer for deposited energy
+    private Map<Long, RingBuffer> eDepMap = null;
+    //ADC pipeline for readout
+    private Map<Long, FADCPipeline> pipelineMap = null;
+    //buffer for window sums
+    private Map<Long, Double> sumMap = null;
+    //buffer for timestamps
+    private Map<Long, Integer> timeMap = null;
+    //queue for hits to be output to clusterer
+    private PriorityQueue<HPSFADCCalorimeterHit> outputQueue = null;
+    //length of ring buffer (in readout cycles)
+    private int bufferLength = 100;
+    //length of readout pipeline (in readout cycles)
+    private int pipelineLength = 2000;
+    //shaper time constant in ns; negative values generate square pulses of the given width
+    private double t0 = 18.0;
+    //delay (number of readout periods) between start of summing window and output of hit to clusterer
+    private int delay0 = 32;
+    //start of readout window relative to trigger time (in readout cycles)
+    //in FADC documentation, "Programmable Latency" or PL
+    private int readoutLatency = 200;
+    //number of ADC samples to read out
+    //in FADC documentation, "Programmable Trigger Window" or PTW
+    private int readoutWindow = 200;
+    //number of ADC samples to read out before each rising threshold crossing
+    //in FADC documentation, "number of samples before" or NSB
+    private int numSamplesBefore = 10;
+    //number of ADC samples to read out after each rising threshold crossing
+    //in FADC documentation, "number of samples before" or NSA
+    private int numSamplesAfter = 50;
+//    private HPSEcalConverter converter = null;
+    //output buffer for hits
+    private LinkedList<HPSFADCCalorimeterHit> buffer = new LinkedList<HPSFADCCalorimeterHit>();
+    //number of readout periods for which a given hit stays in the buffer
+    private int coincidenceWindow = 2;
+    private double pulseIntegral;
+    //output collection name for hits read out from trigger
+    private String ecalReadoutCollectionName = "EcalReadoutHits";
+    private int mode = EventConstants.ECAL_PULSE_INTEGRAL_MODE;
+    private int readoutThreshold = (int) threshold;
+    private int triggerThreshold = (int) threshold;
+    //amplitude ADC counts/GeV
+    private double gain = 1000 * 80.0 / 60;
+    private double scaleFactor = 128;
+
+    public HPSEcalFADCReadoutDriver() {
+        flags = 0;
+        flags += 1 << LCIOConstants.RCHBIT_TIME; //store cell ID
+        hitClass = HPSFADCCalorimeterHit.class;
+//        converter = new HPSEcalConverter(null);
+    }
+
+    public void setGain(double gain) {
+        this.gain = gain;
+    }
+
+    public void setReadoutThreshold(int readoutThreshold) {
+        this.readoutThreshold = readoutThreshold;
+    }
+
+    public void setScaleFactor(double scaleFactor) {
+        this.scaleFactor = scaleFactor;
+    }
+
+    public void setTriggerThreshold(int triggerThreshold) {
+        this.triggerThreshold = triggerThreshold;
+    }
+
+    public void setEcalReadoutCollectionName(String ecalReadoutCollectionName) {
+        this.ecalReadoutCollectionName = ecalReadoutCollectionName;
+    }
+
+    public void setNumSamplesAfter(int numSamplesAfter) {
+        this.numSamplesAfter = numSamplesAfter;
+    }
+
+    public void setNumSamplesBefore(int numSamplesBefore) {
+        this.numSamplesBefore = numSamplesBefore;
+    }
+
+    public void setReadoutLatency(int readoutLatency) {
+        this.readoutLatency = readoutLatency;
+    }
+
+    public void setReadoutWindow(int readoutWindow) {
+        this.readoutWindow = readoutWindow;
+    }
+
+    public void setCoincidenceWindow(int coincidenceWindow) {
+        this.coincidenceWindow = coincidenceWindow;
+    }
+
+    public void setPedestal(double pedestal) {
+//        converter.setPedestal(pedestal);
+    }
+
+    public void setScale(double scale) {
+//        converter.setScale(scale);
+    }
+
+    public void setT0(double t0) {
+        this.t0 = t0;
+    }
+
+    public void setDelay0(int delay0) {
+        this.delay0 = delay0;
+    }
+
+    public void setBufferLength(int bufferLength) {
+        this.bufferLength = bufferLength;
+        resetFADCBuffers();
+    }
+
+    public void setPipelineLength(int pipelineLength) {
+        this.pipelineLength = pipelineLength;
+        resetFADCBuffers();
+    }
+
+    public void setMode(int mode) {
+        this.mode = mode;
+        if (mode != EventConstants.ECAL_WINDOW_MODE && mode != EventConstants.ECAL_PULSE_MODE && mode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
+            throw new IllegalArgumentException("invalid mode " + mode);
+        }
+    }
+
+    @Override
+    protected void readHits(List<RawCalorimeterHit> hits) {
+
+        for (Long cellID : eDepMap.keySet()) {
+            RingBuffer eDepBuffer = eDepMap.get(cellID);
+
+            FADCPipeline pipeline = pipelineMap.get(cellID);
+            pipeline.step();
+            double pedestal = HPSEcalConditions.physicalToPedestal(cellID);
+            double currentValue = gain * eDepBuffer.currentValue();
+            pipeline.writeValue((int) Math.round(pedestal + currentValue));
+
+            Double sum = sumMap.get(cellID);
+            if (sum == null && currentValue > triggerThreshold) {
+                timeMap.put(cellID, readoutCounter);
+                sumMap.put(cellID, currentValue);
+            }
+            if (sum != null) {
+                if (currentValue < triggerThreshold || timeMap.get(cellID) + delay0 == readoutCounter) {
 //					System.out.printf("sum = %f\n",sum);
-					outputQueue.add(new HPSFADCCalorimeterHit(cellID,
-							converter.AtoD((sum + eDepBuffer.currentValue()) / pulseIntegral, cellID),
-							timeMap.get(cellID),
-							readoutCounter - timeMap.get(cellID) + 1));
-					sumMap.remove(cellID);
-				} else {
-					sumMap.put(cellID, sum + eDepBuffer.currentValue());
-				}
-			}
-			eDepBuffer.step();
-		}
-		while (outputQueue.peek() != null && outputQueue.peek().getTimeStamp() <= readoutCounter - delay0) {
-			if (outputQueue.peek().getTimeStamp() < readoutCounter - delay0) {
-				System.out.println("Stale hit in output queue");
-				outputQueue.poll();
-			} else {
-				buffer.add(outputQueue.poll());
-			}
-		}
-		while (!buffer.isEmpty() && buffer.peek().getTimeStamp() <= readoutCounter - delay0 - coincidenceWindow) {
-			buffer.remove();
-		}
-
-		hits.addAll(buffer);
-	}
-
-	@Override
-	public void startOfData() {
-		super.startOfData();
-		if (ecalReadoutCollectionName == null) {
-			throw new RuntimeException("The parameter ecalReadoutCollectionName was not set!");
-		}
-	}
-
-	@Override
-	protected void processTrigger(EventHeader event) {
-		switch (mode) {
-			case EventConstants.ECAL_WINDOW_MODE:
-				System.out.println("Reading out ECal in window mode");
-				event.put(ecalReadoutCollectionName, readWindow(), RawTrackerHit.class, 0, ecalReadoutName);
-				break;
-			case EventConstants.ECAL_PULSE_MODE:
-				System.out.println("Reading out ECal in pulse mode");
-				event.put(ecalReadoutCollectionName, readPulses(), RawTrackerHit.class, 0, ecalReadoutName);
-				break;
-			case EventConstants.ECAL_PULSE_INTEGRAL_MODE:
-				System.out.println("Reading out ECal in integral mode");
-				event.put(ecalReadoutCollectionName, readIntegrals(), RawCalorimeterHit.class, 0, ecalReadoutName);
-				break;
-		}
-	}
-
-	protected short[] getWindow(long cellID) {
-		FADCPipeline pipeline = pipelineMap.get(cellID);
-		boolean samplesAboveThreshold = false;
-		short[] adcValues = new short[readoutWindow];
-		for (int i = 0; i < readoutWindow; i++) {
-			adcValues[i] = (short) pipeline.getValue(readoutLatency - i - 1);
+                    outputQueue.add(new HPSFADCCalorimeterHit(cellID,
+                            (int) Math.round((sum + currentValue) / scaleFactor),
+                            timeMap.get(cellID),
+                            readoutCounter - timeMap.get(cellID) + 1));
+                    sumMap.remove(cellID);
+                } else {
+                    sumMap.put(cellID, sum + currentValue);
+                }
+            }
+            eDepBuffer.step();
+        }
+        while (outputQueue.peek() != null && outputQueue.peek().getTimeStamp() <= readoutCounter - delay0) {
+            if (outputQueue.peek().getTimeStamp() < readoutCounter - delay0) {
+                System.out.println("Stale hit in output queue");
+                outputQueue.poll();
+            } else {
+                buffer.add(outputQueue.poll());
+            }
+        }
+        while (!buffer.isEmpty() && buffer.peek().getTimeStamp() <= readoutCounter - delay0 - coincidenceWindow) {
+            buffer.remove();
+        }
+
+        hits.addAll(buffer);
+    }
+
+    @Override
+    public void startOfData() {
+        super.startOfData();
+        if (ecalReadoutCollectionName == null) {
+            throw new RuntimeException("The parameter ecalReadoutCollectionName was not set!");
+        }
+    }
+
+    @Override
+    protected void processTrigger(EventHeader event) {
+        switch (mode) {
+            case EventConstants.ECAL_WINDOW_MODE:
+                System.out.println("Reading out ECal in window mode");
+                event.put(ecalReadoutCollectionName, readWindow(), RawTrackerHit.class, 0, ecalReadoutName);
+                break;
+            case EventConstants.ECAL_PULSE_MODE:
+                System.out.println("Reading out ECal in pulse mode");
+                event.put(ecalReadoutCollectionName, readPulses(), RawTrackerHit.class, 0, ecalReadoutName);
+                break;
+            case EventConstants.ECAL_PULSE_INTEGRAL_MODE:
+                System.out.println("Reading out ECal in integral mode");
+                event.put(ecalReadoutCollectionName, readIntegrals(), RawCalorimeterHit.class, 0, ecalReadoutName);
+                break;
+        }
+    }
+
+    protected short[] getWindow(long cellID) {
+        FADCPipeline pipeline = pipelineMap.get(cellID);
+        short[] adcValues = new short[readoutWindow];
+        for (int i = 0; i < readoutWindow; i++) {
+            adcValues[i] = (short) pipeline.getValue(readoutLatency - i - 1);
 //			if (adcValues[i] != 0) {
 //				System.out.println("getWindow: " + adcValues[i] + " at i = " + i);
 //			}
-			if (adcValues[i] > converter.AtoD(threshold, cellID)) {
-				samplesAboveThreshold = true;
-			}
-		}
-		if (samplesAboveThreshold) {
-			return adcValues;
-		} else {
-			return null;
-		}
-	}
+        }
+        return adcValues;
+    }
 
-	protected List<RawTrackerHit> readWindow() {
+    protected List<RawTrackerHit> readWindow() {
 //		System.out.println("Reading FADC data");
-		List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
-		for (Long cellID : pipelineMap.keySet()) {
-			short[] adcValues = getWindow(cellID);
-			if (adcValues != null) {
-				hits.add(new BaseRawTrackerHit(cellID, 0, adcValues));
-			}
-		}
-		return hits;
-	}
+        List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
+        for (Long cellID : pipelineMap.keySet()) {
+            short[] adcValues = getWindow(cellID);
+            hits.add(new BaseRawTrackerHit(cellID, 0, adcValues));
+        }
+        return hits;
+    }
 
-	protected List<RawTrackerHit> readPulses() {
+    protected List<RawTrackerHit> readPulses() {
 //		System.out.println("Reading FADC data");
-		List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
-		for (Long cellID : pipelineMap.keySet()) {
-			short[] window = getWindow(cellID);
-			short[] adcValues = null;
-			int pointerOffset = 0;
-			int numSamplesToRead = 0;
-			int thresholdCrossing = 0;
-			if (window != null) {
-				for (int i = 0; i < readoutWindow; i++) {
-					if (numSamplesToRead != 0) {
-						adcValues[adcValues.length - numSamplesToRead] = window[i - pointerOffset];
-						numSamplesToRead--;
-						if (numSamplesToRead == 0) {
-							hits.add(new BaseRawTrackerHit(cellID, thresholdCrossing, adcValues));
-						}
-					} else if ((i == 0 || window[i - 1] <= converter.AtoD(threshold, cellID)) && window[i] > converter.AtoD(threshold, cellID)) {
-						thresholdCrossing = i;
-						pointerOffset = Math.min(numSamplesBefore, i);
-						numSamplesToRead = pointerOffset + Math.min(numSamplesAfter, readoutWindow - i - pointerOffset - 1);
-						adcValues = new short[numSamplesToRead];
-					}
-				}
-			}
-		}
-		return hits;
-	}
+        List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
+        for (Long cellID : pipelineMap.keySet()) {
+            short[] window = getWindow(cellID);
+            short[] adcValues = null;
+            int pointerOffset = 0;
+            int numSamplesToRead = 0;
+            int thresholdCrossing = 0;
+            for (int i = 0; i < readoutWindow; i++) {
+                if (numSamplesToRead != 0) {
+                    adcValues[adcValues.length - numSamplesToRead] = window[i - pointerOffset];
+                    numSamplesToRead--;
+                    if (numSamplesToRead == 0) {
+                        hits.add(new BaseRawTrackerHit(cellID, thresholdCrossing, adcValues));
+                    }
+                } else if ((i == 0 || window[i - 1] <= HPSEcalConditions.physicalToPedestal(cellID) + readoutThreshold) && window[i] > HPSEcalConditions.physicalToPedestal(cellID) + readoutThreshold) {
+                    thresholdCrossing = i;
+                    pointerOffset = Math.min(numSamplesBefore, i);
+                    numSamplesToRead = pointerOffset + Math.min(numSamplesAfter, readoutWindow - i - pointerOffset - 1);
+                    adcValues = new short[numSamplesToRead];
+                }
+            }
+        }
+        return hits;
+    }
 
-	protected List<RawCalorimeterHit> readIntegrals() {
+    protected List<RawCalorimeterHit> readIntegrals() {
 //		System.out.println("Reading FADC data");
-		List<RawCalorimeterHit> hits = new ArrayList<RawCalorimeterHit>();
-		for (Long cellID : pipelineMap.keySet()) {
-			short[] window = getWindow(cellID);
-			int adcSum = 0;
-			int pointerOffset = 0;
-			int numSamplesToRead = 0;
-			int thresholdCrossing = 0;
-			if (window != null) {
-				for (int i = 0; i < readoutWindow; i++) {
-					if (numSamplesToRead != 0) {
-						adcSum += window[i - pointerOffset];
-						numSamplesToRead--;
-						if (numSamplesToRead == 0) {
-							hits.add(new BaseRawCalorimeterHit(cellID, adcSum, thresholdCrossing));
-						}
-					} else if ((i == 0 || window[i - 1] <= converter.AtoD(threshold, cellID)) && window[i] > converter.AtoD(threshold, cellID)) {
-						thresholdCrossing = i;
-						pointerOffset = Math.min(numSamplesBefore, i);
-						numSamplesToRead = pointerOffset + Math.min(numSamplesAfter, readoutWindow - i - pointerOffset - 1);
-						adcSum = 0;
-					}
-				}
-			}
-		}
-		return hits;
-	}
-
-	@Override
-	protected void putHits(List<CalorimeterHit> hits) {
-		//fill the readout buffers
-		for (CalorimeterHit hit : hits) {
-			RingBuffer eDepBuffer = eDepMap.get(hit.getCellID());
-			for (int i = 0; i < bufferLength; i++) {
-				eDepBuffer.addToCell(i, hit.getRawEnergy() * pulseAmplitude((i + 1) * readoutPeriod + readoutTime() - (ClockSingleton.getTime() + hit.getTime())));
-			}
-		}
-	}
-
-	@Override
-	protected void initReadout() {
-		//initialize buffers
-		sumMap = new HashMap<Long, Double>();
-		timeMap = new HashMap<Long, Integer>();
-		outputQueue = new PriorityQueue(20, new HPSFADCCalorimeterHit.TimeComparator());
-		pulseIntegral = t0 * Math.E / readoutPeriod;
-		resetFADCBuffers();
-	}
-
-	@Override
-	public void detectorChanged(Detector detector) {
-		super.detectorChanged(detector);
-		resetFADCBuffers();
-	}
-
-	private boolean resetFADCBuffers() {
-		if (ecal == null) {
-			return false;
-		}
-		eDepMap = new HashMap<Long, RingBuffer>();
-		pipelineMap = new HashMap<Long, FADCPipeline>();
-		Set<Long> cells = ((HPSEcal3) ecal).getNeighborMap().keySet();
-		for (Long cellID : cells) {
-			eDepMap.put(cellID, new RingBuffer(bufferLength));
-			pipelineMap.put(cellID, new FADCPipeline(pipelineLength, converter.AtoD(0.0, cellID)));
-		}
-		return true;
-	}
-
-	private double pulseAmplitude(double time) {
-		if (time < 0.0) {
-			return 0.0;
-		}
-		if (t0 > 0.0) {
-			return (time / t0) * Math.exp(1.0 - time / t0);
-		} else {
-			if (time < -t0) {
-				return 1.0;
-			} else {
-				return 0.0;
-			}
-		}
-	}
-
-	private class FADCPipeline {
-
-		private int[] array;
-		private int size;
-		private int ptr;
-
-		public FADCPipeline(int size) {
-			this.size = size;
-			array = new int[size]; //initialized to 0
-			ptr = 0;
-		}
-
-		//construct pipeline with a nonzero initial value
-		public FADCPipeline(int size, int init) {
-			this.size = size;
-			array = new int[size];
-			for (int i = 0; i < size; i++) {
-				array[i] = init;
-			}
-			ptr = 0;
-		}
-
-		/**
-		 * Write value to current cell
-		 */
-		public void writeValue(int val) {
-			array[ptr] = val;
-		}
-
-		/**
-		 * Write value to current cell
-		 */
-		public void step() {
-			ptr++;
-			if (ptr == size) {
-				ptr = 0;
-			}
-		}
-
-		//return content of specified cell (pos=0 for current cell)
-		public int getValue(int pos) {
-			if (pos >= size || pos < 0) {
-				throw new ArrayIndexOutOfBoundsException();
-			}
-			return array[((ptr - pos) % size + size) % size];
-		}
-	}
+        List<RawCalorimeterHit> hits = new ArrayList<RawCalorimeterHit>();
+        for (Long cellID : pipelineMap.keySet()) {
+            short[] window = getWindow(cellID);
+            int adcSum = 0;
+            int pointerOffset = 0;
+            int numSamplesToRead = 0;
+            int thresholdCrossing = 0;
+            if (window != null) {
+                for (int i = 0; i < readoutWindow; i++) {
+                    if (numSamplesToRead != 0) {
+                        adcSum += window[i - pointerOffset];
+                        numSamplesToRead--;
+                        if (numSamplesToRead == 0) {
+                            hits.add(new BaseRawCalorimeterHit(cellID, adcSum, 64*thresholdCrossing));
+                        }
+                    } else if ((i == 0 || window[i - 1] <= HPSEcalConditions.physicalToPedestal(cellID) + readoutThreshold) && window[i] > HPSEcalConditions.physicalToPedestal(cellID) + readoutThreshold) {
+                        thresholdCrossing = i;
+                        pointerOffset = Math.min(numSamplesBefore, i);
+                        numSamplesToRead = pointerOffset + Math.min(numSamplesAfter, readoutWindow - i - pointerOffset - 1);
+                        adcSum = 0;
+                    }
+                }
+            }
+        }
+        return hits;
+    }
+
+    @Override
+    protected void putHits(List<CalorimeterHit> hits) {
+        //fill the readout buffers
+        for (CalorimeterHit hit : hits) {
+            RingBuffer eDepBuffer = eDepMap.get(hit.getCellID());
+            for (int i = 0; i < bufferLength; i++) {
+                eDepBuffer.addToCell(i, hit.getRawEnergy() * pulseAmplitude((i + 1) * readoutPeriod + readoutTime() - (ClockSingleton.getTime() + hit.getTime())));
+            }
+        }
+    }
+
+    @Override
+    protected void initReadout() {
+        //initialize buffers
+        sumMap = new HashMap<Long, Double>();
+        timeMap = new HashMap<Long, Integer>();
+        outputQueue = new PriorityQueue(20, new HPSFADCCalorimeterHit.TimeComparator());
+        pulseIntegral = t0 * Math.E / readoutPeriod;
+        resetFADCBuffers();
+    }
+
+    @Override
+    public void detectorChanged(Detector detector) {
+        super.detectorChanged(detector);
+        resetFADCBuffers();
+    }
+
+    private boolean resetFADCBuffers() {
+        if (ecal == null) {
+            return false;
+        }
+        eDepMap = new HashMap<Long, RingBuffer>();
+        pipelineMap = new HashMap<Long, FADCPipeline>();
+        Set<Long> cells = ((HPSEcal3) ecal).getNeighborMap().keySet();
+        for (Long cellID : cells) {
+            eDepMap.put(cellID, new RingBuffer(bufferLength));
+            pipelineMap.put(cellID, new FADCPipeline(pipelineLength, (int) Math.round(HPSEcalConditions.physicalToPedestal(cellID))));
+        }
+        return true;
+    }
+
+    private double pulseAmplitude(double time) {
+        if (time < 0.0) {
+            return 0.0;
+        }
+        if (t0 > 0.0) {
+            return (time / t0) * Math.exp(1.0 - time / t0);
+        } else {
+            if (time < -t0) {
+                return 1.0;
+            } else {
+                return 0.0;
+            }
+        }
+    }
+
+    private class FADCPipeline {
+
+        private int[] array;
+        private int size;
+        private int ptr;
+
+        public FADCPipeline(int size) {
+            this.size = size;
+            array = new int[size]; //initialized to 0
+            ptr = 0;
+        }
+
+        //construct pipeline with a nonzero initial value
+        public FADCPipeline(int size, int init) {
+            this.size = size;
+            array = new int[size];
+            for (int i = 0; i < size; i++) {
+                array[i] = init;
+            }
+            ptr = 0;
+        }
+
+        /**
+         * Write value to current cell
+         */
+        public void writeValue(int val) {
+            array[ptr] = val;
+        }
+
+        /**
+         * Write value to current cell
+         */
+        public void step() {
+            ptr++;
+            if (ptr == size) {
+                ptr = 0;
+            }
+        }
+
+        //return content of specified cell (pos=0 for current cell)
+        public int getValue(int pos) {
+            if (pos >= size || pos < 0) {
+                throw new ArrayIndexOutOfBoundsException();
+            }
+            return array[((ptr - pos) % size + size) % size];
+        }
+    }
 }
\ No newline at end of file

hps-java/src/main/resources/org/lcsim/hps/steering
HPSTestRunReconToEvio.lcsim 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- HPSTestRunReconToEvio.lcsim	1 Jun 2012 22:17:10 -0000	1.6
+++ HPSTestRunReconToEvio.lcsim	7 Jun 2012 00:47:31 -0000	1.7
@@ -4,74 +4,79 @@
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
        xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
        
-	<inputFiles>
-		<file>${inputFile}</file>
-	</inputFiles>
+    <inputFiles>
+        <file>${inputFile}</file>
+    </inputFiles>
     
-	<control>
-		<numberOfEvents>-1</numberOfEvents>
-	</control>
-
-	<execute>
-		<driver name="EcalReadout"/>
-		<driver name="EcalConverter"/>
-		<driver name="EcalClusterer"/>
-		<driver name="EcalTrigger"/>
-		<driver name="SVTSensorSetup"/>
-		<driver name="SVTReadout"/>
-		<driver name="ClockDriver"/>
-		<driver name="TestRunReconToEvio"/>
-	</execute> 
-
-	<drivers>
-		<driver name="TestRunReconToEvio" type="org.lcsim.hps.evio.TestRunTriggeredReconToEvio">
-			<evioOutputFile>${evioFile}</evioOutputFile>
-		</driver>
+    <control>
+        <numberOfEvents>-1</numberOfEvents>
+    </control>
+
+    <execute>
+        <driver name="LoadCalibrations"/>
+        <driver name="HPSCalibrationDriver"/>   
+        <driver name="EcalReadout"/>
+        <driver name="EcalConverter"/>
+        <driver name="EcalClusterer"/>
+        <driver name="EcalTrigger"/>
+        <driver name="SVTSensorSetup"/>
+        <driver name="SVTReadout"/>
+        <driver name="ClockDriver"/>
+        <driver name="TestRunReconToEvio"/>
+    </execute> 
+
+    <drivers>
+        <driver name="LoadCalibrations" type="org.lcsim.hps.recon.tracking.LoadCalibrationsDriver" />
+        <driver name="HPSCalibrationDriver" type="org.lcsim.hps.monitoring.HPSCalibrationDriver"/>   
+        <driver name="TestRunReconToEvio" type="org.lcsim.hps.evio.TestRunTriggeredReconToEvio">
+            <evioOutputFile>${evioFile}</evioOutputFile>
+        </driver>
 			
-		<driver name="EcalReadout"
+        <driver name="EcalReadout"
                         type="org.lcsim.hps.recon.ecal.HPSEcalFADCReadoutDriver">
-			<readoutPeriod>4.0</readoutPeriod>
-			<coincidenceWindow>2</coincidenceWindow>
-			<ecalName>Ecal</ecalName>
-			<ecalCollectionName>EcalHits</ecalCollectionName>
-			<ecalRawCollectionName>EcalRawHits</ecalRawCollectionName>
-			<threshold>0.05</threshold>
-			<scale>0.08</scale>
-		</driver>
+            <readoutPeriod>4.0</readoutPeriod>
+            <coincidenceWindow>2</coincidenceWindow>
+            <ecalName>Ecal</ecalName>
+            <ecalCollectionName>EcalHits</ecalCollectionName>
+            <ecalRawCollectionName>EcalRawHits</ecalRawCollectionName>
+            <triggerThreshold>80</triggerThreshold>
+            <readoutThreshold>50</readoutThreshold>
+<!--			<scale>0.08</scale>-->
+        </driver>
 
-		<driver name="EcalConverter"
+        <driver name="EcalConverter"
                         type="org.lcsim.hps.recon.ecal.HPSEcalConverterDriver">
-			<ecalName>Ecal</ecalName>
-			<rawCollectionName>EcalRawHits</rawCollectionName>
-			<ecalCollectionName>EcalCorrectedHits</ecalCollectionName>
-			<scale>0.08</scale>
-		</driver>	
+            <ecalName>Ecal</ecalName>
+            <rawCollectionName>EcalRawHits</rawCollectionName>
+            <ecalCollectionName>EcalCorrectedHits</ecalCollectionName>
+            <scale>1</scale>
+        </driver>	
 
-		<driver name="EcalClusterer"
+        <driver name="EcalClusterer"
                         type="org.lcsim.hps.recon.ecal.HPSEcalCTPClusterer">
-			<ecalName>Ecal</ecalName>
-			<ecalCollectionName>EcalCorrectedHits</ecalCollectionName>
-		</driver>
-
-		<driver name="EcalTrigger"
-                        type="org.lcsim.hps.recon.ecal.HPSFADCTriggerDriver">
-			<clusterCollectionName>EcalClusters</clusterCollectionName>
-			<ecalName>Ecal</ecalName>
-			<deadTime>10</deadTime>
-		</driver>	
+            <ecalName>Ecal</ecalName>
+            <ecalCollectionName>EcalCorrectedHits</ecalCollectionName>
+        </driver>
+
+        <driver name="EcalTrigger"
+                        type="org.lcsim.hps.recon.ecal.TestRunTriggerDriver">
+            <clusterCollectionName>EcalClusters</clusterCollectionName>
+            <ecalName>Ecal</ecalName>
+            <deadTime>10</deadTime>
+        </driver>	
 
-		<driver name="SVTSensorSetup"
+        <driver name="SVTSensorSetup"
                         type="org.lcsim.hps.recon.tracking.HPSSVTSensorSetup">
-		</driver>
+        </driver>
 		
-		<driver name="SVTReadout"
+        <driver name="SVTReadout"
                         type="org.lcsim.hps.recon.tracking.apv25.HPSSiSensorReadout">
-		</driver>
+        </driver>
 
-		<driver name="ClockDriver"
+        <driver name="ClockDriver"
                         type="org.lcsim.hps.util.ClockDriver">
-		</driver>
+        </driver>
 
-	</drivers>
+    </drivers>
 </lcsim>
 	
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