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  December 2014

HPS-SVN December 2014

Subject:

r1666 - in /java/trunk: ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java ecal-recon/src/main/java/org/hps/recon/ecal/HPSRawCalorimeterHit.java evio/src/main/java/org/hps/evio/ECalEvioReader.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 10 Dec 2014 00:44:35 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (213 lines)

Author: [log in to unmask]
Date: Tue Dec  9 16:44:29 2014
New Revision: 1666

Log:
remove usage of HPSRawCalorimeterHit in readout simulation, make ECalEvioReader use BaseRawCalorimeterHit for mode 3

Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/HPSRawCalorimeterHit.java
    java/trunk/evio/src/main/java/org/hps/evio/ECalEvioReader.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	Tue Dec  9 16:44:29 2014
@@ -8,6 +8,7 @@
 import static org.hps.recon.ecal.ECalUtils.riseTime;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -20,7 +21,6 @@
 import org.hps.conditions.ecal.EcalConditions;
 import org.lcsim.conditions.ConditionsManager;
 import org.hps.recon.ecal.ECalUtils;
-import org.hps.recon.ecal.HPSRawCalorimeterHit;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawCalorimeterHit;
@@ -58,7 +58,7 @@
     //buffer for timestamps
     private Map<Long, Integer> timeMap = null;
     //queue for hits to be output to clusterer
-    private PriorityQueue<HPSRawCalorimeterHit> outputQueue = null;
+    private PriorityQueue<RawCalorimeterHit> outputQueue = null;
     //length of ring buffer (in readout cycles)
     private int bufferLength = 100;
     //length of readout pipeline (in readout cycles)
@@ -81,7 +81,7 @@
     private int numSamplesAfter = 30;
 //    private HPSEcalConverter converter = null;
     //output buffer for hits
-    private LinkedList<HPSRawCalorimeterHit> buffer = new LinkedList<HPSRawCalorimeterHit>();
+    private LinkedList<RawCalorimeterHit> buffer = new LinkedList<RawCalorimeterHit>();
     //number of readout periods for which a given hit stays in the buffer
     private int coincidenceWindow = 2;
     //output collection name for hits read out from trigger
@@ -107,7 +107,7 @@
     public FADCEcalReadoutDriver() {
         flags = 0;
         flags += 1 << LCIOConstants.RCHBIT_TIME; //store timestamp
-        hitClass = HPSRawCalorimeterHit.class;
+        hitClass = RawCalorimeterHit.class;
         setReadoutPeriod(ecalReadoutPeriod);
 //        converter = new HPSEcalConverter(null);
     }
@@ -269,19 +269,17 @@
                         sumMap.put(cellID, sum + pipeline.getValue(0));
                     } else if (timeMap.get(cellID) + delay0 <= readoutCounter) {
 //                        System.out.printf("sum = %f\n", sum);
-                        outputQueue.add(new HPSRawCalorimeterHit(cellID,
+                        outputQueue.add(new BaseRawCalorimeterHit(cellID,
                                 (int) Math.round(sum / scaleFactor),
-                                64 * timeMap.get(cellID),
-                                readoutCounter - timeMap.get(cellID) + 1));
+                                64 * timeMap.get(cellID)));
                         sumMap.remove(cellID);
                     }
                 } else {
                     if (pedestalSubtractedValue < triggerThreshold || timeMap.get(cellID) + delay0 == readoutCounter) {
 //					System.out.printf("sum = %f\n",sum);
-                        outputQueue.add(new HPSRawCalorimeterHit(cellID,
+                        outputQueue.add(new BaseRawCalorimeterHit(cellID,
                                 (int) Math.round((sum + pedestalSubtractedValue) / scaleFactor),
-                                64 * timeMap.get(cellID),
-                                readoutCounter - timeMap.get(cellID) + 1));
+                                64 * timeMap.get(cellID)));
                         sumMap.remove(cellID);
                     } else {
                         sumMap.put(cellID, sum + pedestalSubtractedValue);
@@ -468,7 +466,7 @@
         //initialize buffers
         sumMap = new HashMap<Long, Integer>();
         timeMap = new HashMap<Long, Integer>();
-        outputQueue = new PriorityQueue(20, new HPSRawCalorimeterHit.TimeComparator());
+        outputQueue = new PriorityQueue(20, new TimeComparator());
         resetFADCBuffers();
     }
 
@@ -620,4 +618,12 @@
         return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
     }
     
+    
+	public static class TimeComparator implements Comparator<RawCalorimeterHit> {
+
+        @Override
+		public int compare(RawCalorimeterHit o1, RawCalorimeterHit o2) {
+			return o1.getTimeStamp() - o2.getTimeStamp();
+		}
+	}
 }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/HPSRawCalorimeterHit.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/HPSRawCalorimeterHit.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/HPSRawCalorimeterHit.java	Tue Dec  9 16:44:29 2014
@@ -1,7 +1,5 @@
 package org.hps.recon.ecal;
 
-import java.util.Comparator;
-import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.RawCalorimeterHit;
 
 /**
@@ -17,8 +15,6 @@
 	int windowSize;
 	int mode; //A.C. this is the field I use, in case of REAL data, to record which FADC mode was used (ECAL_PULSE_INTEGRAL3_MODE or ECAL_PULSE_INTEGRAL7_MODE)
 	short amplLow,amplHigh;
-	
-	CalorimeterHit analogHit = null;
 
 	public HPSRawCalorimeterHit(long cellID, int amplitude, int timeStamp, int windowSize) { //A.C. I do not change this, since I did not write it!
 		this.cellID = cellID;
@@ -72,20 +68,4 @@
 	public short getAmplHigh(){
 		return amplHigh;
 	}
-	
-	public CalorimeterHit getAnalogHit() {
-		return analogHit;
-	}
-
-	public void setAnalogHit(CalorimeterHit analogHit) {
-		this.analogHit = analogHit;
-	}
-
-	public static class TimeComparator implements Comparator<RawCalorimeterHit> {
-
-        @Override
-		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	Tue Dec  9 16:44:29 2014
@@ -24,6 +24,7 @@
 import org.lcsim.detector.identifier.IIdentifierHelper;
 import org.lcsim.detector.identifier.Identifier;
 import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.event.SimTrackerHit;
 import org.lcsim.event.base.BaseRawCalorimeterHit;
@@ -133,7 +134,7 @@
                                             break;
                                         case EventConstants.ECAL_PULSE_INTEGRAL_BANK_TAG:
                                             hits.addAll(makeIntegralHitsMode3(cdata, crate));
-                                            hitClass = HPSRawCalorimeterHit.class;
+                                            hitClass = RawCalorimeterHit.class;
                                             flags = (1 << LCIOConstants.RCHBIT_TIME); //store timestamp
                                             break;
                                         case EventConstants.ECAL_PULSE_INTEGRAL_HIGHRESTDC_BANK_TAG:
@@ -246,7 +247,7 @@
                 System.out.println("cdata.type[" + i + "]=" + cdata.getTypes().get(i));
             }
         }
-        while (cdata.index() < cdata.getItems().size()) {
+        while (cdata.index() + 1 < cdata.getItems().size()) { //the +1 is a hack because sometimes an extra byte gets read (padding)
             short slot = cdata.getByte();
             int trigger = cdata.getInt();
             long timestamp = cdata.getLong();
@@ -283,8 +284,8 @@
         return hits;
     }
 
-    private List<HPSRawCalorimeterHit> makeIntegralHitsMode3(CompositeData cdata, int crate) {
-        List<HPSRawCalorimeterHit> hits = new ArrayList<HPSRawCalorimeterHit>();
+    private List<RawCalorimeterHit> makeIntegralHitsMode3(CompositeData cdata, int crate) {
+        List<RawCalorimeterHit> hits = new ArrayList<RawCalorimeterHit>();
         if (debug) {
             int n = cdata.getNValues().size();
             for (int i = 0; i < n; i++) {
@@ -321,7 +322,7 @@
                         int[] data = {pulseIntegral, pulseTime};
                         processUnrecognizedChannel(new FADCGenericHit(EventConstants.ECAL_PULSE_INTEGRAL_MODE, crate, slot, channel, data));
                     } else {
-                        hits.add(new HPSRawCalorimeterHit(id, pulseIntegral,pulseTime,0,(short)0,(short)0,EventConstants.ECAL_PULSE_INTEGRAL_MODE));
+                        hits.add(new BaseRawCalorimeterHit(id, pulseIntegral,pulseTime));
                     }
                 }
             }
@@ -365,10 +366,10 @@
                     short amplLow = cdata.getShort();
                     short amplHigh = cdata.getShort();
                     if (debug) {
-                        System.out.println("    pulseTime=" + pulseTime + "; pulseIntegral=" + pulseIntegral);
+                        System.out.println("    pulseTime=" + pulseTime + "; pulseIntegral=" + pulseIntegral + "; amplLow=" + amplLow + "; amplHigh=" + amplHigh);
                     }
                     if (id == null) {
-                        int[] data = {pulseIntegral, pulseTime};
+                        int[] data = {pulseIntegral, pulseTime, amplLow, amplHigh};
                         processUnrecognizedChannel(new FADCGenericHit(EventConstants.ECAL_PULSE_INTEGRAL_HIGHRESTDC_MODE, crate, slot, channel, data));
                     } else {
                         hits.add(new HPSRawCalorimeterHit(id, pulseIntegral,pulseTime,0,amplLow,amplHigh,EventConstants.ECAL_PULSE_INTEGRAL_HIGHRESTDC_MODE));

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