Print

Print


Commit in projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon on MAIN
HpsTestRunSiSensor.java+41-2563358 -> 3359
Instead of extending SiSensor, extend HpsSiSensor and add getters/setters for FPGA ID and Hybrid ID.  If a user tries to access the FEB ID or FEB Hybrid ID, throw an UnsupportedOperation exception.

projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon
HpsTestRunSiSensor.java 3358 -> 3359
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java	2014-10-07 00:05:24 UTC (rev 3358)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java	2014-10-11 19:04:14 UTC (rev 3359)
@@ -1,40 +1,24 @@
 package org.lcsim.detector.tracker.silicon;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.identifier.IExpandedIdentifier;
 import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
 
 
 /**
- * This class extends {@link SiSensor} with conditions specific to HPS SVT half-modules
+ * This class extends {@link HpsSiSensor} with conditions specific to HPS SVT half-modules
  * (sensors) used during the test run.  Each half-module is uniquely identified by 
  * an FPGA/Hybrid ID pair which is then related to calibration conditions such as
  * baseline, noise gain etc.
+ * 
  * @author Jeremy McCormick <[log in to unmask]>
  * @author Omar Moreno <[log in to unmask]>
  */
-public class HpsTestRunSiSensor extends SiSensor {
+public class HpsTestRunSiSensor extends HpsSiSensor {
 	
-	/** Hardware setup information. */
-	protected int fpga;
-	protected int hybrid;
-	public final static int DEFAULT_CHANNELS = 640;
-	protected int nchannels = DEFAULT_CHANNELS;
+	
+	protected int fpgaID;
+	protected int hybridID;
 			
-	/** Time variant conditions data. */
-	Map<Integer,Double> pedestalMap = new HashMap<Integer,Double>();	
-	Map<Integer,Double> noiseMap = new HashMap<Integer,Double>();
-	Map<Integer,Double> gainMap = new HashMap<Integer,Double>();
-	Map<Integer,Double> offsetMap = new HashMap<Integer,Double>();
-	Map<Integer,double[]> shapeFitParametersMap = new HashMap<Integer,double[]>();
-	Set<Integer> badChannels = new HashSet<Integer>();
-	double t0Shift = 0;
 	
 	/**
 	 * This class constructor matches the signature of <code>SiSensor</code>.
@@ -54,264 +38,65 @@
 		super(sensorid, name, parent, support, id);
     }
 	
-	/**
-	 * Get whether this sensor is in the top half of the detector.
-	 * Modules in the top half have module numbers of 0 or 2.
-	 * @return True if sensor is in top layer; false if not.
-	 */
-	public boolean isTopLayer() {
-		return getModuleNumber() % 2 == 0;
-	}
 	
-	/**
-	 * Get whether this sensor is in the bottom half of the detector.
-	 * Modules in the bottom half have module numbers of 1 or 3.
-	 * @return True if sensor is in bottom layer; false if not.
-	 */
-	public boolean isBottomLayer() {
-		return getModuleNumber() % 2 != 0;
-	}
-	
-	/**
-	 * Get the module number of the sensor.
-	 * @return The module number of the sensor.
-	 */
-	public int getModuleNumber() {
-		return getTrackerIdHelper().getModuleValue(getIdentifier());
-	}
-	
-	/**
-	 * Get the specific type of identifier helper for this component.
-	 * @return The identifier helper.
-	 */
-	public SiTrackerIdentifierHelper getTrackerIdHelper() {
-		return (SiTrackerIdentifierHelper)getIdentifierHelper();
-	}
 
 	/**
-	 * Get whether this sensor is axial.
-	 * @return True if sensor is axial; false if not.
+	 * Get the FPGA ID associated with this sensor.
+	 * 
+	 * @return The FPGA ID
 	 */
-	public boolean isAxial() {
-        if (isTopLayer() && getLayerNumber() % 2 == 1) {
-            return true;
-        } else if (!isTopLayer() && getLayerNumber() % 2 == 0) {
-            return true;
-        }
-        return false;
+	public int getFpgaID() {
+		return fpgaID;
 	}
-		
-	/**
-	 * Get the pedestal for the given channel.
-	 * @param channel The channel number.
-	 * @return The pedestal value for the channel or null if not set.
-	 */
-	public Double getPedestal(int channel) {
-		return pedestalMap.get(channel);
-	}
 
 	/**
-	 * Get the noise for the given channel.
-	 * @param channel The channel number.
-	 * @return The noise value for the channel or null if not set.
-	 */
-	public Double getNoise(int channel) {
-		return noiseMap.get(channel);
-	}
-	
-	/**
-	 * Get the gain for the given channel.
-	 * @param channel The channel number.
-	 * @return The gain value for the channel or null if not set.
+	 * Get the hybrid ID associated with this sensor.
 	 * 
+	 * @return The hybrid ID
 	 */
-	public Double getGain(int channel) {
-		return gainMap.get(channel);
-	}	
-
-	/**
-	 * Get the offset for the given channel.
-	 * @param channel The channel number.
-	 * @return The time offset for the channel or null if not set.
-	 */
-	public Double getOffset(int channel) {
-		return offsetMap.get(channel);
+	public int getHybridID() {
+		return hybridID;
 	}
-	
-	/**
-	 * Get the shape fit results (t0, amplitude, chi2 prob. and errors)
-	 * associated with a given channel.
-	 * @param channel The channel number.
-	 * @return The shape fit results for the channel.
-	 */
-	public double[] getShapeFitParameters(int channel) {
-		return shapeFitParametersMap.get(channel);
-	}
 
-	/**
-	 * Get whether the given channel is bad or not.
-	 * @param channel The channel number.
-	 * @return True if channel is bad; false if not.
-	 */
-	public boolean isBadChannel(int channel) {
-		return badChannels.contains(channel);
-	}	
-	
-	/**
-	 * Get whether the given channel number if valid.
-	 * @param channel The channel number.
-	 * @return True if channel number is valid; false if not.
-	 */
-	public boolean isValidChannel(int channel) {
-		return channel >= 0 && channel < nchannels;
+	@Override
+	public int getFebID(){
+		throw new UnsupportedOperationException(
+				"A test run half-module was not identified using a FEB ID");
 	}
-
-	/**
-	 * Get the FPGA number of the sensor.
-	 * @return The FPGA number of the sensor.
-	 */
-	public int getFpgaNumber() {
-		return fpga;
-	}
-
-	/**
-	 * Get the hybrid number of the sensor.
-	 * @return The hybrid number of the sensor.
-	 */
-	public int getHybridNumber() {
-		return hybrid;
-	}
-
-	/**
-	 * Get the layer number of the sensor.
-	 * @return The layer number of the sensor.
-	 */
-	public int getLayerNumber() {
-		return getIdentifierHelper().getValue(getIdentifier(), "layer");
-	}
 	
-	/**
-	 * Get the t0 shift for this sensor.
-	 * @return The t0 shift for this sensor.	
-	 */
-	public double getT0Shift() {
-		return t0Shift;
+	@Override
+	public int getFebHybridID(){
+		throw new UnsupportedOperationException(
+				"A test run half-module was not identified using a FEB Hybrid ID");
 	}
-	
-	/**
-	 * Create an identifier for a channel.
-	 * @param channel The channel number.
-	 * @return The identifier for the channel.
-	 */
-	public long makeChannelId(int channel) {
-		IIdentifierHelper helper = getIdentifierHelper();
-		IIdentifier id = getIdentifier();
-		IExpandedIdentifier expId = helper.unpack(id);
-		int idx = helper.getIdentifierDictionary().getFieldIndex("channel");
-		expId.setValue(idx, channel);
-		return helper.pack(expId).getValue();
-	}
-		
-	/**
-	 * Set the pedestal value for the given channel.
-	 * @param channel The channel number.
-	 * @param pedestal The pedestal value.
-	 */
-	public void setPedestal(int channel, double pedestal) {
-		pedestalMap.put(channel, pedestal);
-	}
 
 	/**
-	 * Set the noise value for the given channel.
-	 * @param channel The channel number.
-	 * @param noise The noise value.
+	 * Set the FPGA ID associated with this sensor.
+	 * 
+	 * @param The FPGA ID
 	 */
-	public void setNoise(int channel, double noise) {
-		noiseMap.put(channel, noise);
+	public void setFpgaID(int fpgaID) {
+		this.fpgaID = fpgaID;
 	}
-	
-	/**
-	 * Set the gain value for the given channel.
-	 * @param channel The channel number.
-	 * @param gain The gain value.
-	 */
-	public void setGain(int channel, double gain) {
-		gainMap.put(channel, gain);
-	}
 
 	/**
-	 * Set the offset for the given channel.
-	 * @param channel The channel number.
-	 * @param offset The offset value.
+	 * Set the hybrid ID associated with this sensor.
+	 * 
+	 * @param The hybrid ID.
 	 */
-	public void setOffset(int channel, double offset) {
-		offsetMap.put(channel, offset);
+	public void setHybridID(int hybridID) {
+		this.hybridID = hybridID;
 	}
 	
-	/**
-	 * Set the shape fit results for the given channel.
-	 * @param channel The channel number.
-	 * @param shapeFitParameters The shape fit results array (should be length 4).
-	 */
-	public void setShapeFitParameters(int channel, double[] shapeFitParameters) {
-		if (shapeFitParameters.length != 4)
-			throw new IllegalArgumentException("Number of shape fit parameters is incorrect: " + shapeFitParameters.length);
-		shapeFitParametersMap.put(channel, shapeFitParameters);
+	@Override
+	public void setFebID(int febID){
+		throw new UnsupportedOperationException(
+				"A test run half-module was not identified using a FEB ID");
 	}
-
-	/**
-	 * Flag the given channel as bad.
-	 * @param channel The channel number.
-	 */
-	public void setBadChannel(int channel) {
-		badChannels.add(channel);
-	}
 	
-	/**
-	 * Set the number of channels in this sensor.	
-	 * @param nchannels The number of channels in the sensor.
-	 */
-	public void setNumberOfChannels(int nchannels) {
-		this.nchannels = nchannels;
+	@Override
+	public void setFebHybridID(int febHybridID){
+		throw new UnsupportedOperationException(
+				"A test run half-module was not identified using a FEB Hybrid ID");
 	}
-
-	/**
-	 * Set the FPGA number of the sensor.
-	 * @param fpga The FPGA number.
-	 */
-	public void setFpgaNumber(int fpga) {
-		this.fpga = fpga;
-	}
-
-	/**
-	 * Set the hybrid number of the sensor.
-	 * @param hybrid The hybrid number.
-	 */
-	public void setHybridNumber(int hybrid) {
-		this.hybrid = hybrid;
-	}
-	
-	/**
-	 * Get the t0 shift for this sensor.
-	 * @param t0Shift The t0 shift for this sensor.	
-	 */
-	public void setT0Shift(double t0Shift) {
-		this.t0Shift = t0Shift;
-	}
-	
-	/**
-	 * Reset the time dependent conditions data of this sensor.
-	 * This does NOT reset the sensor setup information, which is
-	 * assumed to be fixed once it is setup for a given session.
-	 */
-	public void reset() {
-		pedestalMap.clear();	
-		noiseMap.clear();
-		gainMap.clear();
-		offsetMap.clear();
-		shapeFitParametersMap.clear();
-		badChannels.clear();
-		t0Shift = 0;
-	}
-
 }
SVNspam 0.1


Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1