Commit in hps-java/src/main/java/org/lcsim/hps on MAIN
recon/ecal/EcalConditions.java+5-11.1 -> 1.2
readout/ecal/FADCEcalReadoutDriver.java+17-41.2 -> 1.3
+22-5
2 modified files
add noise to ECal hits

hps-java/src/main/java/org/lcsim/hps/recon/ecal
EcalConditions.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- EcalConditions.java	25 Feb 2013 22:39:24 -0000	1.1
+++ EcalConditions.java	24 Oct 2013 20:01:54 -0000	1.2
@@ -17,7 +17,7 @@
 /**
  *
  * @author meeg
- * @version $Id: EcalConditions.java,v 1.1 2013/02/25 22:39:24 meeg Exp $
+ * @version $Id: EcalConditions.java,v 1.2 2013/10/24 20:01:54 meeg Exp $
  */
 public class EcalConditions extends Driver {
 
@@ -336,6 +336,10 @@
         return daqToPedestalMap.get(physicalToDaqMap.get(physicalID));
     }
 
+    public static Double physicalToNoise(long physicalID) {
+        return daqToNoiseMap.get(physicalToDaqMap.get(physicalID));
+    }
+
     public static Double physicalToGain(long physicalID) {
         return physicalToGainMap.get(physicalID);
     }

hps-java/src/main/java/org/lcsim/hps/readout/ecal
FADCEcalReadoutDriver.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- FADCEcalReadoutDriver.java	20 Mar 2013 01:03:32 -0000	1.2
+++ FADCEcalReadoutDriver.java	24 Oct 2013 20:01:54 -0000	1.3
@@ -22,15 +22,16 @@
 import org.lcsim.hps.recon.ecal.EcalConditions;
 import org.lcsim.hps.recon.ecal.HPSRawCalorimeterHit;
 import org.lcsim.hps.util.ClockSingleton;
+import org.lcsim.hps.util.RandomGaussian;
 import org.lcsim.hps.util.RingBuffer;
 import org.lcsim.util.lcio.LCIOConstants;
 
 /**
- * Performs readout of ECal hits.
- * Simulates time evolution of preamp output pulse.
+ * Performs readout of ECal hits. Simulates time evolution of preamp output
+ * pulse.
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: FADCEcalReadoutDriver.java,v 1.2 2013/03/20 01:03:32 meeg Exp $
+ * @version $Id: FADCEcalReadoutDriver.java,v 1.3 2013/10/24 20:01:54 meeg Exp $
  */
 public class FADCEcalReadoutDriver extends EcalReadoutDriver<RawCalorimeterHit> {
 
@@ -82,6 +83,8 @@
     private double scaleFactor = 128;
     private double fixedGain = -1;
     private boolean constantTriggerWindow = false;
+    private boolean addNoise = false;
+    private double pePerMeV = 2.0; //photoelectrons per MeV, used to calculate noise
 
     public FADCEcalReadoutDriver() {
         flags = 0;
@@ -90,6 +93,10 @@
 //        converter = new HPSEcalConverter(null);
     }
 
+    public void setAddNoise(boolean addNoise) {
+        this.addNoise = addNoise;
+    }
+
     public void setConstantTriggerWindow(boolean constantTriggerWindow) {
         this.constantTriggerWindow = constantTriggerWindow;
     }
@@ -375,8 +382,14 @@
         //fill the readout buffers
         for (CalorimeterHit hit : hits) {
             RingBuffer eDepBuffer = eDepMap.get(hit.getCellID());
+            double energyAmplitude = hit.getRawEnergy();
+            if (addNoise) {
+                //add preamp noise and photoelectron Poisson noise in quadrature
+                double noise = Math.sqrt(Math.pow(EcalConditions.physicalToNoise(hit.getCellID()) * EcalConditions.physicalToGain(hit.getCellID()), 2) + hit.getRawEnergy() * ECalUtils.MeV / pePerMeV);
+                energyAmplitude += RandomGaussian.getGaussian(0, noise);
+            }
             for (int i = 0; i < bufferLength; i++) {
-                eDepBuffer.addToCell(i, hit.getRawEnergy() * pulseAmplitude((i + 1) * readoutPeriod + readoutTime() - (ClockSingleton.getTime() + hit.getTime())));
+                eDepBuffer.addToCell(i, energyAmplitude * pulseAmplitude((i + 1) * readoutPeriod + readoutTime() - (ClockSingleton.getTime() + hit.getTime())));
             }
         }
     }
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