Print

Print


Author: [log in to unmask]
Date: Wed Jun 10 13:55:34 2015
New Revision: 3120

Log:
another update to allow pulse fitting to work on mc

Modified:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPulseFitter.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPulseFitter.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPulseFitter.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPulseFitter.java	Wed Jun 10 13:55:34 2015
@@ -14,7 +14,6 @@
 import java.util.logging.Logger;
 
 import org.hps.conditions.database.DatabaseConditionsManager;
-import org.hps.conditions.ecal.EcalChannel;
 import org.hps.conditions.ecal.EcalChannelConstants;
 import org.hps.conditions.ecal.EcalConditions;
 import org.lcsim.event.RawTrackerHit;
@@ -33,6 +32,9 @@
 
     // don't bother fitting pulses with threshold crossing outside this sample range:
     public int threshRange[]={7,20}; // (28 ns <--> 80 ns)
+    
+    // restrict fit's time0 parameter to this range:  (units=samples)
+    public int t0limits[]={1,30};
     
     // fit sample range relative to threshold crossing:
     private final static int fitRange[]={-10,15};
@@ -181,11 +183,7 @@
 
         // constrain parameters:
 //        fitter.fitParameterSettings("time0").setBounds(1,30);
-        double t0min=threshRange[0]-6;
-        double t0max=threshRange[1]+10;
-        if (t0min<1) t0min=1;
-        if (t0max>=samples.length-5) t0max=samples.length-6;
-        fitter.fitParameterSettings("time0").setBounds(t0min,t0max);
+        fitter.fitParameterSettings("time0").setBounds(t0limits[0],t0limits[1]);
         fitter.fitParameterSettings("width").setBounds(0.1,5);
         fitter.fitParameterSettings("integral").setBounds(0,999999);
         if (fixShapeParameter) fitter.fitParameterSettings("width").setFixed(true);

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java	Wed Jun 10 13:55:34 2015
@@ -155,10 +155,12 @@
         pulseFitter.globalThreePoleWidth=width; 
         pulseFitter.fixShapeParameter=true;
     }
-    public void setFitThresholdRange(int sample1,int sample2) {
-        pulseFitter.threshRange[0]=sample1;
-        pulseFitter.threshRange[1]=sample2;
-    }
+    public void setFitThresholdTimeLo(int sample) { pulseFitter.threshRange[0]=sample; }
+    public void setFitThresholdTimeHi(int sample) { pulseFitter.threshRange[1]=sample; }
+    public void setFitLimitTimeLo(int sample) { pulseFitter.t0limits[0]=sample; }
+    public void setFitLimitTimeHi(int sample) { pulseFitter.t0limits[1]=sample; }
+    
+    
 
     public void setLeadingEdgeThreshold(double thresh) {
         leadingEdgeThreshold=thresh;

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java	Wed Jun 10 13:55:34 2015
@@ -48,14 +48,14 @@
     }
 
     /*
+     * Set to <code>true</code> to use pulse fitting instead of arithmetic integration:<br/>
+     */
+    public void setUseFit(boolean useFit) { converter.setUseFit(useFit); }
+    
+    /*
      * Fix 3-pole function width to be the same for all 442 ECal channels.  Units=samples.
      */
     public void setGlobalFixedPulseWidth(double width) { converter.setGlobalFixedPulseWidth(width); }
-    
-    /*
-     * Set to <code>true</code> to use pulse fitting instead of arithmetic integration:<br/>
-     */
-    public void setUseFit(boolean useFit) { converter.setUseFit(useFit); }
     
     /*
      * Set to <code>true</code> to fix fitted pulse widths to their channel's mean value:<br/>
@@ -63,9 +63,16 @@
     public void setFixShapeParameter(boolean fix) { converter.setFixShapeParameter(fix); }
    
     /*
-     * Limit threshold crossing range for pulse-fitter.  Units=samples.
-     */
-    public void setFitThresholdRange(int sample1,int sample2) { converter.setFitThresholdRange(sample1,sample2); }
+     * Limit threshold crossing range that is candidate for pulse-fitting.   Units=samples.
+     */
+    public void setFitThresholdTimeLo(int sample) { converter.setFitThresholdTimeLo(sample); }
+    public void setFitThresholdTimeHi(int sample) { converter.setFitThresholdTimeHi(sample); }
+    
+    /*
+     * Constrain pulse fit time0 parameter.  Units=samples. 
+     */
+    public void setFitLimitTimeLo(int sample) { converter.setFitLimitTimeLo(sample); }
+    public void setFitLimitTimeHi(int sample) { converter.setFitLimitTimeHi(sample); }
     
     /**
      * Set to <code>true</code> to use the "2014" gain formula:<br/>