Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN
TestRunDataProcessingModule.java+138added 1.1
RearTransitionModule.java+1-41.4 -> 1.5
HPSRawTrackerHitFitterDriver.java+1-11.15 -> 1.16
DataProcessingModule.java+84-1961.5 -> 1.6
+224-201
1 added + 3 modified, total 4 files
Added Test Run specific DPM; small changes to digitization and cuts

hps-java/src/main/java/org/lcsim/hps/recon/tracking
TestRunDataProcessingModule.java added at 1.1
diff -N TestRunDataProcessingModule.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TestRunDataProcessingModule.java	15 Sep 2012 01:21:02 -0000	1.1
@@ -0,0 +1,138 @@
+package org.lcsim.hps.recon.tracking;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.lcsim.detector.IReadout;
+import org.lcsim.detector.tracker.silicon.ChargeCarrier;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.SimTrackerHit;
+import org.lcsim.event.base.BaseRawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.hps.recon.tracking.apv25.Apv25DigitalData;
+import org.lcsim.util.Driver;
+
+
+/**
+ * 
+ * @author Omar Moreno <[log in to unmask]>
+ * @version $Id: TestRunDataProcessingModule.java,v 1.1 2012/09/15 01:21:02 omoreno Exp $
+ */
+public class TestRunDataProcessingModule extends DataProcessingModule {
+
+    int nSamplesAboveTreshold = 1;    // Number of samples above noise threshold 
+    int noiseThreshold = 3;           // Units of RMS noise
+
+    boolean enablePileUpCut = true;
+    boolean enableThresholdCut = true;
+
+    /**
+     * Default Ctor
+     */
+    public TestRunDataProcessingModule(){
+    };
+
+    /**
+     * 
+     */
+    public void setNumberOfSamplesAboveTreshold(int nSamplesAboveThreshold){
+        this.nSamplesAboveTreshold = nSamplesAboveThreshold;
+    }
+
+    /**
+     * 
+     */
+    public void setNoiseThreshold(int noiseThreshold /* Noise RMS */){
+        this.noiseThreshold = noiseThreshold;
+    }
+
+    /**
+     *
+     */
+    public void setEnablePileUpCut(boolean enablePileUpCut){
+        this.enablePileUpCut = enablePileUpCut;
+    }
+
+    /**
+     *
+     */
+    public void setEnableThresholdCut(boolean enableThresholdCut){
+        this.enableThresholdCut = enableThresholdCut;
+    }
+
+    protected List<RawTrackerHit> findRawHits(){
+
+        List<RawTrackerHit> rawHits = new ArrayList<RawTrackerHit>();
+
+        // Loop through all blocked data
+        for(Map.Entry<SiSensor, SvtDataBlocks> sensor : sensorToDataBlocks.entrySet()){
+
+            SvtDataBlocks blocks = sensor.getValue();
+
+            for(int channel = 0; channel < 639; channel++){
+            	
+            	if(HPSSVTCalibrationConstants.isBadChannel(sensor.getKey(), channel)) continue;
+            	
+                short[] samples = blocks.getSamples(channel);  
+
+                if(enableThresholdCut && !this.samplesAboveThreshold(sensor.getKey(), channel, samples)) continue;
+
+                if(enablePileUpCut && !this.pileUpCut(samples)) continue;
+
+                // Create a RawTrackerHit
+                int sideNumber;
+                int time = 0;
+                if(sensor.getKey().hasElectrodesOnSide(ChargeCarrier.HOLE)){
+                    sideNumber = ChargeCarrier.HOLE.charge();
+                } else {
+                    sideNumber = ChargeCarrier.ELECTRON.charge();
+                }
+                long cellID = sensor.getKey().makeStripId(channel, sideNumber).getValue();
+                RawTrackerHit rawHit = new BaseRawTrackerHit(time, cellID, samples, new ArrayList<SimTrackerHit>(), sensor.getKey());
+                rawHits.add(rawHit);
+                
+                // Add the raw hit to the sensor readout
+        		IReadout readOut = sensor.getKey().getReadout();
+        		readOut.addHit(rawHit);
+            }
+        }
+
+        System.out.println(this.getClass().getSimpleName() + ": Number of RawTrackerHits created: " + rawHits.size());
+        return rawHits;
+    }
+
+    /**
+     * 
+     */
+    private boolean samplesAboveThreshold(SiSensor sensor, int channel, short[] samples){
+        // Number of samples above threshold
+        int nSamplesAboveThreshold = 0;
+
+        // Get the pedestal and noise for this channel
+        double pedestal = HPSSVTCalibrationConstants.getPedestal(sensor, channel);
+        double noise = HPSSVTCalibrationConstants.getNoise(sensor, channel);
+
+        // Calculate the threshold
+        int threshold = (int) (pedestal + noise*this.noiseThreshold);
+
+        for(int index = 0; index < 6; index++){
+            if(samples[index] >= threshold) nSamplesAboveThreshold++;
+        }
+
+        // If the prerequisite number of samples are above threshold return true
+        if(nSamplesAboveThreshold >= this.nSamplesAboveTreshold ) return true;
+        return false;
+    }
+
+    /**
+     *
+     */
+    private boolean pileUpCut(short[] sample){
+        if(sample[2] > sample[1] || sample[3] > sample[2]) return true;
+        return false; 
+    }
+}

hps-java/src/main/java/org/lcsim/hps/recon/tracking
RearTransitionModule.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- RearTransitionModule.java	28 Aug 2012 07:15:02 -0000	1.4
+++ RearTransitionModule.java	15 Sep 2012 01:21:02 -0000	1.5
@@ -22,7 +22,7 @@
 /**
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: RearTransitionModule.java,v 1.4 2012/08/28 07:15:02 omoreno Exp $
+ * @version $Id: RearTransitionModule.java,v 1.5 2012/09/15 01:21:02 omoreno Exp $
  */
 public class RearTransitionModule extends Driver {
 
@@ -117,9 +117,6 @@
                     double pedestal = HPSSVTCalibrationConstants.getPedestal(analogDatum.getSensor(), physicalChannel);
                     double noise = HPSSVTCalibrationConstants.getNoise(analogDatum.getSensor(), physicalChannel);
                     apv25Output[index] += RandomGaussian.getGaussian(pedestal, noise);            
-
-                    apv25Output[index] = Math.ceil(apv25Output[index]);
-
                 }
 
                 // Add the digital data to the list

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSRawTrackerHitFitterDriver.java 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- HPSRawTrackerHitFitterDriver.java	24 Aug 2012 01:02:27 -0000	1.15
+++ HPSRawTrackerHitFitterDriver.java	15 Sep 2012 01:21:02 -0000	1.16
@@ -62,7 +62,7 @@
     @Override
     public void process(EventHeader event) {
         if (!event.hasCollection(RawTrackerHit.class, rawHitCollectionName)) {
-            System.out.println(rawHitCollectionName + " does not exist; skipping event");
+            //System.out.println(rawHitCollectionName + " does not exist; skipping event");
             return;
         }
 

hps-java/src/main/java/org/lcsim/hps/recon/tracking
DataProcessingModule.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- DataProcessingModule.java	30 Aug 2012 11:57:14 -0000	1.5
+++ DataProcessingModule.java	15 Sep 2012 01:21:02 -0000	1.6
@@ -1,229 +1,117 @@
 package org.lcsim.hps.recon.tracking;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.lcsim.detector.IReadout;
-import org.lcsim.detector.tracker.silicon.ChargeCarrier;
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.base.BaseRawTrackerHit;
 import org.lcsim.geometry.Detector;
 import org.lcsim.hps.recon.tracking.apv25.Apv25DigitalData;
 import org.lcsim.util.Driver;
-
-
 /**
  * 
- * @author Omar Moreno <[log in to unmask]>
- * @version $Id: DataProcessingModule.java,v 1.5 2012/08/30 11:57:14 omoreno Exp $
+ * @author Omar Moreno
+ * @version $Id: DataProcessingModule.java,v 1.6 2012/09/15 01:21:02 omoreno Exp $
  */
-public class DataProcessingModule extends Driver {
+public abstract class DataProcessingModule extends Driver{
 
-    // A map relating a sensor to all sample blocks collected from that sensor and 
-    // the corresponding channel
-    Map<SiSensor, Map<Integer, List<Double>>> sensorToSamplesMap 
-        = new HashMap<SiSensor, Map<Integer, List<Double>>>();
     Map<SiSensor, SvtDataBlocks> sensorToDataBlocks = new HashMap<SiSensor, SvtDataBlocks>();
-
-    // Collection Names
+	
+	// Collection Names
     String apv25DigitalDataCollectionName = "AVP25DigitalData";
     String rawTrackerHitsCollectionName = "SVTRawTrackerHits";
-
-    int nSamples = 0;
-    int nSamplesAboveTreshold = 3;    // Number of samples above noise threshold 
-    int noiseThreshold = 3;           // Units of RMS noise
-
-    boolean enableTailCut = true;
-    boolean enableThresholdCut = true;
-
-    /**
-     * Default Ctor
-     */
-    public DataProcessingModule(){};
-
-    /**
-     * 
-     */
-    public void setNumberOfSamplesAboveTreshold(int nSamplesAboveThreshold){
-        this.nSamplesAboveTreshold = nSamplesAboveThreshold;
-    }
-
-    /**
-     * 
-     */
-    public void setNoiseThreshold(int noiseThreshold){
-        this.noiseThreshold = noiseThreshold;
-    }
-
-    /**
-     *
-     */
-    public void setEnableTailCut(boolean enableTailCut){
-        this.enableTailCut = enableTailCut;
-    }
-
-    /**
-     *
-     */
-    public void setEnableThresholdCut(boolean enableThresholdCut){
-        this.enableThresholdCut = enableThresholdCut;
-    }
-
-    /**
-     * 
-     */
-    @Override
-        public void detectorChanged(Detector detector){
-
-            for(SiSensor sensor : SvtUtils.getInstance().getSensors()){
-                sensorToSamplesMap.put(sensor, new HashMap<Integer, List<Double>>());
-                sensorToDataBlocks.put(sensor, new SvtDataBlocks());
-            }
-        }
-
-    private List<RawTrackerHit> findRawHits(){
-
-        List<RawTrackerHit> rawHits = new ArrayList<RawTrackerHit>();
-
-        // Loop through all blocked data
-        for(Map.Entry<SiSensor, SvtDataBlocks> sensor : sensorToDataBlocks.entrySet()){
-
-            SvtDataBlocks blocks = sensor.getValue();
-
-            for(int channel = 0; channel < 640; channel++){
-            	
-            	if(HPSSVTCalibrationConstants.isBadChannel(sensor.getKey(), channel)) continue;
-            	
-                short[] samples = blocks.getSamples(channel);  
-
-                if(!this.samplesAboveThreshold(sensor.getKey(), channel, samples)) continue;
-
-
-                if(enableTailCut && !this.tailCut(samples)) continue;
-
-                // Create a RawTrackerHit
-                int sideNumber;
-                int time = 0;
-                if(sensor.getKey().hasElectrodesOnSide(ChargeCarrier.HOLE)){
-                    sideNumber = ChargeCarrier.HOLE.charge();
-                } else {
-                    sideNumber = ChargeCarrier.ELECTRON.charge();
-                }
-                long cellID = sensor.getKey().makeStripId(channel, sideNumber).getValue();
-                RawTrackerHit rawHit = new BaseRawTrackerHit(time, cellID, samples, new ArrayList<SimTrackerHit>(), sensor.getKey());
-                rawHits.add(rawHit);
-                
-                // Add the raw hit to the sensor readout
-        		IReadout readOut = sensor.getKey().getReadout();
-        		readOut.addHit(rawHit);
-            }
-        }
-
-        System.out.println(this.getClass().getSimpleName() + ": Number of RawTrackerHits created: " + rawHits.size());
-        return rawHits;
-    }
-
-    /**
-     * 
-     */
+    
+    int nSamples = 0;  // Number of samples which have been processed
+    int totalSamples = 6; // Number of samples which are read out
+    
+    /**
+     * Set the number of shaper signal samples to be readout
+     */
+    public void setNumberOfSamplesToReadOut(int totalSamples){
+    	this.totalSamples = totalSamples;
+    }
+    
+    protected abstract List<RawTrackerHit> findRawHits();
+	
     @Override
-        protected void process(EventHeader event){
-
-            // If the event does not contain any digital data, skip the event
-            if(!event.hasCollection(Apv25DigitalData.class, apv25DigitalDataCollectionName)) return;
-
-            // Get the digital data from the event
-            List<Apv25DigitalData> digitalData = event.get(Apv25DigitalData.class, apv25DigitalDataCollectionName);
-
-            // Block the data together
-            for(Apv25DigitalData digitalDatum : digitalData){
-
-                SiSensor sensor = digitalDatum.getSensor();
-                int apvN = digitalDatum.getApv();
-
-                double[] apv25DigitalOutput = new double[128];
-                System.arraycopy(digitalDatum.getSamples(), 0, apv25DigitalOutput, 0, apv25DigitalOutput.length);
-
-                for(int channel = 0; channel < apv25DigitalOutput.length; channel++){
-
-                    // Calculate the physical number
-                    int physicalChannel = 639 - (apvN*128 + 127 - channel);
-
-                    sensorToDataBlocks.get(sensor).addSample(physicalChannel, nSamples, (short) apv25DigitalOutput[channel]);
-                }
-            }
-            nSamples++;
+    public void detectorChanged(Detector detector){
+        for(SiSensor sensor : SvtUtils.getInstance().getSensors()){
+            sensorToDataBlocks.put(sensor, new SvtDataBlocks());
+        }
+    }
+    
+	@Override
+	public void process(EventHeader event){
+		
+		// If the event does not contain any data to process, skip it
+		if(!event.hasCollection(Apv25DigitalData.class, apv25DigitalDataCollectionName)) return;
+		
+		// Get the digital data from the event
+		List<Apv25DigitalData> digitalData = event.get(Apv25DigitalData.class, apv25DigitalDataCollectionName);
+		
+		// Block the data together
+		for(Apv25DigitalData digitalDatum : digitalData){
+			SiSensor sensor = digitalDatum.getSensor();
+            int apvN = digitalDatum.getApv();
+
+            double[] apv25DigitalOutput = new double[128];
+            System.arraycopy(digitalDatum.getSamples(), 0, apv25DigitalOutput, 0, apv25DigitalOutput.length);
 
+            for(int channel = 0; channel < apv25DigitalOutput.length; channel++){
 
-            // If the expected number of samples has been collected, process the data
-            if(nSamples == 6){
+                // Calculate the physical number
+                int physicalChannel = 639 - (apvN*128 + 127 - channel);
 
-                // Add RawTrackerHits to the event
-                event.put(rawTrackerHitsCollectionName, this.findRawHits(), RawTrackerHit.class, 0);
-                nSamples = 0;
+                sensorToDataBlocks.get(sensor).addSample(physicalChannel, nSamples, (short) apv25DigitalOutput[channel]);
             }
-        }
-
-    public class SvtDataBlocks { 
-
-        Map<Integer, short[]> channelToSamples = new HashMap<Integer, short[]>();
-
-        /**
-         * Default Ctor
-         */
-        public SvtDataBlocks(){
-        }
-
-        /**
-         * 
-         */
-        public void addSample(Integer physicalChannel, int sampleN, short value){
+		}
+		nSamples++;
+		
+		// If the expected number of samples has been collected, process the data
+        if(nSamples == totalSamples){
+
+            // Add RawTrackerHits to the event
+            event.put(rawTrackerHitsCollectionName, this.findRawHits(), RawTrackerHit.class, 0);
+            nSamples = 0;
+        }
+	}
+	
+	protected class SvtDataBlocks {
+		
+		Map<Integer /* sample number */, short[]> channelToSamples = new HashMap<Integer, short[]>();
+		
+		/**
+		 * 
+		 */
+		public SvtDataBlocks(){
+		}
+		
+		public void addSample(Integer physicalChannel, int sampleN, short value){
             if(!channelToSamples.containsKey(physicalChannel)) channelToSamples.put(physicalChannel, new short[6]);
             channelToSamples.get(physicalChannel)[sampleN] = value;
-        }
-
-        /**
+		}
+		
+	       /**
          * 
          */
         public short[] getSamples(int physicalChannel){
             return channelToSamples.get(physicalChannel);
         }
-
-    }
-
-    /**
-     * 
-     */
-    private boolean samplesAboveThreshold(SiSensor sensor, int channel, short[] samples){
-        // Number of samples above threshold
-        int nSamplesAboveThreshold = 0;
-
-        // Get the pedestal and noise for this channel
-        double pedestal = HPSSVTCalibrationConstants.getPedestal(sensor, channel);
-        double noise = HPSSVTCalibrationConstants.getNoise(sensor, channel);
-
-        // Calculate the threshold
-        double threshold = Math.ceil(pedestal + noise*this.noiseThreshold); 
-
-        for(short sample : samples){
-            if(sample > threshold) nSamplesAboveThreshold++;
+        
+        /**
+         * 
+         */
+        public String printSamples(int physicalChannel){
+        	String sampleString = "[ ";
+        	short[] samples = this.getSamples(physicalChannel);
+        	for(int index = 0; index < samples.length -1; index++){
+        		sampleString +=  samples[index] + ", ";
+        	}
+        	sampleString += samples[samples.length - 1] + "]";
+			return sampleString;
         }
-
-        // If the prerequiste number of samples are above threshold return true
-        if(nSamplesAboveThreshold >= this.nSamplesAboveTreshold) return true;
-        return false;
-    }
-
-    /**
-     *
-     */
-    private boolean tailCut(short[] sample){
-        if(sample[2] > sample[1] || sample[3] > sample[4]) return true;
-        return false; 
-    }
+	}
+	
 }
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