Print

Print


Commit in java/trunk/hps-java/src/main/java/org/lcsim/hps on MAIN
readout/ecal/FADCEcalReadoutDriver.java+8-23267 -> 268
recon/ecal/ECalUtils.java+14267 -> 268
          /EcalRawConverter.java+6-6267 -> 268
+28-29
3 modified files
more gain stuff

java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal
FADCEcalReadoutDriver.java 267 -> 268
--- java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal/FADCEcalReadoutDriver.java	2014-02-27 02:11:29 UTC (rev 267)
+++ java/trunk/hps-java/src/main/java/org/lcsim/hps/readout/ecal/FADCEcalReadoutDriver.java	2014-02-28 02:10:12 UTC (rev 268)
@@ -23,6 +23,7 @@
 import org.lcsim.hps.recon.ecal.HPSRawCalorimeterHit;
 import org.lcsim.hps.util.*;
 import org.lcsim.lcio.LCIOConstants;
+import static org.lcsim.hps.recon.ecal.ECalUtils.*;
 
 /**
  * Performs readout of ECal hits. Simulates time evolution of preamp output
@@ -53,10 +54,6 @@
     private boolean useCRRCShape = false;
     //shaper time constant in ns; negative values generate square pulses of the given width (for test run sim)
     private double tp = 14.0;
-    //pulse rise time in ns
-    private double riseTime = 10.0;
-    //pulse fall time in ns
-    private double fallTime = 17.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)
@@ -81,10 +78,6 @@
     private int mode = EventConstants.ECAL_PULSE_INTEGRAL_MODE;
     private int readoutThreshold = 50;
     private int triggerThreshold = 50;
-    //number of bits used by the fADC to code a value
-    private int nBit = 12;
-    //maximum volt output of the fADC
-    private double maxVolt = 2.0;
     //amplitude ADC counts/GeV
 //    private double gain = 0.5*1000 * 80.0 / 60;
     private double scaleFactor = 128;
@@ -92,20 +85,12 @@
     private boolean constantTriggerWindow = false;
     private boolean addNoise = false;
     private double pePerMeV = 2.0; //photoelectrons per MeV, used to calculate noise
-    //parameters for 2014 APDs and preamp
-    private double lightYield = 120. / ECalUtils.MeV; // number of photons per GeV
-    private double quantumEff = 0.7;  // quantum efficiency of the APD
-    private double surfRatio = (10. * 10.) / (16 * 16); // surface ratio between APD and crystals
-    private double gainAPD = 150.; // Gain of the APD
-    private double elemCharge = 1.60217657e-19;
-    private double gainPreAmpl = 525e12; // Gain of the preamplifier in pC/pC, true value is higher but does not take into account losses
-    private double Req = 1.0 / 27.5; // equivalent resistance of the amplification chain
 
     public FADCEcalReadoutDriver() {
         flags = 0;
         flags += 1 << LCIOConstants.RCHBIT_TIME; //store cell ID
         hitClass = HPSRawCalorimeterHit.class;
-        setReadoutPeriod(4.0);
+        setReadoutPeriod(ecalReadoutPeriod);
 //        converter = new HPSEcalConverter(null);
     }
 
@@ -169,17 +154,17 @@
         this.tp = tp;
     }
 
-    public void setFallTime(double fallTime) {
-        this.fallTime = fallTime;
-    }
+//    public void setFallTime(double fallTime) {
+//        this.fallTime = fallTime;
+//    }
 
     public void setPePerMeV(double pePerMeV) {
         this.pePerMeV = pePerMeV;
     }
 
-    public void setRiseTime(double riseTime) {
-        this.riseTime = riseTime;
-    }
+//    public void setRiseTime(double riseTime) {
+//        this.riseTime = riseTime;
+//    }
 
     public void setDelay0(int delay0) {
         this.delay0 = delay0;

java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal
ECalUtils.java 267 -> 268
--- java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal/ECalUtils.java	2014-02-27 02:11:29 UTC (rev 267)
+++ java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal/ECalUtils.java	2014-02-28 02:10:12 UTC (rev 268)
@@ -11,6 +11,20 @@
 
     public static final double GeV = 1.0;
     public static final double MeV = 0.001;
+    //parameters for 2014 APDs and preamp
+    public static final double riseTime = 10.0; //10 pulse rise time in ns
+    public static final double fallTime = 17.0; //17 pulse fall time in ns
+    public static final double lightYield = 120. / MeV; // number of photons per GeV
+    public static final double quantumEff = 0.7;  // quantum efficiency of the APD
+    public static final double surfRatio = (10. * 10.) / (16 * 16); // surface ratio between APD and crystals
+    public static final double gainAPD = 150.; // Gain of the APD
+    public static final double elemCharge = 1.60217657e-19;
+    public static final double gainPreAmpl = 525e12; // Gain of the preamplifier in pC/pC, true value is higher but does not take into account losses
+    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 ecalReadoutPeriod = 4.0; // readout period in ns, it is hardcoded in the public declaration of EcalReadoutDriver. 
 
     /**
      * Returns the quadrant which contains the ECal cluster

java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal
EcalRawConverter.java 267 -> 268
--- java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal/EcalRawConverter.java	2014-02-27 02:11:29 UTC (rev 267)
+++ java/trunk/hps-java/src/main/java/org/lcsim/hps/recon/ecal/EcalRawConverter.java	2014-02-28 02:10:12 UTC (rev 268)
@@ -50,7 +50,7 @@
     public CalorimeterHit HitDtoA(RawTrackerHit hit) {
         double time = hit.getTime();
         long id = hit.getCellID();
-        double rawEnergy = adcToEnergy(sumADC(hit), id);
+        double rawEnergy = adcToEnergy(sumADC(hit), id);      
 //        double[] pos = hit.getDetectorElement().getGeometry().getPosition().v();
         CalorimeterHit h = new HPSCalorimeterHit(rawEnergy + 0.0000001, time, id, 0);
         //+0.0000001 is a horrible hack to ensure rawEnergy!=BaseCalorimeterHit.UNSET_CORRECTED_ENERGY
@@ -64,7 +64,7 @@
         double time = hit.getTimeStamp() / 16.0;
         long id = hit.getCellID();
         double adcSum = hit.getAmplitude() - window * EcalConditions.physicalToPedestal(id);
-        double rawEnergy = adcToEnergy(adcSum, id);
+        double rawEnergy = adcToEnergy(adcSum, id);  
         CalorimeterHit h = new HPSCalorimeterHit(rawEnergy + 0.0000001, time, id, 0);
         //+0.0000001 is a horrible hack to ensure rawEnergy!=BaseCalorimeterHit.UNSET_CORRECTED_ENERGY
         return h;
@@ -88,10 +88,10 @@
      */
     private double adcToEnergy(double adcSum, long cellID) {
         if (use2014Gain) {
-            if (constantGain) { //TODO: use new formula
-                return 0.0;
+            if (constantGain) {
+                return adcSum * ECalUtils.gainFactor * ECalUtils.ecalReadoutPeriod;
             } else {
-                return 0.0;
+                return EcalConditions.physicalToGain(cellID) * adcSum * ECalUtils.gainFactor * ECalUtils.ecalReadoutPeriod; // should not be used for the moment (2014/02)
             }
         } else {
             if (constantGain) {
@@ -114,4 +114,4 @@
      return h;
      }
      */
-}
+}
\ No newline at end of file
SVNspam 0.1