Commit in projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon on MAIN | |||
HpsSiSensor.java | +110 | -35 | 3320 -> 3321 |
Minor updates to HpsSiSensor.
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java 2014-09-12 19:07:36 UTC (rev 3320) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java 2014-09-14 07:56:37 UTC (rev 3321) @@ -15,28 +15,38 @@
* (sensors) used during the engineering run and beyond. Each half-module is uniquely * identified by a FEB ID/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 HpsSiSensor extends SiSensor {
+ //-----------------// + //--- Constants ---// + //-----------------//
public final static int STRIPS_PER_SENSOR = 639; public final static int NUMBER_OF_SAMPLES = 6;
+ public final static int NUMBER_OF_SHAPE_FIT_PARAMETERS = 3;
protected int febID; protected int febHybridID;
- - // Conditions maps - 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[]> shapeFitParametersMap = new HashMap<Integer, double[]>(); - Set<Integer> badChannels = new HashSet<Integer>(); - double t0Shift = 0;
+ protected double t0Shift = 0; + protected boolean isAxial = false; + protected boolean isStereo = false; + + //-----------------------// + //--- Conditions Maps ---// + //-----------------------// + protected Map<Integer, double[]> pedestalMap = new HashMap<Integer, double[]>(); + protected Map<Integer, double[]> noiseMap = new HashMap<Integer, double[]>(); + protected Map<Integer, Double> gainMap = new HashMap<Integer, Double>(); + protected Map<Integer, Double> offsetMap = new HashMap<Integer, Double>(); + protected Map<Integer, double[]> shapeFitParametersMap = new HashMap<Integer, double[]>(); + protected Set<Integer> badChannels = new HashSet<Integer>();
/** * 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.
@@ -56,6 +66,7 @@
/** * 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() {
@@ -65,6 +76,7 @@
/** * 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() {
@@ -73,6 +85,7 @@
/** * Get the module number of the sensor.
+ *
* @return The module number of the sensor. */ public int getModuleNumber() {
@@ -81,6 +94,7 @@
/** * Get the specific type of identifier helper for this component.
+ *
* @return The identifier helper. */ public SiTrackerIdentifierHelper getTrackerIdHelper() {
@@ -89,19 +103,25 @@
/** * Get whether this sensor is axial.
+ *
* @return True if sensor is axial; false if not. */ public boolean isAxial() {
- if (isTopLayer() && getLayerNumber() % 2 == 1) { - return true; - } else if (!isTopLayer() && getLayerNumber() % 2 == 0) { - return true; - } - return false;
+ return isAxial;
}
-
+
/**
+ * Get whether this sensor is stereo. + * + * @return True is sensor is stereo; false if not. + */ + public boolean isStereo(){ + return isStereo; + } + + /**
* Get the pedestal for the given channel and sample number.
+ *
* @param channel The channel number. * @param sample The sample number. * @return The pedestal value for the given channel and sample or null if not set.
@@ -114,6 +134,7 @@
/** * Get the noise for the given channel and sample number.
+ *
* @param channel The channel number. * @param sample The sample number. * @return The noise value for the given channel and sample or null if not set.
@@ -126,26 +147,28 @@
/** * 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.
+ * Get the offset for the given channel. + *
* @param channel The channel number.
- * @return The time offset for the channel or null if not set.
+ * @return The offset for the channel or null if not set.
*/
- public Double getTimeOffset(int channel) {
+ public Double getOffset(int channel) {
return offsetMap.get(channel); } /**
- * Get the shape fit results (t0, amplitude, chi2 prob. and errors) - * associated with a given channel.
+ * Get the shape fit parameters (amplitude, t0, tp) associated with a given + * channel. + *
* @param channel The channel number. * @return The shape fit results for the channel. */
@@ -155,6 +178,7 @@
/** * Get whether the given channel is bad or not.
+ *
* @param channel The channel number. * @return True if channel is bad; false if not. */
@@ -164,6 +188,7 @@
/** * Get the total number of channels in the sensor.
+ *
* @return The total number of channels in the sensor. */ public int getNumberOfChannels() {
@@ -172,6 +197,7 @@
/** * Get whether the given channel number if valid.
+ *
* @param channel The channel number. * @return True if channel number is valid; false if not. */
@@ -180,16 +206,18 @@
} /**
- * Get the FPGA number of the sensor. - * @return The FPGA number of the sensor.
+ * Get the front end board (FEB) ID associated with this sensor. + * + * @return The FEB ID
*/ public int getFebID() { return febID; } /**
- * Get the hybrid number of the sensor. - * @return The hybrid number of the sensor.
+ * Get the FEB hybrid ID of the sensor. + * + * @return The FEB hybrid number of the sensor.
*/ public int getFebHybridID() { return febHybridID;
@@ -197,6 +225,7 @@
/** * Get the layer number of the sensor.
+ *
* @return The layer number of the sensor. */ public int getLayerNumber() {
@@ -205,6 +234,7 @@
/** * Get the t0 shift for this sensor.
+ *
* @return The t0 shift for this sensor. */ public double getT0Shift() {
@@ -213,6 +243,7 @@
/** * Create an identifier for a channel.
+ *
* @param channel The channel number. * @return The identifier for the channel. */
@@ -227,6 +258,7 @@
/** * Set the pedestal value for all samples for a given channel.
+ *
* @param channel The channel number. * @param pedestal The pedestal values for all samples. */
@@ -238,6 +270,7 @@
/** * Set the noise value for the given channel.
+ *
* @param channel The channel number. * @param noise The noise values for all samples. */
@@ -249,6 +282,7 @@
/** * Set the gain value for the given channel.
+ *
* @param channel The channel number. * @param gain The gain value. */
@@ -257,27 +291,30 @@
} /**
- * Set the time offset for the given channel.
+ * Set the offset for the given channel. + *
* @param channel The channel number. * @param offset The offset value. */
- public void setTimeOffset(int channel, double offset) {
+ public void setOffset(int channel, double offset) {
offsetMap.put(channel, offset); } /** * 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)
+ if (shapeFitParameters.length != NUMBER_OF_SHAPE_FIT_PARAMETERS)
throw new IllegalArgumentException("Number of shape fit parameters is incorrect: " + shapeFitParameters.length); shapeFitParametersMap.put(channel, shapeFitParameters); } /** * Flag the given channel as bad.
+ *
* @param channel The channel number. */ public void setBadChannel(int channel) {
@@ -285,16 +322,18 @@
} /**
- * Set the FEB ID of the sensor. - * @param fpga The FPGA number.
+ * Set the front end board (FEB) ID of the sensor. + * + * @param FEB ID The FEB ID of the sensor.
*/ public void setFebID(int febID) { this.febID = febID; } /**
- * Set the hybrid number of the sensor. - * @param hybrid The hybrid number.
+ * Set the FEB hybrid ID of the sensor. + * + * @param FEB hybrid ID The FEB hybrid ID.
*/ public void setFebHybridID(int febHybridID) { this.febHybridID = febHybridID;
@@ -302,7 +341,8 @@
/**
- * Get the t0 shift for this sensor.
+ * Set the t0 shift for this sensor.
+ *
* @param t0Shift The t0 shift for this sensor. */ public void setT0Shift(double t0Shift) {
@@ -310,11 +350,30 @@
} /**
+ * Flag the sensor as being axial. + * + * @param true if the sensor is Axial, false otherwise + */ + public void setAxial(boolean isAxial) + { + this.isAxial = isAxial; + } + + /** + * Flag the sensor as being stereo + * + * @param true is the sensor is stereo, false otherwise + */ + public void setStereo(boolean isStereo){ + this.isStereo = isStereo; + } + + /**
* 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() {
+ public void reset(){
pedestalMap.clear(); noiseMap.clear(); offsetMap.clear();
@@ -323,4 +382,20 @@
gainMap.clear(); t0Shift = 0; }
+ + @Override + public String toString(){ + + StringBuffer buffer = new StringBuffer(); + buffer.append("HpsSiSensor: "); + buffer.append("\n"); + buffer.append("----------------------------------"); + buffer.append("\n"); + buffer.append("Layer: " + this.getLayerNumber() + "\n"); + buffer.append("Module: " + this.getModuleNumber() + "\n"); + buffer.append("----------------------------------"); + + return buffer.toString(); + } +
}
\ No newline at end of file
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