Commit in hps-java/src/main on MAIN
java/org/lcsim/hps/recon/ecal/HPSEcalFADCReadoutDriver.java+12-21.18 -> 1.19
                             /HPSTriggerDriver.java+33-11.18 -> 1.19
java/org/lcsim/hps/recon/tracking/SimpleSvtReadout.java+148-721.4 -> 1.5
resources/org/lcsim/hps/steering/HPSTestRunNoPileup.lcsim+49added 1.1
+242-75
1 added + 3 modified, total 4 files
use HPSTriggerDriver and SimpleSvtReadout to do really sloppy simulation without pileup/time evolution

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalFADCReadoutDriver.java 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- HPSEcalFADCReadoutDriver.java	27 Aug 2012 21:53:47 -0000	1.18
+++ HPSEcalFADCReadoutDriver.java	27 Sep 2012 00:15:27 -0000	1.19
@@ -27,7 +27,7 @@
  * Simulates time evolution of preamp output pulse.
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.18 2012/08/27 21:53:47 meeg Exp $
+ * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.19 2012/09/27 00:15:27 meeg Exp $
  */
 public class HPSEcalFADCReadoutDriver extends HPSEcalReadoutDriver<RawCalorimeterHit> {
 
@@ -77,6 +77,7 @@
     //amplitude ADC counts/GeV
 //    private double gain = 0.5*1000 * 80.0 / 60;
     private double scaleFactor = 128;
+    private double fixedGain = -1;
 
     public HPSEcalFADCReadoutDriver() {
         flags = 0;
@@ -85,6 +86,10 @@
 //        converter = new HPSEcalConverter(null);
     }
 
+    public void setFixedGain(double fixedGain) {
+        this.fixedGain = fixedGain;
+    }
+
     public void setEcalName(String ecalName) {
         this.ecalName = ecalName;
     }
@@ -161,7 +166,12 @@
             double pedestal = HPSEcalConditions.physicalToPedestal(cellID);
             //normalization constant from cal gain (MeV/integral bit) to amplitude gain (amplitude bit/GeV)
             double gainNorm = 1000.0 / pulseIntegral;
-            double gain = gainNorm / HPSEcalConditions.physicalToGain(cellID);
+            double gain;
+            if (fixedGain > 0) {
+                gain = gainNorm / fixedGain;
+            } else {
+                gain = gainNorm / HPSEcalConditions.physicalToGain(cellID);
+            }
 
             double currentValue = gain * eDepBuffer.currentValue();
             pipeline.writeValue((int) Math.round(pedestal + currentValue));

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSTriggerDriver.java 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- HPSTriggerDriver.java	26 Sep 2012 23:31:10 -0000	1.18
+++ HPSTriggerDriver.java	27 Sep 2012 00:15:27 -0000	1.19
@@ -1,5 +1,6 @@
 package org.lcsim.hps.recon.ecal;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.LinkedList;
@@ -7,11 +8,14 @@
 import java.util.Queue;
 
 
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.lcsim.event.EventHeader;
 import org.lcsim.hps.recon.tracking.apv25.Apv25Full;
 import org.lcsim.hps.recon.tracking.apv25.HPSAPV25;
 import org.lcsim.hps.util.ClockSingleton;
 import org.lcsim.util.Driver;
+import org.lcsim.util.lcio.LCIOWriter;
 
 /**
  * Reads clusters and makes trigger decision using opposite quadrant criterion.
@@ -19,7 +23,7 @@
  * Applies SVT trigger latency and sends trigger signal to SVT
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSTriggerDriver.java,v 1.18 2012/09/26 23:31:10 meeg Exp $
+ * @version $Id: HPSTriggerDriver.java,v 1.19 2012/09/27 00:15:27 meeg Exp $
  */
 public abstract class HPSTriggerDriver extends Driver {
 
@@ -42,10 +46,16 @@
     // trigger bank trigger latency
     public static final double triggerTriggerLatency = 50.0; // [ns]
     private static boolean triggerBit = false;
+    private String lcioFile = null;
+    LCIOWriter lcioWriter = null;
 
     public HPSTriggerDriver() {
     }
 
+    public void setLcioFile(String lcioFile) {
+        this.lcioFile = lcioFile;
+    }
+
     /**
      * Set dead time; 0 for no dead time
      * @param deadTime Minimum number of clock ticks between triggers
@@ -76,6 +86,14 @@
             }
         }
 
+        if (lcioFile != null) {
+            try {
+                lcioWriter = new LCIOWriter(new File(lcioFile));
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
         numTriggers = 0;
 
         ecalTriggerTimestamps = new LinkedList<Double>();
@@ -113,6 +131,13 @@
                 }
             }
             makeTriggerData(event, "TriggerStatus");
+            if (lcioWriter != null) {
+                try {
+                    lcioWriter.write(event);
+                } catch (IOException ex) {
+                    Logger.getLogger(HPSTriggerDriver.class.getName()).log(Level.SEVERE, null, ex);
+                }
+            }
         }
 
         // Check if there are any pending SVT triggers to process
@@ -177,6 +202,13 @@
             outputStream.printf("Trigger count: %d\n", numTriggers);
             outputStream.close();
         }
+        if (lcioWriter != null) {
+            try {
+                lcioWriter.close();
+            } catch (IOException ex) {
+                Logger.getLogger(HPSTriggerDriver.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
         System.out.printf("Trigger count: %d\n", numTriggers);
     }
 

hps-java/src/main/java/org/lcsim/hps/recon/tracking
SimpleSvtReadout.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- SimpleSvtReadout.java	29 Aug 2012 21:02:46 -0000	1.4
+++ SimpleSvtReadout.java	27 Sep 2012 00:15:27 -0000	1.5
@@ -27,26 +27,30 @@
 /**
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: SimpleSvtReadout.java,v 1.4 2012/08/29 21:02:46 meeg Exp $
+ * @version $Id: SimpleSvtReadout.java,v 1.5 2012/09/27 00:15:27 meeg Exp $
  */
 public class SimpleSvtReadout extends Driver {
 
     private SiSensorSim siSimulation = new CDFSiSensorSim();
     private String outputCollection = "SVTRawTrackerHits";
     private Map<SiSensor, APV25Pipeline[]> pipelineMap = new HashMap<SiSensor, APV25Pipeline[]>();
-    //readout period in ns
-    private double readoutPeriod = Apv25Constants.SAMPLING_INTERVAL;
     //readout period time offset in ns
     private double readoutOffset = 0.0;
     private String readout = "TrackerHits";
     private SimTrackerHitReadoutDriver readoutDriver = new SimTrackerHitReadoutDriver();
     private int readoutCycle = 0;
     private int samplesAboveThreshold = 3;
+    private boolean noPileup = false;
+    private double timeOffset = 30.0;
 
     public SimpleSvtReadout() {
         add(readoutDriver);
     }
 
+    public void setNoPileup(boolean noPileup) {
+        this.noPileup = noPileup;
+    }
+
     /**
      * 
      */
@@ -58,8 +62,11 @@
         readoutDriver.setCollections(readouts);
 
         pipelineMap.clear();
-        for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-            pipelineMap.put(sensor, new APV25Pipeline[HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR]);
+
+        if (!noPileup) {
+            for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
+                pipelineMap.put(sensor, new APV25Pipeline[HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR]);
+            }
         }
     }
 
@@ -70,109 +77,178 @@
     public void process(EventHeader event) {
         super.process(event);
 
-        //if at the end of a readout cycle, step all the pipelines
-        while (ClockSingleton.getTime() - readoutTime() + ClockSingleton.getDt() >= readoutPeriod) {
-            for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-                APV25Pipeline[] pipelines = pipelineMap.get(sensor);
-                for (int i = 0; i < pipelines.length; i++) {
-                    if (pipelines[i] != null) {
-                        pipelines[i].step();
+        if (!noPileup) {
+            //if at the end of a readout cycle, step all the pipelines
+            while (ClockSingleton.getTime() - readoutTime() + ClockSingleton.getDt() >= Apv25Constants.SAMPLING_INTERVAL) {
+                for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
+                    APV25Pipeline[] pipelines = pipelineMap.get(sensor);
+                    for (int i = 0; i < pipelines.length; i++) {
+                        if (pipelines[i] != null) {
+                            pipelines[i].step();
+                        }
                     }
                 }
+                readoutCycle++;
             }
-            readoutCycle++;
-        }
 
-        for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-            APV25Pipeline[] pipelines = pipelineMap.get(sensor);
+            for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
+                APV25Pipeline[] pipelines = pipelineMap.get(sensor);
 
-            // Set the sensor to be used in the charge deposition simulation
-            siSimulation.setSensor(sensor);
+                // Set the sensor to be used in the charge deposition simulation
+                siSimulation.setSensor(sensor);
 
-            // Perform the charge deposition simulation
-            Map<ChargeCarrier, SiElectrodeDataCollection> electrodeDataMap = siSimulation.computeElectrodeData();
+                // Perform the charge deposition simulation
+                Map<ChargeCarrier, SiElectrodeDataCollection> electrodeDataMap = siSimulation.computeElectrodeData();
 
-            for (ChargeCarrier carrier : ChargeCarrier.values()) {
+                for (ChargeCarrier carrier : ChargeCarrier.values()) {
 
-                // If the sensor is capable of collecting the given charge carrier
-                // then obtain the electrode data for the sensor
-                if (sensor.hasElectrodesOnSide(carrier)) {
+                    // If the sensor is capable of collecting the given charge carrier
+                    // then obtain the electrode data for the sensor
+                    if (sensor.hasElectrodesOnSide(carrier)) {
 
-                    SiElectrodeDataCollection electrodeDataCol = electrodeDataMap.get(carrier);
+                        SiElectrodeDataCollection electrodeDataCol = electrodeDataMap.get(carrier);
 
-                    // If there is no electrode data available create a new instance of electrode data
-                    if (electrodeDataCol == null) {
-                        electrodeDataCol = new SiElectrodeDataCollection();
-                    }
+                        // If there is no electrode data available create a new instance of electrode data
+                        if (electrodeDataCol == null) {
+                            electrodeDataCol = new SiElectrodeDataCollection();
+                        }
 
-                    // Loop over all sensor channels
-                    for (Integer channel : electrodeDataCol.keySet()) {
+                        // Loop over all sensor channels
+                        for (Integer channel : electrodeDataCol.keySet()) {
 
-                        // Get the electrode data for this channel
-                        SiElectrodeData electrodeData = electrodeDataCol.get(channel);
+                            // Get the electrode data for this channel
+                            SiElectrodeData electrodeData = electrodeDataCol.get(channel);
 
-                        // Get the charge in units of electrons
-                        double charge = electrodeData.getCharge();
+                            // Get the charge in units of electrons
+                            double charge = electrodeData.getCharge();
 
-                        if (pipelines[channel] == null) {
-                            pipelines[channel] = new APV25Pipeline();
-                        }
-                        double resistorValue = 100;  // Ohms
-                        double inputStageGain = 1.5;
-                        double amplitude = (charge / Apv25Constants.MIP) * resistorValue * inputStageGain * Math.pow(2, 14) / 2000;
-                        for (int i = 0; i < 20; i++) {
-                            pipelines[channel].addToCell(i, amplitude * pulseAmplitude((i + 1) * readoutPeriod + readoutTime() - ClockSingleton.getTime(), HPSSVTCalibrationConstants.getTShaping(sensor, channel)));
+                            if (pipelines[channel] == null) {
+                                pipelines[channel] = new APV25Pipeline();
+                            }
+                            double resistorValue = 100;  // Ohms
+                            double inputStageGain = 1.5;
+                            double amplitude = (charge / Apv25Constants.MIP) * resistorValue * inputStageGain * Math.pow(2, 14) / 2000;
+                            for (int i = 0; i < 20; i++) {
+                                pipelines[channel].addToCell(i, amplitude * pulseAmplitude((i + 1) * Apv25Constants.SAMPLING_INTERVAL + readoutTime() - ClockSingleton.getTime(), HPSSVTCalibrationConstants.getTShaping(sensor, channel)));
+                            }
                         }
                     }
                 }
-            }
 
-            // Clear the sensors of all deposited charge
-            siSimulation.clearReadout();
-        }
+                // Clear the sensors of all deposited charge
+                siSimulation.clearReadout();
+            }
 
-        // If an Ecal trigger is received, generate six local triggers in order to read out six
-        // samples
-        if (HPSAPV25.readoutBit) {
+            // If an Ecal trigger is received, generate six local triggers in order to read out six
+            // samples
+            if (HPSAPV25.readoutBit) {
 //            System.out.println("Got trigger");
 
-            HPSAPV25.readoutBit = false;
+                HPSAPV25.readoutBit = false;
+
+                // Create a list to hold the analog data
+                List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
+
+                for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
+                    APV25Pipeline[] pipelines = pipelineMap.get(sensor);
+                    for (int channel = 0; channel < pipelines.length; channel++) {
+                        if (pipelines[channel] != null) {
+                            short[] samples = new short[6];
+                            for (int j = 0; j < 6; j++) {
+                                samples[j] = (short) (pipelines[channel].getValue(j) + HPSSVTCalibrationConstants.getPedestal(sensor, channel));
+//                            System.out.println(samples[j]);
+                            }
+//                            System.out.println();
+
+                            // Find the side number (is 1)
+                            int sideNumber;
+                            if (sensor.hasElectrodesOnSide(ChargeCarrier.HOLE)) {
+                                sideNumber = ChargeCarrier.HOLE.charge();
+                            } else {
+                                sideNumber = ChargeCarrier.ELECTRON.charge();
+                            }
+                            long cell_id = sensor.makeStripId(channel, sideNumber).getValue();
+
+                            RawTrackerHit hit = new BaseRawTrackerHit(0, cell_id, samples, null, sensor);
+//                        System.out.println("Making RTH");
+                            if (samplesAboveThreshold(hit)) {
+                                hits.add(hit);
+                            }
+                        }
+                    }
+                }
 
+                int flags = 1 << LCIOConstants.TRAWBIT_ID1;
+                event.put(outputCollection, hits, RawTrackerHit.class, flags, readout);
+                System.out.println("Made " + hits.size() + " RawTrackerHits");
+            }
+        } else {
             // Create a list to hold the analog data
             List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
 
             for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-                APV25Pipeline[] pipelines = pipelineMap.get(sensor);
-                for (int channel = 0; channel < pipelines.length; channel++) {
-                    if (pipelines[channel] != null) {
-                        short[] samples = new short[6];
-                        for (int j = 0; j < 6; j++) {
-                            samples[j] = (short) (pipelines[channel].getValue(j) + HPSSVTCalibrationConstants.getPedestal(sensor, channel));
-//                            System.out.println(samples[j]);
-                        }
-//                            System.out.println();
+                // Set the sensor to be used in the charge deposition simulation
+                siSimulation.setSensor(sensor);
+
+                // Perform the charge deposition simulation
+                Map<ChargeCarrier, SiElectrodeDataCollection> electrodeDataMap = siSimulation.computeElectrodeData();
+
+                for (ChargeCarrier carrier : ChargeCarrier.values()) {
+
+                    // If the sensor is capable of collecting the given charge carrier
+                    // then obtain the electrode data for the sensor
+                    if (sensor.hasElectrodesOnSide(carrier)) {
 
-                        // Find the side number (is 1)
-                        int sideNumber;
-                        if (sensor.hasElectrodesOnSide(ChargeCarrier.HOLE)) {
-                            sideNumber = ChargeCarrier.HOLE.charge();
-                        } else {
-                            sideNumber = ChargeCarrier.ELECTRON.charge();
+                        SiElectrodeDataCollection electrodeDataCol = electrodeDataMap.get(carrier);
+
+                        // If there is no electrode data available create a new instance of electrode data
+                        if (electrodeDataCol == null) {
+                            electrodeDataCol = new SiElectrodeDataCollection();
                         }
-                        long cell_id = sensor.makeStripId(channel, sideNumber).getValue();
 
-                        RawTrackerHit hit = new BaseRawTrackerHit(0, cell_id, samples, null, sensor);
+                        // Loop over all sensor channels
+                        for (Integer channel : electrodeDataCol.keySet()) {
+                            short[] samples = new short[6];
+
+                            // Get the electrode data for this channel
+                            SiElectrodeData electrodeData = electrodeDataCol.get(channel);
+
+                            // Get the charge in units of electrons
+                            double charge = electrodeData.getCharge();
+
+                            double resistorValue = 100;  // Ohms
+                            double inputStageGain = 1.5;
+                            double amplitude = (charge / Apv25Constants.MIP) * resistorValue * inputStageGain * Math.pow(2, 14) / 2000;
+                            for (int i = 0; i < 6; i++) {
+                                double time = i * Apv25Constants.SAMPLING_INTERVAL - timeOffset;
+                                samples[i] = (short) Math.round(amplitude * pulseAmplitude(time, HPSSVTCalibrationConstants.getTShaping(sensor, channel)) + HPSSVTCalibrationConstants.getPedestal(sensor, channel));
+                            }
+
+                            int sideNumber;
+                            if (sensor.hasElectrodesOnSide(ChargeCarrier.HOLE)) {
+                                sideNumber = ChargeCarrier.HOLE.charge();
+                            } else {
+                                sideNumber = ChargeCarrier.ELECTRON.charge();
+                            }
+                            long cell_id = sensor.makeStripId(channel, sideNumber).getValue();
+
+                            RawTrackerHit hit = new BaseRawTrackerHit(0, cell_id, samples, null, sensor);
 //                        System.out.println("Making RTH");
-                        if (samplesAboveThreshold(hit)) {
-                            hits.add(hit);
+                            if (samplesAboveThreshold(hit)) {
+                                hits.add(hit);
+                            }
+
                         }
                     }
                 }
+
+                // Clear the sensors of all deposited charge
+                siSimulation.clearReadout();
             }
 
             int flags = 1 << LCIOConstants.TRAWBIT_ID1;
             event.put(outputCollection, hits, RawTrackerHit.class, flags, readout);
-            System.out.println("Made " + hits.size() + " RawTrackerHits");
+//            System.out.println("Made " + hits.size() + " RawTrackerHits");
         }
     }
 
@@ -245,6 +321,6 @@
     }
 
     private double readoutTime() {
-        return readoutCycle * readoutPeriod + readoutOffset;
+        return readoutCycle * Apv25Constants.SAMPLING_INTERVAL + readoutOffset;
     }
 }

hps-java/src/main/resources/org/lcsim/hps/steering
HPSTestRunNoPileup.lcsim added at 1.1
diff -N HPSTestRunNoPileup.lcsim
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HPSTestRunNoPileup.lcsim	27 Sep 2012 00:15:27 -0000	1.1
@@ -0,0 +1,49 @@
+
+<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
+       xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">       
+    <control>
+        <printInputFiles>true</printInputFiles>
+        <printDriversDetailed>true</printDriversDetailed>
+    </control>    
+    <execute>
+        <driver name="EventMarkerDriver"/>
+        <driver name="HPSCalibrationDriver"/>
+        <driver name="EcalRawConverter"/>
+<!--        <driver name="EcalClusterer"/>-->
+        <driver name="EcalTriggerFilter"/>
+        <driver name="EcalTriggerClusterer"/>
+        <driver name="SimpleSVTReadout"/>
+        <driver name="EcalTrigger"/>
+        <driver name="ClockDriver"/>
+    </execute>    
+    <drivers>
+        <driver name="HPSCalibrationDriver" type="org.lcsim.hps.monitoring.HPSCalibrationDriver">
+        </driver>
+        <driver name="EcalRawConverter" type="org.lcsim.hps.recon.ecal.HPSEcalEdepToTriggerConverterDriver">
+        </driver>
+        <driver name="EcalTriggerFilter" type="org.lcsim.hps.recon.ecal.HPSEcalTriggerFilterDriver">
+            <inputCollection>EcalTriggerHits</inputCollection>
+            <outputCollection>EcalFilteredHits</outputCollection>
+        </driver>        
+        <driver name="EcalTriggerClusterer"
+                type="org.lcsim.hps.recon.ecal.HPSEcalCTPClusterer">
+            <ecalName>Ecal</ecalName>
+            <ecalCollectionName>EcalFilteredHits</ecalCollectionName>
+            <clusterCollectionName>EcalTriggerClusters</clusterCollectionName>
+        </driver>
+        <driver name="EcalTrigger"
+                        type="org.lcsim.hps.recon.ecal.TestRunTriggerDriver">
+            <clusterCollectionName>EcalTriggerClusters</clusterCollectionName>
+            <deadTime>0</deadTime>
+            <lcioFile>out.slcio</lcioFile>
+        </driver>	
+        <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
+            <eventInterval>1000</eventInterval>
+        </driver>
+        
+        <driver name="SimpleSVTReadout" type="org.lcsim.hps.recon.tracking.SimpleSvtReadout">
+            <noPileup>true</noPileup>
+        </driver>
+        <driver name="ClockDriver" type="org.lcsim.hps.util.ClockDriver"/>
+    </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