Commit in hps-java/src/main/java/org/lcsim/hps/conditions on MAIN | |||
ecal/EcalChannel.java | +35 | 1.1 -> 1.2 | |
/EcalChannelConverter.java | +13 | 1.1 -> 1.2 | |
/EcalConditions.java | +53 | -6 | 1.1 -> 1.2 |
/EcalConditionsLoader.java | +13 | -1 | 1.1 -> 1.2 |
/EcalGain.java | +28 | -3 | 1.1 -> 1.2 |
/EcalGainCollection.java | +1 | -3 | 1.1 -> 1.2 |
/EcalGainConverter.java | +13 | -11 | 1.1 -> 1.2 |
svt/SvtConditions.java | +6 | -1 | 1.5 -> 1.6 |
/SvtConditionsLoader.java | +10 | -2 | 1.3 -> 1.4 |
+172 | -27 |
add doc
diff -u -r1.1 -r1.2 --- EcalChannel.java 25 Sep 2013 22:14:24 -0000 1.1 +++ EcalChannel.java 25 Sep 2013 22:36:52 -0000 1.2 @@ -4,6 +4,9 @@
* This class encapsulates all the information about a single ECal channel, e.g. one crystal. * This includes the ID from the conditions database; the crate, slot, and channel numbers * from the DAQ hardware; and the physical x and y values of the geometric crystal volumes.
+ * Each of these three pieces of data specifies a unique channel, so the information is in + * some sense redundant. This class allows all these values to be associated by channel + * in the same place.
* @author Jeremy McCormick <[log in to unmask]> */ public class EcalChannel {
@@ -32,30 +35,58 @@
this.y = y; }
+ /** + * Get the crate number. + * @return The crate number. + */
public int getCrate() { return crate; }
+ /** + * Get the slot number. + * @return The slot number. + */
public int getSlot() { return slot; }
+ /** + * Get the channel number. + * @return The channel number. + */
public int getChannel() { return channel; }
+ /** + * Get the x value. + * @return The x value. + */
public int getX() { return x; }
+ /** + * Get the y value. + * @return The y value. + */
public int getY() { return y; }
+ /** + * Get the ID. + * @return The ID of the channel. + */
public int getId() { return id; }
+ /** + * Implementation of equals. + * @return True if objects are equal; false if not. + */
public boolean equals(Object o) { if (o == null) { return false;
@@ -75,6 +106,10 @@
&& c.getY() == y; }
+ /** + * Implement of string conversion. + * @return The string representation of this channel data. + */
public String toString() { return "id: " + id + ", crate: " + crate
diff -u -r1.1 -r1.2 --- EcalChannelConverter.java 25 Sep 2013 22:14:24 -0000 1.1 +++ EcalChannelConverter.java 25 Sep 2013 22:36:52 -0000 1.2 @@ -11,8 +11,17 @@
import org.lcsim.hps.conditions.ConnectionManager; import org.lcsim.hps.conditions.DatabaseConditionsConverter;
+/** + * This class creates the {@link EcalChannelMap} from the conditions table containing the channel data. + * @author Jeremy McCormick <[log in to unmask]> + */
public class EcalChannelConverter extends DatabaseConditionsConverter<EcalChannelMap> {
+ /** + * Load the data from the conditions database. + * @param manager The conditions manager. + * @param name The name of the conditions set. + */
public EcalChannelMap getData(ConditionsManager manager, String name) { // Collection to be returned to caller.
@@ -72,6 +81,10 @@
return channels; }
+ /** + * Get the type that this converter handles. + * @return The type handled by this converter. + */
public Class<EcalChannelMap> getType() { return EcalChannelMap.class; }
diff -u -r1.1 -r1.2 --- EcalConditions.java 25 Sep 2013 22:14:24 -0000 1.1 +++ EcalConditions.java 25 Sep 2013 22:36:52 -0000 1.2 @@ -1,11 +1,16 @@
package org.lcsim.hps.conditions.ecal;
-import java.io.PrintStream;
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set;
+/** + * This class allows accses to all ECal conditions from the database, + * including gain, pedestal and bad channel settings per crystal. + * + * @author Jeremy McCormick <[log in to unmask]> + */
public class EcalConditions { EcalChannelMap channels = new EcalChannelMap();
@@ -13,56 +18,98 @@
Map<EcalChannel, Double> gains = new HashMap<EcalChannel, Double>(); Map<EcalChannel, Double> pedestals = new HashMap<EcalChannel, Double>(); Set<EcalChannel> badChannels = new HashSet<EcalChannel>();
- - PrintStream ps = System.out; -
+
/** * Class constructor, which is package protected. */ EcalConditions() { }
+ /** + * Get the gain value by channel. + * This value is multiplied by an ADC count to get an energy value. + * @param channel The channel. + * @return The gain for this channel. + */
public Double getGain(EcalChannel channel) { return gains.get(channel); }
+ /** + * Get the pedestal by channel. + * @param channel The channel. + * @return The pedestal value for this channel. + */
public Double getPedestal(EcalChannel channel) { return pedestals.get(channel); }
+ /** + * Get whether or not the given channel is "bad" in some way, + * meaning it should not be used for reconstruction, etc. + * @param channel The channel. + * @return True if channel is bad; false if not. + */
public boolean isDeadChannel(EcalChannel channel) { return badChannels.contains(channel); }
+ /** + * Get the map between database IDs and <code>EcalChannel</code> objects. + * @return The channel map. + */
public EcalChannelMap getChannelMap() { return channels; }
+ /** + * Set the gain for the channel. + * @param channel The channel. + * @param gain The gain. + */
void setGain(EcalChannel channel, double gain) { gains.put(channel, gain); }
+ /** + * Set the pedestal for the channel. + * @param channel The channel. + * @param pedestal The pedestal. + */
void setPedestal(EcalChannel channel, double pedestal) { pedestals.put(channel, pedestal); }
+ /** + * Flag a channel as bad. + * @param channel The channel. + */
void addDeadChannel(EcalChannel channel) { badChannels.add(channel); }
+ /** + * Set the channel map. + * @param channels The channel map. + */
void setChannelMap(EcalChannelMap channels) { this.channels = channels; }
+ /** + * Convert this object to a string. + * @return A string representation of this object. + */
public String toString() { StringBuffer buff = new StringBuffer(); for (EcalChannel channel : channels.values()) { boolean badChannel = badChannels.contains(channel); Double gain = getGain(channel); Double pedestal = getPedestal(channel);
- ps.println(channel + ", gain: " + (gain == null ? "NONE" : gain)
+ buff.append(channel + + ", gain: " + (gain == null ? "NONE" : gain)
+ ", pedestal: " + (pedestal == null ? "NONE" : pedestal)
- + ", badChannel: " + badChannel);
+ + ", badChannel: " + badChannel + '\n');
} return buff.toString(); }
diff -u -r1.1 -r1.2 --- EcalConditionsLoader.java 25 Sep 2013 22:14:24 -0000 1.1 +++ EcalConditionsLoader.java 25 Sep 2013 22:36:52 -0000 1.2 @@ -6,10 +6,18 @@
import org.lcsim.conditions.ConditionsManager;
+/** + * This class loads all ecal conditions into an {@link EcalConditions} objects. + * @author Jeremy McCormick <[log in to unmask]> + */
public class EcalConditionsLoader {
-
+ + /** The conditions object that will be constructed. */
private EcalConditions conditions = null;
+ /** + * Load ECal conditions into the <code>conditions</code> instance variable. + */
public void load() { // Reset conditions object.
@@ -31,6 +39,10 @@
} }
+ /** + * Get the ecal conditions object that was loaded. + * @return The ecal conditions object or null if not loaded yet. + */
public EcalConditions getEcalConditions() { return conditions; }
diff -u -r1.1 -r1.2 --- EcalGain.java 25 Sep 2013 22:14:24 -0000 1.1 +++ EcalGain.java 25 Sep 2013 22:36:52 -0000 1.2 @@ -1,19 +1,44 @@
package org.lcsim.hps.conditions.ecal;
-public class EcalGain { -
+/** + * This class is a simplistic representation of gain values from the ecal + * conditions database. The assigned channels can be looked up by using the + * {@link EcalChannelMap} for the event. This class is used as input for + * setting up gains within an {@link EcalConditions} object by the + * {@link EcalConditionsLoader}. + * + * @author Jeremy McCormick <[log in to unmask]> + */ +class EcalGain { + + /** The database ID. */
private int id;
+ + /** The gain value. */
private double gain;
- public EcalGain(int id, double gain) {
+ /** + * Fully qualified class constructor. + * @param id + * @param gain + */ + EcalGain(int id, double gain) {
this.id = id; this.gain = gain; }
+ /** + * Get the database ID. + * @return The database ID. + */
public int getId() { return id; }
+ /** + * Get the gain value. + * @return The gain value. + */
public double getGain() { return gain; }
diff -u -r1.1 -r1.2 --- EcalGainCollection.java 25 Sep 2013 22:14:24 -0000 1.1 +++ EcalGainCollection.java 25 Sep 2013 22:36:52 -0000 1.2 @@ -4,8 +4,6 @@
/** * This class maps integer IDs from the database to ECal gain parameters.
- * The EcalChannelMap data structure can be used to retrieve the channel - * data from the ID.
*/
-public class EcalGainCollection extends LinkedHashMap<Integer,EcalGain> {
+class EcalGainCollection extends LinkedHashMap<Integer,EcalGain> {
}
diff -u -r1.1 -r1.2 --- EcalGainConverter.java 25 Sep 2013 22:14:24 -0000 1.1 +++ EcalGainConverter.java 25 Sep 2013 22:36:52 -0000 1.2 @@ -10,8 +10,16 @@
import org.lcsim.hps.conditions.ConnectionManager; import org.lcsim.hps.conditions.DatabaseConditionsConverter;
+/** + * This class creates an {@link EcalGainCollection} from the appropriate conditions database information. + */
public class EcalGainConverter extends DatabaseConditionsConverter<EcalGainCollection> {
+ /** + * Create the collection from the conditions database. + * @param manager The conditions manager. + * @param name The name of the conditions set. + */
public EcalGainCollection getData(ConditionsManager manager, String name) { // Collection to be returned to caller.
@@ -38,21 +46,11 @@
// Get the name of the current database being used. String database = ConnectionManager.getConnectionParameters().getDatabase();
- /* - String query = "SELECT ecal_channel_id, crate, slot, channel, gain FROM " - + database + "." + tableName + ", " - + database + "." + ECAL_CHANNELS - + "WHERE " + fieldName + " = " + fieldValue - + " AND " + tableName + ".ecal_channel_id = ecal_channels.id " - + " ORDER BY " + ECAL_CHANNELS + ".id ASC"; - */
String query = "SELECT ecal_channel_id, gain FROM " + database + "." + tableName + " WHERE " + fieldName + " = " + fieldValue + " ORDER BY id ASC";
- - //System.out.println(query); -
+
// Execute the query and get the results. statement = connection.createStatement(); resultSet = statement.executeQuery(query);
@@ -87,6 +85,10 @@
return gains; }
+ /** + * Get the type handled by this converter. + * @return The type handled by this converter. + */
public Class<EcalGainCollection> getType() { return EcalGainCollection.class; }
diff -u -r1.5 -r1.6 --- SvtConditions.java 24 Sep 2013 02:51:35 -0000 1.5 +++ SvtConditions.java 25 Sep 2013 22:36:53 -0000 1.6 @@ -6,13 +6,18 @@
import org.lcsim.detector.tracker.silicon.SiSensor; /**
+ * This class models all available SVT conditions data, including + * noise, pedestal, shaping time, and time shift by channel.
* * @author Omar Moreno <[log in to unmask]> * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: SvtConditions.java,v 1.5 2013/09/24 02:51:35 jeremy Exp $
+ * @version $Id: SvtConditions.java,v 1.6 2013/09/25 22:36:53 jeremy Exp $
*/ public class SvtConditions {
+ /** + * Data maps for SVT conditions. + */
private Map<SiSensor, double[]> noiseMap = new HashMap<SiSensor, double[]>(); private Map<SiSensor, double[]> pedestalMap = new HashMap<SiSensor, double[]>(); private Map<SiSensor, double[]> tpMap = new HashMap<SiSensor, double[]>();
diff -u -r1.3 -r1.4 --- SvtConditionsLoader.java 25 Sep 2013 22:14:24 -0000 1.3 +++ SvtConditionsLoader.java 25 Sep 2013 22:36:53 -0000 1.4 @@ -11,12 +11,16 @@
import static org.lcsim.hps.conditions.ConditionsConstants.SVT_CALIBRATIONS; /**
- *
+ * This class creates an {@link SvtConditions} object from the conditions database.
*/ public class SvtConditionsLoader {
+ // Object to be returned to caller.
private SvtConditions conditions = null;
-
+ + /** + * Load the SVT conditions. + */
public void load() { // Get the default conditions manager. This needs to be setup beforehand with the detector.
@@ -56,6 +60,10 @@
} }
+ /** + * Get the SVT conditions. + * @return The SVT conditions or null if not loaded yet. + */
public SvtConditions getSvtConditions() { return conditions; }
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