LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  June 2015

HPS-SVN June 2015

Subject:

r3113 - in /java/trunk: ecal-readout-sim/src/main/java/org/hps/readout/ecal/ evio/src/main/java/org/hps/evio/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 8 Jun 2015 19:52:12 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (314 lines)

Author: [log in to unmask]
Date: Mon Jun  8 12:51:57 2015
New Revision: 3113

Log:
add mode 1 threshold cut, rename constant

Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java
    java/trunk/evio/src/main/java/org/hps/evio/EcalEvioReader.java
    java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java
    java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java
    java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToEvio.java
    java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToLcio.java

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java	Mon Jun  8 12:51:57 2015
@@ -42,7 +42,7 @@
 public class FADCEcalReadoutDriver extends EcalReadoutDriver<RawCalorimeterHit> {
 
     // Repeated here from EventConstants in evio module to avoid depending on it.
-    private static final int ECAL_WINDOW_MODE = 1;
+    private static final int ECAL_RAW_MODE = 1;
     private static final int ECAL_PULSE_MODE = 2;
     private static final int ECAL_PULSE_INTEGRAL_MODE = 3;
     private String ecalName = "Ecal";
@@ -92,16 +92,16 @@
     private double fixedGain = -1;
     private boolean constantTriggerWindow = true;
     private boolean addNoise = false;
-   
+
     // 32.8 p.e./MeV = New detector in 2014
     // 2 p.e./MeV = Test Run detector
     private double pePerMeV = 32.8; //photoelectrons per MeV, used to calculate noise
-    
+
     //switch between test run and 2014 definitions of gain constants
     // true = ONLY simulation studies in 2014
     // false = Test Run data/simulations and 2014+ Detector's real data 
     private boolean use2014Gain = false;
-    
+
     //switch between three pulse shape functions
     private PulseShape pulseShape = PulseShape.ThreePole;
 
@@ -208,7 +208,7 @@
 
     public void setMode(int mode) {
         this.mode = mode;
-        if (mode != ECAL_WINDOW_MODE && mode != ECAL_PULSE_MODE && mode != ECAL_PULSE_INTEGRAL_MODE) {
+        if (mode != ECAL_RAW_MODE && mode != ECAL_PULSE_MODE && mode != ECAL_PULSE_INTEGRAL_MODE) {
             throw new IllegalArgumentException("invalid mode " + mode);
         }
     }
@@ -239,7 +239,7 @@
 
             FADCPipeline pipeline = pipelineMap.get(cellID);
             pipeline.step();
-            
+
             // Get the channel data.
             EcalChannelConstants channelData = findChannel(cellID);
 
@@ -325,9 +325,9 @@
     @Override
     protected void processTrigger(EventHeader event) {
         switch (mode) {
-            case ECAL_WINDOW_MODE:
+            case ECAL_RAW_MODE:
                 if (debug) {
-                    System.out.println("Reading out ECal in window mode");
+                    System.out.println("Reading out ECal in raw mode");
                 }
                 event.put(ecalReadoutCollectionName, readWindow(), RawTrackerHit.class, 0, ecalReadoutName);
                 break;
@@ -371,7 +371,17 @@
         List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
         for (Long cellID : pipelineMap.keySet()) {
             short[] adcValues = getWindow(cellID);
-            hits.add(new BaseRawTrackerHit(cellID, 0, adcValues));
+            EcalChannelConstants channelData = findChannel(cellID);
+            boolean isAboveThreshold = false;
+            for (int i = 0; i < adcValues.length; i++) {
+                if (adcValues[i] > channelData.getCalibration().getPedestal() + readoutThreshold) {
+                    isAboveThreshold = true;
+                    break;
+                }
+            }
+            if (isAboveThreshold) {
+                hits.add(new BaseRawTrackerHit(cellID, 0, adcValues));
+            }
         }
         return hits;
     }
@@ -385,12 +395,15 @@
             int pointerOffset = 0;
             int numSamplesToRead = 0;
             int thresholdCrossing = 0;
-            
+
             // Get the channel data.
             EcalChannelConstants channelData = findChannel(cellID);
-            
+
             for (int i = 0; i < readoutWindow; i++) {
                 if (numSamplesToRead != 0) {
+                    if (adcValues == null) {
+                        throw new RuntimeException("expected a pulse buffer, none found (this should never happen)");
+                    }
                     adcValues[adcValues.length - numSamplesToRead] = window[i - pointerOffset];
                     numSamplesToRead--;
                     if (numSamplesToRead == 0) {
@@ -416,10 +429,10 @@
             int pointerOffset = 0;
             int numSamplesToRead = 0;
             int thresholdCrossing = 0;
-            
+
             // Get the channel data.
             EcalChannelConstants channelData = findChannel(cellID);
-            
+
             if (window != null) {
                 for (int i = 0; i < readoutWindow; i++) {
                     if (numSamplesToRead != 0) {
@@ -455,11 +468,11 @@
                 //add preamp noise and photoelectron Poisson noise in quadrature
                 double noise;
                 if (use2014Gain) {
-                    noise = Math.sqrt(Math.pow(channelData.getCalibration().getNoise() * channelData.getGain().getGain() * EcalUtils.gainFactor * EcalUtils.ecalReadoutPeriod, 2) 
-                    		+ hit.getRawEnergy() / (EcalUtils.lightYield * EcalUtils.quantumEff * EcalUtils.surfRatio));
+                    noise = Math.sqrt(Math.pow(channelData.getCalibration().getNoise() * channelData.getGain().getGain() * EcalUtils.gainFactor * EcalUtils.ecalReadoutPeriod, 2)
+                            + hit.getRawEnergy() / (EcalUtils.lightYield * EcalUtils.quantumEff * EcalUtils.surfRatio));
                 } else {
-                    noise = Math.sqrt(Math.pow(channelData.getCalibration().getNoise() * channelData.getGain().getGain() * EcalUtils.MeV, 2) 
-                    		+ hit.getRawEnergy() * EcalUtils.MeV / pePerMeV);
+                    noise = Math.sqrt(Math.pow(channelData.getCalibration().getNoise() * channelData.getGain().getGain() * EcalUtils.MeV, 2)
+                            + hit.getRawEnergy() * EcalUtils.MeV / pePerMeV);
                 }
                 energyAmplitude += RandomGaussian.getGaussian(0, noise);
             }
@@ -482,10 +495,10 @@
     public void detectorChanged(Detector detector) {
         // Get the Subdetector.
         ecal = detector.getSubdetector(ecalName);
-        
+
         // ECAL combined conditions object.
         ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions();
-        
+
         resetFADCBuffers();
     }
 
@@ -497,7 +510,7 @@
         pipelineMap = new HashMap<Long, FADCPipeline>();
         Set<Long> cells = ((HPSEcal3) ecal).getNeighborMap().keySet();
         for (Long cellID : cells) {
-        	EcalChannelConstants channelData = findChannel(cellID);
+            EcalChannelConstants channelData = findChannel(cellID);
             signalMap.put(cellID, new RingBuffer(bufferLength));
             pipelineMap.put(cellID, new FADCPipeline(pipelineLength, (int) Math.round(channelData.getCalibration().getPedestal())));
         }
@@ -507,7 +520,7 @@
     private double pulseAmplitude(double time, long cellID) {
         // Get the channel data.
         EcalChannelConstants channelData = findChannel(cellID);
-    	
+
         if (use2014Gain) {
             //if fixedGain is set, multiply the default gain by this factor
             double corrGain;
@@ -615,22 +628,22 @@
             return array[((ptr - pos) % size + size) % size];
         }
     }
-    
-    /** 
+
+    /**
      * Convert physical ID to gain value.
+     *
      * @param cellID (long)
      * @return channel constants (EcalChannelConstants)
      */
     private EcalChannelConstants findChannel(long cellID) {
         return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
     }
-    
-    
-	public static class TimeComparator implements Comparator<RawCalorimeterHit> {
+
+    public static class TimeComparator implements Comparator<RawCalorimeterHit> {
 
         @Override
-		public int compare(RawCalorimeterHit o1, RawCalorimeterHit o2) {
-			return o1.getTimeStamp() - o2.getTimeStamp();
-		}
-	}
+        public int compare(RawCalorimeterHit o1, RawCalorimeterHit o2) {
+            return o1.getTimeStamp() - o2.getTimeStamp();
+        }
+    }
 }

Modified: java/trunk/evio/src/main/java/org/hps/evio/EcalEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EcalEvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EcalEvioReader.java	Mon Jun  8 12:51:57 2015
@@ -260,7 +260,7 @@
                 }
 
                 if (id == null) {
-                    FADCGenericHit hit = makeGenericRawHit(EventConstants.ECAL_WINDOW_MODE, crate, slot, channel, cdata, nSamples);
+                    FADCGenericHit hit = makeGenericRawHit(EventConstants.ECAL_RAW_MODE, crate, slot, channel, cdata, nSamples);
                     processUnrecognizedChannel(hit);
                 } else {
                     BaseRawTrackerHit hit = makeECalRawHit(0, id, cdata, nSamples);

Modified: java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java	Mon Jun  8 12:51:57 2015
@@ -69,7 +69,7 @@
 
     public void setMode(int mode) {
         this.mode = mode;
-        if (mode != EventConstants.ECAL_WINDOW_MODE && mode != EventConstants.ECAL_PULSE_MODE && mode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
+        if (mode != EventConstants.ECAL_RAW_MODE && mode != EventConstants.ECAL_PULSE_MODE && mode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
             throw new IllegalArgumentException("invalid mode " + mode);
         }
     }
@@ -77,7 +77,7 @@
     @Override
     public boolean hasData(EventHeader event) {
         switch (mode) {
-            case EventConstants.ECAL_WINDOW_MODE:
+            case EventConstants.ECAL_RAW_MODE:
                 return event.hasCollection(RawTrackerHit.class, hitCollectionName);
             case EventConstants.ECAL_PULSE_MODE:
                 return event.hasCollection(RawTrackerHit.class, hitCollectionName);
@@ -92,7 +92,7 @@
     public void writeData(EventHeader event, EventBuilder builder) {
         List<Object> hits = new ArrayList<Object>();
         switch (mode) {
-            case EventConstants.ECAL_WINDOW_MODE:
+            case EventConstants.ECAL_RAW_MODE:
                 hits.addAll(event.get(RawTrackerHit.class, hitCollectionName));
                 writeHits(hits, builder, mode);
                 break;
@@ -160,7 +160,7 @@
         }
 
         switch (mode) {
-            case EventConstants.ECAL_WINDOW_MODE:
+            case EventConstants.ECAL_RAW_MODE:
                 // Write the two collections for top and bottom hits to separate EVIO banks.
                 writeWindowHitCollection(topHits, topBank, builder);
                 writeWindowHitCollection(bottomHits, botBank, builder);
@@ -415,7 +415,7 @@
     public void writeData(EventHeader event, EventHeader toEvent) {
         String readoutName = ((org.lcsim.geometry.compact.Subdetector) subDetector).getReadout().getName();
         switch (mode) {
-            case EventConstants.ECAL_WINDOW_MODE:
+            case EventConstants.ECAL_RAW_MODE:
             case EventConstants.ECAL_PULSE_MODE:
                 List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, hitCollectionName);
                 if (verbosity >= 1) {

Modified: java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java	Mon Jun  8 12:51:57 2015
@@ -16,7 +16,7 @@
     public static final int SVT_BANK_NUMBER = 1;
     public static final int ECAL_BANK_NUMBER = 1;
     public static final int TRIGGER_BANK_NUMBER = 1;
-    public static final int ECAL_WINDOW_MODE = 1;
+    public static final int ECAL_RAW_MODE = 1;
     public static final int ECAL_PULSE_MODE = 2;
     public static final int ECAL_PULSE_INTEGRAL_MODE = 3; //FADC mode 3
     public static final int ECAL_PULSE_INTEGRAL_HIGHRESTDC_MODE = 4; //FADC mode 7

Modified: java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToEvio.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToEvio.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToEvio.java	Mon Jun  8 12:51:57 2015
@@ -58,7 +58,7 @@
 
     public void setEcalMode(int ecalMode) {
         this.ecalMode = ecalMode;
-        if (ecalMode != EventConstants.ECAL_WINDOW_MODE && ecalMode != EventConstants.ECAL_PULSE_MODE && ecalMode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
+        if (ecalMode != EventConstants.ECAL_RAW_MODE && ecalMode != EventConstants.ECAL_PULSE_MODE && ecalMode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
             throw new IllegalArgumentException("invalid mode " + ecalMode);
         }
         if (ecalWriter != null) {

Modified: java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToLcio.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToLcio.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToLcio.java	Mon Jun  8 12:51:57 2015
@@ -77,7 +77,7 @@
 
     public void setEcalMode(int ecalMode) {
         this.ecalMode = ecalMode;
-        if (ecalMode != EventConstants.ECAL_WINDOW_MODE && ecalMode != EventConstants.ECAL_PULSE_MODE && ecalMode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
+        if (ecalMode != EventConstants.ECAL_RAW_MODE && ecalMode != EventConstants.ECAL_PULSE_MODE && ecalMode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
             throw new IllegalArgumentException("invalid mode " + ecalMode);
         }
         if (ecalWriter != null) {

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use