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:

r1643 - /java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 3 Dec 2014 23:55:30 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (159 lines)

Author: [log in to unmask]
Date: Wed Dec  3 15:55:26 2014
New Revision: 1643

Log:
Test run SVT EVIO reader used to convert SVT bank integer data to LCIO objects.

Added:
    java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java   (with props)

Added: java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java	(added)
+++ java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java	Wed Dec  3 15:55:26 2014
@@ -0,0 +1,143 @@
+package org.hps.evio;
+
+import java.util.List;
+
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
+import org.lcsim.detector.tracker.silicon.HpsTestRunSiSensor;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.base.BaseRawTrackerHit;
+import org.lcsim.geometry.Subdetector;
+
+import org.hps.util.Pair;
+
+import static org.hps.evio.EventConstants.TEST_RUN_SVT_BANK_TAG;
+
+/**
+ *	Test run SVT EVIO reader used to convert SVT bank raw integers to LCIO
+ *	objects.
+ * 
+ * 	@author Omar Moreno <[log in to unmask]>
+ * 	@date November 20, 2014
+ *
+ */
+public class TestRunSvtEvioReader extends AbstractSvtEvioReader {
+
+	//-----------------//
+	//--- Constants ---//
+	//-----------------//
+
+	private static final int DATA_HEADER_LENGTH = 7;
+	private static final int DATA_TAIL_LENGTH = 1; 
+	private static final int MAX_FPGA_ID = 6;
+	
+	/** 
+	 * Default Constructor
+	 */
+	public TestRunSvtEvioReader() { }; 
+	
+	/**
+	 *	Get the maximum data bank tag in the event.  For the test run, this
+	 *	corresponds to the maximum FPGA ID of 6.  The data contained an 
+	 *	additional FPGA bank with tag = 7, but this wasn't used.
+	 *
+	 *	@return Maximum FPGA ID
+	 */
+	@Override
+	protected int getMaxDataBankTag() {
+		return MAX_FPGA_ID;
+	}
+	
+	/**
+	 *	Get the SVT bank tag.  For the test run, the bank tag was set to 0x3.
+	 *
+	 *	@return The SVT bank tag.
+	 */
+	@Override
+	protected int getSvtBankTag() { 
+		return TEST_RUN_SVT_BANK_TAG; 
+	}
+	
+	/**
+	 *	Get the number of 32 bit integers composing the data block header. For
+	 * 	the test run, the header consisted of 7 32 bit integers.
+	 *
+	 *	@return The header length. 
+	 */
+	@Override
+	protected int getDataHeaderLength() {
+		return DATA_HEADER_LENGTH;
+	}
+	
+	/**
+	 * 	Get the number of 32 bit integers composing the data block tail.  For
+	 * 	the test run, the tail consisted of a single 32 bit integer.
+	 * 
+	 *	@return The tail length
+	 */
+	@Override
+	protected int getDataTailLength() {
+		return DATA_TAIL_LENGTH;
+	}
+
+	/**
+	 *	A method to setup a mapping between a DAQ pair (FPGA/Hybrid) and the 
+	 *	corresponding sensor.
+	 *
+	 *	@param subdetector - The tracker {@link Subdetector} object
+	 */
+	// TODO: This can probably be done when the conditions are loaded.
+	@Override
+	protected void setupDaqMap(Subdetector subdetector) { 
+	
+        List<HpsTestRunSiSensor> sensors 
+        	= subdetector.getDetectorElement().findDescendants(HpsTestRunSiSensor.class);
+		for (HpsTestRunSiSensor sensor : sensors) { 
+			Pair<Integer, Integer> daqPair 
+				= new Pair<Integer, Integer>(sensor.getFpgaID(), sensor.getHybridID());
+			daqPairToSensor.put(daqPair, sensor);
+		}
+		this.isDaqMapSetup = true;
+	}
+
+	/**
+	 *	Get the sensor associated with a set of samples.  The sample block of
+	 *	data is used to extract the FPGA ID and Hybrid ID corresponding to 
+	 *	the samples. 
+	 *
+	 *	@param data - sample block of data
+	 *	@return The sensor associated with a set of sample 
+	 */
+	@Override
+	protected HpsSiSensor getSensor(int[] data) {
+		//System.out.println("[ " + this.getClass().getSimpleName() + " ]: FPGA ID: " + SvtEvioUtils.getFpgaID(data));
+		//System.out.println("[ " + this.getClass().getSimpleName() + " ]: Hybrid ID: " + SvtEvioUtils.getHybridID(data));
+		
+        Pair<Integer, Integer> daqPair 
+        	= new Pair<Integer, Integer>(SvtEvioUtils.getFpgaID(data),
+        								 SvtEvioUtils.getHybridID(data));
+		return daqPairToSensor.get(daqPair);
+	}
+
+
+	/**
+	 * 	Make a {@link RawTrackerHit} from a set of samples.
+	 * 
+	 *	@param data - sample block of data
+	 * 	@return A raw hit
+	 */
+	@Override
+	protected RawTrackerHit makeHit(int[] data) {
+		
+		HpsSiSensor sensor = this.getSensor(data); 
+		int channel = SvtEvioUtils.getChannelNumber(data);
+		//System.out.println("[ " + this.getClass().getSimpleName() + " ]: Channel ID: " + SvtEvioUtils.getChannelNumber(data));
+		long cellID = sensor.makeChannelID(channel);
+		int hitTime = 0;
+		//short[] samples = SvtEvioUtils.getSamples(data);
+		//for(int sampleN = 0; sampleN < 6; sampleN++) { 
+		//	System.out.println("[ " + this.getClass().getSimpleName() + " ]: Sample " + sampleN + ": " + samples[sampleN]);
+		//}
+		
+		return new BaseRawTrackerHit(hitTime, cellID, SvtEvioUtils.getSamples(data), null, sensor);
+	}
+}

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