Commit in java/trunk/hps-java/src/main/java/org/lcsim/hps on MAIN
analysis/ecal/HPSEcalTriggerPlotsDriver.java+20-12308 -> 309
readout/ecal/FADCEcalReadoutDriver.java+5-5308 -> 309
            /FADCTriggerDriver.java+17-7308 -> 309
recon/ecal/ECalUtils.java+3-1308 -> 309
+45-25
4 modified files
rename some variables and set better defaults

java/trunk/hps-java/src/main/java/org/lcsim/hps/analysis/ecal
HPSEcalTriggerPlotsDriver.java 308 -> 309
--- java/trunk/hps-java/src/main/java/org/lcsim/hps/analysis/ecal/HPSEcalTriggerPlotsDriver.java	2014-03-18 01:06:55 UTC (rev 308)
+++ java/trunk/hps-java/src/main/java/org/lcsim/hps/analysis/ecal/HPSEcalTriggerPlotsDriver.java	2014-03-18 01:08:09 UTC (rev 309)
@@ -20,7 +20,8 @@
  * Diagnostic plots for HPS ECal.
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalTriggerPlotsDriver.java,v 1.7 2013/02/25 22:39:26 meeg Exp $
+ * @version $Id: HPSEcalTriggerPlotsDriver.java,v 1.7 2013/02/25 22:39:26 meeg
+ * Exp $
  */
 public class HPSEcalTriggerPlotsDriver extends Driver {
 
@@ -28,6 +29,7 @@
     String clusterCollectionName = "EcalClusters";
     AIDA aida = AIDA.defaultInstance();
     IHistogram2D hitXYPlot;
+    IHistogram2D hitXYPlot50;
     IHistogram2D hitXYPlot100;
     IHistogram2D hitXYPlot200;
     IHistogram2D hitXYPlot500;
@@ -55,6 +57,9 @@
         hitXYPlot = aida.histogram2D(
                 "Trigger plots: " + ecalCollectionName + " : Hits",
                 46, -23, 23, 11, -5.5, 5.5);
+        hitXYPlot50 = aida.histogram2D(
+                "Trigger plots: " + ecalCollectionName + " : Hits above 50 MeV",
+                46, -23, 23, 11, -5.5, 5.5);
         hitXYPlot100 = aida.histogram2D(
                 "Trigger plots: " + ecalCollectionName + " : Hits above 100 MeV",
                 46, -23, 23, 11, -5.5, 5.5);
@@ -103,15 +108,18 @@
         for (CalorimeterHit hit : hits) {
             int ix = hit.getIdentifierFieldValue("ix");
             int iy = hit.getIdentifierFieldValue("iy");
-            hitXYPlot.fill(ix-0.5*Math.signum(ix), iy, 1.0 / coincidenceWindow);
-            if (hit.getRawEnergy() > 100.0 * ECalUtils.MeV) {
-                hitXYPlot100.fill(ix-0.5*Math.signum(ix), iy, 1.0 / coincidenceWindow);
-                if (hit.getRawEnergy() > 200.0 * ECalUtils.MeV) {
-                    hitXYPlot200.fill(ix-0.5*Math.signum(ix), iy, 1.0 / coincidenceWindow);
-                    if (hit.getRawEnergy() > 500.0 * ECalUtils.MeV) {
-                        hitXYPlot500.fill(ix-0.5*Math.signum(ix), iy, 1.0 / coincidenceWindow);
-                        if (hit.getRawEnergy() > 1000.0 * ECalUtils.MeV) {
-                            hitXYPlot1000.fill(ix-0.5*Math.signum(ix), iy, 1.0 / coincidenceWindow);
+            hitXYPlot.fill(ix - 0.5 * Math.signum(ix), iy, 1.0 / coincidenceWindow);
+            if (hit.getRawEnergy() > 50.0 * ECalUtils.MeV) {
+                hitXYPlot50.fill(ix - 0.5 * Math.signum(ix), iy, 1.0 / coincidenceWindow);
+                if (hit.getRawEnergy() > 100.0 * ECalUtils.MeV) {
+                    hitXYPlot100.fill(ix - 0.5 * Math.signum(ix), iy, 1.0 / coincidenceWindow);
+                    if (hit.getRawEnergy() > 200.0 * ECalUtils.MeV) {
+                        hitXYPlot200.fill(ix - 0.5 * Math.signum(ix), iy, 1.0 / coincidenceWindow);
+                        if (hit.getRawEnergy() > 500.0 * ECalUtils.MeV) {
+                            hitXYPlot500.fill(ix - 0.5 * Math.signum(ix), iy, 1.0 / coincidenceWindow);
+                            if (hit.getRawEnergy() > 1000.0 * ECalUtils.MeV) {
+                                hitXYPlot1000.fill(ix - 0.5 * Math.signum(ix), iy, 1.0 / coincidenceWindow);
+                            }
                         }
                     }
                 }
@@ -120,11 +128,11 @@
             for (int time = 0; time < 500; time++) {
                 if (hit.getRawEnergy() * pulseAmplitude(time) > threshold) {
                     deadTime += 1e-6; //units of milliseconds
-                } else if (time > 2*tp || deadTime != 0) {
+                } else if (time > 2 * tp || deadTime != 0) {
                     break;
                 }
             }
-            crystalDeadTime.fill(ix-0.5*Math.signum(ix), iy, deadTime / coincidenceWindow);
+            crystalDeadTime.fill(ix - 0.5 * Math.signum(ix), iy, deadTime / coincidenceWindow);
         }
 
         for (HPSEcalCluster clus : clusters) {

java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal
FADCEcalReadoutDriver.java 308 -> 309
--- java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal/FADCEcalReadoutDriver.java	2014-03-18 01:06:55 UTC (rev 308)
+++ java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal/FADCEcalReadoutDriver.java	2014-03-18 01:08:09 UTC (rev 309)
@@ -51,7 +51,7 @@
     //length of readout pipeline (in readout cycles)
     private int pipelineLength = 2000;
     //switch between two pulse shape functions
-    private boolean useCRRCShape = false;
+    private boolean useCRRCShape = true;
     //shaper time constant in ns; negative values generate square pulses of the given width (for test run sim)
     private double tp = 14.0;
     //delay (number of readout periods) between start of summing window and output of hit to clusterer
@@ -413,7 +413,7 @@
             if (addNoise) {
                 //add preamp noise and photoelectron Poisson noise in quadrature
                 double noise;
-                if (useCRRCShape) {
+                if (!useCRRCShape) {
                     noise = Math.sqrt(Math.pow(EcalConditions.physicalToNoise(hit.getCellID()) * EcalConditions.physicalToGain(hit.getCellID()) * ECalUtils.gainFactor * ECalUtils.ecalReadoutPeriod, 2) + hit.getRawEnergy() * ECalUtils.MeV / pePerMeV);
                 } else {
                     noise = Math.sqrt(Math.pow(EcalConditions.physicalToNoise(hit.getCellID()) * EcalConditions.physicalToGain(hit.getCellID()) * ECalUtils.MeV, 2) + hit.getRawEnergy() * ECalUtils.MeV / pePerMeV);
@@ -494,12 +494,12 @@
                 corrGain = 1.0 / EcalConditions.physicalToGain(cellID);
             }
 
-            double norm = ((riseTime + fallTime) / 2) * Math.sqrt(2 * Math.PI) / Req; //to ensure the total integral is equal to 1/R, R is necessary for homogeneity
+            double norm = ((riseTime + fallTime) / 2) * Math.sqrt(2 * Math.PI); //to ensure the total integral is equal to 1: = 33.8
 
             if (time < 3 * riseTime) {
-                return corrGain * lightYield * quantumEff * surfRatio * gainAPD * gainPreAmpl * elemCharge * funcGaus(time - 3 * riseTime, riseTime) / norm;
+                return corrGain * readoutGain * funcGaus(time - 3 * riseTime, riseTime) / norm;
             } else {
-                return corrGain * lightYield * quantumEff * surfRatio * gainAPD * gainPreAmpl * elemCharge * funcGaus(time - 3 * riseTime, fallTime) / norm;
+                return corrGain * readoutGain * funcGaus(time - 3 * riseTime, fallTime) / norm;
             }
         }
     }

java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal
FADCTriggerDriver.java 308 -> 309
--- java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal/FADCTriggerDriver.java	2014-03-18 01:06:55 UTC (rev 308)
+++ java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal/FADCTriggerDriver.java	2014-03-18 01:08:09 UTC (rev 309)
@@ -52,6 +52,7 @@
     IHistogram2D clusterEnergy2DAll, clusterSumDiff2DAll, energyDistance2DAll, clusterAngles2DAll, clusterCoplanarity2DAll;
     IHistogram2D clusterEnergy2D, clusterSumDiff2D, energyDistance2D, clusterAngles2D, clusterCoplanarity2D;
     IHistogram1D triggerBits1D, triggerTimes1D;
+    int truthPeriod = 250;
     private boolean useQuadrants = false;
     protected String clusterCollectionName = "EcalClusters";
 
@@ -105,12 +106,21 @@
     }
 
     protected double getBeamEnergyFromDetector(Detector detector) {
-        if (detector.getName().contains("1pt1")) return 1.1;
-        else if (detector.getName().contains("2pt2")) return 2.2;
-        else if (detector.getName().contains("6pt6")) return 6.6;
-        else return -1.0;
+        if (detector.getName().contains("1pt1")) {
+            return 1.1;
+        } else if (detector.getName().contains("2pt2")) {
+            return 2.2;
+        } else if (detector.getName().contains("6pt6")) {
+            return 6.6;
+        } else {
+            return -1.0;
+        }
     }
-    
+
+    public void setTruthPeriod(int truthPeriod) {
+        this.truthPeriod = truthPeriod;
+    }
+
     @Override
     public void detectorChanged(Detector detector) {
         setBeamEnergy(this.getBeamEnergyFromDetector(detector));
@@ -128,7 +138,7 @@
         clusterAngles2D = aida.histogram2D("Passed other cuts: cluster angle (less energetic vs. more energetic)", 100, -180.0, 180.0, 100, -180.0, 180.0);
 
         triggerBits1D = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : trigger bits", 17, -1.5, 15.5);
-        triggerTimes1D = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : trigger times", 500, -0.5, 499.5);
+        triggerTimes1D = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : trigger times", truthPeriod, -0.5, truthPeriod - 0.5);
     }
 
     @Override
@@ -284,7 +294,7 @@
         }
         if (trigger) {
             triggerBits1D.fill(-1);
-            triggerTimes1D.fill(ClockSingleton.getClock() % 500);
+            triggerTimes1D.fill(ClockSingleton.getClock() % truthPeriod);
         }
         return trigger;
     }

java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal
ECalUtils.java 308 -> 309
--- java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal/ECalUtils.java	2014-03-18 01:06:55 UTC (rev 308)
+++ java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal/ECalUtils.java	2014-03-18 01:08:09 UTC (rev 309)
@@ -23,7 +23,9 @@
     public static final int nBit = 12;  //number of bits used by the fADC to code a value
     public static final double maxVolt = 2.0;   //maximum volt intput of the fADC
     public static final double Req = 1.0 / 27.5; // equivalent resistance of the amplification chain
-    public static final double gainFactor = 2.0 / ((Math.pow(2, nBit) - 1) * Req * lightYield * quantumEff * surfRatio * gainAPD * gainPreAmpl * elemCharge);
+    public static final double adcResolution = 2.0 / (Math.pow(2, nBit) - 1); //volts per ADC count
+    public static final double readoutGain = Req * lightYield * quantumEff * surfRatio * gainAPD * gainPreAmpl * elemCharge;// = 15.0545 volt-seconds/GeV
+    public static final double gainFactor = adcResolution / readoutGain;
     public static final double ecalReadoutPeriod = 4.0; // readout period in ns, it is hardcoded in the public declaration of EcalReadoutDriver. 
 
     /**
SVNspam 0.1