Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps on MAIN
recon/ecal/HPSEcalFADCReadoutDriver.java+11-61.8 -> 1.9
          /HPSFADCTriggerDriver.java+2-181.3 -> 1.4
          /HPSTriggerDriver.java+53-361.6 -> 1.7
          /HPSEcalReadoutDriver.java+132-1191.15 -> 1.16
monitoring/MonitoringExample.java-11.6 -> 1.7
+198-180
5 modified files
adding ECal readout to trigger

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalFADCReadoutDriver.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- HPSEcalFADCReadoutDriver.java	1 Apr 2012 21:20:56 -0000	1.8
+++ HPSEcalFADCReadoutDriver.java	3 Apr 2012 17:02:35 -0000	1.9
@@ -23,7 +23,7 @@
  * Simulates time evolution of preamp output pulse.
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.8 2012/04/01 21:20:56 meeg Exp $
+ * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.9 2012/04/03 17:02:35 meeg Exp $
  */
 public class HPSEcalFADCReadoutDriver extends HPSEcalReadoutDriver<RawCalorimeterHit> {
 
@@ -47,10 +47,10 @@
 	private int delay0 = 32;
 	//start of readout window relative to trigger time (in readout cycles)
 	//in FADC documentation, "Programmable Latency" or PL
-	private int readoutLatency = 200;
+	private int readoutLatency = 500;
 	//number of ADC samples to read out
 	//in FADC documentation, "Programmable Trigger Window" or PTW
-	private int readoutWindow = 64;
+	private int readoutWindow = 256;
 	//number of ADC samples to read out before each pulse maximum
 	//in FADC documentation, "number of samples before" or NSB
 	private int numSamplesBefore = 5;
@@ -63,6 +63,7 @@
 	//number of readout periods for which a given hit stays in the buffer
 	private int coincidenceWindow = 2;
 	private double pulseIntegral;
+	//output collection name for hits read out from trigger
 	private String ecalReadoutCollectionName = "EcalReadoutHits";
 
 	public HPSEcalFADCReadoutDriver() {
@@ -190,12 +191,16 @@
 		}
 
 		if (ClockSingleton.triggered()) {
-			event.put(ecalReadoutCollectionName, readWindow(), RawTrackerHit.class, 0, ecalReadoutName);
 		}
 	}
 
+	@Override
+	protected void processTrigger(EventHeader event) {
+		event.put(ecalReadoutCollectionName, readWindow(), RawTrackerHit.class, 0, ecalReadoutName);
+	}
+
 	protected List<RawTrackerHit> readWindow() {
-		System.out.println("Reading ADC data");
+		System.out.println("Reading FADC data");
 		List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
 
 		Set<Long> cells = ((HPSEcal3) ecal).getNeighborMap().keySet();
@@ -299,7 +304,7 @@
 
 		//return content of specified cell (pos=0 for current cell)
 		public int getValue(int pos) {
-			if (pos > size) {
+			if (pos > size || pos < 0) {
 				throw new ArrayIndexOutOfBoundsException();
 			}
 			return array[((ptr - pos) % size + size) % size];

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSFADCTriggerDriver.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- HPSFADCTriggerDriver.java	9 Jan 2012 22:39:07 -0000	1.3
+++ HPSFADCTriggerDriver.java	3 Apr 2012 17:02:35 -0000	1.4
@@ -15,7 +15,7 @@
  *
  * @author Omar Moreno <[log in to unmask]>
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSFADCTriggerDriver.java,v 1.3 2012/01/09 22:39:07 meeg Exp $
+ * @version $Id: HPSFADCTriggerDriver.java,v 1.4 2012/04/03 17:02:35 meeg Exp $
  */
 public class HPSFADCTriggerDriver extends HPSTriggerDriver {
 
@@ -45,23 +45,7 @@
 
 	@Override
 	public void startOfData() {
-		if (clusterCollectionName == null) {
-			throw new RuntimeException("The parameter ecalCollectionName was not set!");
-		}
-
-		if (ecalName == null) {
-			throw new RuntimeException("The parameter ecalName was not set!");
-		}
-
-		if (outputFileName != null) {
-			try {
-				outputStream = new PrintWriter(outputFileName);
-			} catch (IOException ex) {
-				throw new RuntimeException("Invalid outputFilePath!");
-			}
-		}
-
-		numTriggers = 0;
+		super.startOfData();
 
 		oppositeQuadrantCount = 0;
 		clusterEnergyCount = 0;

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSTriggerDriver.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- HPSTriggerDriver.java	12 Jan 2012 22:52:09 -0000	1.6
+++ HPSTriggerDriver.java	3 Apr 2012 17:02:35 -0000	1.7
@@ -21,26 +21,27 @@
  * Applies SVT trigger latency and sends trigger signal to SVT
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSTriggerDriver.java,v 1.6 2012/01/12 22:52:09 omoreno Exp $
+ * @version $Id: HPSTriggerDriver.java,v 1.7 2012/04/03 17:02:35 meeg Exp $
  */
 public abstract class HPSTriggerDriver extends Driver {
 
-	Subdetector ecal;
-	String ecalName;
-	String clusterCollectionName;
-	IDDecoder dec = null;
-	String outputFileName;
-	PrintWriter outputStream = null;
-	int numTriggers;
+	protected Subdetector ecal;
+	private String ecalName;
+	private String clusterCollectionName;
+	protected IDDecoder dec = null;
+	private String outputFileName;
+	protected PrintWriter outputStream = null;
+	protected int numTriggers;
 	private int lastTrigger;
 	private int deadTime = 0;
-        
-        // FIFO queue to store the svt trigger time stamp 
-        public Queue<Double> svtTriggerTimeStamp
-           = new LinkedList<Double>();
-        
-        // SVT trigger latency
-        public static final double svtTriggerLatency = 80.0; // [ns]
+	// FIFO queue to store the svt trigger time stamp 
+	public Queue<Double> svtTriggerTimeStamp = new LinkedList<Double>();
+	// SVT trigger latency
+	public static final double svtTriggerLatency = 80.0; // [ns]
+	// FIFO queue to store the ECal trigger time stamp 
+	private Queue<Double> ecalTriggerTimestamps = null;
+	// ECal trigger latency
+	private static final double ecalTriggerLatency = 80.0; // [ns]
 
 	public HPSTriggerDriver() {
 	}
@@ -84,6 +85,8 @@
 		}
 
 		numTriggers = 0;
+
+		ecalTriggerTimestamps = new LinkedList<Double>();
 	}
 
 	@Override
@@ -119,27 +122,41 @@
 				}
 			}
 		}
-                
-                // If an ECal trigger signal has been sent store the trigger
-                // time offset by the SVT trigger latency
-                if(ClockSingleton.triggered()){
-                    svtTriggerTimeStamp.offer(
-                                ClockSingleton.getTime() + svtTriggerLatency);
-                    System.out.println("Trigger added");
-                }
-                
-                // Check if there are any pending SVT triggers to process
-                if(svtTriggerTimeStamp.peek() != null 
-                    && ClockSingleton.getTime() == svtTriggerTimeStamp.peek()){
-                    
-                    if(outputStream != null){
-                        outputStream.printf("SVT Trigger sent on event %d\n", event.getEventNumber());
-                    }
-                    
-                    // Send a trigger signal to the SVT
-                    HPSAPV25.triggerBit = true;
-                    svtTriggerTimeStamp.remove();
-                }
+
+		// If an ECal trigger signal has been sent store the trigger
+		// time offset by the trigger latencies
+		if (ClockSingleton.triggered()) {
+			svtTriggerTimeStamp.offer(
+					ClockSingleton.getTime() + svtTriggerLatency);
+			ecalTriggerTimestamps.add(ClockSingleton.getTime() + ecalTriggerLatency);
+			System.out.println("Trigger added");
+		}
+
+		// Check if there are any pending SVT triggers to process
+		if (svtTriggerTimeStamp.peek() != null
+				&& ClockSingleton.getTime() == svtTriggerTimeStamp.peek()) {
+
+			if (outputStream != null) {
+				outputStream.printf("SVT trigger sent on event %d\n", event.getEventNumber());
+			}
+
+			// Send a trigger signal to the SVT
+			HPSAPV25.triggerBit = true;
+			svtTriggerTimeStamp.remove();
+		}
+
+		// Check if there are any pending ECal triggers to process
+		if (ecalTriggerTimestamps.peek() != null
+				&& ClockSingleton.getTime() >= ecalTriggerTimestamps.peek()) {
+
+			if (outputStream != null) {
+				outputStream.printf("ECal trigger sent on event %d\n", event.getEventNumber());
+			}
+
+			// Send a trigger signal to the ECal
+			HPSEcalReadoutDriver.triggerBit = true;
+			ecalTriggerTimestamps.remove();
+		}
 	}
 
 	public abstract boolean testTrigger(List<HPSEcalCluster> clusters);

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalReadoutDriver.java 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- HPSEcalReadoutDriver.java	9 Dec 2011 23:40:21 -0000	1.15
+++ HPSEcalReadoutDriver.java	3 Apr 2012 17:02:35 -0000	1.16
@@ -15,128 +15,141 @@
  * Performs readout of ECal hits.
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalReadoutDriver.java,v 1.15 2011/12/09 23:40:21 meeg Exp $
+ * @version $Id: HPSEcalReadoutDriver.java,v 1.16 2012/04/03 17:02:35 meeg Exp $
  */
 public abstract class HPSEcalReadoutDriver<T> extends Driver {
 
-    Subdetector ecal;
-    String ecalCollectionName;
-    String ecalName;
-    String ecalRawCollectionName = "EcalRawHits";
-    String ecalReadoutName = "EcalHits";
+	Subdetector ecal;
+	String ecalCollectionName;
+	String ecalName;
+	String ecalRawCollectionName = "EcalRawHits";
+	String ecalReadoutName = "EcalHits";
 	Class hitClass;
-    //hit type as in org.lcsim.recon.calorimetry.CalorimeterHitType
-    int hitType = 0;
-    //number of bunches in readout cycle
-    int readoutCycle = 1;
-    //minimum readout value to write a hit
-    double threshold = 0.0;
-    //LCIO flags
-    int flags = 0;
-    //readout period in ns
-    double readoutPeriod = 2.0;
-    //readout period time offset in ns
-    double readoutOffset = 0.0;
-    //readout period counter
-    int readoutCounter;
-
-    public HPSEcalReadoutDriver() {
-        flags += 1 << LCIOConstants.CHBIT_LONG; //store position
-        flags += 1 << LCIOConstants.RCHBIT_ID1; //store cell ID
-
-    }
-
-    public void setEcalReadoutName(String ecalReadoutName) {
-        this.ecalReadoutName = ecalReadoutName;
-    }
-
-    public void setEcalRawCollectionName(String ecalRawCollectionName) {
-        this.ecalRawCollectionName = ecalRawCollectionName;
-    }
-
-    public void setEcalCollectionName(String ecalCollectionName) {
-        this.ecalCollectionName = ecalCollectionName;
-    }
-
-    public void setEcalName(String ecalName) {
-        this.ecalName = ecalName;
-    }
-
-    public void setReadoutCycle(int readoutCycle) {
-        this.readoutCycle = readoutCycle;
-        if (readoutCycle > 0)
-            this.readoutPeriod = readoutCycle * ClockSingleton.getDt();
-    }
-
-    public void setReadoutOffset(double readoutOffset) {
-        this.readoutOffset = readoutOffset;
-    }
-
-    public void setReadoutPeriod(double readoutPeriod) {
-        this.readoutPeriod = readoutPeriod;
-        this.readoutCycle = -1;
-    }
-
-    public void setThreshold(double threshold) {
-        this.threshold = threshold;
-    }
-
-    public void startOfData() {
-        if (ecalCollectionName == null)
-            throw new RuntimeException("The parameter ecalCollectionName was not set!");
-
-        if (ecalName == null)
-            throw new RuntimeException("The parameter ecalName was not set!");
-
-        readoutCounter = 0;
-
-        initReadout();
-    }
-
-    public void detectorChanged(Detector detector) {
-        // Get the Subdetector.
-        ecal = detector.getSubdetector(ecalName);
-    }
-
-    public void process(EventHeader event) {
-        //System.out.println(this.getClass().getCanonicalName() + " - process");
-        // Get the list of ECal hits.
-        List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
-        if (hits == null)
-            throw new RuntimeException("Event is missing ECal hits collection!");
-
-        //write hits into buffers
-        putHits(hits);
-
-        ArrayList<T> newHits = new ArrayList<T>();
-
-        //if at the end of a readout cycle, write buffers to hits
-        if (readoutCycle > 0) {
-            if ((ClockSingleton.getClock() + 1) % readoutCycle == 0) {
-                readHits(newHits);
-                readoutCounter++;
-            }
-        } else {
-            while (ClockSingleton.getTime() - readoutTime() + ClockSingleton.getDt() >= readoutPeriod) {
-                readHits(newHits);
-                readoutCounter++;
-            }
-        }
-
-        event.put(ecalRawCollectionName, newHits, hitClass, flags, ecalReadoutName);
-    }
-
-    protected double readoutTime() {
-        return readoutCounter * readoutPeriod + readoutOffset;
-    }
-
-    //read analog signal out of buffers and make hits; reset buffers
-    protected abstract void readHits(List<T> hits);
-
-    //add deposited energy to buffers
-    //must be run every event, even if the list is empty
-    protected abstract void putHits(List<CalorimeterHit> hits);
+	//hit type as in org.lcsim.recon.calorimetry.CalorimeterHitType
+	int hitType = 0;
+	//number of bunches in readout cycle
+	int readoutCycle = 1;
+	//minimum readout value to write a hit
+	double threshold = 0.0;
+	//LCIO flags
+	int flags = 0;
+	//readout period in ns
+	double readoutPeriod = 2.0;
+	//readout period time offset in ns
+	double readoutOffset = 0.0;
+	//readout period counter
+	int readoutCounter;
+	public static boolean triggerBit = false;
+
+	public HPSEcalReadoutDriver() {
+		flags += 1 << LCIOConstants.CHBIT_LONG; //store position
+		flags += 1 << LCIOConstants.RCHBIT_ID1; //store cell ID
+
+	}
+
+	public void setEcalReadoutName(String ecalReadoutName) {
+		this.ecalReadoutName = ecalReadoutName;
+	}
+
+	public void setEcalRawCollectionName(String ecalRawCollectionName) {
+		this.ecalRawCollectionName = ecalRawCollectionName;
+	}
+
+	public void setEcalCollectionName(String ecalCollectionName) {
+		this.ecalCollectionName = ecalCollectionName;
+	}
+
+	public void setEcalName(String ecalName) {
+		this.ecalName = ecalName;
+	}
+
+	public void setReadoutCycle(int readoutCycle) {
+		this.readoutCycle = readoutCycle;
+		if (readoutCycle > 0) {
+			this.readoutPeriod = readoutCycle * ClockSingleton.getDt();
+		}
+	}
+
+	public void setReadoutOffset(double readoutOffset) {
+		this.readoutOffset = readoutOffset;
+	}
+
+	public void setReadoutPeriod(double readoutPeriod) {
+		this.readoutPeriod = readoutPeriod;
+		this.readoutCycle = -1;
+	}
+
+	public void setThreshold(double threshold) {
+		this.threshold = threshold;
+	}
+
+	public void startOfData() {
+		if (ecalCollectionName == null) {
+			throw new RuntimeException("The parameter ecalCollectionName was not set!");
+		}
+
+		if (ecalName == null) {
+			throw new RuntimeException("The parameter ecalName was not set!");
+		}
+
+		readoutCounter = 0;
+
+		initReadout();
+	}
+
+	public void detectorChanged(Detector detector) {
+		// Get the Subdetector.
+		ecal = detector.getSubdetector(ecalName);
+	}
+
+	public void process(EventHeader event) {
+		//System.out.println(this.getClass().getCanonicalName() + " - process");
+		// Get the list of ECal hits.
+		List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
+		if (hits == null) {
+			throw new RuntimeException("Event is missing ECal hits collection!");
+		}
+
+		//write hits into buffers
+		putHits(hits);
+
+		ArrayList<T> newHits = new ArrayList<T>();
+
+		//if at the end of a readout cycle, write buffers to hits
+		if (readoutCycle > 0) {
+			if ((ClockSingleton.getClock() + 1) % readoutCycle == 0) {
+				readHits(newHits);
+				readoutCounter++;
+			}
+		} else {
+			while (ClockSingleton.getTime() - readoutTime() + ClockSingleton.getDt() >= readoutPeriod) {
+				readHits(newHits);
+				readoutCounter++;
+			}
+		}
+
+		event.put(ecalRawCollectionName, newHits, hitClass, flags, ecalReadoutName);
+
+		if (triggerBit) {
+			processTrigger(event);
+			triggerBit = false;
+		}
+	}
+
+	protected double readoutTime() {
+		return readoutCounter * readoutPeriod + readoutOffset;
+	}
+
+	//read analog signal out of buffers and make hits; reset buffers
+	protected abstract void readHits(List<T> hits);
+
+	//add deposited energy to buffers
+	//must be run every event, even if the list is empty
+	protected abstract void putHits(List<CalorimeterHit> hits);
 
-    //initialize buffers
-    protected abstract void initReadout();
+	protected void processTrigger(EventHeader event) {
+	}
+
+	//initialize buffers
+	protected abstract void initReadout();
 }
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/monitoring
MonitoringExample.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- MonitoringExample.java	2 Apr 2012 18:59:12 -0000	1.6
+++ MonitoringExample.java	3 Apr 2012 17:02:35 -0000	1.7
@@ -15,7 +15,6 @@
 import org.jlab.coda.jevio.EvioEvent;
 import org.jlab.coda.jevio.EvioReader;
 import org.lcsim.event.EventHeader;
-import org.lcsim.hps.evio.LCSimEventBuilder;
 import org.lcsim.hps.evio.LCSimTestRunEventBuilder;
 import org.lcsim.hps.monitoring.ConnectionStatusPanel.ConnectionStatus;
 import org.lcsim.job.JobControlManager;
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