Commit in GeomConverter/src/org/lcsim/detector/tracker/silicon on MAIN | |||
HpsSiSensor.java | +66 | -53 | 1.2 -> 1.3 |
remove sensor state for axial and half; figure it out on the fly; add missing gain setting; add a few additional utility methods
diff -u -r1.2 -r1.3 --- HpsSiSensor.java 10 Oct 2013 01:46:54 -0000 1.2 +++ HpsSiSensor.java 11 Oct 2013 00:56:07 -0000 1.3 @@ -11,33 +11,30 @@
import org.lcsim.detector.identifier.IIdentifierHelper; /**
- * This class extends {@link SiSensor} with HPS-specific functionality. Since there are - * a large number of extra parameters that would need to be included in a fully - * qualified class constructor, public setters are used instead.
+ * This class extends {@link SiSensor} with information specific to HPS SVT sensors, + * including FPGA and hybrid numbers, as well as time variant conditions data per channel + * such as gain, noise, etc.
* @author Jeremy McCormick <[log in to unmask]> */ public class HpsSiSensor extends SiSensor {
- // Sensor setup information. - int fpga; - int hybrid; - int layer; - int nchannels; - boolean top; - boolean axial;
+ /** Hardware setup information. */ + protected int fpga; + protected int hybrid; + private final static int DEFAULT_CHANNELS = 640; + protected int nchannels = DEFAULT_CHANNELS;
- // Time variable conditions data.
+ /** Time variant conditions data. */
Map<Integer,Double> pedestalMap = new HashMap<Integer,Double>(); Map<Integer,Double> noiseMap = new HashMap<Integer,Double>(); Map<Integer,Double> offsetMap = new HashMap<Integer,Double>();
+ Map<Integer,Double> gainMap = new HashMap<Integer,Double>();
Map<Integer,Double> t0Map = new HashMap<Integer,Double>(); Map<Integer,double[]> pulseParameterMap = new HashMap<Integer,double[]>(); Set<Integer> badChannels = new HashSet<Integer>();
- - private static final boolean debug = true; -
+
/**
- * This class constructor matches that of <code>SiSensor</code>.
+ * This class constructor matches the signature of <code>SiSensor</code>.
* @param sensorid The sensor ID. * @param name The name of the sensor. * @param parent The parent DetectorElement.
@@ -52,24 +49,40 @@
IIdentifier id) { super(sensorid, name, parent, support, id);
- if (debug) - System.out.println("created HpsSiSensor: " + name);
} /**
- * Get whether this sensor is in a top layer.
+ * 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 top;
+ return getModuleNumber() % 2 == 0;
} /**
- * Get whether this sensor is in a bottom layer.
+ * 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 top == false;
+ 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();
} /**
@@ -77,9 +90,14 @@
* @return True if sensor is axial; false if not. */ public boolean isAxial() {
- return axial;
+ if (this.isTopLayer() && getLayerNumber() % 2 == 1) { + return true; + } else if (!isTopLayer() && getLayerNumber() % 2 == 0) { + return true; + } + return false;
}
-
+
/** * Get the pedestal for the given channel. * @param channel The channel number.
@@ -97,6 +115,16 @@
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. + * + */ + public Double getGain(int channel) { + return gainMap.get(channel); + }
/** * Get the time offset for the given channel.
@@ -172,7 +200,7 @@
* @return The layer number of the sensor. */ public int getLayerNumber() {
- return layer;
+ return getIdentifierHelper().getValue(getIdentifier(), "layer");
} /**
@@ -188,24 +216,7 @@
expId.setValue(idx, channel); return helper.pack(expId).getValue(); }
- - /** - * Set this sensor as being in the top layer or not. - * If this is set to false, then it is assumed to be in the bottom layer. - * @param top The top layer setting. - */ - public void setTopLayer(boolean top) { - this.top = top; - } - - /** - * Set whether or not this sensor is axial. - * @param axial The axial setting. - */ - public void setAxial(boolean axial) { - this.axial = axial; - } -
+
/** * Set the pedestal value for the given channel. * @param channel The channel number.
@@ -223,6 +234,15 @@
public void setNoise(int channel, double noise) { noiseMap.put(channel, noise); }
+ + /** + * 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 time offset for the given channel.
@@ -262,7 +282,7 @@
} /**
- * Set the number of channels in this sensor.
+ * Set the number of channels in this sensor.
* @param nchannels The number of channels in the sensor. */ public void setNumberOfChannels(int nchannels) {
@@ -284,19 +304,11 @@
public void setHybridNumber(int hybrid) { this.hybrid = hybrid; }
- - /** - * Set the layer number of the sensor. - * @param layer The layer number. - */ - public void setLayerNumber(int layer) { - this.layer = layer; - }
/**
- * Reset the time dependent conditions of this sensor.
+ * Reset the time dependent conditions data of this sensor.
* This does NOT reset the sensor setup information, which is
- * assumed to be fixed once set.
+ * assumed to be fixed once it is setup for a given session.
*/ public void reset() { pedestalMap.clear();
@@ -305,5 +317,6 @@
t0Map.clear(); pulseParameterMap.clear(); badChannels.clear();
+ gainMap.clear();
} }
\ No newline at end of file
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