Author: [log in to unmask]
Date: Mon Nov 10 00:16:49 2014
New Revision: 1466
Log:
Format all source code in conditions module.
Modified:
java/trunk/conditions/src/main/java/org/hps/conditions/AbstractConditionsDriver.java
java/trunk/conditions/src/main/java/org/hps/conditions/AbstractIdentifier.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObject.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectCollection.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectConverter.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectException.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectUtil.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecord.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecordConverter.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeries.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeriesConverter.java
java/trunk/conditions/src/main/java/org/hps/conditions/ConnectionParameters.java
java/trunk/conditions/src/main/java/org/hps/conditions/DatabaseConditionsManager.java
java/trunk/conditions/src/main/java/org/hps/conditions/QueryBuilder.java
java/trunk/conditions/src/main/java/org/hps/conditions/TableConstants.java
java/trunk/conditions/src/main/java/org/hps/conditions/TableMetaData.java
java/trunk/conditions/src/main/java/org/hps/conditions/TestRunConditionsDriver.java
java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java
java/trunk/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamSpot.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamlineConstants.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/CalibrationDriver.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/EcalConditions.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/FieldMap.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTCalibrationConstants.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTConstants.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTSensorSetup.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/QuietBaseLCSimEvent.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/StereoPair.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/SvtUtils.java
java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/TestRunConditionsReader.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConverterRegistry.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalDetectorSetup.java
java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConverterRegistry.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java
java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java
java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsObjectTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalConditionsConverterTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalDetectorSetupTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java
java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/AbstractConditionsDriver.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/AbstractConditionsDriver.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/AbstractConditionsDriver.java Mon Nov 10 00:16:49 2014
@@ -8,10 +8,9 @@
import org.lcsim.util.Driver;
/**
- * This abstract {@link org.lcsim.util.Driver} contains the
- * general methods used to set up {@link DatabaseConditionsManager}
- * and load the conditions onto a detector. The connection
- * parameters are set by subclasses.
+ * This abstract {@link org.lcsim.util.Driver} contains the general methods used
+ * to set up {@link DatabaseConditionsManager} and load the conditions onto a
+ * detector. The connection parameters are set by subclasses.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
@@ -22,19 +21,18 @@
private String ecalSubdetectorName = "Ecal";
protected String svtSubdetectorName = "Tracker";
-
+
boolean loadSvtConditions = true;
boolean loadEcalConditions = true;
-
public void setLoadSvtConditions(boolean loadSvtConditions) {
this.loadSvtConditions = loadSvtConditions;
}
-
+
public void setLoadEcalConditions(boolean loadEcaltConditions) {
this.loadEcalConditions = loadSvtConditions;
}
-
+
public void setEcalSubdetectorName(String ecalSubdetectorName) {
this.ecalSubdetectorName = ecalSubdetectorName;
}
@@ -42,7 +40,7 @@
public void setSvtSubdetectorName(String svtSubdetectorName) {
this.svtSubdetectorName = svtSubdetectorName;
}
-
+
/**
* This method updates a new detector with SVT and ECal conditions data.
*/
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/AbstractIdentifier.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/AbstractIdentifier.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/AbstractIdentifier.java Mon Nov 10 00:16:49 2014
@@ -1,8 +1,8 @@
package org.hps.conditions;
/**
- * This class is a simplistic representation of a packaged identifier for use in the
- * conditions system.
+ * This class is a simplistic representation of a packaged identifier for use in
+ * the conditions system.
*
* @author Jeremy McCormick <[log in to unmask]>
*
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java Mon Nov 10 00:16:49 2014
@@ -6,6 +6,7 @@
import org.hps.conditions.svt.SvtDetectorSetup;
import org.lcsim.conditions.ConditionsManager;
import org.lcsim.geometry.Detector;
+
/**
* This {@link org.lcsim.util.Driver} is a subclass of
* {@link AbstractConditionsDriver} and specifies the database connection
@@ -18,13 +19,13 @@
public ConditionsDriver() {
if (ConditionsManager.defaultInstance() instanceof DatabaseConditionsManager) {
- getLogger().config("ConditionsDriver found existing DatabaseConditionsManager.");
+ getLogger().config("ConditionsDriver found existing DatabaseConditionsManager.");
manager = (DatabaseConditionsManager) ConditionsManager.defaultInstance();
} else {
manager = new DatabaseConditionsManager();
}
}
-
+
/**
* Load the {@link SvtConditions} set onto <code>HpsSiSensor</code>.
* @param detector The detector to update.
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObject.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObject.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObject.java Mon Nov 10 00:16:49 2014
@@ -3,9 +3,9 @@
import java.util.LinkedHashMap;
/**
- * This is an ORM interface for accessing conditions database information by row. It can
- * handle new or existing records. The ID values for new records are -1 which indicates
- * they are not in the database yet.
+ * This is an ORM interface for accessing conditions database information by
+ * row. It can handle new or existing records. The ID values for new records are
+ * -1 which indicates they are not in the database yet.
* @author Jeremy McCormick <[log in to unmask]>
*/
public interface ConditionsObject {
@@ -44,7 +44,8 @@
void insert() throws ConditionsObjectException;
/**
- * Select data into this object from the database using a SQL SELECT statement.
+ * Select data into this object from the database using a SQL SELECT
+ * statement.
*/
void select() throws ConditionsObjectException;
@@ -55,19 +56,22 @@
boolean isReadOnly();
/**
- * Return true if this object is new and hasn't been inserted into the database yet.
+ * Return true if this object is new and hasn't been inserted into the
+ * database yet.
* @return True if object is new.
*/
boolean isNew();
/**
- * Return true if this object's data has been modified without a database update.
+ * Return true if this object's data has been modified without a database
+ * update.
* @return True if object is dirty.
*/
boolean isDirty();
/**
- * Generic set method for field values. This will set the object to the 'dirty' state.
+ * Generic set method for field values. This will set the object to the
+ * 'dirty' state.
* @param fieldName The name of the field.
* @param fieldValue The field value.
*/
@@ -75,7 +79,8 @@
/**
* Set all of the field values on this object.
- * @param fieldValues The FieldValueMap containing pairs of names and values.
+ * @param fieldValues The FieldValueMap containing pairs of names and
+ * values.
*/
void setFieldValues(FieldValueMap fieldValues);
@@ -94,35 +99,38 @@
public <T> T getFieldValue(String field);
/**
- * Set the ConditionsTableMetaData of this object. This cannot be reset once set.
+ * Set the ConditionsTableMetaData of this object. This cannot be reset once
+ * set.
* @param tableMetaData The ConditionsTableMetaData.
* @throws ConditionsObjectException if already set
*/
void setTableMetaData(TableMetaData tableMetaData) throws ConditionsObjectException;
/**
- * Set the collection ID of this object. This cannot be reset once set to a valid ID
- * (e.g. not -1).
+ * Set the collection ID of this object. This cannot be reset once set to a
+ * valid ID (e.g. not -1).
* @param collectionId The collection ID.
* @throws ConditionsObjectException if already set
*/
void setCollectionId(int collectionId) throws ConditionsObjectException;
/**
- * Set the row ID of this object. This cannot be reset once set to a valid ID (e.g.
- * not -1).
+ * Set the row ID of this object. This cannot be reset once set to a valid
+ * ID (e.g. not -1).
* @param rowId The object's row ID.
* @throws ConditionsObjectException if already set
*/
public void setRowId(int rowId) throws ConditionsObjectException;
/**
- * Set the object to read only mode. This cannot be changed back once it is set.
+ * Set the object to read only mode. This cannot be changed back once it is
+ * set.
*/
void setIsReadOnly();
/**
- * Simple class extending <code>java.lang.Map</code> that maps field names to values.
+ * Simple class extending <code>java.lang.Map</code> that maps field names
+ * to values.
*/
public static final class FieldValueMap extends LinkedHashMap<String, Object> {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectCollection.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectCollection.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectCollection.java Mon Nov 10 00:16:49 2014
@@ -18,7 +18,7 @@
protected ConditionsObjectCollection() {
}
-
+
public ConditionsObjectCollection(TableMetaData tableMetaData, int collectionId, boolean isReadOnly) {
this.tableMetaData = tableMetaData;
this.collectionId = collectionId;
@@ -27,7 +27,7 @@
this.isNew = true;
}
}
-
+
public ConditionsRecord getConditionsRecord() {
return conditionsRecord;
}
@@ -44,8 +44,10 @@
return getObjects().contains(object);
}
- // TODO: Should check here if object has an existing collection ID that is different
- // from this collection's, in which case this collection becomes "mixed" and it should
+ // TODO: Should check here if object has an existing collection ID that is
+ // different
+ // from this collection's, in which case this collection becomes "mixed" and
+ // it should
// be
// flagged as read only.
public void add(ObjectType object) throws ConditionsObjectException {
@@ -53,7 +55,8 @@
throw new IllegalArgumentException("Collection already contains this object.");
}
try {
- // Only assign a collection ID to the object if this collection has a valid ID
+ // Only assign a collection ID to the object if this collection has
+ // a valid ID
// and the object does not have one already.
if (getCollectionId() != -1)
object.setCollectionId(getCollectionId());
@@ -85,7 +88,8 @@
setIsDirty(false);
}
- // TODO: This does not need to loop. It should just call delete on the collection ID
+ // TODO: This does not need to loop. It should just call delete on the
+ // collection ID
// value.
public void delete() throws ConditionsObjectException {
if (isReadOnly()) {
@@ -96,7 +100,8 @@
}
}
- // TODO: This should not loop. It should select all the objects with a matching
+ // TODO: This should not loop. It should select all the objects with a
+ // matching
// collection ID
// from the database.
public void select() throws ConditionsObjectException, SQLException {
@@ -105,7 +110,8 @@
}
}
- // TODO: This method needs to get the next collection ID from the conditions manager.
+ // TODO: This method needs to get the next collection ID from the conditions
+ // manager.
// TODO: This operation should lock the table.
public void insert() throws ConditionsObjectException, SQLException {
if (!isNew()) {
@@ -131,7 +137,8 @@
this.isDirty = isDirty;
}
- // TODO: This can probably just check if collection ID is not valid e.g. equals -1.
+ // TODO: This can probably just check if collection ID is not valid e.g.
+ // equals -1.
public boolean isNew() {
return isNew;
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectConverter.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectConverter.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectConverter.java Mon Nov 10 00:16:49 2014
@@ -9,8 +9,8 @@
/**
* <p>
- * Implementation of default conversion from database tables to a {@link ConditionsObject}
- * class.
+ * Implementation of default conversion from database tables to a
+ * {@link ConditionsObject} class.
* </p>
* <p>
* This class actually returns collections and not individual objects.
@@ -21,16 +21,18 @@
* @param <T> The type of the returned data which should be a class extending
* {@link ConditionsObjectCollection}.
*/
-// FIXME: This class should only allow one collection to be returned and not mix the database records together.
-// TODO: This class can probably be removed in favor of using the ConditionsSeriesConverter in all cases.
+// FIXME: This class should only allow one collection to be returned and not mix
+// the database records together.
+// TODO: This class can probably be removed in favor of using the
+// ConditionsSeriesConverter in all cases.
public abstract class ConditionsObjectConverter<T> implements ConditionsConverter<T> {
public ConditionsObjectConverter() {
}
/**
- * Classes that extend this must define this method to specify what type the converter
- * is able to handle.
+ * Classes that extend this must define this method to specify what type the
+ * converter is able to handle.
* @return The Class that this converter handles.
*/
public abstract Class getType();
@@ -40,7 +42,8 @@
// System.out.println("finding conditions for key " + name + " ...");
- // Get the DatabaseConditionsManager which is required for using this converter.
+ // Get the DatabaseConditionsManager which is required for using this
+ // converter.
DatabaseConditionsManager databaseConditionsManager = DatabaseConditionsManager.castFrom(conditionsManager);
// Get the table meta data from the key given by the caller.
@@ -50,8 +53,9 @@
// Create a collection to return.
ConditionsObjectCollection collection = ConditionsObjectUtil.createCollection(tableMetaData);
-
- // Get the ConditionsRecord with the meta-data, which will use the current run
+
+ // Get the ConditionsRecord with the meta-data, which will use the
+ // current run
// number from the manager.
ConditionsRecordCollection conditionsRecords = databaseConditionsManager.findConditionsRecords(name);
@@ -61,11 +65,13 @@
} else if (conditionsRecords.getObjects().size() > 1) {
// There were multiple records returned.
if (!allowMultipleCollections())
- // If there are multiple records returned but this is not allowed by the
+ // If there are multiple records returned but this is not
+ // allowed by the
// converter, then this is a fatal error.
throw new RuntimeException("Multiple conditions records returned but this is not allowed.");
} else {
- // There was a single conditions record so the collection information can be
+ // There was a single conditions record so the collection
+ // information can be
// set meaningfully.
try {
collection.setCollectionId(conditionsRecords.get(0).getCollectionId());
@@ -109,7 +115,7 @@
// Return new collection.
return (T) collection;
}
-
+
public boolean allowMultipleCollections() {
return true;
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectException.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectException.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectException.java Mon Nov 10 00:16:49 2014
@@ -1,8 +1,8 @@
package org.hps.conditions;
/**
- * Generic Exception type throw by methods of {@link ConditionsObject} or other associated
- * classes such as converters and collections.
+ * Generic Exception type throw by methods of {@link ConditionsObject} or other
+ * associated classes such as converters and collections.
*/
@SuppressWarnings("serial")
public final class ConditionsObjectException extends Exception {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectUtil.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectUtil.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsObjectUtil.java Mon Nov 10 00:16:49 2014
@@ -7,12 +7,13 @@
import org.hps.conditions.ConditionsObject.FieldValueMap;
/**
- * Some static utility methods for <tt>ConditionsObject</tt> and related classes.
+ * Some static utility methods for <tt>ConditionsObject</tt> and related
+ * classes.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
final class ConditionsObjectUtil {
-
+
private ConditionsObjectUtil() {
}
@@ -42,8 +43,8 @@
}
newObject.setFieldValues(fieldValues);
return newObject;
- }
-
+ }
+
static final ConditionsObjectCollection createCollection(TableMetaData tableMetaData) {
ConditionsObjectCollection collection;
try {
@@ -53,5 +54,5 @@
}
return collection;
}
-
+
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecord.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecord.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecord.java Mon Nov 10 00:16:49 2014
@@ -3,13 +3,15 @@
import java.util.Date;
/**
- * This class represents a single record from the primary conditions data table, which
- * defines the validity range for a specific collection of conditions objects.
+ * This class represents a single record from the primary conditions data table,
+ * which defines the validity range for a specific collection of conditions
+ * objects.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
// TODO: Check behavior of select, delete, update and insert operations.
-// TODO: Override default behavior of methods in super class that don't make sense.
+// TODO: Override default behavior of methods in super class that don't make
+// sense.
public final class ConditionsRecord extends AbstractConditionsObject {
/**
@@ -17,15 +19,16 @@
*/
public static class ConditionsRecordCollection extends ConditionsObjectCollection<ConditionsRecord> {
/**
- * Since ConditionsRecord collections are always "mixed", meaning the collection
- * ID values are usually all going to be different, the default behavior of the
- * super class is overridden.
+ * Since ConditionsRecord collections are always "mixed", meaning the
+ * collection ID values are usually all going to be different, the
+ * default behavior of the super class is overridden.
*/
public void add(ConditionsRecord record) {
objects.add(record);
}
- // FIXME: Should probably override more methods here that don't make sense for
+ // FIXME: Should probably override more methods here that don't make
+ // sense for
// this type!
}
@@ -81,8 +84,9 @@
}
/**
- * Get the name of these conditions, which should be unique by run number. This is
- * called the "key" in the table meta data to distinguish it from "table name".
+ * Get the name of these conditions, which should be unique by run number.
+ * This is called the "key" in the table meta data to distinguish it from
+ * "table name".
* @return The name of the conditions.
*/
public String getName() {
@@ -104,7 +108,7 @@
public int getCollectionId() {
return getFieldValue("collection_id");
}
-
+
/**
* Get the string tag associated with these conditions.
* @return The string tag.
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecordConverter.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecordConverter.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecordConverter.java Mon Nov 10 00:16:49 2014
@@ -9,7 +9,8 @@
/**
* Read ConditionsRecord objects from the conditions database.
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: ConditionsRecordConverter.java,v 1.5 2013/10/15 23:24:47 jeremy Exp $
+ * @version $Id: ConditionsRecordConverter.java,v 1.5 2013/10/15 23:24:47 jeremy
+ * Exp $
*/
class ConditionsRecordConverter extends ConditionsObjectConverter<ConditionsRecordCollection> {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeries.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeries.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeries.java Mon Nov 10 00:16:49 2014
@@ -5,33 +5,34 @@
import java.util.List;
/**
- * This class represents a series of collections containing <tt>ConditionsObjects</tt>. It
- * is used to conditions collections when there are multiple ones with the same key that
- * are valid for the current run.
- *
+ * This class represents a series of collections containing
+ * <tt>ConditionsObjects</tt>. It is used to conditions collections when there
+ * are multiple ones with the same key that are valid for the current run.
+ *
* @author Jeremy McCormick <[log in to unmask]>
*
- * @param <CollectionType> The specific type of the <tt>ConditionsObjectCollection</tt> the series contains.
+ * @param <CollectionType> The specific type of the
+ * <tt>ConditionsObjectCollection</tt> the series contains.
*/
public class ConditionsSeries<CollectionType extends ConditionsObjectCollection> implements Iterable<CollectionType> {
-
+
List<CollectionType> collections = new ArrayList<CollectionType>();
-
+
CollectionType getCollection(int series) {
return collections.get(series);
}
-
+
int addCollection(CollectionType collection) {
if (collections.contains(collection))
throw new IllegalArgumentException("The collection is already registered with this object.");
collections.add(collection);
return collections.indexOf(collection);
}
-
+
int getNumberOfCollections() {
return collections.size();
}
-
+
CollectionType findCollection(ConditionsRecord record) {
for (CollectionType collection : collections) {
if (collection.conditionsRecord == record)
@@ -39,7 +40,7 @@
}
return null;
}
-
+
public Iterator<CollectionType> iterator() {
return collections.iterator();
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeriesConverter.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeriesConverter.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsSeriesConverter.java Mon Nov 10 00:16:49 2014
@@ -7,14 +7,16 @@
/**
* <p>
- * This converter creates a <tt>ConditionsSeries</tt> which is a set of <tt>ConditionsObjectCollection</tt>
- * objects with the same type. This can be used to retrieve sets of conditions that may overlap in
- * time validity, such as sets of bad channels .
+ * This converter creates a <tt>ConditionsSeries</tt> which is a set of
+ * <tt>ConditionsObjectCollection</tt> objects with the same type. This can be
+ * used to retrieve sets of conditions that may overlap in time validity, such
+ * as sets of bad channels .
* </p>
* <p>
- * Since type inference from the target variable is used in the {@link #createSeries(String)} method
- * signature, there only needs to be one of these converters per {@link DatabaseConditionsManager}.
- * The creation of the specific types is also done automatically, so each type of conditions object
+ * Since type inference from the target variable is used in the
+ * {@link #createSeries(String)} method signature, there only needs to be one of
+ * these converters per {@link DatabaseConditionsManager}. The creation of the
+ * specific types is also done automatically, so each type of conditions object
* does not need its own converter class.
* </p>
*
@@ -23,20 +25,24 @@
class ConditionsSeriesConverter {
DatabaseConditionsManager conditionsManager = null;
-
+
ConditionsSeriesConverter(DatabaseConditionsManager conditionsManager) {
if (conditionsManager == null)
throw new RuntimeException("The conditionsManager is null.");
this.conditionsManager = conditionsManager;
}
-
+
/**
- * Create a <tt>ConditionsSeries</tt> which is a series of <tt>ConditionsObjectCollections</tt> of the same type,
- * each of which have their own <tt>ConditionsRecord</tt>. This should be used for overlapping conditions, such as
- * sets of bad channels that are combined together as in the test run.
+ * Create a <tt>ConditionsSeries</tt> which is a series of
+ * <tt>ConditionsObjectCollections</tt> of the same type, each of which have
+ * their own <tt>ConditionsRecord</tt>. This should be used for overlapping
+ * conditions, such as sets of bad channels that are combined together as in
+ * the test run.
*
- * @param conditionsKey The name of the conditions key to retrieve from the conditions table.
- * @return The <tt>ConditionsSeries</tt> matching <tt>conditionsKey</tt> which type inferred from target variable.
+ * @param conditionsKey The name of the conditions key to retrieve from the
+ * conditions table.
+ * @return The <tt>ConditionsSeries</tt> matching <tt>conditionsKey</tt>
+ * which type inferred from target variable.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public <CollectionType extends ConditionsObjectCollection> ConditionsSeries<CollectionType> createSeries(String conditionsKey) {
@@ -48,13 +54,14 @@
ConditionsSeries<CollectionType> series = new ConditionsSeries<CollectionType>();
- // Get the ConditionsRecord with the meta-data, which will use the current run
+ // Get the ConditionsRecord with the meta-data, which will use the
+ // current run
// number from the manager.
ConditionsRecordCollection conditionsRecords = conditionsManager.findConditionsRecords(conditionsKey);
// Loop over conditions records. This will usually just be one record.
for (ConditionsRecord conditionsRecord : conditionsRecords.getObjects()) {
-
+
ConditionsObjectCollection collection = ConditionsObjectUtil.createCollection(tableMetaData);
try {
@@ -85,13 +92,13 @@
// Add new object to collection, which will also assign it a
// collection ID if applicable.
- collection.add(newObject);
+ collection.add(newObject);
}
} catch (SQLException | ConditionsObjectException e) {
throw new RuntimeException(e);
}
-
- series.addCollection((CollectionType)collection);
+
+ series.addCollection((CollectionType) collection);
}
// Return new collection.
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConnectionParameters.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConnectionParameters.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConnectionParameters.java Mon Nov 10 00:16:49 2014
@@ -11,11 +11,12 @@
import java.util.Properties;
/**
- * This class encapsulates the parameters for connecting to a database, including
- * hostname, port, user and password. It can also create and return a Connection object
- * based on these parameters.
+ * This class encapsulates the parameters for connecting to a database,
+ * including hostname, port, user and password. It can also create and return a
+ * Connection object based on these parameters.
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: ConnectionParameters.java,v 1.8 2013/10/04 01:54:16 jeremy Exp $
+ * @version $Id: ConnectionParameters.java,v 1.8 2013/10/04 01:54:16 jeremy Exp
+ * $
*/
public class ConnectionParameters {
@@ -27,10 +28,10 @@
/**
* Protected constructor for sub-classes.
- */
+ */
protected ConnectionParameters() {
}
-
+
/**
* Fully qualified constructor.
* @param user The user name.
@@ -39,7 +40,7 @@
* @param port The port number.
* @param conditionsTable The table containing conditions validity data.
*/
- public ConnectionParameters(String user, String password, String database, String hostname, int port) {
+ public ConnectionParameters(String user, String password, String database, String hostname, int port) {
this.user = user;
this.password = password;
this.database = database;
@@ -47,7 +48,7 @@
this.port = port;
}
- /**
+ /**
* Get Properties object for this connection.
* @return The Properties for this connection.
*/
@@ -105,11 +106,11 @@
}
/**
- * Create a database connection from these parameters. The caller becomes the "owner"
- * and is responsible for closing it when finished.
+ * Create a database connection from these parameters. The caller becomes
+ * the "owner" and is responsible for closing it when finished.
* @return The Connection object.
*/
- public Connection createConnection() {
+ public Connection createConnection() {
Properties connectionProperties = getConnectionProperties();
Connection connection = null;
try {
@@ -137,8 +138,8 @@
}
/**
- * Configure the connection parameters from an embedded classpath resource which
- * should be a properties file.
+ * Configure the connection parameters from an embedded classpath resource
+ * which should be a properties file.
* @param String The resource path.
* @return The connection parameters.
*/
@@ -147,7 +148,8 @@
}
/**
- * Configure the connection parameters from an <code>InputStream</code> of properties.
+ * Configure the connection parameters from an <code>InputStream</code> of
+ * properties.
* @param in The InputStream of the properties.
* @return The connection parameters.
* @throws RuntimeException if the InputStream is invalid
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/DatabaseConditionsManager.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/DatabaseConditionsManager.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/DatabaseConditionsManager.java Mon Nov 10 00:16:49 2014
@@ -33,8 +33,8 @@
/**
* <p>
- * This class should be used as the top-level ConditionsManager for database access to
- * conditions data.
+ * This class should be used as the top-level ConditionsManager for database
+ * access to conditions data.
* </p>
* <p>
* In general, this will be overriding the
@@ -59,7 +59,7 @@
protected boolean isConnected = false;
protected ConditionsSeriesConverter conditionsSeriesConverter = new ConditionsSeriesConverter(this);
protected static final String DEFAULT_CONFIG = "/org/hps/conditions/config/conditions_dev.xml";
-
+
/**
* Simple log formatter for this class.
*/
@@ -71,7 +71,7 @@
return sb.toString();
}
}
-
+
/**
* Setup the logger for this class, with initial level of ALL.
*/
@@ -85,27 +85,27 @@
logger.addHandler(handler);
logger.config("logger initialized with level " + handler.getLevel());
}
-
+
/**
* Default connection parameters.
*/
static class DefaultConnectionParameters extends ConnectionParameters {
- DefaultConnectionParameters() {
- this.port = 3306;
- try {
- if (InetAddress.getLocalHost().getHostName().contains("jlab.org")) {
- this.hostname = "jmysql.jlab.org";
- this.database = "hps_conditions";
- } else {
- this.hostname = "ppa-jeremym-l.slac.stanford.edu";
- this.database = "hps_conditions_dev";
- }
- } catch (UnknownHostException e) {
- throw new RuntimeException(e);
- }
- this.user = "hpsuser";
- this.password = "darkphoton";
- }
+ DefaultConnectionParameters() {
+ this.port = 3306;
+ try {
+ if (InetAddress.getLocalHost().getHostName().contains("jlab.org")) {
+ this.hostname = "jmysql.jlab.org";
+ this.database = "hps_conditions";
+ } else {
+ this.hostname = "ppa-jeremym-l.slac.stanford.edu";
+ this.database = "hps_conditions_dev";
+ }
+ } catch (UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
+ this.user = "hpsuser";
+ this.password = "darkphoton";
+ }
}
/**
@@ -115,7 +115,7 @@
registerConditionsConverter(new DetectorConditionsConverter());
setupConnectionFromSystemProperty();
configure(DEFAULT_CONFIG);
- register();
+ register();
}
/**
@@ -126,8 +126,8 @@
}
/**
- * Get the static instance of this class, which must have been registered first from a
- * call to {@link #register()}.
+ * Get the static instance of this class, which must have been registered
+ * first from a call to {@link #register()}.
* @return The static instance of the manager.
*/
public static DatabaseConditionsManager getInstance() {
@@ -146,11 +146,11 @@
return (DatabaseConditionsManager) manager;
}
-
+
public Connection getConnection() {
return this.connection;
}
-
+
/**
* Open the database connection.
*/
@@ -196,33 +196,37 @@
if (isConnected())
closeConnection();
}
-
- /**
- * Get multiple <code>ConditionsObjectCollection</code> objects that may have overlapping time validity information.
+
+ /**
+ * Get multiple <code>ConditionsObjectCollection</code> objects that may
+ * have overlapping time validity information.
* @param conditionsKey The conditions key.
- * @return The <code>ConditionsSeries</code> containing the matching <code>ConditionsObjectCollection</code>.
+ * @return The <code>ConditionsSeries</code> containing the matching
+ * <code>ConditionsObjectCollection</code>.
*/
public <CollectionType extends ConditionsObjectCollection> ConditionsSeries<CollectionType> getConditionsSeries(String conditionsKey) {
return conditionsSeriesConverter.createSeries(conditionsKey);
}
-
- /**
- * Get a given collection of the given type from the conditions database.
- * @param type Class type
- * @return A collection of objects of the given type from the conditions database
- */
- public <CollectionType extends ConditionsObjectCollection> CollectionType getCollection(Class<CollectionType> type){
- TableMetaData metaData = this.findTableMetaData(type);
- if(metaData == null) {
- throw new RuntimeException("Table name data for condition of type " + type.getSimpleName() + " was not found.");
- }
- String tableName = metaData.getTableName();
- CollectionType conditionsCollection = this.getCachedConditions(type, tableName).getCachedData();
- return conditionsCollection;
- }
-
- /**
- * Simple utility method to cast the generic <code>ConditionsManager</code> to this class.
+
+ /**
+ * Get a given collection of the given type from the conditions database.
+ * @param type Class type
+ * @return A collection of objects of the given type from the conditions
+ * database
+ */
+ public <CollectionType extends ConditionsObjectCollection> CollectionType getCollection(Class<CollectionType> type) {
+ TableMetaData metaData = this.findTableMetaData(type);
+ if (metaData == null) {
+ throw new RuntimeException("Table name data for condition of type " + type.getSimpleName() + " was not found.");
+ }
+ String tableName = metaData.getTableName();
+ CollectionType conditionsCollection = this.getCachedConditions(type, tableName).getCachedData();
+ return conditionsCollection;
+ }
+
+ /**
+ * Simple utility method to cast the generic <code>ConditionsManager</code>
+ * to this class.
* @param conditionsManager The <code>ConditionsManager</code>.
* @return The <code>DatabaseConditionsManager</code> object.
*/
@@ -232,16 +236,17 @@
} else {
throw new RuntimeException("The conditionsManager points to an object of the wrong type: " + conditionsManager.getClass().getCanonicalName());
}
- }
-
- /**
- * This method catches changes to the detector name and run number.
- * It is actually called every time an lcsim event is created, so it has internal logic
- * to figure out if the conditions system actually needs to be updated.
+ }
+
+ /**
+ * This method catches changes to the detector name and run number. It is
+ * actually called every time an lcsim event is created, so it has internal
+ * logic to figure out if the conditions system actually needs to be
+ * updated.
*/
@Override
public void setDetector(String detectorName, int runNumber) throws ConditionsNotFoundException {
-
+
// Detector update.
if (getDetector() == null || !getDetector().equals(detectorName)) {
logger.config("setting new detector " + detectorName);
@@ -255,7 +260,7 @@
}
// Let the super class do whatever it think it needs to do.
- super.setDetector(detectorName, runNumber);
+ super.setDetector(detectorName, runNumber);
}
/**
@@ -270,7 +275,8 @@
}
/**
- * Get the lcsim compact <code>Detector</code> object from the conditions system.
+ * Get the lcsim compact <code>Detector</code> object from the conditions
+ * system.
* @return The detector object.
*/
public Detector getDetectorObject() {
@@ -287,7 +293,7 @@
logger.fine("getting conditions " + name + " of type " + type.getSimpleName());
return getCachedConditions(type, name).getCachedData();
}
-
+
/**
* Configure this object from an XML file.
* @param file The XML file.
@@ -356,9 +362,10 @@
logger.fine("new collection ID " + collectionId + " created for table " + tableName);
return collectionId;
}
-
- /**
- * This method will return true if the given collection ID already exists in the table.
+
+ /**
+ * This method will return true if the given collection ID already exists in
+ * the table.
* @param tableName The name of the table.
* @param collectionID The collection ID value.
* @return True if collection exists.
@@ -411,7 +418,8 @@
* @param type The collection class.
* @return The table meta data.
*/
- // FIXME: This should return a list in case of multiple conditions defined with same type.
+ // FIXME: This should return a list in case of multiple conditions defined
+ // with same type.
public TableMetaData findTableMetaData(Class type) {
for (TableMetaData meta : tableMetaData) {
if (meta.getCollectionClass().equals(type)) {
@@ -475,9 +483,9 @@
}
/**
- * Find a collection of conditions validity records by key name. The key name is
- * distinct from the table name, but they are usually set to the same value in the XML
- * configuration.
+ * Find a collection of conditions validity records by key name. The key
+ * name is distinct from the table name, but they are usually set to the
+ * same value in the XML configuration.
* @param name The conditions key name.
* @return The set of matching conditions records.
*/
@@ -513,7 +521,7 @@
public int getRunNumber() {
return runNumber;
}
-
+
/**
* Close a JDBC <code>Statement</code>.
* @param statement the Statement to close
@@ -532,7 +540,8 @@
}
/**
- * Close a JDBC <code>ResultSet</code>, or rather the Statement connected to it.
+ * Close a JDBC <code>ResultSet</code>, or rather the Statement connected to
+ * it.
* @param resultSet the ResultSet to close
*/
static void close(ResultSet resultSet) {
@@ -558,8 +567,8 @@
}
/**
- * Configure this class from an <code>InputStream</code> which should point to an XML
- * document.
+ * Configure this class from an <code>InputStream</code> which should point
+ * to an XML document.
* @param in the InputStream which should be in XML format
*/
private void configure(InputStream in) {
@@ -597,11 +606,12 @@
*/
private void loadConverters(Document config) {
- if (this.converters != null) {
+ if (this.converters != null) {
this.converters.clear();
- }
-
- // Load the list of converters from the "converters" section of the config document.
+ }
+
+ // Load the list of converters from the "converters" section of the
+ // config document.
loadConditionsConverters(config.getRootElement().getChild("converters"));
// Register the list of converters with this manager.
@@ -616,22 +626,25 @@
* @param config The XML document.
*/
private void loadTableMetaData(Document config) {
-
+
if (this.tableMetaData != null) {
- this.tableMetaData.clear();
- }
-
- // Load table meta data from the "tables" section of the config document.
+ this.tableMetaData.clear();
+ }
+
+ // Load table meta data from the "tables" section of the config
+ // document.
loadTableMetaData(config.getRootElement().getChild("tables"));
}
-
- /**
- * Setup the database connection from a file specified by Java system property setting.
- * This is possible overridden by subsequent API calls to {@link #setConnectionProperties(File)} or
- * {@link #setConnectionResource(String)}, as it is called in the class's constructor.
+
+ /**
+ * Setup the database connection from a file specified by Java system
+ * property setting. This is possible overridden by subsequent API calls to
+ * {@link #setConnectionProperties(File)} or
+ * {@link #setConnectionResource(String)}, as it is called in the class's
+ * constructor.
*/
private void setupConnectionFromSystemProperty() {
- String systemPropertiesConnectionPath = (String)System.getProperties().get(connectionProperty);
+ String systemPropertiesConnectionPath = (String) System.getProperties().get(connectionProperty);
if (systemPropertiesConnectionPath != null) {
File f = new File(systemPropertiesConnectionPath);
if (!f.exists())
@@ -639,87 +652,88 @@
this.setConnectionProperties(f);
}
}
-
- /**
- * This method expects an XML element containing child "table" elements.
- * @param element
- */
- @SuppressWarnings("unchecked")
- void loadTableMetaData(Element element) {
-
- tableMetaData = new ArrayList<TableMetaData>();
-
- for (Iterator<?> iterator = element.getChildren("table").iterator(); iterator.hasNext();) {
- Element tableElement = (Element) iterator.next();
- String tableName = tableElement.getAttributeValue("name");
- String key = tableElement.getAttributeValue("key");
-
- Element classesElement = tableElement.getChild("classes");
- Element classElement = classesElement.getChild("object");
- Element collectionElement = classesElement.getChild("collection");
-
- String className = classElement.getAttributeValue("class");
- String collectionName = collectionElement.getAttributeValue("class");
-
- Class<? extends ConditionsObject> objectClass;
- Class<?> rawObjectClass;
- try {
- rawObjectClass = Class.forName(className);
- if (!ConditionsObject.class.isAssignableFrom(rawObjectClass)) {
- throw new RuntimeException("The class " + rawObjectClass.getSimpleName() + " does not extend ConditionsObject.");
- }
- objectClass = (Class<? extends ConditionsObject>) rawObjectClass;
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
-
- Class<? extends ConditionsObjectCollection<?>> collectionClass;
- Class<?> rawCollectionClass;
- try {
- rawCollectionClass = Class.forName(collectionName);
- if (!ConditionsObjectCollection.class.isAssignableFrom(rawCollectionClass))
- throw new RuntimeException("The class " + rawCollectionClass.getSimpleName() + " does not extend ConditionsObjectCollection.");
- collectionClass = (Class<? extends ConditionsObjectCollection<?>>) rawCollectionClass;
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
-
- TableMetaData tableData = new TableMetaData(key, tableName, objectClass, collectionClass);
- Element fieldsElement = tableElement.getChild("fields");
- for (Iterator<?> fieldsIterator = fieldsElement.getChildren("field").iterator(); fieldsIterator.hasNext();) {
- Element fieldElement = (Element) fieldsIterator.next();
- String fieldName = fieldElement.getAttributeValue("name");
- tableData.addField(fieldName);
- }
-
- tableMetaData.add(tableData);
- }
- }
-
- /**
- * This class reads in an XML configuration specifying a list of converter classes,
- * e.g. from the config file for the {@link DatabaseConditionsManager}.
+
+ /**
+ * This method expects an XML element containing child "table" elements.
+ * @param element
+ */
+ @SuppressWarnings("unchecked")
+ void loadTableMetaData(Element element) {
+
+ tableMetaData = new ArrayList<TableMetaData>();
+
+ for (Iterator<?> iterator = element.getChildren("table").iterator(); iterator.hasNext();) {
+ Element tableElement = (Element) iterator.next();
+ String tableName = tableElement.getAttributeValue("name");
+ String key = tableElement.getAttributeValue("key");
+
+ Element classesElement = tableElement.getChild("classes");
+ Element classElement = classesElement.getChild("object");
+ Element collectionElement = classesElement.getChild("collection");
+
+ String className = classElement.getAttributeValue("class");
+ String collectionName = collectionElement.getAttributeValue("class");
+
+ Class<? extends ConditionsObject> objectClass;
+ Class<?> rawObjectClass;
+ try {
+ rawObjectClass = Class.forName(className);
+ if (!ConditionsObject.class.isAssignableFrom(rawObjectClass)) {
+ throw new RuntimeException("The class " + rawObjectClass.getSimpleName() + " does not extend ConditionsObject.");
+ }
+ objectClass = (Class<? extends ConditionsObject>) rawObjectClass;
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+
+ Class<? extends ConditionsObjectCollection<?>> collectionClass;
+ Class<?> rawCollectionClass;
+ try {
+ rawCollectionClass = Class.forName(collectionName);
+ if (!ConditionsObjectCollection.class.isAssignableFrom(rawCollectionClass))
+ throw new RuntimeException("The class " + rawCollectionClass.getSimpleName() + " does not extend ConditionsObjectCollection.");
+ collectionClass = (Class<? extends ConditionsObjectCollection<?>>) rawCollectionClass;
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+
+ TableMetaData tableData = new TableMetaData(key, tableName, objectClass, collectionClass);
+ Element fieldsElement = tableElement.getChild("fields");
+ for (Iterator<?> fieldsIterator = fieldsElement.getChildren("field").iterator(); fieldsIterator.hasNext();) {
+ Element fieldElement = (Element) fieldsIterator.next();
+ String fieldName = fieldElement.getAttributeValue("name");
+ tableData.addField(fieldName);
+ }
+
+ tableMetaData.add(tableData);
+ }
+ }
+
+ /**
+ * This class reads in an XML configuration specifying a list of converter
+ * classes, e.g. from the config file for the
+ * {@link DatabaseConditionsManager}.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
- private void loadConditionsConverters(Element element) {
- converters = new ArrayList<ConditionsConverter>();
- for (Iterator iterator = element.getChildren("converter").iterator(); iterator.hasNext();) {
- Element converterElement = (Element) iterator.next();
- try {
- Class converterClass = Class.forName(converterElement.getAttributeValue("class"));
- if (ConditionsConverter.class.isAssignableFrom(converterClass)) {
- try {
- converters.add((ConditionsConverter) converterClass.newInstance());
- } catch (InstantiationException | IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- } else {
- throw new RuntimeException("The converter class " + converterClass.getSimpleName() + " does not extend the correct base type.");
- }
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
- }
+ private void loadConditionsConverters(Element element) {
+ converters = new ArrayList<ConditionsConverter>();
+ for (Iterator iterator = element.getChildren("converter").iterator(); iterator.hasNext();) {
+ Element converterElement = (Element) iterator.next();
+ try {
+ Class converterClass = Class.forName(converterElement.getAttributeValue("class"));
+ if (ConditionsConverter.class.isAssignableFrom(converterClass)) {
+ try {
+ converters.add((ConditionsConverter) converterClass.newInstance());
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ throw new RuntimeException("The converter class " + converterClass.getSimpleName() + " does not extend the correct base type.");
+ }
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/QueryBuilder.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/QueryBuilder.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/QueryBuilder.java Mon Nov 10 00:16:49 2014
@@ -3,7 +3,8 @@
import java.util.List;
/**
- * This is a static utility class for building SQL queries for the conditions system.
+ * This is a static utility class for building SQL queries for the conditions
+ * system.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
@@ -62,7 +63,7 @@
buff.append(") ");
return buff.toString();
}
-
+
public static String buildInsert(String tableName, int collectionID, List<String> columnNames, List<List<String>> rows) {
StringBuffer buff = new StringBuffer();
buff.append("INSERT INTO " + tableName + " ( collection_id");
@@ -77,16 +78,15 @@
buff.append(", '" + value + "'");
}
buff.append("), ");
- }
+ }
buff.setLength(buff.length() - 2);
return buff.toString();
}
-
public static String buildDelete(String tableName, int rowId) {
if (rowId <= 0)
throw new IllegalArgumentException("Invalid row ID: " + rowId);
String query = "DELETE FROM " + tableName + " WHERE id = " + rowId;
return query;
- }
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/TableConstants.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/TableConstants.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/TableConstants.java Mon Nov 10 00:16:49 2014
@@ -2,17 +2,19 @@
/**
* <p>
- * This is a static set of constants defining default table names and lookup key values
- * for conditions data. The actual table names for the conditions data are defined
- * externally in an XML configuration file read by the {@link DatabaseConditionsManager}.
+ * This is a static set of constants defining default table names and lookup key
+ * values for conditions data. The actual table names for the conditions data
+ * are defined externally in an XML configuration file read by the
+ * {@link DatabaseConditionsManager}.
* </p>
* <p>
- * It is possible that the key and table names are defined differently in the XML
- * configuration, e.g. if the name of the key is not exactly the same as the table name,
- * but usually they are the same value.
+ * It is possible that the key and table names are defined differently in the
+ * XML configuration, e.g. if the name of the key is not exactly the same as the
+ * table name, but usually they are the same value.
* </p>
*/
-// FIXME: This should really be called something like "ConditionsKeys" as the table names
+// FIXME: This should really be called something like "ConditionsKeys" as the
+// table names
// are found in the XML configuration only.
public final class TableConstants {
@@ -39,19 +41,19 @@
/** ECAL time shifts. */
public static final String ECAL_TIME_SHIFTS = "ecal_time_shifts";
-
+
/** ECAL LED setup. */
- public static final String ECAL_LEDS = "ecal_leds";
+ public static final String ECAL_LEDS = "ecal_leds";
/** Conditions key for combined SVT conditions. */
public static final String SVT_CONDITIONS = "svt_conditions";
-
+
/** Conditions key for SVT alignment data. */
public static final String SVT_ALIGNMENTS = "svt_alignments";
/** Conditions key for SVT bad channels. */
public static final String SVT_BAD_CHANNELS = "svt_bad_channels";
-
+
/** Table with SVT channel data. */
public static final String SVT_CHANNELS = "svt_channels";
@@ -60,7 +62,7 @@
/** Conditions key for SVT calibration data. */
public static final String SVT_CALIBRATIONS = "svt_calibrations";
-
+
/** Conditions key for SVT configuration files. */
public static final String SVT_CONFIGURATIONS = "svt_configurations";
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/TableMetaData.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/TableMetaData.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/TableMetaData.java Mon Nov 10 00:16:49 2014
@@ -5,13 +5,14 @@
/**
* <p>
- * This class provides meta data about a conditions table, including a list of conditions
- * data fields. The list of fields does not include the collection ID or row ID, which are
- * implicitly assumed to exist.
+ * This class provides meta data about a conditions table, including a list of
+ * conditions data fields. The list of fields does not include the collection ID
+ * or row ID, which are implicitly assumed to exist.
* </p>
* <p>
- * It also has references to the implementation classes which are used to map the data
- * onto {@link ConditionsObject} and {@link ConditionsObjectCollection}s.
+ * It also has references to the implementation classes which are used to map
+ * the data onto {@link ConditionsObject} and {@link ConditionsObjectCollection}
+ * s.
* </p>
*
* @author Jeremy McCormick <[log in to unmask]>
@@ -50,7 +51,7 @@
* Get the type of collection this table maps onto.
* @return
*/
- public Class<? extends ConditionsObjectCollection<?>> getCollectionClass() {
+ public Class<? extends ConditionsObjectCollection<?>> getCollectionClass() {
return collectionClass;
}
@@ -82,8 +83,8 @@
}
/**
- * Get the key of this conditions type. May be different from table name but is
- * usually the same.
+ * Get the key of this conditions type. May be different from table name but
+ * is usually the same.
* @return The key name of the conditions type.
*/
public String getKey() {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/TestRunConditionsDriver.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/TestRunConditionsDriver.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/TestRunConditionsDriver.java Mon Nov 10 00:16:49 2014
@@ -9,9 +9,9 @@
import static org.hps.conditions.TableConstants.SVT_CONDITIONS;
/**
- * This {@link org.lcsim.util.Driver} is a subclass of {@link AbstractConditionsDriver}
- * and specifies the database connection parameters and configuration for the
- * test run database.
+ * This {@link org.lcsim.util.Driver} is a subclass of
+ * {@link AbstractConditionsDriver} and specifies the database connection
+ * parameters and configuration for the test run database.
*
* @author Omar Moreno <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
@@ -21,10 +21,11 @@
// Default constructor used to setup the database connection
public TestRunConditionsDriver() {
if (ConditionsManager.defaultInstance() instanceof DatabaseConditionsManager) {
- //System.out.println(this.getName()+": Found existing DatabaseConditionsManager");
- //manager = (DatabaseConditionsManager) ConditionsManager.defaultInstance();
- throw new RuntimeException("ConditionsManager was already setup.");
- } else {
+ // System.out.println(this.getName()+": Found existing DatabaseConditionsManager");
+ // manager = (DatabaseConditionsManager)
+ // ConditionsManager.defaultInstance();
+ throw new RuntimeException("ConditionsManager was already setup.");
+ } else {
manager = new DatabaseConditionsManager();
manager.configure("/org/hps/conditions/config/conditions_database_testrun_2012.xml");
manager.register();
@@ -32,7 +33,8 @@
}
/**
- * Load the {@link TestRunSvtConditions} set onto <code>HpsTestRunSiSensor</code>.
+ * Load the {@link TestRunSvtConditions} set onto
+ * <code>HpsTestRunSiSensor</code>.
*
* @param detector The detector to update.
*/
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java Mon Nov 10 00:16:49 2014
@@ -15,17 +15,18 @@
/**
* <p>
- * This class is a command-line tool for performing commands on the conditions database.
- * It has sub-commands much like the cvs or svn clients. The only current implemented
- * command is 'load' to import text files, but more will be added.
+ * This class is a command-line tool for performing commands on the conditions
+ * database. It has sub-commands much like the cvs or svn clients. The only
+ * current implemented command is 'load' to import text files, but more will be
+ * added.
* <p>
- * Command line options allow a custom connection properties file or XML configuration
- * to be supplied by the user which will override the default.
+ * Command line options allow a custom connection properties file or XML
+ * configuration to be supplied by the user which will override the default.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
public class CommandLineTool {
-
+
Options options = new Options();
Map<String, AbstractCommand> commands = new HashMap<String, AbstractCommand>();
PosixParser parser = new PosixParser();
@@ -33,12 +34,12 @@
static final String XML_CONFIG_RESOURCE = "/org/hps/conditions/config/conditions_dev.xml";
DatabaseConditionsManager conditionsManager;
boolean verbose = false;
-
- public static void main(String[] arguments) {
+
+ public static void main(String[] arguments) {
CommandLineTool.create().run(arguments);
}
-
- void run(String[] arguments) {
+
+ void run(String[] arguments) {
try {
if (arguments.length == 0) {
printUsage();
@@ -58,11 +59,11 @@
printUsage();
exit(0);
}
-
+
if (commandLine.hasOption("v")) {
verbose = true;
}
-
+
setupConditionsManager(commandLine);
String commandName = commandLine.getArgs()[0];
@@ -99,7 +100,7 @@
if (verbose)
System.out.println("using connection resource " + CONNECTION_PROPERTIES_RESOURCE);
conditionsManager.setConnectionResource(CONNECTION_PROPERTIES_RESOURCE);
- }
+ }
if (commandLine.hasOption("x")) {
File xmlConfigFile = new File(commandLine.getOptionValue("x"));
conditionsManager.configure(xmlConfigFile);
@@ -109,31 +110,31 @@
if (verbose)
System.out.println("using XML config resource " + XML_CONFIG_RESOURCE);
conditionsManager.configure(XML_CONFIG_RESOURCE);
- }
+ }
conditionsManager.register();
conditionsManager.openConnection();
}
-
+
void printUsage() {
HelpFormatter help = new HelpFormatter();
StringBuffer s = new StringBuffer();
for (String command : commands.keySet()) {
s.append(command + '\n');
}
- help.printHelp("CommandLineTool", "Commands:\n" + s.toString(), options, "");
+ help.printHelp("CommandLineTool", "Commands:\n" + s.toString(), options, "");
}
-
+
void exit(int status) {
System.exit(status);
}
-
+
void registerCommand(AbstractCommand command) {
if (commands.containsKey(command.getName())) {
throw new IllegalArgumentException("There is already a command called " + command.getName());
}
commands.put(command.getName(), command);
}
-
+
static CommandLineTool create() {
CommandLineTool cli = new CommandLineTool();
cli.options.addOption(new Option("h", false, "Print help and exit"));
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java Mon Nov 10 00:16:49 2014
@@ -18,12 +18,15 @@
/**
* <p>
- * This is a sub-command to add conditions data using an input text file.
- * The file should be ASCII text that is tab or space delimited and includes headers with the names of
- * the database columns. (These must match exactly!) The user must supply a table name as the target
- * for the SQL insert. An optional collection ID can be supplied, which may not exist already in the table.
- * Otherwise, the command will fail. By default, the next collection ID will be found by the conditions manager.
+ * This is a sub-command to add conditions data using an input text file. The
+ * file should be ASCII text that is tab or space delimited and includes headers
+ * with the names of the database columns. (These must match exactly!) The user
+ * must supply a table name as the target for the SQL insert. An optional
+ * collection ID can be supplied, which may not exist already in the table.
+ * Otherwise, the command will fail. By default, the next collection ID will be
+ * found by the conditions manager.
* <p>
+ *
* <pre>
* java -cp hps-distribution-bin.jar org.hps.conditions.cli.CommandLineTool -p conditions_dev_local.properties \
* load -t scratch_svt_gains -f ./scratch_svt_gains.txt -c 1
@@ -32,59 +35,59 @@
* @author Jeremy McCormick <[log in to unmask]>
*/
public class LoadCommand extends AbstractCommand {
-
+
LoadCommand() {
super("load", "Load a set of conditions into the database from a text file");
this.options.addOption(new Option("t", true, "Set the name of the target table in the database"));
this.options.addOption(new Option("c", true, "Set the collection ID of this conditions set"));
this.options.addOption(new Option("f", true, "Set the input data file"));
- }
-
+ }
+
@Override
public void execute(String[] arguments) {
- CommandLine commandLine;
+ CommandLine commandLine;
try {
- commandLine = parser.parse(options, arguments);
+ commandLine = parser.parse(options, arguments);
} catch (ParseException e) {
throw new RuntimeException(e);
}
-
+
String fileName = commandLine.getOptionValue("f");
if (fileName == null) {
throw new IllegalArgumentException("Missing file argument.");
}
-
+
String tableName = commandLine.getOptionValue("t");
if (tableName == null) {
throw new IllegalArgumentException("Missing table name.");
}
-
+
DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
if (conditionsManager == null) {
throw new RuntimeException("The DatabaseConditionsManager was not setup properly.");
}
-
+
int collectionID;
if (commandLine.getOptionValue("c") != null) {
collectionID = Integer.parseInt(commandLine.getOptionValue("c"));
if (conditionsManager.collectionExists(tableName, collectionID)) {
throw new IllegalArgumentException("The user supplied collection ID " + collectionID + " already exists in this table.");
- }
+ }
} else {
- collectionID = conditionsManager.getNextCollectionID(tableName);
+ collectionID = conditionsManager.getNextCollectionID(tableName);
}
-
+
List<String> columnNames = new ArrayList<String>();
- List<List<String>> rows = new ArrayList<List<String>>();
+ List<List<String>> rows = new ArrayList<List<String>>();
parseFile(fileName, columnNames, rows);
-
+
String insertSql = QueryBuilder.buildInsert(tableName, collectionID, columnNames, rows);
if (verbose)
System.out.println(insertSql);
List<Integer> IDs = conditionsManager.updateQuery(insertSql);
System.out.println("Inserted " + IDs.size() + " new rows into table " + tableName + " with collection_id " + collectionID);
}
-
+
void parseFile(String fileName, List<String> columnNames, List<List<String>> rows) {
File inputFile = new File(fileName);
BufferedReader reader = null;
@@ -117,6 +120,6 @@
e.printStackTrace();
}
}
- }
- }
+ }
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamSpot.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamSpot.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamSpot.java Mon Nov 10 00:16:49 2014
@@ -8,8 +8,7 @@
/**
* Class describing the HPS beamspot at the target (Z=0)
- * @author mgraham
- * created on 6/27/2011
+ * @author mgraham created on 6/27/2011
*/
public class BeamSpot {
@@ -27,7 +26,7 @@
}
public BeamSpot(double sigX, double sigY) {
- // default beamspot position
+ // default beamspot position
_position[0] = 0;
_position[1] = 0;
_angle[0] = 0;
@@ -65,7 +64,7 @@
public SymmetricMatrix getBeamCovariance() {
return _beamcov;
- }
+ }
public void setBeamPosition(double[] pos) {
_position = pos;
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamlineConstants.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamlineConstants.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/BeamlineConstants.java Mon Nov 10 00:16:49 2014
@@ -1,12 +1,17 @@
package org.hps.conditions.deprecated;
public final class BeamlineConstants {
-
- private BeamlineConstants() {}
-
- public static final double ECAL_FACE_TESTRUN = 1524; // mm
- public static final double DIPOLE_EDGE_TESTRUN = 457.2 + 457.2; // 452.2 + 462.2; //914; // mm
- public static final double DIPOLE_EDGELOW_TESTRUN = 0.; //452.2 - 462.2; // mm
- public static final double HARP_POSITION_TESTRUN = -674.062; // mm
+
+ private BeamlineConstants() {
+ }
+
+ public static final double ECAL_FACE_TESTRUN = 1524; // mm
+ public static final double DIPOLE_EDGE_TESTRUN = 457.2 + 457.2; // 452.2 +
+ // 462.2;
+ // //914; //
+ // mm
+ public static final double DIPOLE_EDGELOW_TESTRUN = 0.; // 452.2 - 462.2; //
+ // mm
+ public static final double HARP_POSITION_TESTRUN = -674.062; // mm
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/CalibrationDriver.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/CalibrationDriver.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/CalibrationDriver.java Mon Nov 10 00:16:49 2014
@@ -15,15 +15,16 @@
*/
public class CalibrationDriver extends Driver implements ConditionsListener {
- // The test run number of interest. If it equals -1, the default calibrations
+ // The test run number of interest. If it equals -1, the default
+ // calibrations
// are loaded
private static int runNumber = -1;
private boolean fixRunNumber = false;
- private String gainFilename = "default.gain";
+ private String gainFilename = "default.gain";
public CalibrationDriver() {
add(new EcalConditions());
- //add(new HPSSVTSensorSetup());
+ // add(new HPSSVTSensorSetup());
}
public void setRunNumber(int runNumber) {
@@ -52,13 +53,15 @@
super.detectorChanged(detector);
if (!EcalConditions.calibrationLoaded()) {
- EcalConditions.setGainFilename(gainFilename);
- EcalConditions.loadCalibration();
+ EcalConditions.setGainFilename(gainFilename);
+ EcalConditions.loadCalibration();
}
- /*if (fixRunNumber && (!HPSSVTCalibrationConstants.pedestalLoaded() || !HPSSVTCalibrationConstants.tpLoaded())) {
- System.out.println("Loading calibration for set run: " + runNumber);
- loadCalibsByRun(runNumber);
- }*/
+ /*
+ * if (fixRunNumber && (!HPSSVTCalibrationConstants.pedestalLoaded() ||
+ * !HPSSVTCalibrationConstants.tpLoaded())) {
+ * System.out.println("Loading calibration for set run: " + runNumber);
+ * loadCalibsByRun(runNumber); }
+ */
}
@Override
@@ -76,13 +79,14 @@
}
private void loadCalibsByRun(int run) {
- //HPSSVTCalibrationConstants.loadCalibration(run);
+ // HPSSVTCalibrationConstants.loadCalibration(run);
FieldMap.loadFieldMap(run);
}
/**
- * get specified conditions list, parse as a map of run numbers to calibration file paths; get the appropriate file
- * @param calibName
+ * get specified conditions list, parse as a map of run numbers to
+ * calibration file paths; get the appropriate file
+ * @param calibName
* @param run
* @return
*/
@@ -95,7 +99,7 @@
String filePath = null;
for (Object key : calibSet.keySet()) {
int keyRun = Integer.parseInt((String) key);
-// System.out.println("Available calibration for run: " + keyRun);
+ // System.out.println("Available calibration for run: " + keyRun);
if (keyRun > mostRecentValid && keyRun <= run) {
mostRecentValid = keyRun;
filePath = calibSet.getString((String) key);
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/EcalConditions.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/EcalConditions.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/EcalConditions.java Mon Nov 10 00:16:49 2014
@@ -21,19 +21,19 @@
*/
public class EcalConditions extends Driver {
- //DAQ channel map
+ // DAQ channel map
private static HashMap<Long, Long> daqToPhysicalMap = new HashMap<Long, Long>();
private static HashMap<Long, Long> physicalToDaqMap = new HashMap<Long, Long>();
- //pedestals
+ // pedestals
private static HashMap<Long, Double> daqToPedestalMap = new HashMap<Long, Double>();
private static HashMap<Long, Double> daqToNoiseMap = new HashMap<Long, Double>();
- //set of bad channels to ignore
+ // set of bad channels to ignore
private static HashSet<Long> badChannelsSet = new HashSet<Long>();
private static boolean badChannelsLoaded = false;
private static IIdentifierHelper helper = null;
- //gain
+ // gain
private static HashMap<Long, Double> physicalToGainMap = new HashMap<Long, Double>();
- //subdetector name (for when this is used as a driver)
+ // subdetector name (for when this is used as a driver)
private String subdetectorName = "Ecal";
private static Subdetector subdetector;
private static boolean debug = false;
@@ -72,9 +72,9 @@
loadPedestals();
calibrationLoaded = true;
}
-
+
public static void setGainFilename(String name) {
- gainFilename = name;
+ gainFilename = name;
}
public void setSubdetectorName(String subdetectorName) {
@@ -139,7 +139,7 @@
daqToPedestalMap.put(daqid, pedestal);
daqToNoiseMap.put(daqid, noise);
if (debug) {
- System.out.printf("Channel %d: pede %.2f noise %.2f (crate %d slot %d channel %d)\n", daqid,pedestal,noise,crate,slot,channel);
+ System.out.printf("Channel %d: pede %.2f noise %.2f (crate %d slot %d channel %d)\n", daqid, pedestal, noise, crate, slot, channel);
}
}
}
@@ -186,7 +186,7 @@
expId.setValue(helper.getFieldIndex("iy"), y);
badChannelsSet.add(helper.pack(expId).getValue());
if (debug) {
- System.out.printf("Channel %d is bad (x=%d y=%d)\n", helper.pack(expId).getValue(),x,y);
+ System.out.printf("Channel %d is bad (x=%d y=%d)\n", helper.pack(expId).getValue(), x, y);
}
}
}
@@ -201,9 +201,9 @@
BufferedReader bufferedReader;
ConditionsManager conditions = ConditionsManager.defaultInstance();
try {
- bufferedReader = new BufferedReader(conditions.getRawConditions("calibECal/"+EcalConditions.gainFilename).getReader());
+ bufferedReader = new BufferedReader(conditions.getRawConditions("calibECal/" + EcalConditions.gainFilename).getReader());
} catch (IOException e) {
- throw new RuntimeException("couldn't get gain file("+gainFilename+") ", e);
+ throw new RuntimeException("couldn't get gain file(" + gainFilename + ") ", e);
}
String line;
@@ -232,7 +232,7 @@
double gain = Double.valueOf(lineTok.nextToken());
physicalToGainMap.put(makePhysicalID(x, y), gain);
if (debug) {
- System.out.printf("Channel %d: gain %.2f (x=%d y=%d)\n", makePhysicalID(x, y),gain,x,y);
+ System.out.printf("Channel %d: gain %.2f (x=%d y=%d)\n", makePhysicalID(x, y), gain, x, y);
}
}
}
@@ -280,7 +280,7 @@
} else {
int x = Integer.valueOf(lineTok.nextToken());
int y = Integer.valueOf(lineTok.nextToken());
-// if (x>0 && y>0) x = 24-x;
+ // if (x>0 && y>0) x = 24-x;
expId.setValue(helper.getFieldIndex("ix"), x);
expId.setValue(helper.getFieldIndex("iy"), y);
int crate = Integer.valueOf(lineTok.nextToken());
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/FieldMap.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/FieldMap.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/FieldMap.java Mon Nov 10 00:16:49 2014
@@ -13,38 +13,35 @@
import org.hps.util.Pair;
/**
-
-@author Mathew Graham <[log in to unmask]> $Id: FieldMap.java,v 1.14
-2012/07/23 23:02:57 mgraham Exp $
+ * @author Mathew Graham <[log in to unmask]> $Id: FieldMap.java,v 1.14
+ * 2012/07/23 23:02:57 mgraham Exp $
*/
public class FieldMap {
// TODO: Change all pairs such that FPGA is the fist value
// TODO: Change all map keys to type SiSensor?
- public static Map<Pair<Integer/*
- zbin
- */, Integer/*
- xbin
- */>, Double/*
- b_y
- */> fieldMap = new HashMap<Pair<Integer, Integer>, Double>();
- ;
public static Map<Pair<Integer/*
- zbin
- */, Integer/*
- zbin
- */>, Pair<Double/*
- zpos
- */, Double/*
- xpos
- */>> fieldBins = new HashMap<Pair<Integer, Integer>, Pair<Double, Double>>();
- ;
+ * zbin
+ */, Integer/*
+ * xbin
+ */>, Double/*
+ * b_y
+ */> fieldMap = new HashMap<Pair<Integer, Integer>, Double>();;
+ public static Map<Pair<Integer/*
+ * zbin
+ */, Integer/*
+ * zbin
+ */>, Pair<Double/*
+ * zpos
+ */, Double/*
+ * xpos
+ */>> fieldBins = new HashMap<Pair<Integer, Integer>, Pair<Double, Double>>();;
private static boolean fieldMapLoaded = false;
private static boolean debug = false;
/**
- Default Ctor
+ * Default Ctor
*/
private FieldMap() {
}
@@ -55,13 +52,15 @@
public static void loadFieldMap(int run) {
System.out.println("Loading fieldmap for run " + run);
- //write something here to read in constants from calibration file
+ // write something here to read in constants from calibration file
ConditionsManager conditions = ConditionsManager.defaultInstance();
String filePath = null;
- //TODO: if we ever have more than one field map, make a list and uncomment this
-// filePath = HPSCalibrationListener.getCalibForRun("FieldMap/bfieldmap", run);
+ // TODO: if we ever have more than one field map, make a list and
+ // uncomment this
+ // filePath =
+ // HPSCalibrationListener.getCalibForRun("FieldMap/bfieldmap", run);
if (filePath == null) {
filePath = "FieldMap/bfieldmap.dat";
@@ -73,9 +72,6 @@
} catch (IOException e) {
throw new RuntimeException("couldn't get baseline file", e);
}
-
-
-
}
@@ -113,17 +109,20 @@
double val = vals.get(i);
if (i == 0 && val >= 0) {
xval = 0.0;
- zval = val * 10.0;//convert from cm to mm
+ zval = val * 10.0;// convert from cm to mm
ix = 0;
iz++;
} else {
- bY = val / 10000.0 * 0.491 / 0.5;//gauss-->tesla and normalize by our nominal bfield (file is for 0.5T)
+ bY = val / 10000.0 * 0.491 / 0.5;// gauss-->tesla and
+ // normalize by our
+ // nominal bfield (file
+ // is for 0.5T)
bY = Math.abs(bY);
Pair zx = new Pair(zval, xval);
Pair izix = new Pair(iz, ix);
-// System.out.println("Putting B = "+bY+" & (Z,X) = "+zval+","+xval+")");
+ // System.out.println("Putting B = "+bY+" & (Z,X) = "+zval+","+xval+")");
fieldMap.put(izix, bY);
-// System.out.println("Making _fieldBins pair = ("+iz+","+ix+")");
+ // System.out.println("Making _fieldBins pair = ("+iz+","+ix+")");
fieldBins.put(izix, zx);
xval += 10.0;
ix++;
@@ -143,10 +142,10 @@
List<Double> nums = new ArrayList<Double>();
while (tok.hasMoreTokens()) {
String tokVal = tok.nextToken();
-// System.out.println(tokVal);
+ // System.out.println(tokVal);
nums.add(Double.valueOf(tokVal).doubleValue());
}
-// System.out.println("Returning list");
+ // System.out.println("Returning list");
return nums;
}
@@ -179,15 +178,15 @@
return izix;
}
-
+
public static void printFieldMap() {
- int xval = 0;
+ int xval = 0;
System.out.printf("---- B-field ----\n");
- System.out.printf("%5s %5s %10s\n", "z","x","B");
- for(int zval=-100;zval< 1400;++zval) {
- double bfield = FieldMap.getFieldFromMap((double)zval, (double)xval);
- System.out.printf("%5d %5d %10.3f\n", zval,xval,bfield);
- }
+ System.out.printf("%5s %5s %10s\n", "z", "x", "B");
+ for (int zval = -100; zval < 1400; ++zval) {
+ double bfield = FieldMap.getFieldFromMap((double) zval, (double) xval);
+ System.out.printf("%5d %5d %10.3f\n", zval, xval, bfield);
+ }
}
-
+
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTCalibrationConstants.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTCalibrationConstants.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTCalibrationConstants.java Mon Nov 10 00:16:49 2014
@@ -21,54 +21,55 @@
/**
*
* @author Mathew Graham <[log in to unmask]> $Id:
- * HPSSVTCalibrationConstants.java,v 1.23 2013/02/25 22:39:26 meeg Exp $
+ * HPSSVTCalibrationConstants.java,v 1.23 2013/02/25 22:39:26 meeg Exp $
*/
public class HPSSVTCalibrationConstants {
// TODO: Change all map keys to type SiSensor?
// TODO: Update everything to make it compatible new version of SVT Utils
private static Map<Pair<Integer /*
- * FPGA
- */, Integer /*
- * Hybrid
- */>, double[] /*
- * constants
- */> noiseMap = new HashMap<Pair<Integer, Integer>, double[]>();
+ * FPGA
+ */, Integer /*
+ * Hybrid
+ */>, double[] /*
+ * constants
+ */> noiseMap = new HashMap<Pair<Integer, Integer>, double[]>();
private static Map<Pair<Integer /*
- * FPGA
- */, Integer /*
- * Hybrid
- */>, double[] /*
- * constants
- */> pedestalMap = new HashMap<Pair<Integer, Integer>, double[]>();
+ * FPGA
+ */, Integer /*
+ * Hybrid
+ */>, double[] /*
+ * constants
+ */> pedestalMap = new HashMap<Pair<Integer, Integer>, double[]>();
private static Map<Pair<Integer /*
- * FPGA
- */, Integer /*
- * Hybrid
- */>, double[] /*
- * constants
- */> tpMap = new HashMap<Pair<Integer, Integer>, double[]>();
+ * FPGA
+ */, Integer /*
+ * Hybrid
+ */>, double[] /*
+ * constants
+ */> tpMap = new HashMap<Pair<Integer, Integer>, double[]>();
private static Map<Pair<Integer /*
- * FPGA
- */, Integer /*
- * Hybrid
- */>, Set<Integer> /*
- * Bad channels
- */> badChannelMap = new HashMap<Pair<Integer, Integer>, Set<Integer>>();
+ * FPGA
+ */, Integer /*
+ * Hybrid
+ */>, Set<Integer> /*
+ * Bad
+ * channels
+ */> badChannelMap = new HashMap<Pair<Integer, Integer>, Set<Integer>>();
private static Map<Pair<Integer /*
- * FPGA
- */, Integer /*
- * Hybrid
- */>, List<Double> /*
- * channels
- */> gainMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
+ * FPGA
+ */, Integer /*
+ * Hybrid
+ */>, List<Double> /*
+ * channels
+ */> gainMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
private static Map<Pair<Integer /*
- * FPGA
- */, Integer /*
- * Hybrid
- */>, List<Double> /*
- * channels
- */> offsetMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
+ * FPGA
+ */, Integer /*
+ * Hybrid
+ */>, List<Double> /*
+ * channels
+ */> offsetMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
private static Map<Pair<Integer, Integer>, Double> t0ShiftMap = new HashMap<Pair<Integer, Integer>, Double>();
private static boolean pedestalLoaded = false;
private static boolean tpLoaded = false;
@@ -88,7 +89,7 @@
}
public static void loadCalibrationConstants(int run) {
- //write something here to read in constants from calibration file
+ // write something here to read in constants from calibration file
ConditionsManager conditions = ConditionsManager.defaultInstance();
String filePath = null;
@@ -104,7 +105,6 @@
} catch (IOException e) {
throw new RuntimeException("couldn't get baseline file", e);
}
-
filePath = CalibrationDriver.getCalibForRun("calibSVT/tp", run);
@@ -203,7 +203,24 @@
int channel = Integer.valueOf(lineTok.nextToken());
double amplitude = Double.valueOf(lineTok.nextToken());
double t0 = Double.valueOf(lineTok.nextToken());
- double tp = Double.valueOf(lineTok.nextToken()) * 24.0 / 25.0; //FIXME: this is a hack to compensate for the calibrations we have that assumed 25 ns APV clock
+ double tp = Double.valueOf(lineTok.nextToken()) * 24.0 / 25.0; // FIXME:
+ // this
+ // is
+ // a
+ // hack
+ // to
+ // compensate
+ // for
+ // the
+ // calibrations
+ // we
+ // have
+ // that
+ // assumed
+ // 25
+ // ns
+ // APV
+ // clock
double chisq = Double.valueOf(lineTok.nextToken());
Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
@@ -261,7 +278,8 @@
reader = new BufferedReader(conditions.getRawConditions(filePath).getReader());
loadBadChannels(reader);
} catch (IOException exception) {
- // If the file isn't found, continue on with just the QA bad channels
+ // If the file isn't found, continue on with just the QA bad
+ // channels
System.out.println("File " + filePath + " was not found! Continuing with only QA bad channels");
}
}
@@ -460,7 +478,7 @@
* Checks if a channel has been tagged as bad
*
* @param daqPair : a FPGA/Hybrid pair defining which sensor the channels in
- * located on
+ * located on
* @param channel : The channel to be checked
* @return true if the channel is bad, false otherwise
*/
@@ -477,7 +495,8 @@
return totalBadChannels;
}
- //class to hold calibration constants for a channel; leave fields NaN or null if not known
+ // class to hold calibration constants for a channel; leave fields NaN or
+ // null if not known
public static class ChannelConstants {
private double pedestal = Double.NaN;
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTConstants.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTConstants.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTConstants.java Mon Nov 10 00:16:49 2014
@@ -9,33 +9,33 @@
public class HPSSVTConstants {
- public static final int SVT_TOTAL_FPGAS = 7;
- public static final int TOTAL_APV25_PER_HYBRID = 5;
- public static final int TOTAL_APV25_CHANNELS = 128;
- public static final int TOTAL_HYBRIDS_PER_FPGA = 3;
- public static final int TOTAL_TEMPS_PER_HYBRID = 4;
-
- // The Rear Transition Module gain
- public static final double RTM_GAIN = 1.5;
-
- // Total number of strips per sensor
- public static final int TOTAL_STRIPS_PER_SENSOR = 639;
-
- // Total number of shaper signal samples obtained
- public static final int TOTAL_NUMBER_OF_SAMPLES = 6;
-
- // MASKs used to encode and decode the SVT data
+ public static final int SVT_TOTAL_FPGAS = 7;
+ public static final int TOTAL_APV25_PER_HYBRID = 5;
+ public static final int TOTAL_APV25_CHANNELS = 128;
+ public static final int TOTAL_HYBRIDS_PER_FPGA = 3;
+ public static final int TOTAL_TEMPS_PER_HYBRID = 4;
+
+ // The Rear Transition Module gain
+ public static final double RTM_GAIN = 1.5;
+
+ // Total number of strips per sensor
+ public static final int TOTAL_STRIPS_PER_SENSOR = 639;
+
+ // Total number of shaper signal samples obtained
+ public static final int TOTAL_NUMBER_OF_SAMPLES = 6;
+
+ // MASKs used to encode and decode the SVT data
public static final int TEMP_MASK = 0xFFFF;
public static final int HYBRID_MASK = 0x3;
public static final int APV_MASK = 0x7;
public static final int CHANNEL_MASK = 0x7F;
public static final int FPGA_MASK = 0xFFFF;
public static final int SAMPLE_MASK = 0x3FFF;
-
- // Temperature constants
- public static final double MIN_TEMP = -50;
+
+ // Temperature constants
+ public static final double MIN_TEMP = -50;
public static final double MAX_TEMP = 150;
- public static final int ADC_TEMP_COUNT = 4096;
+ public static final int ADC_TEMP_COUNT = 4096;
public static final double TEMP_K0 = 273.15;
public static final double CONST_A = 0.03448533;
public static final double BETA = 3750.;
@@ -43,7 +43,7 @@
public static final double V_REF = 2.5;
public static final double R_DIV = 10000.;
public static final double TEMP_INC = 0.01;
-
+
// Length of the APV25 analog pipeline
public static final int ANALOG_PIPELINE_LENGTH = 192;
// Total number of channels an APV25 ASIC contains
@@ -57,5 +57,5 @@
public static final double MULTIPLEXER_GAIN = 1;
// The APV25 front end gain
public static final double FRONT_END_GAIN = 100.0; //
-
+
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTSensorSetup.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTSensorSetup.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/HPSSVTSensorSetup.java Mon Nov 10 00:16:49 2014
@@ -20,7 +20,7 @@
* Setup driver for the HPSTracker subdetector.
*
* @author Mathew Graham <[log in to unmask]>
- * @author Omar Moreno <[log in to unmask]>
+ * @author Omar Moreno <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
* @version $Id: HPSSVTSensorSetup.java,v 1.13 2013/10/29 23:28:53 jeremy Exp $
*/
@@ -29,26 +29,24 @@
boolean debug = false;
String subdetectorName = "Tracker";
// Sensor Characteristics
- private double readoutStripPitch = 0.060; // mm
- private double senseStripPitch = 0.030; // mm
+ private double readoutStripPitch = 0.060; // mm
+ private double senseStripPitch = 0.030; // mm
private double readoutStripCapacitanceIntercept = 0;
- private double readoutStripCapacitanceSlope = 0.16; // pf/mm
+ private double readoutStripCapacitanceSlope = 0.16; // pf/mm
private double senseStripCapacitanceIntercept = 0;
- private double senseStripCapacitanceSlope = 0.16; // pf/mm
+ private double senseStripCapacitanceSlope = 0.16; // pf/mm
private double readoutTransferEfficiency = 0.986;
private double senseTransferEfficiency = 0.419;
/*
- * Adding separate strip capacitance for long detectors following
- * S/N = mip_charge/(270e- + 36*C[pf/cm]*L[cm]
- * e.g. for expected S/N=16 and L=20cm -> C=0.1708pf/mm
- * e.g. for expected S/N=8 and L=20cm -> C=0.39pf/mm
- * This should be taken into account by the noise model -> FIX THIS.
- */
- private double longSensorLengthThreshold = 190.0; //mm
- private double readoutLongStripCapacitanceSlope = 0.39; // pf/mm
- private double senseLongStripCapacitanceSlope = 0.39; // pf/mm
-
-
+ * Adding separate strip capacitance for long detectors following S/N =
+ * mip_charge/(270e- + 36*C[pf/cm]*L[cm] e.g. for expected S/N=16 and L=20cm
+ * -> C=0.1708pf/mm e.g. for expected S/N=8 and L=20cm -> C=0.39pf/mm This
+ * should be taken into account by the noise model -> FIX THIS.
+ */
+ private double longSensorLengthThreshold = 190.0; // mm
+ private double readoutLongStripCapacitanceSlope = 0.39; // pf/mm
+ private double senseLongStripCapacitanceSlope = 0.39; // pf/mm
+
// Set of sensors
Set<SiSensor> sensors = new HashSet<SiSensor>();
@@ -78,16 +76,17 @@
configureSensors(sensors);
// Create DAQ Maps
- //if (!SvtUtils.getInstance().isSetup()) {
- SvtUtils.getInstance().reset(); // Hard reset of SvtUtils to clear previous detector state.
+ // if (!SvtUtils.getInstance().isSetup()) {
+ SvtUtils.getInstance().reset(); // Hard reset of SvtUtils to clear
+ // previous detector state.
SvtUtils.getInstance().setup(detector);
- //}
+ // }
}
/**
* Configure the SVT sensors
*
- * @param subdetector
+ * @param subdetector
*/
private void configureSensors(Set<SiSensor> sensors) {
// Loop through all the sensors in the set.
@@ -110,7 +109,7 @@
// Translate to the outside of the box in order to setup electrodes.
ITranslation3D electrodesPosition = new Translation3D(VecOp.mult(-pSide.getDistance(), pSide.getNormal()));
- // Align the strips with the edge of the sensor.
+ // Align the strips with the edge of the sensor.
IRotation3D electrodesRotation = new RotationPassiveXYZ(0, 0, 0);
Transform3D electrodesTransform = new Transform3D(electrodesPosition, electrodesRotation);
@@ -122,28 +121,28 @@
System.out.println("The number of readout strips is " + readoutElectrodes.getNCells());
System.out.println("The number of sense strips is " + senseElectrodes.getNCells());
}
-
+
double roCap = this.getStripLength(sensor) > longSensorLengthThreshold ? readoutLongStripCapacitanceSlope : readoutStripCapacitanceSlope;
double senseCap = this.getStripLength(sensor) > longSensorLengthThreshold ? senseLongStripCapacitanceSlope : senseStripCapacitanceSlope;
-
+
// Set the strip capacitance.
readoutElectrodes.setCapacitanceIntercept(readoutStripCapacitanceIntercept);
readoutElectrodes.setCapacitanceSlope(roCap);
senseElectrodes.setCapacitanceIntercept(senseStripCapacitanceIntercept);
senseElectrodes.setCapacitanceSlope(senseCap);
- if(debug) {
- System.out.printf("%s: Sensor %s has strip length %.3f\n",this.getClass().getSimpleName(),sensor.getName(),this.getStripLength(sensor));
- System.out.printf("%s: ro electrodes capacitance %.3f (cell0 %.3f)\n",this.getClass().getSimpleName(),readoutElectrodes.getCapacitance(),readoutElectrodes.getCapacitance(0));
- System.out.printf("%s: ro sense capacitance %.3f (cell0 %.3f)\n",this.getClass().getSimpleName(),senseElectrodes.getCapacitance(),senseElectrodes.getCapacitance(0));
- }
-
+ if (debug) {
+ System.out.printf("%s: Sensor %s has strip length %.3f\n", this.getClass().getSimpleName(), sensor.getName(), this.getStripLength(sensor));
+ System.out.printf("%s: ro electrodes capacitance %.3f (cell0 %.3f)\n", this.getClass().getSimpleName(), readoutElectrodes.getCapacitance(), readoutElectrodes.getCapacitance(0));
+ System.out.printf("%s: ro sense capacitance %.3f (cell0 %.3f)\n", this.getClass().getSimpleName(), senseElectrodes.getCapacitance(), senseElectrodes.getCapacitance(0));
+ }
+
// Set sense and readout electrodes.
sensor.setSenseElectrodes(senseElectrodes);
sensor.setReadoutElectrodes(readoutElectrodes);
// Set the charge transfer efficiency.
- double[][] transferEfficiencies = {{readoutTransferEfficiency, senseTransferEfficiency}};
+ double[][] transferEfficiencies = { { readoutTransferEfficiency, senseTransferEfficiency } };
sensor.setTransferEfficiencies(ChargeCarrier.HOLE, new BasicMatrix(transferEfficiencies));
if (debug) {
@@ -154,32 +153,31 @@
double getStripLength(SiSensor sensor) {
/*
- * Returns the length of the strip
- * This is getting the face of the sensor and then getting the longest edge
- * VERY DANGEROUS -> FIX THIS!
+ * Returns the length of the strip This is getting the face of the
+ * sensor and then getting the longest edge VERY DANGEROUS -> FIX THIS!
*/
double length = 0;
- List<Polygon3D> faces = ((Box) sensor.getGeometry().getLogicalVolume().getSolid()).getFacesNormalTo(new BasicHep3Vector(0,0,1));
- for(Polygon3D face : faces) {
- //System.out.printf("%s: Sensor %s polygon3D %s\n",this.getClass().getSimpleName(),sensor.getName(),face.toString());
+ List<Polygon3D> faces = ((Box) sensor.getGeometry().getLogicalVolume().getSolid()).getFacesNormalTo(new BasicHep3Vector(0, 0, 1));
+ for (Polygon3D face : faces) {
+ // System.out.printf("%s: Sensor %s polygon3D %s\n",this.getClass().getSimpleName(),sensor.getName(),face.toString());
List<LineSegment3D> edges = face.getEdges();
- for(LineSegment3D edge : edges) {
+ for (LineSegment3D edge : edges) {
double l = edge.getLength();
- if(l>length) {
+ if (l > length) {
length = l;
}
- //System.out.printf("%s: edge %.3f \n",this.getClass().getSimpleName(),edge.getLength());
+ // System.out.printf("%s: edge %.3f \n",this.getClass().getSimpleName(),edge.getLength());
}
}
return length;
}
-
+
/**
* Set the readout strip capacitance
*
* @param intercept
- * @param slope
+ * @param slope
*/
public void setReadoutStripCapacitance(double intercept, double slope) {
readoutStripCapacitanceIntercept = intercept;
@@ -187,10 +185,10 @@
}
/**
- * Set the sense strip capacitance
+ * Set the sense strip capacitance
*
* @param intercept
- * @param slope
+ * @param slope
*/
public void setSenseStripCapacitance(double intercept, double slope) {
senseStripCapacitanceIntercept = intercept;
@@ -218,7 +216,7 @@
/**
* Set readout strip transfer efficiency
*
- * @param efficiency
+ * @param efficiency
*/
public void setReadoutTransferEfficiency(double efficiency) {
readoutTransferEfficiency = efficiency;
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/QuietBaseLCSimEvent.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/QuietBaseLCSimEvent.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/QuietBaseLCSimEvent.java Mon Nov 10 00:16:49 2014
@@ -1,4 +1,5 @@
package org.hps.conditions.deprecated;
+
import hep.physics.event.BaseEvent;
import java.util.ArrayList;
@@ -28,225 +29,197 @@
import org.lcsim.lcio.LCIOUtil;
/**
- * Duplicates BaseLCSimEvent but doesn't call conditionsManager.setDetector in its constructor.
- * Used in TestRunTriggeredReconToLcio to avoid causing spurious detectorChanged events.
- * TODO: really should find a better way to do this, this is awful, but I don't see a clean way to do this by just extending BaseLCSimEvent.
+ * Duplicates BaseLCSimEvent but doesn't call conditionsManager.setDetector in
+ * its constructor. Used in TestRunTriggeredReconToLcio to avoid causing
+ * spurious detectorChanged events. TODO: really should find a better way to do
+ * this, this is awful, but I don't see a clean way to do this by just extending
+ * BaseLCSimEvent.
* @author Sho Uemura
*/
-public class QuietBaseLCSimEvent extends BaseEvent implements EventHeader
-{
+public class QuietBaseLCSimEvent extends BaseEvent implements EventHeader {
private String detectorName;
- private final Map<List,LCMetaData> metaDataMap = new IdentityHashMap<List,LCMetaData>();
+ private final Map<List, LCMetaData> metaDataMap = new IdentityHashMap<List, LCMetaData>();
private ConditionsManager conditionsManager = ConditionsManager.defaultInstance();
private static final int NANO_SECONDS = 1000000;
public static final String READOUT_NAME = "ReadoutName";
/** Creates a new instance of BaseLCSimEvent */
- public QuietBaseLCSimEvent(int run, int event, String detectorName)
- {
- this(run,event,detectorName,System.currentTimeMillis()*NANO_SECONDS);
- }
-
- public QuietBaseLCSimEvent(int run, int event, String detectorName, long timeStamp)
- {
- super(run,event,timeStamp);
+ public QuietBaseLCSimEvent(int run, int event, String detectorName) {
+ this(run, event, detectorName, System.currentTimeMillis() * NANO_SECONDS);
+ }
+
+ public QuietBaseLCSimEvent(int run, int event, String detectorName, long timeStamp) {
+ super(run, event, timeStamp);
this.detectorName = detectorName;
-// try
-// {
-// conditionsManager.setDetector(detectorName,run);
-// }
-// catch (ConditionsNotFoundException x)
-// {
-// throw new RuntimeException("Please see http://confluence.slac.stanford.edu/display/ilc/Conditions+database",x);
-// }
- }
-
- //public String getInputFile()
- //{
- // return (String)get("INPUT_FILE");
- //}
-
- public String toString()
- {
- return "Run "+getRunNumber()+" Event "+getEventNumber()+" ("+new Date(getTimeStamp()/NANO_SECONDS)+") Detector: "+detectorName;
- }
-
- public Detector getDetector()
- {
- return conditionsManager.getCachedConditions(Detector.class,"compact.xml").getCachedData();
- }
-
- public List<MCParticle> getMCParticles()
- {
- return get(MCParticle.class,MC_PARTICLES);
- }
-
- public List<Track> getTracks()
- {
- return get(Track.class,TRACKS);
- }
-
- public List<Cluster> getClusters()
- {
- return get(Cluster.class,CLUSTERS);
- }
-
- public List<SimCalorimeterHit> getSimCalorimeterHits(String name)
- {
- return get(SimCalorimeterHit.class,name);
- }
-
- public List<SimTrackerHit> getSimTrackerHits(String name)
- {
- return get(SimTrackerHit.class,name);
- }
-
- public <T> List<T> get(Class<T> type, String name)
- {
+ // try
+ // {
+ // conditionsManager.setDetector(detectorName,run);
+ // }
+ // catch (ConditionsNotFoundException x)
+ // {
+ // throw new
+ // RuntimeException("Please see http://confluence.slac.stanford.edu/display/ilc/Conditions+database",x);
+ // }
+ }
+
+ // public String getInputFile()
+ // {
+ // return (String)get("INPUT_FILE");
+ // }
+
+ public String toString() {
+ return "Run " + getRunNumber() + " Event " + getEventNumber() + " (" + new Date(getTimeStamp() / NANO_SECONDS) + ") Detector: " + detectorName;
+ }
+
+ public Detector getDetector() {
+ return conditionsManager.getCachedConditions(Detector.class, "compact.xml").getCachedData();
+ }
+
+ public List<MCParticle> getMCParticles() {
+ return get(MCParticle.class, MC_PARTICLES);
+ }
+
+ public List<Track> getTracks() {
+ return get(Track.class, TRACKS);
+ }
+
+ public List<Cluster> getClusters() {
+ return get(Cluster.class, CLUSTERS);
+ }
+
+ public List<SimCalorimeterHit> getSimCalorimeterHits(String name) {
+ return get(SimCalorimeterHit.class, name);
+ }
+
+ public List<SimTrackerHit> getSimTrackerHits(String name) {
+ return get(SimTrackerHit.class, name);
+ }
+
+ public <T> List<T> get(Class<T> type, String name) {
return (List<T>) get(name);
}
- public <T> List<List<T>> get(Class<T> type)
- {
+ public <T> List<List<T>> get(Class<T> type) {
List<List<T>> result = new ArrayList<List<T>>();
- for (Map.Entry<List,LCMetaData> entry : metaDataMap.entrySet())
- {
- if (type.isAssignableFrom(entry.getValue().getType()))
- {
+ for (Map.Entry<List, LCMetaData> entry : metaDataMap.entrySet()) {
+ if (type.isAssignableFrom(entry.getValue().getType())) {
result.add(entry.getKey());
}
}
return result;
}
-
- public Collection<LCMetaData> getMetaData()
- {
- return metaDataMap.values();
- }
-
- public Set<List> getLists()
- {
- return metaDataMap.keySet();
- }
-
- public LCMetaData getMetaData(List x)
- {
+
+ public Collection<LCMetaData> getMetaData() {
+ return metaDataMap.values();
+ }
+
+ public Set<List> getLists() {
+ return metaDataMap.keySet();
+ }
+
+ public LCMetaData getMetaData(List x) {
return metaDataMap.get(x);
}
- public void put(String name, Object component)
- {
+ public void put(String name, Object component) {
super.put(name, component);
- if (component instanceof List)
- {
+ if (component instanceof List) {
List list = (List) component;
Class type = list.isEmpty() ? Object.class : list.get(0).getClass();
- for (Object o : list)
- {
- if (!type.isAssignableFrom(o.getClass())) type = Object.class;
- }
- metaDataMap.put(list,new MetaData(name,type,0,null));
- }
- }
-
- public void put(String name, List collection, Class type, int flags)
- {
- put(name,collection,type,flags,null);
- }
-
- public void put(String name, List collection, Class type, int flags, String readoutName)
- {
- super.put(name,collection);
-
+ for (Object o : list) {
+ if (!type.isAssignableFrom(o.getClass()))
+ type = Object.class;
+ }
+ metaDataMap.put(list, new MetaData(name, type, 0, null));
+ }
+ }
+
+ public void put(String name, List collection, Class type, int flags) {
+ put(name, collection, type, flags, null);
+ }
+
+ public void put(String name, List collection, Class type, int flags, String readoutName) {
+ super.put(name, collection);
+
LCMetaData meta = new MetaData(name, type, flags, readoutName);
- metaDataMap.put(collection,meta);
+ metaDataMap.put(collection, meta);
setCollectionMetaData(collection, type, meta);
}
private void setCollectionMetaData(List collection, Class type, LCMetaData meta) {
- //System.out.println("setCollectionMetaData");
+ // System.out.println("setCollectionMetaData");
// Set MetaData on collection objects.
if (HasMetaData.class.isAssignableFrom(type)) {
for (Object o : collection) {
if (o instanceof HasMetaData) {
- ((HasMetaData)o).setMetaData(meta);
+ ((HasMetaData) o).setMetaData(meta);
}
}
}
}
-
- protected void put(String name, List collection, Class type, int flags, Map intMap, Map floatMap, Map stringMap)
- {
- super.put(name,collection);
+
+ protected void put(String name, List collection, Class type, int flags, Map intMap, Map floatMap, Map stringMap) {
+ super.put(name, collection);
LCMetaData meta = new MetaData(name, type, flags, intMap, floatMap, stringMap);
- metaDataMap.put(collection,meta);
+ metaDataMap.put(collection, meta);
}
/**
* Removes a collection from the event.
*/
- public void remove(String name)
- {
+ public void remove(String name) {
Object collection = get(name);
- if (collection instanceof List) metaDataMap.remove((List) collection);
+ if (collection instanceof List)
+ metaDataMap.remove((List) collection);
super.keys().remove(name);
}
- public String getDetectorName()
- {
+ public String getDetectorName() {
return detectorName;
}
- public boolean hasCollection(Class type, String name)
- {
- if (!hasItem(name)) return false;
+ public boolean hasCollection(Class type, String name) {
+ if (!hasItem(name))
+ return false;
Object collection = get(name);
- if (!(collection instanceof List)) return false;
+ if (!(collection instanceof List))
+ return false;
return type.isAssignableFrom(metaDataMap.get(collection).getType());
}
-
- public boolean hasCollection(Class type)
- {
- for (LCMetaData meta : metaDataMap.values())
- {
- if (type.isAssignableFrom(meta.getType()))
- {
+
+ public boolean hasCollection(Class type) {
+ for (LCMetaData meta : metaDataMap.values()) {
+ if (type.isAssignableFrom(meta.getType())) {
return true;
}
}
- return false;
- }
-
- public boolean hasItem(String name)
- {
+ return false;
+ }
+
+ public boolean hasItem(String name) {
return super.keys().contains(name);
}
-
- public Map<String, int[]> getIntegerParameters()
- {
- return Collections.<String, int[]>emptyMap();
-
- }
-
- public Map<String, float[]> getFloatParameters()
- {
- return Collections.<String, float[]>emptyMap();
-
- }
-
- public Map<String, String[]> getStringParameters()
- {
- return Collections.<String, String[]>emptyMap();
- }
-
- public float getWeight()
- {
+
+ public Map<String, int[]> getIntegerParameters() {
+ return Collections.<String, int[]> emptyMap();
+
+ }
+
+ public Map<String, float[]> getFloatParameters() {
+ return Collections.<String, float[]> emptyMap();
+
+ }
+
+ public Map<String, String[]> getStringParameters() {
+ return Collections.<String, String[]> emptyMap();
+ }
+
+ public float getWeight() {
return 1.0f;
}
- private class MetaData implements LCMetaData
- {
+ private class MetaData implements LCMetaData {
private int flags;
private final String name;
private final Class type;
@@ -255,15 +228,15 @@
private Map<String, String[]> stringMap;
private transient IDDecoder dec;
- MetaData(String name, Class type, int flags, String readoutName)
- {
+ MetaData(String name, Class type, int flags, String readoutName) {
this.name = name;
this.type = type;
this.flags = flags;
- if (readoutName != null) getStringParameters().put(READOUT_NAME,new String[]{ readoutName });
- }
- MetaData(String name, Class type, int flags, Map intMap, Map floatMap, Map stringMap)
- {
+ if (readoutName != null)
+ getStringParameters().put(READOUT_NAME, new String[] { readoutName });
+ }
+
+ MetaData(String name, Class type, int flags, Map intMap, Map floatMap, Map stringMap) {
this.name = name;
this.type = type;
this.flags = flags;
@@ -272,121 +245,109 @@
this.stringMap = stringMap;
}
- public int getFlags()
- {
+ public int getFlags() {
return flags;
}
- public String getName()
- {
+ public String getName() {
return name;
}
- public Class getType()
- {
+ public Class getType() {
return type;
}
- public org.lcsim.geometry.IDDecoder getIDDecoder()
- {
- if (dec == null) dec = findIDDecoder();
+ public org.lcsim.geometry.IDDecoder getIDDecoder() {
+ if (dec == null)
+ dec = findIDDecoder();
return dec;
}
- public org.lcsim.geometry.IDDecoder findIDDecoder()
- {
- // If the IDDecoder name is explicitly set then use it, otherwise
+ public org.lcsim.geometry.IDDecoder findIDDecoder() {
+ // If the IDDecoder name is explicitly set then use it, otherwise
// use the name of the collection itself.
String readoutName = name;
- if (stringMap != null)
- {
+ if (stringMap != null) {
String[] names = stringMap.get(READOUT_NAME);
- if (names != null && names.length >= 1) readoutName = names[0];
+ if (names != null && names.length >= 1)
+ readoutName = names[0];
}
// Find the IDDecoder using the Detector.
- org.lcsim.geometry.IDDecoder result=null;
+ org.lcsim.geometry.IDDecoder result = null;
try {
result = getDetector().getDecoder(readoutName);
- }
- catch (RuntimeException x)
- {}
-
- // Detector lookup failed. Attempt to use the CellIDEncoding collection parameter.
+ } catch (RuntimeException x) {
+ }
+
+ // Detector lookup failed. Attempt to use the CellIDEncoding
+ // collection parameter.
if (result == null)
result = createIDDecoderFromCellIDEncoding();
// If both methods failed, then there is a problem.
- if (result == null)
- throw new RuntimeException("Could not find or create an IDDecoder for the collection: "+name+", readout: "+readoutName);
+ if (result == null)
+ throw new RuntimeException("Could not find or create an IDDecoder for the collection: " + name + ", readout: " + readoutName);
return result;
}
/**
- * Make an IDDecoder for this MetaData using the CellIDEncoding parameter.
+ * Make an IDDecoder for this MetaData using the CellIDEncoding
+ * parameter.
* @return An IDDecoder made built from the CellIDEncoding.
*/
- private IDDecoder createIDDecoderFromCellIDEncoding()
- {
+ private IDDecoder createIDDecoderFromCellIDEncoding() {
String[] cellIdEncoding = getStringParameters().get("CellIDEncoding");
IDDecoder result = null;
- if (cellIdEncoding != null)
- {
+ if (cellIdEncoding != null) {
result = new BaseIDDecoder();
try {
IDDescriptor desc = new IDDescriptor(cellIdEncoding[0]);
result.setIDDescription(desc);
- }
- catch (IDDescriptor.IDException x)
- {
+ } catch (IDDescriptor.IDException x) {
throw new RuntimeException(x);
}
- }
+ }
return result;
}
- public Map<String, int[]> getIntegerParameters()
- {
- if (intMap == null) intMap = new HashMap<String, int[]>();
+ public Map<String, int[]> getIntegerParameters() {
+ if (intMap == null)
+ intMap = new HashMap<String, int[]>();
return intMap;
}
- public Map<String, float[]> getFloatParameters()
- {
- if (floatMap == null) floatMap = new HashMap<String, float[]>();
+ public Map<String, float[]> getFloatParameters() {
+ if (floatMap == null)
+ floatMap = new HashMap<String, float[]>();
return floatMap;
}
- public Map<String, String[]> getStringParameters()
- {
- if (stringMap == null) stringMap = new HashMap<String, String[]>();
+ public Map<String, String[]> getStringParameters() {
+ if (stringMap == null)
+ stringMap = new HashMap<String, String[]>();
return stringMap;
}
- public EventHeader getEvent()
- {
+ public EventHeader getEvent() {
return QuietBaseLCSimEvent.this;
}
- public void setSubset(boolean isSubset)
- {
- flags = LCIOUtil.bitSet(flags,LCIOConstants.BITSubset,isSubset);
- }
-
- public boolean isSubset()
- {
- return LCIOUtil.bitTest(flags,LCIOConstants.BITSubset);
- }
-
- public void setTransient(boolean isTransient)
- {
- flags = LCIOUtil.bitSet(flags,LCIOConstants.BITTransient,isTransient);
- }
-
- public boolean isTransient()
- {
- return LCIOUtil.bitTest(flags,LCIOConstants.BITTransient);
+ public void setSubset(boolean isSubset) {
+ flags = LCIOUtil.bitSet(flags, LCIOConstants.BITSubset, isSubset);
+ }
+
+ public boolean isSubset() {
+ return LCIOUtil.bitTest(flags, LCIOConstants.BITSubset);
+ }
+
+ public void setTransient(boolean isTransient) {
+ flags = LCIOUtil.bitSet(flags, LCIOConstants.BITTransient, isTransient);
+ }
+
+ public boolean isTransient() {
+ return LCIOUtil.bitTest(flags, LCIOConstants.BITTransient);
}
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/StereoPair.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/StereoPair.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/StereoPair.java Mon Nov 10 00:16:49 2014
@@ -7,124 +7,126 @@
*
* @author Per Hansson <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: StereoPair.java,v 1.3 2013/07/30 00:53:07 omoreno Exp $
+ * @version $Id: StereoPair.java,v 1.3 2013/07/30 00:53:07 omoreno Exp $
*/
public class StereoPair {
-
- // Layer number to which the stereo pair belongs to
- private int layerNumber = -1;
-
- // The axial and stereo sensors
- private SiSensor axialSensor = null;
- private SiSensor stereoSensor = null;
-
- // The detector volume in which the stereo pair resides
- public enum detectorVolume{ Top, Bottom };
- private detectorVolume volume = detectorVolume.Top;
-
- /**
- * Default Ctor
- *
- * @param layerNumber : Layer number to which the stereo pair belongs to
- */
- public StereoPair(int layerNumber){
- this.layerNumber = layerNumber;
- }
-
- /**
- * Ctor
- *
- * @param layerNumber : Layer number to which the stereo pair belongs to
- * @param volume : detector volume (detectorVolume.Top or detector Volume.Bottom) in
- * which the stereo pair resides
- * @param axialSensor
- * @param stereoSensor
- */
- public StereoPair(int layerNumber, detectorVolume volume, SiSensor axialSensor, SiSensor stereoSensor){
- this.layerNumber = layerNumber;
- this.volume = volume;
- this.axialSensor = axialSensor;
- this.stereoSensor = stereoSensor;
- }
+ // Layer number to which the stereo pair belongs to
+ private int layerNumber = -1;
- /**
- * Set the axial sensor of stereo pair
- *
- * @param axialSensor
- */
- public void setAxialSensor(SiSensor axialSensor){
- this.axialSensor = axialSensor;
- }
-
- /**
- * Set the stereo sensor of the stereo pair
- *
- * @param stereoSensor
- */
- public void setStereoSensor(SiSensor stereoSensor){
- this.stereoSensor = stereoSensor;
- }
-
- /**
- * Set the SVT volume in which the stereo pair resides
- *
- * @param volume : detectorVolume.Top or detectorVolume.Bottom
- */
- public void setDetectorVolume(detectorVolume volume){
- this.volume = volume;
- }
-
- /**
- * Get the axial sensor of the stereo pair
- *
- * @return Axial sensor. Returns null if it hasn't been set yet.
- */
- public SiSensor getAxialSensor(){
- return axialSensor;
- }
-
- /**
- * Get the stereo sensor of the stereo pair
- *
- * @return Stereo sensor. Returns null if it hasn't been set yet.
- */
- public SiSensor getStereoSensor(){
- return stereoSensor;
- }
+ // The axial and stereo sensors
+ private SiSensor axialSensor = null;
+ private SiSensor stereoSensor = null;
- /**
- * Get the layer number to which the stereo pair belongs to
- *
- * @return layer number
- */
- public int getLayerNumber(){
- return layerNumber;
- }
-
- /**
- * Get the SVT volume in which the stereo pair resides
- *
- * @return volume : detectorVolume.Top or detectorVolume.Bottom
- */
- public detectorVolume getDetectorVolume(){
- return volume;
- }
-
- /**
- * Return a string describing the stereo pair
- *
- * @return stereo pair description
- */
- @Override
- public String toString(){
- String axialName = axialSensor == null ? "None" : axialSensor.getName();
- String stereoName = stereoSensor == null ? "None" : stereoSensor.getName();
- String description = "Stereo Pair:\n";
- description += "\tLayer Number: " + this.getLayerNumber();
- description += "\t\tAxial Sensor: " + axialName;
- description += "\t\tStereo Sensor: " + stereoName;
- return description;
-
- }
+ // The detector volume in which the stereo pair resides
+ public enum detectorVolume {
+ Top, Bottom
+ };
+
+ private detectorVolume volume = detectorVolume.Top;
+
+ /**
+ * Default Ctor
+ *
+ * @param layerNumber : Layer number to which the stereo pair belongs to
+ */
+ public StereoPair(int layerNumber) {
+ this.layerNumber = layerNumber;
+ }
+
+ /**
+ * Ctor
+ *
+ * @param layerNumber : Layer number to which the stereo pair belongs to
+ * @param volume : detector volume (detectorVolume.Top or detector
+ * Volume.Bottom) in which the stereo pair resides
+ * @param axialSensor
+ * @param stereoSensor
+ */
+ public StereoPair(int layerNumber, detectorVolume volume, SiSensor axialSensor, SiSensor stereoSensor) {
+ this.layerNumber = layerNumber;
+ this.volume = volume;
+ this.axialSensor = axialSensor;
+ this.stereoSensor = stereoSensor;
+ }
+
+ /**
+ * Set the axial sensor of stereo pair
+ *
+ * @param axialSensor
+ */
+ public void setAxialSensor(SiSensor axialSensor) {
+ this.axialSensor = axialSensor;
+ }
+
+ /**
+ * Set the stereo sensor of the stereo pair
+ *
+ * @param stereoSensor
+ */
+ public void setStereoSensor(SiSensor stereoSensor) {
+ this.stereoSensor = stereoSensor;
+ }
+
+ /**
+ * Set the SVT volume in which the stereo pair resides
+ *
+ * @param volume : detectorVolume.Top or detectorVolume.Bottom
+ */
+ public void setDetectorVolume(detectorVolume volume) {
+ this.volume = volume;
+ }
+
+ /**
+ * Get the axial sensor of the stereo pair
+ *
+ * @return Axial sensor. Returns null if it hasn't been set yet.
+ */
+ public SiSensor getAxialSensor() {
+ return axialSensor;
+ }
+
+ /**
+ * Get the stereo sensor of the stereo pair
+ *
+ * @return Stereo sensor. Returns null if it hasn't been set yet.
+ */
+ public SiSensor getStereoSensor() {
+ return stereoSensor;
+ }
+
+ /**
+ * Get the layer number to which the stereo pair belongs to
+ *
+ * @return layer number
+ */
+ public int getLayerNumber() {
+ return layerNumber;
+ }
+
+ /**
+ * Get the SVT volume in which the stereo pair resides
+ *
+ * @return volume : detectorVolume.Top or detectorVolume.Bottom
+ */
+ public detectorVolume getDetectorVolume() {
+ return volume;
+ }
+
+ /**
+ * Return a string describing the stereo pair
+ *
+ * @return stereo pair description
+ */
+ @Override
+ public String toString() {
+ String axialName = axialSensor == null ? "None" : axialSensor.getName();
+ String stereoName = stereoSensor == null ? "None" : stereoSensor.getName();
+ String description = "Stereo Pair:\n";
+ description += "\tLayer Number: " + this.getLayerNumber();
+ description += "\t\tAxial Sensor: " + axialName;
+ description += "\t\tStereo Sensor: " + stereoName;
+ return description;
+
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/SvtUtils.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/SvtUtils.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/SvtUtils.java Mon Nov 10 00:16:49 2014
@@ -24,7 +24,7 @@
import static org.hps.conditions.deprecated.StereoPair.detectorVolume;
/**
- * A class providing various utilities related to the HPS SVT.
+ * A class providing various utilities related to the HPS SVT.
*
* @author Omar Moreno <[log in to unmask]>
* @version $Id: SvtUtils.java,v 1.19 2013/11/06 20:25:37 omoreno Exp $
@@ -35,11 +35,11 @@
// Set of sensors
private Set<SiSensor> sensors = new HashSet<SiSensor>();
// Set of stereo pairs
- private Set<StereoPair> stereoPairs = new HashSet<StereoPair>();
+ private Set<StereoPair> stereoPairs = new HashSet<StereoPair>();
// Map from Sensor to Hybrid/FPGA pair
private Map<SiSensor /* sensor */, Pair<Integer /* FPGA */, Integer /* Hybrid */>> sensorToDaqPair = new HashMap<SiSensor, Pair<Integer, Integer>>();
// Map from Hybrid/FPGA pair
- private Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, SiSensor /* Sensor*/> daqPairToSensor = new HashMap<Pair<Integer, Integer>, SiSensor>();
+ private Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, SiSensor /* Sensor */> daqPairToSensor = new HashMap<Pair<Integer, Integer>, SiSensor>();
// Map from SVT top layer to Hybrid/FPGA pair
private Map<Integer /* Layer */, List<Pair<Integer /* FPGA */, Integer /* Hybrid */>>> topLayerDaqMap = new HashMap<Integer, List<Pair<Integer, Integer>>>();
// Map from SVT bottom layer to Hybrid/FPGA pair
@@ -50,7 +50,7 @@
private Map<SiSensor /* Sensor */, Integer /* Layer */> sensorToBottomLayer = new HashMap<SiSensor, Integer>();
// Map sensor to descriptor
private Map<SiSensor /* Sensor */, String /* Description */> sensorToDescriptor = new HashMap<SiSensor, String>();
- // Map layer to top SVT sensor
+ // Map layer to top SVT sensor
private Map<Integer /* Layer */, List<SiSensor> /* Sensor */> topLayerToSensor = new HashMap<Integer, List<SiSensor>>();
// Map layer to bottom SVT sensor
private Map<Integer /* Layer */, List<SiSensor> /* Sensor */> bottomLayerToSensor = new HashMap<Integer, List<SiSensor>>();
@@ -65,7 +65,7 @@
boolean debug = false;
/*
- * Private ctor to keep user from instantiating
+ * Private ctor to keep user from instantiating
*/
private SvtUtils() {
}
@@ -90,21 +90,21 @@
}
/**
- * Get the plane number to which the sensor belongs to. This is does not
+ * Get the plane number to which the sensor belongs to. This is does not
* return the SVT layer number.
*
* @param sensor
* @return The layer number
*/
- // TODO: Change the name to clarify that what is being returned is the plane number
+ // TODO: Change the name to clarify that what is being returned is the plane
+ // number
public int getLayerNumber(SiSensor sensor) {
if (sensorToTopLayer.containsKey(sensor)) {
return sensorToTopLayer.get(sensor);
} else if (sensorToBottomLayer.containsKey(sensor)) {
return sensorToBottomLayer.get(sensor);
} else {
- throw new RuntimeException("The sensor " + sensor.getName()
- + " does not have an associated plane number");
+ throw new RuntimeException("The sensor " + sensor.getName() + " does not have an associated plane number");
}
}
@@ -126,7 +126,7 @@
/**
* Checks if the orientation of the sensor is axial.
*
- * @return true if it is, false if it is a stereo sensor
+ * @return true if it is, false if it is a stereo sensor
*/
public boolean isAxial(SiSensor sensor) {
if (this.isTopLayer(sensor) && this.getLayerNumber(sensor) % 2 == 1) {
@@ -140,9 +140,9 @@
/**
* Get a sensor by its plane and module id. Both are zero-indexed.
*
- * @param moduleNumber : module id
- * @param planeNumber : plane id (typically 1 less than the layer id)
- * @return sensor
+ * @param moduleNumber : module id
+ * @param planeNumber : plane id (typically 1 less than the layer id)
+ * @return sensor
*/
public SiSensor getSensor(int moduleNumber, int planeNumber) {
if (moduleNumber < 0 || moduleNumber > maxModuleNumber) {
@@ -156,50 +156,52 @@
/**
* Get a sensor by its FPGA and hybrid number.
*
- * @param daqPair : a Pair of the form Pair<FPGA number, hybrid number>
- * @return sensor
+ * @param daqPair : a Pair of the form Pair<FPGA number, hybrid number>
+ * @return sensor
*/
public SiSensor getSensor(Pair<Integer, Integer> daqPair) {
return daqPairToSensor.get(daqPair);
}
/**
- * Get a sensor from the top SVT volume by its plane number and sensor
+ * Get a sensor from the top SVT volume by its plane number and sensor
* position within a plane.
*
- * @param planeNumber
- * @param sensorNumber : position within a plane
- * @return sensor or null if the sensor doesn't exist in that position
+ * @param planeNumber
+ * @param sensorNumber : position within a plane
+ * @return sensor or null if the sensor doesn't exist in that position
*/
public SiSensor getTopSensor(int planeNumber, int sensorNumber) {
- if(topLayerToSensor.get(planeNumber).size() <= sensorNumber) return null;
+ if (topLayerToSensor.get(planeNumber).size() <= sensorNumber)
+ return null;
return topLayerToSensor.get(planeNumber).get(sensorNumber);
}
/**
- * Get a sensor from the bottom SVT volume by its plane number and sensor
+ * Get a sensor from the bottom SVT volume by its plane number and sensor
* position within a plane.
*
- * @param planeNumber
- * @param sensorNumber : position within a plane
- * @return sensor or null if the sensor doesn't exist in that position
+ * @param planeNumber
+ * @param sensorNumber : position within a plane
+ * @return sensor or null if the sensor doesn't exist in that position
*/
public SiSensor getBottomSensor(int layer, int sensorNumber) {
- if(bottomLayerToSensor.get(layer).size() <= sensorNumber) return null;
+ if (bottomLayerToSensor.get(layer).size() <= sensorNumber)
+ return null;
return bottomLayerToSensor.get(layer).get(sensorNumber);
}
/**
* Get the Set of all sensors which compose the SVT.
*
- * @return set of sensors
+ * @return set of sensors
*/
public Set<SiSensor> getSensors() {
return sensors;
}
/**
- * Get the Set of all FPGA numbers.
+ * Get the Set of all FPGA numbers.
*
* @return set of FPGA numbers
*/
@@ -275,14 +277,14 @@
}
return sensor.makeStripId(channel, sideNumber).getValue();
}
-
+
/**
* Get the set of all stereo pairs which compose the SVT.
*
- * @return Set of stereo pairs
- */
- public Set<StereoPair> getStereoPairs(){
- return stereoPairs;
+ * @return Set of stereo pairs
+ */
+ public Set<StereoPair> getStereoPairs() {
+ return stereoPairs;
}
/**
@@ -293,15 +295,16 @@
public void setup(Detector detector) {
this.printDebug("Method: setupMaps: \n\tDetector: " + detector.getDetectorName());
-
+
// Load the DAQ Map from the conditions database
this.loadSvtDaqMap();
-
+
// Instantiate 'sensorArray' which allows for retrieval of a SiSensor
// by module and layer id
sensorArray = new SiSensor[maxModuleNumber + 1][maxLayerNumber];
- // Get all of the sensors composing the SVT and add them to the set of all sensors
+ // Get all of the sensors composing the SVT and add them to the set of
+ // all sensors
IDetectorElement detectorElement = detector.getDetectorElement().findDetectorElement(subdetectorName);
helper = detectorElement.getIdentifierHelper();
sensors.addAll(detectorElement.findDescendants(SiSensor.class));
@@ -325,38 +328,38 @@
sensorArray[moduleNumber][layerNumber - 1] = sensor;
int listPosition = 0;
switch (moduleNumber % 2) {
- // Top Layer
- case 0:
-
- listPosition = moduleNumber / 2;
- sensorToTopLayer.put(sensor, layerNumber);
- sensorToDaqPair.put( sensor, topLayerDaqMap.get(layerNumber).get(listPosition));
- topLayerToSensor.get(layerNumber).set(listPosition, sensor);
- daqPairToSensor.put(topLayerDaqMap.get(layerNumber).get(listPosition), sensor);
- description = "Top Layer " + layerNumber + " - Sensor " + listPosition;
- this.printDebug("\tDescription: " + description);
- sensorToDescriptor.put(sensor, description);
- break;
- // Bottom Layer
- case 1:
-
- listPosition = (moduleNumber - 1) / 2;
- sensorToBottomLayer.put(sensor, layerNumber);
- sensorToDaqPair.put(sensor, bottomLayerDaqMap.get(layerNumber).get(listPosition));
- bottomLayerToSensor.get(layerNumber).set(listPosition, sensor);
- daqPairToSensor.put(bottomLayerDaqMap.get(layerNumber).get(listPosition), sensor);
- description = "Bottom Layer " + layerNumber + " - Sensor " + listPosition;
- this.printDebug("\tDescription: " + description);
- sensorToDescriptor.put(sensor, description);
- break;
- default:
- throw new RuntimeException("Invalid module number: " + moduleNumber);
+ // Top Layer
+ case 0:
+
+ listPosition = moduleNumber / 2;
+ sensorToTopLayer.put(sensor, layerNumber);
+ sensorToDaqPair.put(sensor, topLayerDaqMap.get(layerNumber).get(listPosition));
+ topLayerToSensor.get(layerNumber).set(listPosition, sensor);
+ daqPairToSensor.put(topLayerDaqMap.get(layerNumber).get(listPosition), sensor);
+ description = "Top Layer " + layerNumber + " - Sensor " + listPosition;
+ this.printDebug("\tDescription: " + description);
+ sensorToDescriptor.put(sensor, description);
+ break;
+ // Bottom Layer
+ case 1:
+
+ listPosition = (moduleNumber - 1) / 2;
+ sensorToBottomLayer.put(sensor, layerNumber);
+ sensorToDaqPair.put(sensor, bottomLayerDaqMap.get(layerNumber).get(listPosition));
+ bottomLayerToSensor.get(layerNumber).set(listPosition, sensor);
+ daqPairToSensor.put(bottomLayerDaqMap.get(layerNumber).get(listPosition), sensor);
+ description = "Bottom Layer " + layerNumber + " - Sensor " + listPosition;
+ this.printDebug("\tDescription: " + description);
+ sensorToDescriptor.put(sensor, description);
+ break;
+ default:
+ throw new RuntimeException("Invalid module number: " + moduleNumber);
}
}
-
+
// Create stereo pairs
this.createStereoPairs();
-
+
isSetup = true;
}
@@ -364,142 +367,152 @@
* Load the SVT DAQ Map from the conditions database
*
*/
- private void loadSvtDaqMap(){
-
- // Path to file in conditions database
+ private void loadSvtDaqMap() {
+
+ // Path to file in conditions database
String filePath = "daqmap/svt_default.daqmap";
- BufferedReader daqMapReader = null;
+ BufferedReader daqMapReader = null;
String currentLine = null;
try {
daqMapReader = new BufferedReader(manager.getRawConditions(filePath).getReader());
-
- // Continue to read lines for the DAQ map until the end of file is
+
+ // Continue to read lines for the DAQ map until the end of file is
// reached. The DAQ map is has the following format
//
- // layer module fpga hybrid
+ // layer module fpga hybrid
// ---------------------------------
while ((currentLine = daqMapReader.readLine()) != null) {
-
- // If the line is a comment,skip it
- if (currentLine.indexOf("#") != -1) continue;
-
+
+ // If the line is a comment,skip it
+ if (currentLine.indexOf("#") != -1)
+ continue;
+
// Split the line into tokens by whitespace
StringTokenizer stringTok = new StringTokenizer(currentLine);
int listPosition = 0;
while (stringTok.hasMoreTokens()) {
-
- // Parse the line
+
+ // Parse the line
int layer = Integer.valueOf(stringTok.nextToken());
int module = Integer.valueOf(stringTok.nextToken());
int fpga = Integer.valueOf(stringTok.nextToken());
int hybrid = Integer.valueOf(stringTok.nextToken());
-
- // Find the maximum layer number and module number. This
- // is used when instantiating 'sensorArray' and when creating
+
+ // Find the maximum layer number and module number. This
+ // is used when instantiating 'sensorArray' and when
+ // creating
// stereo pairs.
maxModuleNumber = Math.max(maxModuleNumber, module);
maxLayerNumber = Math.max(maxLayerNumber, layer);
-
+
// A pair is used to relate an FPGA value to a hybrid number
Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
fpgaNumbers.add(fpga);
-
+
// Load the maps based on module number.
//
- // Module 0 & 2 correspond to sensors which lie in the top SVT volume
- // Module 1 & 3 correspond to sensors which lie in the bottom SVT volume
+ // Module 0 & 2 correspond to sensors which lie in the top
+ // SVT volume
+ // Module 1 & 3 correspond to sensors which lie in the
+ // bottom SVT volume
//
- // A module number > 1 indicate that the sensor is part of a double layer.
- // For the test run detector, all module numbers are either 0 or 1.
+ // A module number > 1 indicate that the sensor is part of a
+ // double layer.
+ // For the test run detector, all module numbers are either
+ // 0 or 1.
switch (module % 2) {
- case 0:
- listPosition = module / 2;
- // If the top layer DAQ map doesn't contain the layer, add it
- if (!topLayerDaqMap.containsKey(layer)) {
- topLayerDaqMap.put(layer, new ArrayList<Pair<Integer, Integer>>());
- }
- this.printDebug("\tAdding FPGA: " + daqPair.getFirstElement() + ", Hybrid: " + daqPair.getSecondElement() + " to position: " + listPosition);
- // Add the DAQ pair to the corresponding layer
- topLayerDaqMap.get(layer).add(listPosition, daqPair);
-
- // If the top layer sensor map doesn't contain the layer, add it
- if (!topLayerToSensor.containsKey(layer)) {
- topLayerToSensor.put(layer, new ArrayList<SiSensor>());
- }
- // Create room within the sensor map for the sensor
- topLayerToSensor.get(layer).add(null);
- break;
- case 1:
- listPosition = (module - 1) / 2;
- if (!bottomLayerDaqMap.containsKey(layer)) {
- bottomLayerDaqMap.put(layer, new ArrayList<Pair<Integer, Integer>>());
- }
- this.printDebug("\tAdding FPGA: " + daqPair.getFirstElement() + ", Hybrid: " + daqPair.getSecondElement() + " to position: " + listPosition);
- bottomLayerDaqMap.get(layer).add(listPosition, daqPair);
- if (!bottomLayerToSensor.containsKey(layer)) {
- bottomLayerToSensor.put(layer, new ArrayList<SiSensor>());
- }
- bottomLayerToSensor.get(layer).add(null);
- break;
- default:
- throw new RuntimeException("Invalid module number: " + module);
+ case 0:
+ listPosition = module / 2;
+ // If the top layer DAQ map doesn't contain the layer,
+ // add it
+ if (!topLayerDaqMap.containsKey(layer)) {
+ topLayerDaqMap.put(layer, new ArrayList<Pair<Integer, Integer>>());
+ }
+ this.printDebug("\tAdding FPGA: " + daqPair.getFirstElement() + ", Hybrid: " + daqPair.getSecondElement() + " to position: " + listPosition);
+ // Add the DAQ pair to the corresponding layer
+ topLayerDaqMap.get(layer).add(listPosition, daqPair);
+
+ // If the top layer sensor map doesn't contain the
+ // layer, add it
+ if (!topLayerToSensor.containsKey(layer)) {
+ topLayerToSensor.put(layer, new ArrayList<SiSensor>());
+ }
+ // Create room within the sensor map for the sensor
+ topLayerToSensor.get(layer).add(null);
+ break;
+ case 1:
+ listPosition = (module - 1) / 2;
+ if (!bottomLayerDaqMap.containsKey(layer)) {
+ bottomLayerDaqMap.put(layer, new ArrayList<Pair<Integer, Integer>>());
+ }
+ this.printDebug("\tAdding FPGA: " + daqPair.getFirstElement() + ", Hybrid: " + daqPair.getSecondElement() + " to position: " + listPosition);
+ bottomLayerDaqMap.get(layer).add(listPosition, daqPair);
+ if (!bottomLayerToSensor.containsKey(layer)) {
+ bottomLayerToSensor.put(layer, new ArrayList<SiSensor>());
+ }
+ bottomLayerToSensor.get(layer).add(null);
+ break;
+ default:
+ throw new RuntimeException("Invalid module number: " + module);
}
}
}
-
+
} catch (IOException exception) {
throw new RuntimeException("Unable to load DAQ Map from " + filePath, exception);
}
}
-
- /**
- *
- */
- private void createStereoPairs(){
-
- // Loop through all the sensors in both top and bottom layers and
- // create stereo pairs.
- SiSensor firstSensor = null;
- SiSensor secondSensor = null;
- int trackerLayer = 0;
-
- //
- for(int layerNumber = 1; layerNumber <= maxLayerNumber; layerNumber+=2 ){
- for(int sensorNumber = 0; sensorNumber < (maxModuleNumber+1)/2; sensorNumber++){
-
- firstSensor = this.getTopSensor(layerNumber, sensorNumber);
- secondSensor = this.getTopSensor(layerNumber+1, sensorNumber);
-
- if(firstSensor == null || secondSensor == null) continue;
-
- trackerLayer = (layerNumber + 1)/2;
- if(this.isAxial(firstSensor)){
- stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Top, firstSensor, secondSensor));
- } else {
- stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Top, secondSensor, firstSensor));
- }
-
- firstSensor = this.getBottomSensor(layerNumber, sensorNumber);
- secondSensor = this.getBottomSensor(layerNumber+1, sensorNumber);
-
- if(firstSensor == null || secondSensor == null) continue;
-
- if(this.isAxial(firstSensor)){
- stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Bottom, firstSensor, secondSensor));
- } else {
- stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Bottom, secondSensor, firstSensor));
- }
- }
- }
-
- this.printDebug("Total number of stereo pairs created: " + stereoPairs.size());
- for(StereoPair stereoPair : stereoPairs){
- this.printDebug(stereoPair.toString());
- }
- }
-
- /**
- * Print a debug message
+
+ /**
+ *
+ */
+ private void createStereoPairs() {
+
+ // Loop through all the sensors in both top and bottom layers and
+ // create stereo pairs.
+ SiSensor firstSensor = null;
+ SiSensor secondSensor = null;
+ int trackerLayer = 0;
+
+ //
+ for (int layerNumber = 1; layerNumber <= maxLayerNumber; layerNumber += 2) {
+ for (int sensorNumber = 0; sensorNumber < (maxModuleNumber + 1) / 2; sensorNumber++) {
+
+ firstSensor = this.getTopSensor(layerNumber, sensorNumber);
+ secondSensor = this.getTopSensor(layerNumber + 1, sensorNumber);
+
+ if (firstSensor == null || secondSensor == null)
+ continue;
+
+ trackerLayer = (layerNumber + 1) / 2;
+ if (this.isAxial(firstSensor)) {
+ stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Top, firstSensor, secondSensor));
+ } else {
+ stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Top, secondSensor, firstSensor));
+ }
+
+ firstSensor = this.getBottomSensor(layerNumber, sensorNumber);
+ secondSensor = this.getBottomSensor(layerNumber + 1, sensorNumber);
+
+ if (firstSensor == null || secondSensor == null)
+ continue;
+
+ if (this.isAxial(firstSensor)) {
+ stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Bottom, firstSensor, secondSensor));
+ } else {
+ stereoPairs.add(new StereoPair(trackerLayer, detectorVolume.Bottom, secondSensor, firstSensor));
+ }
+ }
+ }
+
+ this.printDebug("Total number of stereo pairs created: " + stereoPairs.size());
+ for (StereoPair stereoPair : stereoPairs) {
+ this.printDebug(stereoPair.toString());
+ }
+ }
+
+ /**
+ * Print a debug message
*
* @param debugMessage : message to be printed
*/
@@ -508,10 +521,10 @@
System.out.println(this.getClass().getSimpleName() + ": " + debugMessage);
}
}
-
+
public void reset() {
sensors = new HashSet<SiSensor>();
- stereoPairs = new HashSet<StereoPair>();
+ stereoPairs = new HashSet<StereoPair>();
sensorToDaqPair = new HashMap<SiSensor, Pair<Integer, Integer>>();
daqPairToSensor = new HashMap<Pair<Integer, Integer>, SiSensor>();
topLayerDaqMap = new HashMap<Integer, List<Pair<Integer, Integer>>>();
@@ -521,7 +534,7 @@
sensorToDescriptor = new HashMap<SiSensor, String>();
topLayerToSensor = new HashMap<Integer, List<SiSensor>>();
bottomLayerToSensor = new HashMap<Integer, List<SiSensor>>();
- sensorArray= null;
+ sensorArray = null;
fpgaNumbers = new HashSet<Integer>();
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/TestRunConditionsReader.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/TestRunConditionsReader.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/deprecated/TestRunConditionsReader.java Mon Nov 10 00:16:49 2014
@@ -7,13 +7,14 @@
import org.lcsim.conditions.ConditionsReader;
/**
- * This is a simple extension of {@link org.lcsim.conditions.ConditionsReader} to find
- * text file conditions data for the HPS Test Run 2012. It basically just checks
- * two resource locations for files and fails if they do not exist.
+ * This is a simple extension of {@link org.lcsim.conditions.ConditionsReader}
+ * to find text file conditions data for the HPS Test Run 2012. It basically
+ * just checks two resource locations for files and fails if they do not exist.
*
* @author Sho Uemura <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: TestRunConditionsReader.java,v 1.4 2013/10/17 23:04:19 jeremy Exp $
+ * @version $Id: TestRunConditionsReader.java,v 1.4 2013/10/17 23:04:19 jeremy
+ * Exp $
*/
public class TestRunConditionsReader extends ConditionsReader {
@@ -21,16 +22,18 @@
public TestRunConditionsReader() {
}
-
- // FIXME: The reader argument is never used anywhere so this ctor is not needed.
+
+ // FIXME: The reader argument is never used anywhere so this ctor is not
+ // needed.
public TestRunConditionsReader(ConditionsReader reader) {
}
-
+
public InputStream open(String name, String type) throws IOException {
-
- //System.out.println(this.getClass().getSimpleName() + ".open - " + name + ", " + type);
-
- // Check the detector base directory.
+
+ // System.out.println(this.getClass().getSimpleName() + ".open - " +
+ // name + ", " + type);
+
+ // Check the detector base directory.
InputStream in = getClass().getResourceAsStream("/" + detectorName + "/" + name + "." + type);
if (in == null) {
// Check for embedded jar resources e.g. in hps-java.
@@ -39,7 +42,7 @@
// If these failed to find conditions, then something went wrong.
if (in == null) {
throw new IOException("Conditions " + name + " for " + detectorName + " with type " + type + " were not found");
- }
+ }
}
return in;
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java Mon Nov 10 00:16:49 2014
@@ -4,8 +4,8 @@
import org.hps.conditions.ConditionsObjectCollection;
/**
- * This class represents an ECAL channel that is considered "bad" which means it should
- * not be used in reconstruction.
+ * This class represents an ECAL channel that is considered "bad" which means it
+ * should not be used in reconstruction.
*/
public final class EcalBadChannel extends AbstractConditionsObject {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java Mon Nov 10 00:16:49 2014
@@ -4,11 +4,11 @@
import org.hps.conditions.ConditionsObjectCollection;
/**
- * This class is a simplistic representation of ECal pedestal and noise values from the
- * conditions database.
+ * This class is a simplistic representation of ECal pedestal and noise values
+ * from the conditions database.
*
- * The pedestal and noise are in units of ADC counts. They are the mean and the standard
- * deviation of the digitized pre-amp output.
+ * The pedestal and noise are in units of ADC counts. They are the mean and the
+ * standard deviation of the digitized pre-amp output.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
@@ -26,8 +26,8 @@
}
/**
- * Get the pedestal value in units of ADC counts, which is the mean of the digitized
- * pre-amp output.
+ * Get the pedestal value in units of ADC counts, which is the mean of the
+ * digitized pre-amp output.
* @return The gain value.
*/
public double getPedestal() {
@@ -35,8 +35,8 @@
}
/**
- * Get the noise value in units of ADC counts, which is the standard deviation of the
- * digitized pre-amp output.
+ * Get the noise value in units of ADC counts, which is the standard
+ * deviation of the digitized pre-amp output.
* @return The noise value.
*/
public double getNoise() {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java Mon Nov 10 00:16:49 2014
@@ -12,16 +12,16 @@
import org.lcsim.detector.identifier.IIdentifierHelper;
/**
- * This class encapsulates all the information about a single ECal channel, corresponding
- * to one physical crystal in the detector.
+ * This class encapsulates all the information about a single ECal channel,
+ * corresponding to one physical crystal in the detector.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
public final class EcalChannel extends AbstractConditionsObject {
/**
- * The <code>DaqId</code> is the combination of crate, slot and channel that specify
- * the channel's DAQ configuration.
+ * The <code>DaqId</code> is the combination of crate, slot and channel that
+ * specify the channel's DAQ configuration.
*/
public static final class DaqId extends AbstractIdentifier {
@@ -48,8 +48,8 @@
}
/**
- * The <code>GeometryId</code> contains the x and y indices of the crystal in the
- * LCSIM-based geometry representation.
+ * The <code>GeometryId</code> contains the x and y indices of the crystal
+ * in the LCSIM-based geometry representation.
*/
public static final class GeometryId extends AbstractIdentifier {
@@ -82,11 +82,12 @@
}
/**
- * The <code>ChannelId</code> is a unique number identifying the channel within its
- * conditions collection. The channels in the database are given sequential channel
- * IDs from 1 to N in semi-arbitrary order. The channel ID is generally the number
- * used to connect other conditions objects such as {@link EcalGain} or
- * {@link EcalCalibration} to the appropriate crystal in the calorimeter.
+ * The <code>ChannelId</code> is a unique number identifying the channel
+ * within its conditions collection. The channels in the database are given
+ * sequential channel IDs from 1 to N in semi-arbitrary order. The channel
+ * ID is generally the number used to connect other conditions objects such
+ * as {@link EcalGain} or {@link EcalCalibration} to the appropriate crystal
+ * in the calorimeter.
*/
public static final class ChannelId extends AbstractIdentifier {
@@ -130,8 +131,9 @@
Map<Long, EcalChannel> channelMap = new HashMap<Long, EcalChannel>();
/**
- * Add an <code>EcalChannel</code> to the collection and cache its ID information.
- * The GeometryId must be created later as it requires access to the Detector API.
+ * Add an <code>EcalChannel</code> to the collection and cache its ID
+ * information. The GeometryId must be created later as it requires
+ * access to the Detector API.
*/
@Override
public void add(EcalChannel channel) throws ConditionsObjectException {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java Mon Nov 10 00:16:49 2014
@@ -6,12 +6,13 @@
import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
/**
- * This class provides access to all ECAL conditions from the database, including gain,
- * pedestal and bad channel settings, per crystal.
+ * This class provides access to all ECAL conditions from the database,
+ * including gain, pedestal and bad channel settings, per crystal.
*
* Unlike most conditions data types, it does not extend
* {@link org.hps.conditions.ConditionsObject}, because it is a composite object
- * containing data assembled from many other {@link org.hps.conditions.ConditionsObjects}.
+ * containing data assembled from many other
+ * {@link org.hps.conditions.ConditionsObjects}.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
@@ -46,12 +47,13 @@
}
/**
- * Get the conditions constants for a specific channel. These will be created if they
- * do not exist for the given channel, BUT only channels in the current channel map
- * are allowed as an argument.
+ * Get the conditions constants for a specific channel. These will be
+ * created if they do not exist for the given channel, BUT only channels in
+ * the current channel map are allowed as an argument.
* @param channel The ECAL channel.
* @return The conditions constants for the channel.
- * @throws IllegalArgumentException if channel does not exist in the channel map.
+ * @throws IllegalArgumentException if channel does not exist in the channel
+ * map.
*/
public EcalChannelConstants getChannelConstants(EcalChannel channel) {
// This channel must come from the map.
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java Mon Nov 10 00:16:49 2014
@@ -12,64 +12,67 @@
import org.hps.conditions.DatabaseConditionsManager;
/**
- * This class loads all ECal conditions into an {@link EcalConditions} object from the
- * database, based on the current run number known by the conditions manager.
+ * This class loads all ECal conditions into an {@link EcalConditions} object
+ * from the database, based on the current run number known by the conditions
+ * manager.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
public final class EcalConditionsConverter implements ConditionsConverter<EcalConditions> {
-
/**
* Create ECAL conditions object containing all data for the current run.
*/
public EcalConditions getData(ConditionsManager manager, String name) {
- DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
+ DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
// Get the ECal channel map from the conditions database
EcalChannelCollection channels = dbConditionsManager.getCollection(EcalChannelCollection.class);
- // Create the ECal conditions object that will be used to encapsulate
+ // Create the ECal conditions object that will be used to encapsulate
// ECal conditions collections
EcalConditions conditions = new EcalConditions();
-
+
// Set the channel map.
conditions.setChannelCollection(channels);
- // Get the ECal gains from the conditions database and add them to the conditions set
+ // Get the ECal gains from the conditions database and add them to the
+ // conditions set
EcalGainCollection gains = dbConditionsManager.getCollection(EcalGainCollection.class);
for (EcalGain gain : gains.getObjects()) {
- ChannelId channelId = new ChannelId(new int[] {gain.getChannelId()});
+ ChannelId channelId = new ChannelId(new int[] { gain.getChannelId() });
EcalChannel channel = channels.findChannel(channelId);
conditions.getChannelConstants(channel).setGain(gain);
}
- // Get the ECal bad channels and add them to the conditions set
- try {
- EcalBadChannelCollection badChannels = dbConditionsManager.getCollection(EcalBadChannelCollection.class);
- for (EcalBadChannel badChannel : badChannels.getObjects()) {
- ChannelId channelId = new ChannelId(new int[] {badChannel.getChannelId()});
- EcalChannel channel = channels.findChannel(channelId);
- conditions.getChannelConstants(channel).setBadChannel(true);
- }
- } catch(RuntimeException e){
- System.out.println("[ " + conditions.getClass().getSimpleName() + "]: A set of bad channels were not found!");
+ // Get the ECal bad channels and add them to the conditions set
+ try {
+ EcalBadChannelCollection badChannels = dbConditionsManager.getCollection(EcalBadChannelCollection.class);
+ for (EcalBadChannel badChannel : badChannels.getObjects()) {
+ ChannelId channelId = new ChannelId(new int[] { badChannel.getChannelId() });
+ EcalChannel channel = channels.findChannel(channelId);
+ conditions.getChannelConstants(channel).setBadChannel(true);
+ }
+ } catch (RuntimeException e) {
+ System.out.println("[ " + conditions.getClass().getSimpleName() + "]: A set of bad channels were not found!");
}
- // Get the ECal calibrations from the conditions database and add them to the conditions set.
+ // Get the ECal calibrations from the conditions database and add them
+ // to the conditions set.
EcalCalibrationCollection calibrations = dbConditionsManager.getCollection(EcalCalibrationCollection.class);
for (EcalCalibration calibration : calibrations.getObjects()) {
- ChannelId channelId = new ChannelId(new int[] {calibration.getChannelId()});
+ ChannelId channelId = new ChannelId(new int[] { calibration.getChannelId() });
EcalChannel channel = channels.findChannel(channelId);
conditions.getChannelConstants(channel).setCalibration(calibration);
}
- // Get the ECal time shifts from the conditions database and add them to the conditions set.
+ // Get the ECal time shifts from the conditions database and add them to
+ // the conditions set.
EcalTimeShiftCollection timeShifts = dbConditionsManager.getCollection(EcalTimeShiftCollection.class);
for (EcalTimeShift timeShift : timeShifts.getObjects()) {
- ChannelId channelId = new ChannelId(new int[] {timeShift.getChannelId()});
+ ChannelId channelId = new ChannelId(new int[] { timeShift.getChannelId() });
EcalChannel channel = channels.findChannel(channelId);
conditions.getChannelConstants(channel).setTimeShift(timeShift);
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java Mon Nov 10 00:16:49 2014
@@ -8,7 +8,8 @@
import org.lcsim.detector.identifier.Identifier;
/**
- * This is a set of utility methods for the ECAL that use the database conditions system.
+ * This is a set of utility methods for the ECAL that use the database
+ * conditions system.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
@@ -25,8 +26,8 @@
}
/**
- * Constructor which will find the ECAL conditions from the static conditions manager
- * instance.
+ * Constructor which will find the ECAL conditions from the static
+ * conditions manager instance.
*/
public EcalConditionsUtil() {
conditions = DatabaseConditionsManager.getInstance().getConditionsData(EcalConditions.class, TableConstants.ECAL_CONDITIONS);
@@ -36,7 +37,8 @@
* Find a channel object from a cell ID, e.g. from Monte Carlo data.
* @param helper The identifier helper of the hit.
* @param cellId The cell ID of the hit.
- * @return The corresponding ECAL channel found from the physical ID information.
+ * @return The corresponding ECAL channel found from the physical ID
+ * information.
*/
EcalChannel findChannel(IIdentifierHelper helper, long cellId) {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConverterRegistry.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConverterRegistry.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConverterRegistry.java Mon Nov 10 00:16:49 2014
@@ -47,7 +47,7 @@
return EcalTimeShiftCollection.class;
}
}
-
+
public static final class EcalLedConverter extends ConditionsObjectConverter<EcalLed> {
public Class getType() {
return EcalLedCollection.class;
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalDetectorSetup.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalDetectorSetup.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalDetectorSetup.java Mon Nov 10 00:16:49 2014
@@ -9,7 +9,8 @@
import org.lcsim.geometry.Subdetector;
/**
- * Puts {@link EcalConditions} data onto <code>EcalCrystal</code> objects on the detector.
+ * Puts {@link EcalConditions} data onto <code>EcalCrystal</code> objects on the
+ * detector.
* @author Jeremy McCormick <[log in to unmask]>
*/
public final class EcalDetectorSetup {
@@ -39,7 +40,8 @@
// Loop over crystals.
for (EcalCrystal crystal : crystals) {
- // System.out.println(crystal.getName() + " @ " + crystal.getX() + ", " +
+ // System.out.println(crystal.getName() + " @ " + crystal.getX() +
+ // ", " +
// crystal.getY());
// Reset in case of existing conditions data.
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java Mon Nov 10 00:16:49 2014
@@ -4,18 +4,18 @@
import org.hps.conditions.ConditionsObjectCollection;
/**
- * A conditions class for representing the setup of the LED system
- * in the ECAL for one channel.
+ * A conditions class for representing the setup of the LED system in the ECAL
+ * for one channel.
* @author Jeremy McCormick <[log in to unmask]>
*/
public class EcalLed extends AbstractConditionsObject {
-
+
/**
- * Generic collection class for these objects.
+ * Generic collection class for these objects.
*/
- public static class EcalLedCollection extends ConditionsObjectCollection<EcalLed> {
+ public static class EcalLedCollection extends ConditionsObjectCollection<EcalLed> {
}
-
+
/**
* Get the ECAL channel ID.
* @return The ECAL channel ID.
@@ -23,7 +23,7 @@
int getEcalChannelId() {
return getFieldValue("ecal_channel_id");
}
-
+
/**
* Get the crate number assigned to this crystal.
* @return The crate number.
@@ -31,7 +31,7 @@
int getCrateNumber() {
return getFieldValue("crate");
}
-
+
/**
* Get the LED number assigned to this crystal.
* @return The LED number.
@@ -39,7 +39,7 @@
int getLedNumber() {
return getFieldValue("number");
}
-
+
/**
* Get the time delay of this channel.
* @return The time delay.
@@ -47,7 +47,7 @@
double getTimeDelay() {
return getFieldValue("time_delay");
}
-
+
/**
* Get the amplitude high setting.
* @return The amplitude high setting.
@@ -55,12 +55,12 @@
double getAmplitudeHigh() {
return getFieldValue("amplitude_high");
}
-
+
/**
* Get the amplitude low setting.
* @return The amplitude low setting.
*/
double getAmplitudeLow() {
return getFieldValue("amplitude_low");
- }
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java Mon Nov 10 00:16:49 2014
@@ -10,64 +10,62 @@
import org.hps.util.Pair;
/**
- * This abstract class provides basic setup information for an SVT
- * sensor channel.
+ * This abstract class provides basic setup information for an SVT sensor
+ * channel.
*
* @author Omar Moreno <[log in to unmask]>
*/
public class AbstractSvtChannel extends AbstractConditionsObject {
// TODO: Put constants into their own class
- public static final int MAX_NUMBER_OF_SAMPLES = 6;
-
- public static abstract class AbstractSvtChannelCollection<T extends AbstractSvtChannel>
- extends ConditionsObjectCollection<T> {
-
- Map<Integer, T> channelMap = new HashMap<Integer, T>();
-
- /**
- * Add a channel of type extending {@link AbstractSvtChannel} to the
- * channel map
- *
- * @param A channel of a type extending {@link AbstractSvtChannel}
- */
- public void add(T channel){
-
- // If it doesn't exist, add the channel to the channel map
- if(channelMap.containsKey(channel.getChannelID())){
- throw new IllegalArgumentException("[ " + this.getClass().getSimpleName() + " ]: Channel ID already exists: "
- + channel.getChannelID());
- }
- channelMap.put(channel.getChannelID(), channel);
-
- // Add to the collection
- try {
- super.add(channel);
- } catch(ConditionsObjectException e){
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Find a channel of type extending {@link AbstractSvtChannel} using the
- * channel ID
- *
- * @param channelID
- * @return An SVT channel of type extending {@link AbstractSvtChannel}
- */
- public T findChannel(int channelID){
- return channelMap.get(channelID);
- }
-
+ public static final int MAX_NUMBER_OF_SAMPLES = 6;
+
+ public static abstract class AbstractSvtChannelCollection<T extends AbstractSvtChannel> extends ConditionsObjectCollection<T> {
+
+ Map<Integer, T> channelMap = new HashMap<Integer, T>();
+
/**
- * Find the collection of channels of type extending
+ * Add a channel of type extending {@link AbstractSvtChannel} to the
+ * channel map
+ *
+ * @param A channel of a type extending {@link AbstractSvtChannel}
+ */
+ public void add(T channel) {
+
+ // If it doesn't exist, add the channel to the channel map
+ if (channelMap.containsKey(channel.getChannelID())) {
+ throw new IllegalArgumentException("[ " + this.getClass().getSimpleName() + " ]: Channel ID already exists: " + channel.getChannelID());
+ }
+ channelMap.put(channel.getChannelID(), channel);
+
+ // Add to the collection
+ try {
+ super.add(channel);
+ } catch (ConditionsObjectException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Find a channel of type extending {@link AbstractSvtChannel} using the
+ * channel ID
+ *
+ * @param channelID
+ * @return An SVT channel of type extending {@link AbstractSvtChannel}
+ */
+ public T findChannel(int channelID) {
+ return channelMap.get(channelID);
+ }
+
+ /**
+ * Find the collection of channels of type extending
* {@link AbstractSvtChannel} that match a DAQ pair.
- *
+ *
* @param pair The DAQ pair.
* @return The channels matching the DAQ pair or null if not found.
*/
public abstract Collection<T> find(Pair<Integer, Integer> pair);
-
+
/**
* Convert this object to a human readable string.
*
@@ -80,8 +78,8 @@
}
return buff.toString();
}
- }
-
+ }
+
/**
* Get the channel ID.
*
@@ -99,5 +97,5 @@
public int getChannel() {
return getFieldValue("channel");
}
-
+
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java Mon Nov 10 00:16:49 2014
@@ -8,7 +8,7 @@
import org.hps.conditions.svt.AbstractSvtT0Shift.AbstractSvtT0ShiftCollection;
/**
- * Abstract class providing some of the common functionality used to define an
+ * Abstract class providing some of the common functionality used to define an
* SVT conditions object
*
* @author Omar Moreno <[log in to unmask]>
@@ -16,24 +16,22 @@
*/
public abstract class AbstractSvtConditions {
- protected Map<AbstractSvtChannel, ChannelConstants> channelData
- = new HashMap<AbstractSvtChannel, ChannelConstants>();
+ protected Map<AbstractSvtChannel, ChannelConstants> channelData = new HashMap<AbstractSvtChannel, ChannelConstants>();
protected AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<? extends AbstractSvtT0Shift> t0Shifts = null;
protected AbstractSvtChannel.AbstractSvtChannelCollection<? extends AbstractSvtChannel> channelMap = null;
protected AbstractSvtDaqMapping.AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> daqMap = null;
-
-
+
/**
* Get the DAQ map associated with these conditions.
*
* @return The SVT DAQ map.
*/
- public abstract AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> getDaqMap();
-
+ public abstract AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> getDaqMap();
+
/**
- * Get the conditions constants for a specific channel. These will be created if they
- * do not exist for the given channel, BUT only channels in the current channel map
- * are allowed as an argument.
+ * Get the conditions constants for a specific channel. These will be
+ * created if they do not exist for the given channel, BUT only channels in
+ * the current channel map are allowed as an argument.
*
* @param channel The SVT channel of interest
* @return The conditions constants for the given channel
@@ -57,38 +55,38 @@
* @return The SVT channel map.
*/
public abstract AbstractSvtChannelCollection<? extends AbstractSvtChannel> getChannelMap();
-
+
/**
* Get the t0 shifts for this conditions set.
*
* @return The t0 shifts by sensor.
*/
public abstract AbstractSvtT0ShiftCollection<? extends AbstractSvtT0Shift> getT0Shifts();
-
+
/**
* Set the DAQ map for this conditions set.
*
* @param daqMap DAQ map for this conditions set.
*/
- public void setDaqMap(AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> daqMap){
- this.daqMap = daqMap;
+ public void setDaqMap(AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> daqMap) {
+ this.daqMap = daqMap;
}
-
+
/**
* Set the SVT channel map for this conditions set.
*
- * @param channelMap The SVT channel map for this conditions set.
+ * @param channelMap The SVT channel map for this conditions set.
*/
- public void setChannelMap(AbstractSvtChannelCollection<? extends AbstractSvtChannel> channelMap){
- this.channelMap = channelMap;
+ public void setChannelMap(AbstractSvtChannelCollection<? extends AbstractSvtChannel> channelMap) {
+ this.channelMap = channelMap;
}
-
+
/**
- * Set the sensor t0 shifts for this conditions set.
+ * Set the sensor t0 shifts for this conditions set.
*
* @param t0Shifts for this conditions set.
*/
- public void setT0Shifts(AbstractSvtT0ShiftCollection<? extends AbstractSvtT0Shift> t0Shifts){
- this.t0Shifts = t0Shifts;
+ public void setT0Shifts(AbstractSvtT0ShiftCollection<? extends AbstractSvtT0Shift> t0Shifts) {
+ this.t0Shifts = t0Shifts;
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java Mon Nov 10 00:16:49 2014
@@ -9,29 +9,29 @@
import org.hps.conditions.svt.SvtGain.SvtGainCollection;
import org.hps.conditions.svt.SvtShapeFitParameters.SvtShapeFitParametersCollection;
-
/**
- * Abstract class providing some of the common methods used in creating
- * SVT conditions objects from the database.
+ * Abstract class providing some of the common methods used in creating SVT
+ * conditions objects from the database.
*
* @author Omar Moreno <[log in to unmask]>
*
- * @param <T extends AbstractSvtConditions> SVT conditions object type
+ * @param <T extends AbstractSvtConditions> SVT conditions object type
*/
public abstract class AbstractSvtConditionsConverter<T extends AbstractSvtConditions> implements ConditionsConverter<T> {
-
- protected T conditions;
-
+
+ protected T conditions;
+
/**
* Create and return the SVT conditions object.
* @param manager The current conditions manager.
* @param name The conditions key, which is ignored for now.
*/
- public T getData(ConditionsManager manager, String name){
-
- DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
-
- // Get the SVT calibrations (baseline, noise) from the conditions database
+ public T getData(ConditionsManager manager, String name) {
+
+ DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
+
+ // Get the SVT calibrations (baseline, noise) from the conditions
+ // database
SvtCalibrationCollection calibrations = dbConditionsManager.getCollection(SvtCalibrationCollection.class);
for (SvtCalibration calibration : calibrations.getObjects()) {
AbstractSvtChannel channel = conditions.getChannelMap().findChannel(calibration.getChannelID());
@@ -39,23 +39,23 @@
}
// Get the Channel pulse fit parameters from the conditions database
- SvtShapeFitParametersCollection shapeFitParametersCollection
- = dbConditionsManager.getCollection(SvtShapeFitParametersCollection.class);
+ SvtShapeFitParametersCollection shapeFitParametersCollection = dbConditionsManager.getCollection(SvtShapeFitParametersCollection.class);
for (SvtShapeFitParameters shapeFitParameters : shapeFitParametersCollection.getObjects()) {
AbstractSvtChannel channel = conditions.getChannelMap().findChannel(shapeFitParameters.getChannelID());
conditions.getChannelConstants(channel).setShapeFitParameters(shapeFitParameters);
}
-
- // Get the bad channels from the conditions database. If there aren't any bad channels,
+
+ // Get the bad channels from the conditions database. If there aren't
+ // any bad channels,
// notify the user and move on.
- try {
- SvtBadChannelCollection badChannels = dbConditionsManager.getCollection(SvtBadChannelCollection.class);
- for (SvtBadChannel badChannel : badChannels.getObjects()) {
- AbstractSvtChannel channel = conditions.getChannelMap().findChannel(badChannel.getChannelId());
- conditions.getChannelConstants(channel).setBadChannel(true);
- }
- } catch (RuntimeException e) {
- System.out.println("[ " + conditions.getClass().getSimpleName() + "]: A set of bad channels were not found!");
+ try {
+ SvtBadChannelCollection badChannels = dbConditionsManager.getCollection(SvtBadChannelCollection.class);
+ for (SvtBadChannel badChannel : badChannels.getObjects()) {
+ AbstractSvtChannel channel = conditions.getChannelMap().findChannel(badChannel.getChannelId());
+ conditions.getChannelConstants(channel).setBadChannel(true);
+ }
+ } catch (RuntimeException e) {
+ System.out.println("[ " + conditions.getClass().getSimpleName() + "]: A set of bad channels were not found!");
}
// Get the gains and offsets from the conditions database
@@ -67,5 +67,5 @@
}
return conditions;
- }
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java Mon Nov 10 00:16:49 2014
@@ -6,61 +6,57 @@
import org.hps.conditions.ConditionsObjectCollection;
import org.hps.util.Pair;
-
/**
- * This abstract class provides some of the basic functionality used to
- * access SVT DAQ map variables.
+ * This abstract class provides some of the basic functionality used to access
+ * SVT DAQ map variables.
*
* @author Omar Moreno <[log in to unmask]>
*/
public abstract class AbstractSvtDaqMapping extends AbstractConditionsObject {
-
- public static abstract class AbstractSvtDaqMappingCollection<T extends AbstractSvtDaqMapping>
- extends ConditionsObjectCollection<T> {
-
- /**
- * Flag values for top or bottom half.
- */
- public static final String TOP_HALF = "T";
- public static final String BOTTOM_HALF = "B";
-
- /**
- * Flag values for axial or stereo sensors
+ public static abstract class AbstractSvtDaqMappingCollection<T extends AbstractSvtDaqMapping> extends ConditionsObjectCollection<T> {
+
+ /**
+ * Flag values for top or bottom half.
*/
- public static final String AXIAL = "A";
- public static final String STEREO = "S";
+ public static final String TOP_HALF = "T";
+ public static final String BOTTOM_HALF = "B";
- /**
- * Get a DAQ pair for the given {@link HpsSiSensor}
- *
- * @param sensor A sensor of type {@link HpsSiSensor}
- * @return The DAQ pair associated with the sensor
- */
- public abstract Pair<Integer, Integer> getDaqPair(HpsSiSensor sensor);
-
-
+ /**
+ * Flag values for axial or stereo sensors
+ */
+ public static final String AXIAL = "A";
+ public static final String STEREO = "S";
+
+ /**
+ * Get a DAQ pair for the given {@link HpsSiSensor}
+ *
+ * @param sensor A sensor of type {@link HpsSiSensor}
+ * @return The DAQ pair associated with the sensor
+ */
+ public abstract Pair<Integer, Integer> getDaqPair(HpsSiSensor sensor);
+
/**
* Get the orientation of a sensor.
*
* @param daqPair for a given sensor
- * @return If a daqPair is found, return an "A" if the sensor
- * orientation is Axial, an "S" if the orientation is Stereo or
- * null if the daqPair doesn't exist.
+ * @return If a daqPair is found, return an "A" if the sensor
+ * orientation is Axial, an "S" if the orientation is Stereo or
+ * null if the daqPair doesn't exist.
*/
public abstract String getOrientation(Pair<Integer, Integer> daqPair);
-
- }
-
+
+ }
+
public String getSvtHalf() {
return getFieldValue("svt_half");
}
-
+
public int getLayerNumber() {
return getFieldValue("layer");
}
-
- public String getOrientation() {
- return getFieldValue("orientation");
+
+ public String getOrientation() {
+ return getFieldValue("orientation");
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java Mon Nov 10 00:16:49 2014
@@ -5,28 +5,26 @@
import org.hps.util.Pair;
/**
- * Abstract class providing some of the basic functionality used to
- * relate a t0 shift value with either a FEB ID/FEB hybrid ID or
- * an FPGA ID/hybrid ID.
+ * Abstract class providing some of the basic functionality used to relate a t0
+ * shift value with either a FEB ID/FEB hybrid ID or an FPGA ID/hybrid ID.
*
* @author Omar Moreno <[log in to unmask]>
*/
public class AbstractSvtT0Shift extends AbstractConditionsObject {
- public static abstract class AbstractSvtT0ShiftCollection<T extends AbstractSvtT0Shift>
- extends ConditionsObjectCollection<T> {
-
+ public static abstract class AbstractSvtT0ShiftCollection<T extends AbstractSvtT0Shift> extends ConditionsObjectCollection<T> {
+
/**
* Get the t0 shift associated with a given DAQ pair
*
* @param DAQ pair for a given sensor
- * @return The t0 shift associated with the DAQ pair. If a t0 shift
- * for a given DAQ pair can't be found, it returns null.
+ * @return The t0 shift associated with the DAQ pair. If a t0 shift for
+ * a given DAQ pair can't be found, it returns null.
*/
- public abstract T getT0Shift(Pair<Integer, Integer> pair);
-
+ public abstract T getT0Shift(Pair<Integer, Integer> pair);
+
}
-
+
/**
* Get the t0 shift.
*
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java Mon Nov 10 00:16:49 2014
@@ -5,7 +5,8 @@
/**
* <p>
- * Encapsulates an SVT alignment constant, which is an encoded key plus a double value.
+ * Encapsulates an SVT alignment constant, which is an encoded key plus a double
+ * value.
* </p>
* <p>
* The format of the keys is ABCDE where:<br>
@@ -18,53 +19,55 @@
* @author Jeremy McCormick <[log in to unmask]>
*/
public class SvtAlignmentConstant extends AbstractConditionsObject {
-
- public static class SvtAlignmentCollection extends ConditionsObjectCollection<SvtAlignmentConstant> {
+
+ public static class SvtAlignmentCollection extends ConditionsObjectCollection<SvtAlignmentConstant> {
}
-
+
/** Top or bottom half. */
- public enum Half {
- TOP(1),
- BOTTOM(2);
- int value;
+ public enum Half {
+ TOP(1), BOTTOM(2);
+ int value;
+
Half(int value) {
this.value = value;
- }
- int getValue() {
- return value;
}
- };
-
- /** The alignment constant type which is rotation or translation. */
- public enum AlignmentType {
- ROTATION(1),
- TRANSLATION(2);
- int value;
- AlignmentType(int value) {
- this.value = value;
- }
+
int getValue() {
return value;
}
};
-
+
+ /** The alignment constant type which is rotation or translation. */
+ public enum AlignmentType {
+ ROTATION(1), TRANSLATION(2);
+ int value;
+
+ AlignmentType(int value) {
+ this.value = value;
+ }
+
+ int getValue() {
+ return value;
+ }
+ };
+
/** The unit axis. */
- public enum UnitAxis {
- U(1),
- V(2),
- W(3);
+ public enum UnitAxis {
+ U(1), V(2), W(3);
int value;
+
UnitAxis(int value) {
this.value = value;
}
+
int getValue() {
return value;
- }
+ }
};
-
+
/** Maximum value of module number. */
private static final int MAX_MODULE_NUMBER = 10;
-
+
/**
* Get the alignment constant's full key with the encoded information.
* @return the alignment constant's key
@@ -72,7 +75,7 @@
public String getParameter() {
return getFieldValue("parameter");
}
-
+
/**
* Get the the alignment constant's value which is always a single double.
* @return the alignment constant's value as a double
@@ -80,7 +83,7 @@
public double getValue() {
return getFieldValue("value");
}
-
+
/**
* Decode the Half value from the key.
* @return the Half value from the key
@@ -93,9 +96,9 @@
return Half.BOTTOM;
} else {
throw new IllegalArgumentException("Could not parse valid Half from " + getParameter());
- }
+ }
}
-
+
/**
* Decode the AlignmentType value from the key.
* @return the AlignmentType value from the key
@@ -110,7 +113,7 @@
throw new IllegalArgumentException("Could not parse valid AlignmentType from " + getParameter());
}
}
-
+
/**
* Decode the UnitAxis from the key.
* @return the UnitAxis v
@@ -127,10 +130,10 @@
throw new IllegalArgumentException("Could not parse valid UnitAxis from " + getParameter());
}
}
-
+
/**
* Decode the module number from the key.
- * @return the module number from the key
+ * @return the module number from the key
*/
public int getModuleNumber() {
int moduleNumber = Integer.parseInt(getParameter().substring(3, 5));
@@ -139,14 +142,14 @@
}
return moduleNumber;
}
-
+
public String toString() {
StringBuffer buff = new StringBuffer();
buff.append(super.toString());
buff.append("half: ").append(getHalf().getValue()).append('\n');
buff.append("alignment_type: ").append(getAlignmentType().getValue()).append('\n');
buff.append("unit_axis: ").append(getUnitAxis().getValue()).append('\n');
- buff.append("module_number: " ).append(getModuleNumber()).append('\n');
+ buff.append("module_number: ").append(getModuleNumber()).append('\n');
return buff.toString();
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java Mon Nov 10 00:16:49 2014
@@ -11,9 +11,9 @@
public int getChannelId() {
return getFieldValue("svt_channel_id");
}
-
- public int getNote(){
- return getFieldValue("notes");
+
+ public int getNote() {
+ return getFieldValue("notes");
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java Mon Nov 10 00:16:49 2014
@@ -6,14 +6,13 @@
import static org.hps.conditions.svt.SvtChannel.MAX_NUMBER_OF_SAMPLES;
/**
- * This class encapsulates noise and pedestal measurement for an SVT channel.
+ * This class encapsulates noise and pedestal measurement for an SVT channel.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
public final class SvtCalibration extends AbstractConditionsObject {
-
public static class SvtCalibrationCollection extends ConditionsObjectCollection<SvtCalibration> {
}
@@ -30,9 +29,9 @@
* @return The noise value.
*/
public double getNoise(int sample) {
- if(sample < 0 || sample > MAX_NUMBER_OF_SAMPLES){
- throw new RuntimeException("Sample number is not within range.");
- }
+ if (sample < 0 || sample > MAX_NUMBER_OF_SAMPLES) {
+ throw new RuntimeException("Sample number is not within range.");
+ }
return getFieldValue(Double.class, "noise_" + Integer.toString(sample));
}
@@ -41,9 +40,9 @@
* @return The pedestal value.
*/
public double getPedestal(int sample) {
- if(sample < 0 || sample > MAX_NUMBER_OF_SAMPLES){
- throw new RuntimeException("Sample number is not within range.");
- }
+ if (sample < 0 || sample > MAX_NUMBER_OF_SAMPLES) {
+ throw new RuntimeException("Sample number is not within range.");
+ }
return getFieldValue(Double.class, "pedestal_" + Integer.toString(sample));
}
@@ -52,51 +51,51 @@
* @return This object converted to a string.
*/
public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("Channel ID: " + this.getChannelID());
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Channel ID: " + this.getChannelID());
for (int i = 0; i < 115; i++) {
buffer.append("-");
}
- buffer.append("Pedestal sample 0:");
- buffer.append(" ");
- buffer.append("Pedestal sample 1:");
- buffer.append(" ");
- buffer.append("Pedestal sample 2:");
- buffer.append(" ");
- buffer.append("Pedestal sample 3:");
- buffer.append(" ");
- buffer.append("Pedesdtal sample 4:");
- buffer.append(" ");
- buffer.append("Pedestal sample 5:");
- buffer.append("\n");
+ buffer.append("Pedestal sample 0:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 1:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 2:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 3:");
+ buffer.append(" ");
+ buffer.append("Pedesdtal sample 4:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 5:");
+ buffer.append("\n");
for (int i = 0; i < 115; i++) {
buffer.append("-");
}
- buffer.append("\n");
- for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
- buffer.append(this.getPedestal(sample));
- buffer.append(" ");
- }
- buffer.append("Noise sample 0:");
- buffer.append(" ");
- buffer.append("Noise sample 1:");
- buffer.append(" ");
- buffer.append("Noise sample 2:");
- buffer.append(" ");
- buffer.append("Noise sample 3:");
- buffer.append(" ");
- buffer.append("Noise sample 4:");
- buffer.append(" ");
- buffer.append("Noise sample 5:");
- buffer.append("\n");
+ buffer.append("\n");
+ for (int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++) {
+ buffer.append(this.getPedestal(sample));
+ buffer.append(" ");
+ }
+ buffer.append("Noise sample 0:");
+ buffer.append(" ");
+ buffer.append("Noise sample 1:");
+ buffer.append(" ");
+ buffer.append("Noise sample 2:");
+ buffer.append(" ");
+ buffer.append("Noise sample 3:");
+ buffer.append(" ");
+ buffer.append("Noise sample 4:");
+ buffer.append(" ");
+ buffer.append("Noise sample 5:");
+ buffer.append("\n");
for (int i = 0; i < 115; i++) {
buffer.append("-");
}
- buffer.append("\n");
- for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
- buffer.append(this.getNoise(sample));
- buffer.append(" ");
- }
- return buffer.toString();
+ buffer.append("\n");
+ for (int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++) {
+ buffer.append(this.getNoise(sample));
+ buffer.append(" ");
+ }
+ return buffer.toString();
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java Mon Nov 10 00:16:49 2014
@@ -7,24 +7,22 @@
import org.hps.util.Pair;
/**
- * This class represents SVT channel setup information, including FEB ID,
- * FEB Hybrid ID, and channel numbers.
+ * This class represents SVT channel setup information, including FEB ID, FEB
+ * Hybrid ID, and channel numbers.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
public final class SvtChannel extends AbstractSvtChannel {
-
- public static class SvtChannelCollection
- extends AbstractSvtChannel.AbstractSvtChannelCollection<SvtChannel> {
+ public static class SvtChannelCollection extends AbstractSvtChannel.AbstractSvtChannelCollection<SvtChannel> {
/**
* Find channels that match a DAQ pair (FEB ID, FEB Hybrid ID).
* @param pair The DAQ pair.
* @return The channels matching the DAQ pair or null if not found.
*/
- @Override
+ @Override
public Collection<SvtChannel> find(Pair<Integer, Integer> pair) {
List<SvtChannel> channels = new ArrayList<SvtChannel>();
int febID = pair.getFirstElement();
@@ -59,10 +57,7 @@
* @return This object as a string.
*/
public String toString() {
- return "channel_id: " + getChannelID() +
- ", feb_id: " + getFebID() +
- ", feb_hybrid_id: " + getFebHybridID() +
- ", channel: " + getChannel();
+ return "channel_id: " + getChannelID() + ", feb_id: " + getFebID() + ", feb_hybrid_id: " + getFebHybridID() + ", channel: " + getChannel();
}
/**
@@ -77,9 +72,6 @@
if (o == this)
return true;
SvtChannel channel = (SvtChannel) o;
- return getChannelID() == channel.getChannelID()
- && getFebID() == channel.getFebID()
- && getFebHybridID() == channel.getFebHybridID()
- && getChannel() == channel.getChannel();
+ return getChannelID() == channel.getChannelID() && getFebID() == channel.getFebID() && getFebHybridID() == channel.getFebHybridID() && getChannel() == channel.getChannel();
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java Mon Nov 10 00:16:49 2014
@@ -10,23 +10,22 @@
/**
*
- * This class contains all test run SVT conditions data by readout channel.
- * {@link SvtChannel} objects from the SVT channel map should be used to
- * lookup the conditions using the {@link #getChannelConstants(SvtChannel)}
- * method.
+ * This class contains all test run SVT conditions data by readout channel.
+ * {@link SvtChannel} objects from the SVT channel map should be used to lookup
+ * the conditions using the {@link #getChannelConstants(SvtChannel)} method.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
public final class SvtConditions extends AbstractSvtConditions {
- /**
+ /**
* Get the {@link SvtDaqMappingCollection} associated with these conditions.
*
* @return The SVT DAQ map.
*/
@Override
- public SvtDaqMappingCollection getDaqMap(){
+ public SvtDaqMappingCollection getDaqMap() {
return (SvtDaqMappingCollection) daqMap;
}
@@ -36,30 +35,29 @@
* @return The SVT channel map.
*/
@Override
- public SvtChannelCollection getChannelMap(){
+ public SvtChannelCollection getChannelMap() {
return (SvtChannelCollection) channelMap;
}
-
+
/**
* Get the {@link SvtT0ShiftCollection} associated with these conditions.
*
* @return The {@link SvtT0ShiftCollection}
*/
@Override
- public SvtT0ShiftCollection getT0Shifts() {
- return (SvtT0ShiftCollection) t0Shifts;
+ public SvtT0ShiftCollection getT0Shifts() {
+ return (SvtT0ShiftCollection) t0Shifts;
}
-
/**
- * Convert this object to a human readable string. This method prints a formatted
- * table of channel data independently of how its member objects implement their
- * string conversion method. For now, it does not print the time shifts by sensor as
- * all other information is by channel.
+ * Convert this object to a human readable string. This method prints a
+ * formatted table of channel data independently of how its member objects
+ * implement their string conversion method. For now, it does not print the
+ * time shifts by sensor as all other information is by channel.
*
- * @return This object converted to a string, without the DAQ map.
- * TODO: Make this look more human readable. At the moment, reading this
- * requires a huge terminal window.
+ * @return This object converted to a string, without the DAQ map. TODO:
+ * Make this look more human readable. At the moment, reading this
+ * requires a huge terminal window.
*/
public String toString() {
StringBuffer buff = new StringBuffer();
@@ -131,13 +129,13 @@
buff.append(String.format("%-6d %-5d %-8d %-8d ", channel.getChannelID(), channel.getFebID(), channel.getFebHybridID(), channel.getChannel()));
// Calibration.
- for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
- buff.append(calibration.getPedestal(sample));
- buff.append(" ");
+ for (int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++) {
+ buff.append(calibration.getPedestal(sample));
+ buff.append(" ");
}
- for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
- buff.append(calibration.getNoise(sample));
- buff.append(" ");
+ for (int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++) {
+ buff.append(calibration.getNoise(sample));
+ buff.append(" ");
}
// Gain.
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java Mon Nov 10 00:16:49 2014
@@ -7,45 +7,46 @@
import org.hps.conditions.svt.SvtT0Shift.SvtT0ShiftCollection;
/**
- * This class creates an {@link SvtConditions} object from the database, based on the
- * current run number known by the conditions manager.
+ * This class creates an {@link SvtConditions} object from the database, based
+ * on the current run number known by the conditions manager.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
public final class SvtConditionsConverter extends AbstractSvtConditionsConverter<SvtConditions> {
- public SvtConditionsConverter(){
- this.conditions = new SvtConditions();
- }
-
+ public SvtConditionsConverter() {
+ this.conditions = new SvtConditions();
+ }
+
/**
- * Create and return an {@link SvtConditions} object
+ * Create and return an {@link SvtConditions} object
*
* @param manager The current conditions manager.
* @param name The conditions key, which is ignored for now.
*/
@Override
public SvtConditions getData(ConditionsManager manager, String name) {
-
- DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
- // Get the channel map from the conditions database
- SvtChannelCollection channels = dbConditionsManager.getCollection(SvtChannelCollection.class);
+ DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
- // Create the SVT conditions object to use to encapsulate SVT condition collections
+ // Get the channel map from the conditions database
+ SvtChannelCollection channels = dbConditionsManager.getCollection(SvtChannelCollection.class);
+
+ // Create the SVT conditions object to use to encapsulate SVT condition
+ // collections
conditions.setChannelMap(channels);
-
- // Get the DAQ map from the conditions database
- SvtDaqMappingCollection daqMap= dbConditionsManager.getCollection(SvtDaqMappingCollection.class);
+
+ // Get the DAQ map from the conditions database
+ SvtDaqMappingCollection daqMap = dbConditionsManager.getCollection(SvtDaqMappingCollection.class);
conditions.setDaqMap(daqMap);
-
+
// Get the collection of T0 shifts from the conditions database
SvtT0ShiftCollection t0Shifts = dbConditionsManager.getCollection(SvtT0ShiftCollection.class);
conditions.setT0Shifts(t0Shifts);
-
+
conditions = super.getData(manager, name);
-
+
return conditions;
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java Mon Nov 10 00:16:49 2014
@@ -17,7 +17,7 @@
* This is a simple class for getting an SVT XML configuration file.
*/
public class SvtConfiguration extends AbstractConditionsObject {
-
+
public static class SvtConfigurationCollection extends ConditionsObjectCollection<SvtConfiguration> {
}
@@ -28,11 +28,12 @@
public String getFileName() {
return getFieldValue("filename");
}
-
+
/**
- * Convert the raw database field value for the configuration into an XML document.
+ * Convert the raw database field value for the configuration into an XML
+ * document.
* @return The Document created from the raw data.
- * @throws IOException
+ * @throws IOException
* @throws JDOMException
*/
public Document createDocument() throws IOException, JDOMException {
@@ -42,7 +43,7 @@
builder.setValidation(false);
return builder.build(inputStream);
}
-
+
/**
* Save this configuration to a local file on disk.
* @param filename The name of the local file.
@@ -56,9 +57,10 @@
throw new RuntimeException(e);
}
}
-
+
/**
- * Save this configuration to a local file on disk using its name from the database.
+ * Save this configuration to a local file on disk using its name from the
+ * database.
*/
public void writeToFile() {
XMLOutputter out = new XMLOutputter();
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConverterRegistry.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConverterRegistry.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtConverterRegistry.java Mon Nov 10 00:16:49 2014
@@ -15,19 +15,20 @@
import org.hps.conditions.svt.TestRunSvtT0Shift.TestRunSvtT0ShiftCollection;
/**
- * Definitions of converters from the database to SVT specific conditions classes.
+ * Definitions of converters from the database to SVT specific conditions
+ * classes.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public final class SvtConverterRegistry {
- public static class SvtAlignmentConverter extends ConditionsObjectConverter<SvtAlignmentCollection> {
+ public static class SvtAlignmentConverter extends ConditionsObjectConverter<SvtAlignmentCollection> {
public Class getType() {
return SvtAlignmentCollection.class;
- }
+ }
}
-
+
public static class SvtBadChannelConverter extends ConditionsObjectConverter<SvtBadChannelCollection> {
public Class getType() {
return SvtBadChannelCollection.class;
@@ -45,7 +46,7 @@
return SvtChannelCollection.class;
}
}
-
+
public static class SvtConfigurationConverter extends ConditionsObjectConverter<SvtConfigurationCollection> {
public Class getType() {
return SvtConfigurationCollection.class;
@@ -75,15 +76,15 @@
return SvtT0ShiftCollection.class;
}
}
-
+
public static class TestRunSvtDaqMappingConverter extends ConditionsObjectConverter<TestRunSvtDaqMappingCollection> {
public Class getType() {
return TestRunSvtDaqMappingCollection.class;
}
}
-
+
public static class TestRunSvtChannelConverter extends ConditionsObjectConverter<TestRunSvtChannelCollection> {
- public Class getType(){
+ public Class getType() {
return TestRunSvtChannelCollection.class;
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java Mon Nov 10 00:16:49 2014
@@ -12,49 +12,47 @@
*/
public class SvtDaqMapping extends AbstractSvtDaqMapping {
- public static class SvtDaqMappingCollection
- extends AbstractSvtDaqMappingCollection<SvtDaqMapping> {
+ public static class SvtDaqMappingCollection extends AbstractSvtDaqMappingCollection<SvtDaqMapping> {
/**
- * Get a DAQ pair (FEB ID, FEB Hybrid ID) for the given
+ * Get a DAQ pair (FEB ID, FEB Hybrid ID) for the given
* {@link HpsSiSensor}
*
- * @param sensor A sensor of type {@link HpsSiSensor}
- * @return The DAQ pair associated with the sensor
+ * @param sensor A sensor of type {@link HpsSiSensor}
+ * @return The DAQ pair associated with the sensor
*/
public Pair<Integer, Integer> getDaqPair(HpsSiSensor sensor) {
-
- String svtHalf = sensor.isTopLayer() ? TOP_HALF : BOTTOM_HALF;
- for (SvtDaqMapping object : this.getObjects()) {
-
- if(svtHalf.equals(object.getSvtHalf())
- && object.getLayerNumber() == sensor.getLayerNumber()
- && object.getSide().equals(sensor.getSide())) {
-
- return new Pair<Integer, Integer>(object.getFebID(), object.getFebHybridID());
- }
+
+ String svtHalf = sensor.isTopLayer() ? TOP_HALF : BOTTOM_HALF;
+ for (SvtDaqMapping object : this.getObjects()) {
+
+ if (svtHalf.equals(object.getSvtHalf()) && object.getLayerNumber() == sensor.getLayerNumber() && object.getSide().equals(sensor.getSide())) {
+
+ return new Pair<Integer, Integer>(object.getFebID(), object.getFebHybridID());
+ }
}
return null;
}
-
+
/**
* Get the orientation of a sensor using the FEB ID and FEB Hybrid ID.
- * If the FEB ID and FEB Hybrid ID combination is not found, return null.
+ * If the FEB ID and FEB Hybrid ID combination is not found, return
+ * null.
*
* @param daqPair (Pair<FEB ID, FEB Hybrid ID>) for a given sensor
- * @return If a daqPair is found, return an "A" if the sensor
- * orientation is Axial, an "S" if the orientation is Stereo or
- * null if the daqPair doesn't exist.
+ * @return If a daqPair is found, return an "A" if the sensor
+ * orientation is Axial, an "S" if the orientation is Stereo or
+ * null if the daqPair doesn't exist.
*/
- public String getOrientation(Pair<Integer, Integer> daqPair){
-
- for(SvtDaqMapping daqMapping : this.getObjects()){
-
- if(daqPair.getFirstElement() == daqMapping.getFebID() && daqPair.getSecondElement() == daqMapping.getFebHybridID()){
- return daqMapping.getOrientation();
- }
- }
- return null;
+ public String getOrientation(Pair<Integer, Integer> daqPair) {
+
+ for (SvtDaqMapping daqMapping : this.getObjects()) {
+
+ if (daqPair.getFirstElement() == daqMapping.getFebID() && daqPair.getSecondElement() == daqMapping.getFebHybridID()) {
+ return daqMapping.getOrientation();
+ }
+ }
+ return null;
}
/**
@@ -79,9 +77,9 @@
buff.append("----------------------");
buff.append('\n');
for (SvtDaqMapping object : getObjects()) {
- buff.append(object.getFebID());
+ buff.append(object.getFebID());
buff.append(" ");
- buff.append(object.getFebHybridID());
+ buff.append(object.getFebHybridID());
buff.append(" ");
buff.append(object.getSvtHalf());
buff.append(" ");
@@ -96,16 +94,16 @@
return buff.toString();
}
}
-
- public int getFebID() {
- return getFieldValue("feb_id");
+
+ public int getFebID() {
+ return getFieldValue("feb_id");
}
-
- public int getFebHybridID() {
- return getFieldValue("feb_hybrid_id");
+
+ public int getFebHybridID() {
+ return getFieldValue("feb_hybrid_id");
}
-
- public String getSide(){
- return getFieldValue("side");
+
+ public String getSide() {
+ return getFieldValue("side");
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java Mon Nov 10 00:16:49 2014
@@ -12,7 +12,8 @@
import org.hps.util.Pair;
/**
- * This class puts {@link SvtConditions} data onto <code>HpsSiSensor</code> objects.
+ * This class puts {@link SvtConditions} data onto <code>HpsSiSensor</code>
+ * objects.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
@@ -22,13 +23,13 @@
/**
* Load conditions data onto a detector object.
*
- * @param The detector object.
+ * @param The detector object.
* @param conditions The conditions object.
*/
public void load(Subdetector subdetector, SvtConditions conditions) {
// Find sensor objects.
- List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
+ List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
SvtChannelCollection channelMap = conditions.getChannelMap();
SvtDaqMappingCollection daqMap = conditions.getDaqMap();
SvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();
@@ -47,16 +48,16 @@
// Set the FEB ID of the sensor
sensor.setFebID(daqPair.getFirstElement());
-
+
// Set the FEB Hybrid ID of the sensor
sensor.setFebHybridID(daqPair.getSecondElement());
-
+
// Set the orientation of the sensor
String orientation = daqMap.getOrientation(daqPair);
- if(orientation != null && orientation.contentEquals(SvtDaqMappingCollection.AXIAL)){
- sensor.setAxial(true);
- } else if(orientation != null && orientation.contains(SvtDaqMappingCollection.STEREO)){
- sensor.setStereo(true);
+ if (orientation != null && orientation.contentEquals(SvtDaqMappingCollection.AXIAL)) {
+ sensor.setAxial(true);
+ } else if (orientation != null && orientation.contains(SvtDaqMappingCollection.STEREO)) {
+ sensor.setStereo(true);
}
// Find all the channels for this sensor.
@@ -64,35 +65,35 @@
// Loop over the channels of the sensor.
for (SvtChannel channel : channels) {
-
- // Get conditions data for this channel.
+
+ // Get conditions data for this channel.
ChannelConstants constants = conditions.getChannelConstants(channel);
int channelNumber = channel.getChannel();
//
// Set conditions data for this channel on the sensor object:
//
-
+
// Check if the channel was flagged as bad
if (constants.isBadChannel()) {
sensor.setBadChannel(channelNumber);
}
-
- // Set the pedestal and noise of each of the samples for the
+
+ // Set the pedestal and noise of each of the samples for the
// channel
double[] pedestal = new double[6];
double[] noise = new double[6];
- for(int sampleN = 0; sampleN < HpsSiSensor.NUMBER_OF_SAMPLES; sampleN++){
- pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
- noise[sampleN] = constants.getCalibration().getNoise(sampleN);
+ for (int sampleN = 0; sampleN < HpsSiSensor.NUMBER_OF_SAMPLES; sampleN++) {
+ pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
+ noise[sampleN] = constants.getCalibration().getNoise(sampleN);
}
sensor.setPedestal(channelNumber, pedestal);
sensor.setNoise(channelNumber, noise);
-
+
// Set the gain and offset for the channel
sensor.setGain(channelNumber, constants.getGain().getGain());
sensor.setOffset(channelNumber, constants.getGain().getOffset());
-
+
// Set the shape fit parameters
sensor.setShapeFitParameters(channelNumber, constants.getShapeFitParameters().toArray());
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java Mon Nov 10 00:16:49 2014
@@ -39,7 +39,7 @@
}
/**
- * Get tp.
+ * Get tp.
* @return tp.
*/
double getTp() {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java Mon Nov 10 00:16:49 2014
@@ -3,23 +3,22 @@
import org.hps.util.Pair;
/**
- * This class is a data holder for associating a t0 shift with a specific
- * sensor by FEB ID and FEB hybrid ID.
+ * This class is a data holder for associating a t0 shift with a specific sensor
+ * by FEB ID and FEB hybrid ID.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
public final class SvtT0Shift extends AbstractSvtT0Shift {
- public static class SvtT0ShiftCollection
- extends AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<SvtT0Shift> {
+ public static class SvtT0ShiftCollection extends AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<SvtT0Shift> {
/**
* Get the {@link SvtT0Shift} associated with a given DAQ pair
*
* @param DAQ pair for a given sensor
- * @return The {@link SvtT0Shift} associated with the DAQ pair. If a t0 shift
- * for a given DAQ pair can't be found, it returns null.
+ * @return The {@link SvtT0Shift} associated with the DAQ pair. If a t0
+ * shift for a given DAQ pair can't be found, it returns null.
*/
@Override
public SvtT0Shift getT0Shift(Pair<Integer, Integer> pair) {
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java Mon Nov 10 00:16:49 2014
@@ -8,38 +8,37 @@
public final class TestRunSvtChannel extends AbstractSvtChannel {
- public static class TestRunSvtChannelCollection
- extends AbstractSvtChannel.AbstractSvtChannelCollection<TestRunSvtChannel> {
+ public static class TestRunSvtChannelCollection extends AbstractSvtChannel.AbstractSvtChannelCollection<TestRunSvtChannel> {
@Override
public Collection<TestRunSvtChannel> find(Pair<Integer, Integer> pair) {
List<TestRunSvtChannel> channels = new ArrayList<TestRunSvtChannel>();
int fpga = pair.getFirstElement();
int hybrid = pair.getSecondElement();
- for(TestRunSvtChannel channel : this.getObjects()){
- if(channel.getFpgaID() == fpga && channel.getHybridID() == hybrid){
+ for (TestRunSvtChannel channel : this.getObjects()) {
+ if (channel.getFpgaID() == fpga && channel.getHybridID() == hybrid) {
channels.add(channel);
}
}
return channels;
}
}
-
+
/**
* Get the FPGA ID.
*
* @return The FPGA ID
*/
- public int getFpgaID(){
+ public int getFpgaID() {
return getFieldValue("fpga");
}
-
+
/**
* Get the hybrid ID.
*
* @return The hybrid ID.
*/
- public int getHybridID(){
+ public int getHybridID() {
return getFieldValue("hybrid");
}
@@ -48,12 +47,9 @@
* @return This object as a string.
*/
public String toString() {
- return "channel_id: " + getChannelID() +
- ", fpga: " + getFpgaID() +
- ", hybrid: " + getHybridID() +
- ", channel: " + getChannel();
+ return "channel_id: " + getChannelID() + ", fpga: " + getFpgaID() + ", hybrid: " + getHybridID() + ", channel: " + getChannel();
}
-
+
/**
* Implementation of equals.
* @return True if the object equals this one; false if not.
@@ -66,9 +62,6 @@
if (o == this)
return true;
TestRunSvtChannel channel = (TestRunSvtChannel) o;
- return getChannelID() == channel.getChannelID()
- && getFpgaID() == channel.getFpgaID()
- && getHybridID() == channel.getHybridID()
- && getChannel() == channel.getChannel();
+ return getChannelID() == channel.getChannelID() && getFpgaID() == channel.getFpgaID() && getHybridID() == channel.getHybridID() && getChannel() == channel.getChannel();
}
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java Mon Nov 10 00:16:49 2014
@@ -9,18 +9,19 @@
import static org.hps.conditions.svt.SvtChannel.MAX_NUMBER_OF_SAMPLES;
/**
- * This class contains all test run SVT conditions data by readout channel.
+ * This class contains all test run SVT conditions data by readout channel.
* {@link TestRunSvtChannel} objects from the SVT channel map should be used to
- * lookup the conditions using the {@link #getChannelConstants(TestRunSvtChannel)}
- * method.
+ * lookup the conditions using the
+ * {@link #getChannelConstants(TestRunSvtChannel)} method.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
public class TestRunSvtConditions extends AbstractSvtConditions {
- /**
- * Get the {@link TestRunSvtDaqMappingCollection} associated with these conditions.
+ /**
+ * Get the {@link TestRunSvtDaqMappingCollection} associated with these
+ * conditions.
*
* @return The SVT DAQ map.
*/
@@ -40,24 +41,25 @@
}
/**
- * Get the {@link TestRunSvtT0ShiftCollection} associated with these conditions.
+ * Get the {@link TestRunSvtT0ShiftCollection} associated with these
+ * conditions.
*
* @return The {@link TestRunSvtT0ShiftCollection}
*/
@Override
- public TestRunSvtT0ShiftCollection getT0Shifts() {
- return (TestRunSvtT0ShiftCollection) t0Shifts;
+ public TestRunSvtT0ShiftCollection getT0Shifts() {
+ return (TestRunSvtT0ShiftCollection) t0Shifts;
}
-
+
/**
- * Convert this object to a human readable string. This method prints a formatted
- * table of channel data independently of how its member objects implement their
- * string conversion method. For now, it does not print the time shifts by sensor as
- * all other information is by channel.
+ * Convert this object to a human readable string. This method prints a
+ * formatted table of channel data independently of how its member objects
+ * implement their string conversion method. For now, it does not print the
+ * time shifts by sensor as all other information is by channel.
*
- * @return This object converted to a string, without the DAQ map.
- * TODO: Make this look more human readable. At the moment, reading this
- * requires a huge terminal window.
+ * @return This object converted to a string, without the DAQ map. TODO:
+ * Make this look more human readable. At the moment, reading this
+ * requires a huge terminal window.
*/
public String toString() {
StringBuffer buff = new StringBuffer();
@@ -120,7 +122,7 @@
for (TestRunSvtChannel channel : this.getChannelMap().getObjects()) {
System.out.println("Channel: " + channel.toString());
-
+
// Get the conditions for the channel.
ChannelConstants constants = getChannelConstants(channel);
SvtGain gain = constants.getGain();
@@ -131,13 +133,13 @@
buff.append(String.format("%-6d %-5d %-8d %-8d ", channel.getChannelID(), channel.getFpgaID(), channel.getHybridID(), channel.getChannel()));
// Calibration.
- for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
- buff.append(calibration.getPedestal(sample));
- buff.append(" ");
+ for (int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++) {
+ buff.append(calibration.getPedestal(sample));
+ buff.append(" ");
}
- for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
- buff.append(calibration.getNoise(sample));
- buff.append(" ");
+ for (int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++) {
+ buff.append(calibration.getNoise(sample));
+ buff.append(" ");
}
// Gain.
@@ -161,5 +163,4 @@
return buff.toString();
}
-
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java Mon Nov 10 00:16:49 2014
@@ -8,9 +8,8 @@
public final class TestRunSvtConditionsConverter extends AbstractSvtConditionsConverter<TestRunSvtConditions> {
-
- public TestRunSvtConditionsConverter(){
- this.conditions = new TestRunSvtConditions();
+ public TestRunSvtConditionsConverter() {
+ this.conditions = new TestRunSvtConditions();
}
/**
@@ -20,20 +19,21 @@
* @param name The conditions key, which is ignored for now.
*/
@Override
- public TestRunSvtConditions getData(ConditionsManager manager, String name){
-
+ public TestRunSvtConditions getData(ConditionsManager manager, String name) {
+
DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
-
- // Get the channel map from the conditions database
+
+ // Get the channel map from the conditions database
TestRunSvtChannelCollection channels = dbConditionsManager.getCollection(TestRunSvtChannelCollection.class);
- // Create the SVT conditions object to use to encapsulate SVT condition collections
+ // Create the SVT conditions object to use to encapsulate SVT condition
+ // collections
conditions.setChannelMap(channels);
-
+
// Get the DAQ map from the conditions database
TestRunSvtDaqMappingCollection daqMap = dbConditionsManager.getCollection(TestRunSvtDaqMappingCollection.class);
conditions.setDaqMap(daqMap);
-
+
// Get the collection of T0 shifts from the conditions database
TestRunSvtT0ShiftCollection t0Shifts = dbConditionsManager.getCollection(TestRunSvtT0ShiftCollection.class);
conditions.setT0Shifts(t0Shifts);
@@ -42,14 +42,13 @@
return conditions;
}
-
-
+
/**
* Get the type handled by this converter.
* @return The type handled by this converter.
*/
- @Override
- public Class<TestRunSvtConditions> getType() {
- return TestRunSvtConditions.class;
- }
+ @Override
+ public Class<TestRunSvtConditions> getType() {
+ return TestRunSvtConditions.class;
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java Mon Nov 10 00:16:49 2014
@@ -12,60 +12,55 @@
*/
public class TestRunSvtDaqMapping extends AbstractSvtDaqMapping {
- public static class TestRunSvtDaqMappingCollection
- extends AbstractSvtDaqMappingCollection<TestRunSvtDaqMapping> {
-
+ public static class TestRunSvtDaqMappingCollection extends AbstractSvtDaqMappingCollection<TestRunSvtDaqMapping> {
+
/**
- * Get a test run DAQ pair (FPGA and Hybrid ID) for the given
- * {@linkplain HpsTestRunSiSensor}
- *
- * @param sensor A sensor of type {@link HpsTestRunSiSensor}
- * @return The DAQ pair associated with the sensor
- */
- public Pair<Integer, Integer> getDaqPair(HpsSiSensor sensor){
-
- String svtHalf = sensor.isTopLayer() ? TOP_HALF : BOTTOM_HALF;
- for(TestRunSvtDaqMapping daqMapping : this.getObjects()){
-
- if(svtHalf.equals(daqMapping.getSvtHalf())
- && daqMapping.getLayerNumber() == sensor.getLayerNumber()){
-
- return new Pair<Integer, Integer>(daqMapping.getFpgaID(),
- daqMapping.getHybridID());
- }
- }
- return null;
- }
-
+ * Get a test run DAQ pair (FPGA and Hybrid ID) for the given
+ * {@linkplain HpsTestRunSiSensor}
+ *
+ * @param sensor A sensor of type {@link HpsTestRunSiSensor}
+ * @return The DAQ pair associated with the sensor
+ */
+ public Pair<Integer, Integer> getDaqPair(HpsSiSensor sensor) {
+
+ String svtHalf = sensor.isTopLayer() ? TOP_HALF : BOTTOM_HALF;
+ for (TestRunSvtDaqMapping daqMapping : this.getObjects()) {
+
+ if (svtHalf.equals(daqMapping.getSvtHalf()) && daqMapping.getLayerNumber() == sensor.getLayerNumber()) {
+
+ return new Pair<Integer, Integer>(daqMapping.getFpgaID(), daqMapping.getHybridID());
+ }
+ }
+ return null;
+ }
+
/**
- * Get the orientation of a sensor using the FPGA and Hybrid ID.
- * If the FPGA and Hybrid ID combination is not found, return null.
+ * Get the orientation of a sensor using the FPGA and Hybrid ID. If the
+ * FPGA and Hybrid ID combination is not found, return null.
*
* @param daqPair (Pair<FPGA ID, Hybrid ID>) for a given sensor
- * @return If a daqPair is found, return an "A" if the sensor
- * orientation is Axial, an "S" if the orientation is Stereo or
- * null if the daqPair doesn't exist.
+ * @return If a daqPair is found, return an "A" if the sensor
+ * orientation is Axial, an "S" if the orientation is Stereo or
+ * null if the daqPair doesn't exist.
*/
- public String getOrientation(Pair<Integer, Integer> daqPair){
-
- for(TestRunSvtDaqMapping daqMapping : this.getObjects()){
-
- if(daqPair.getFirstElement() == ((TestRunSvtDaqMapping) daqMapping).getFpgaID()
- && daqPair.getSecondElement() == ((TestRunSvtDaqMapping) daqMapping).getHybridID()){
- return daqMapping.getOrientation();
- }
- }
- return null;
+ public String getOrientation(Pair<Integer, Integer> daqPair) {
+
+ for (TestRunSvtDaqMapping daqMapping : this.getObjects()) {
+
+ if (daqPair.getFirstElement() == ((TestRunSvtDaqMapping) daqMapping).getFpgaID() && daqPair.getSecondElement() == ((TestRunSvtDaqMapping) daqMapping).getHybridID()) {
+ return daqMapping.getOrientation();
+ }
+ }
+ return null;
}
-
-
+
/**
* Convert {@link TestRunSvtDaqMapping} to a string.
* @return This object converted to a string.
*/
public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("FPGA ID: ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("FPGA ID: ");
buffer.append(" ");
buffer.append("Hybrid ID: ");
buffer.append(" ");
@@ -78,11 +73,11 @@
buffer.append('\n');
buffer.append("----------------------");
buffer.append('\n');
- for (TestRunSvtDaqMapping daqMapping : getObjects()){
- TestRunSvtDaqMapping testRunDaqMapping = (TestRunSvtDaqMapping) daqMapping;
- buffer.append(testRunDaqMapping.getFpgaID());
+ for (TestRunSvtDaqMapping daqMapping : getObjects()) {
+ TestRunSvtDaqMapping testRunDaqMapping = (TestRunSvtDaqMapping) daqMapping;
+ buffer.append(testRunDaqMapping.getFpgaID());
buffer.append(" ");
- buffer.append(testRunDaqMapping.getHybridID());
+ buffer.append(testRunDaqMapping.getHybridID());
buffer.append(" ");
buffer.append(testRunDaqMapping.getSvtHalf());
buffer.append(" ");
@@ -92,15 +87,15 @@
buffer.append(" ");
buffer.append('\n');
}
- return buffer.toString();
+ return buffer.toString();
}
- }
-
- public int getFpgaID(){
- return getFieldValue("fpga");
- }
-
- public int getHybridID(){
- return getFieldValue("hybrid");
- }
+ }
+
+ public int getFpgaID() {
+ return getFieldValue("fpga");
+ }
+
+ public int getHybridID() {
+ return getFieldValue("hybrid");
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java Mon Nov 10 00:16:49 2014
@@ -12,7 +12,7 @@
import org.hps.util.Pair;
/**
- * This class puts {@link TestRunSvtConditions} data onto
+ * This class puts {@link TestRunSvtConditions} data onto
* <code>HpsTestRunSiSensor</code> objects.
*
* @author Omar Moreno <[log in to unmask]>
@@ -22,85 +22,84 @@
/**
* Load conditions data onto a detector object.
*
- * @param The detector object.
+ * @param The detector object.
* @param conditions The conditions object.
*/
- public void load(Subdetector subdetector, TestRunSvtConditions conditions){
-
+ public void load(Subdetector subdetector, TestRunSvtConditions conditions) {
+
// Find sensor objects.
- List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
- TestRunSvtChannelCollection channelMap = conditions.getChannelMap();
+ List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
+ TestRunSvtChannelCollection channelMap = conditions.getChannelMap();
TestRunSvtDaqMappingCollection daqMap = conditions.getDaqMap();
TestRunSvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();
-
+
// Loop over sensors.
- for(HpsSiSensor sensor : sensors){
-
+ for (HpsSiSensor sensor : sensors) {
+
// Reset possible existing conditions data on sensor.
sensor.reset();
-
+
// Get DAQ pair (FPGA ID, Hybrid ID) corresponding to this sensor
Pair<Integer, Integer> daqPair = daqMap.getDaqPair(sensor);
if (daqPair == null) {
throw new RuntimeException("Failed to find DAQ pair for sensor: " + sensor.getName());
}
-
+
// Set the FPGA ID of the sensor
((HpsTestRunSiSensor) sensor).setFpgaID(daqPair.getFirstElement());
-
+
// Set the hybrid ID of the sensor
((HpsTestRunSiSensor) sensor).setHybridID(daqPair.getSecondElement());
-
+
// Set the orientation of the sensor
String orientation = daqMap.getOrientation(daqPair);
- if(orientation != null && orientation.contentEquals(TestRunSvtDaqMappingCollection.AXIAL)){
- sensor.setAxial(true);
- } else if(orientation != null && orientation.contains(TestRunSvtDaqMappingCollection.STEREO)){
- sensor.setStereo(true);
+ if (orientation != null && orientation.contentEquals(TestRunSvtDaqMappingCollection.AXIAL)) {
+ sensor.setAxial(true);
+ } else if (orientation != null && orientation.contains(TestRunSvtDaqMappingCollection.STEREO)) {
+ sensor.setStereo(true);
}
-
+
// Find all the channels for this sensor.
Collection<TestRunSvtChannel> channels = channelMap.find(daqPair);
-
-
+
// Loop over the channels of the sensor.
for (TestRunSvtChannel channel : channels) {
-
- // Get conditions data for this channel.
+
+ // Get conditions data for this channel.
ChannelConstants constants = conditions.getChannelConstants(channel);
int channelNumber = channel.getChannel();
-
+
//
// Set conditions data for this channel on the sensor object:
//
-
+
// Check if the channel was flagged as bad
if (constants.isBadChannel()) {
sensor.setBadChannel(channelNumber);
}
-
- // Set the pedestal and noise of each of the samples for the
+
+ // Set the pedestal and noise of each of the samples for the
// channel
double[] pedestal = new double[6];
double[] noise = new double[6];
- for(int sampleN = 0; sampleN < HpsTestRunSiSensor.NUMBER_OF_SAMPLES; sampleN++){
- pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
- noise[sampleN] = constants.getCalibration().getNoise(sampleN);
+ for (int sampleN = 0; sampleN < HpsTestRunSiSensor.NUMBER_OF_SAMPLES; sampleN++) {
+ pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
+ noise[sampleN] = constants.getCalibration().getNoise(sampleN);
}
sensor.setPedestal(channelNumber, pedestal);
sensor.setNoise(channelNumber, noise);
-
+
// Set the gain and offset for the channel
sensor.setGain(channelNumber, constants.getGain().getGain());
sensor.setOffset(channelNumber, constants.getGain().getOffset());
-
+
// Set the shape fit parameters
sensor.setShapeFitParameters(channelNumber, constants.getShapeFitParameters().toArray());
}
-
+
// Set the t0 shift for the sensor.
TestRunSvtT0Shift sensorT0Shift = t0Shifts.getT0Shift(daqPair);
sensor.setT0Shift(sensorT0Shift.getT0Shift());
}
- }
+ }
}
Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java
=============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java (original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java Mon Nov 10 00:16:49 2014
@@ -3,26 +3,26 @@
import org.hps.util.Pair;
/**
- * This class is a container that allows associating a t0 shift with a specific
+ * This class is a container that allows associating a t0 shift with a specific
* sensor by FPGA ID and hybrid ID.
*
* @author Omar Moreno <[log in to unmask]>
*/
public final class TestRunSvtT0Shift extends AbstractSvtT0Shift {
- public static class TestRunSvtT0ShiftCollection
- extends AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<TestRunSvtT0Shift> {
+ public static class TestRunSvtT0ShiftCollection extends AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<TestRunSvtT0Shift> {
/**
* Get the {@link TestRunSvtT0Shift} associated with a given DAQ pair
*
* @param DAQ pair for a given sensor
- * @return The {@link TestRunSvtT0Shift} associated with the DAQ pair. If a t0 shift
- * for a given DAQ pair can't be found, it returns null.
+ * @return The {@link TestRunSvtT0Shift} associated with the DAQ pair.
+ * If a t0 shift for a given DAQ pair can't be found, it returns
+ * null.
*/
- @Override
- public TestRunSvtT0Shift getT0Shift(Pair<Integer, Integer> pair) {
-
+ @Override
+ public TestRunSvtT0Shift getT0Shift(Pair<Integer, Integer> pair) {
+
int fpgaID = pair.getFirstElement();
int hybridID = pair.getSecondElement();
for (TestRunSvtT0Shift t0Shift : this.getObjects()) {
@@ -31,24 +31,24 @@
}
}
return null;
- }
- }
-
- /**
- * Get the FPGA ID.
- *
- * @return The FPGA ID.
- */
- int getFpgaID() {
- return getFieldValue("fpga");
- }
-
- /**
- * Get the hybrid ID.
- *
- * @return The hybrid ID.
- */
- int getHybridID() {
- return getFieldValue("hybrid");
- }
+ }
+ }
+
+ /**
+ * Get the FPGA ID.
+ *
+ * @return The FPGA ID.
+ */
+ int getFpgaID() {
+ return getFieldValue("fpga");
+ }
+
+ /**
+ * Get the hybrid ID.
+ *
+ * @return The hybrid ID.
+ */
+ int getHybridID() {
+ return getFieldValue("hybrid");
+ }
}
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java Mon Nov 10 00:16:49 2014
@@ -15,13 +15,15 @@
import org.lcsim.util.loop.LCSimLoop;
/**
- * This class tests that {@link org.lcsim.hps.conditions.TestRunConditionsDriver} works correctly
- * by checking the number of runs it processes.
+ * This class tests that
+ * {@link org.lcsim.hps.conditions.TestRunConditionsDriver} works correctly by
+ * checking the number of runs it processes.
* @author Jeremy McCormick <[log in to unmask]>
*/
public class ConditionsDriverTest extends TestCase {
- // This test file has a few events from each of the "good runs" of the 2012 Test Run.
+ // This test file has a few events from each of the "good runs" of the 2012
+ // Test Run.
private static final String fileLocation = "http://www.lcsim.org/test/hps-java/ConditionsTest.slcio";
// Number of runs that should be processed in the job.
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsObjectTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsObjectTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/ConditionsObjectTest.java Mon Nov 10 00:16:49 2014
@@ -6,18 +6,19 @@
import org.hps.conditions.svt.SvtGain.SvtGainCollection;
/**
- * Test some basic operations of {@link org.hps.conditions.ConditionsObject} using the
- * {@link org.hps.conditions.svt.SvtGain} type.
+ * Test some basic operations of {@link org.hps.conditions.ConditionsObject}
+ * using the {@link org.hps.conditions.svt.SvtGain} type.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
public class ConditionsObjectTest extends TestCase {
public void testBasicOperations() throws ConditionsObjectException {
-
+
DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
- // Create a new collection, setting its table meta data and collection ID.
+ // Create a new collection, setting its table meta data and collection
+ // ID.
TableMetaData tableMetaData = conditionsManager.findTableMetaData(TableConstants.SVT_GAINS);
int collectionId = conditionsManager.getNextCollectionID(tableMetaData.getTableName());
SvtGainCollection collection = new SvtGainCollection();
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java Mon Nov 10 00:16:49 2014
@@ -73,8 +73,8 @@
int currentRun = Integer.MIN_VALUE;
/**
- * This method will check the beam current against the answer key for the first
- * event of a new run.
+ * This method will check the beam current against the answer key for
+ * the first event of a new run.
*/
public void process(EventHeader event) {
if (currentRun != event.getRunNumber()) {
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalConditionsConverterTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalConditionsConverterTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalConditionsConverterTest.java Mon Nov 10 00:16:49 2014
@@ -12,17 +12,17 @@
public class EcalConditionsConverterTest extends TestCase {
DatabaseConditionsManager conditionsManager;
-
- public void setUp() {
+
+ public void setUp() {
conditionsManager = DatabaseConditionsManager.getInstance();
try {
- conditionsManager.setDetector("HPS-Proposal2014-v7-2pt2", 0);
- } catch (ConditionsNotFoundException e) {
- throw new RuntimeException(e);
- }
+ conditionsManager.setDetector("HPS-Proposal2014-v7-2pt2", 0);
+ } catch (ConditionsNotFoundException e) {
+ throw new RuntimeException(e);
+ }
}
- public void test() {
+ public void test() {
// Test that the manager gets ECAL conditions.
EcalConditions conditions = conditionsManager.getCachedConditions(EcalConditions.class, "ecal_conditions").getCachedData();
assertNotNull(conditions);
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalDetectorSetupTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalDetectorSetupTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/ecal/EcalDetectorSetupTest.java Mon Nov 10 00:16:49 2014
@@ -9,8 +9,8 @@
import org.lcsim.geometry.Detector;
/**
- * This test loads ECal conditions data onto a Test Run detector and checks some of the results
- * for basic validity.
+ * This test loads ECal conditions data onto a Test Run detector and checks some
+ * of the results for basic validity.
*
* @author Jeremy McCormick <[log in to unmask]>
*/
@@ -34,7 +34,8 @@
private static final int CRYSTAL_COUNT = 442;
/**
- * Load SVT conditions data onto the detector and perform basic checks afterwards.
+ * Load SVT conditions data onto the detector and perform basic checks
+ * afterwards.
*/
public void testLoad() throws Exception {
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java Mon Nov 10 00:16:49 2014
@@ -19,12 +19,14 @@
import org.lcsim.util.loop.LCSimLoop;
/**
- * This class tests that the correct bad channel conditions are found for the test run.
+ * This class tests that the correct bad channel conditions are found for the
+ * test run.
* @author Jeremy McCormick <[log in to unmask]>
*/
public class SvtBadChannelTest extends TestCase {
- // This test file has a few events from each of the "good runs" of the 2012 Test Run.
+ // This test file has a few events from each of the "good runs" of the 2012
+ // Test Run.
private static final String TEST_FILE_URL = "http://www.lcsim.org/test/hps/conditions_test.slcio";
// This is the number of bad channels in the QA set across all runs.
@@ -68,7 +70,8 @@
}
/**
- * This Driver will check the number of bad channels for a run against the answer key.
+ * This Driver will check the number of bad channels for a run against the
+ * answer key.
* @author Jeremy McCormick <[log in to unmask]>
*/
class SvtBadChannelChecker extends Driver {
@@ -76,8 +79,8 @@
int _currentRun = -1;
/**
- * This method will check the number of bad channels against the answer key for
- * the first event of a new run.
+ * This method will check the number of bad channels against the answer
+ * key for the first event of a new run.
*/
public void process(EventHeader event) {
int run = event.getRunNumber();
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java Mon Nov 10 00:16:49 2014
@@ -13,11 +13,11 @@
public class SvtConfigurationTest extends TestCase {
DatabaseConditionsManager manager;
-
+
public void testSvtConfiguration() {
- DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
+ DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
SvtConfigurationCollection collection = manager.getCachedConditions(SvtConfigurationCollection.class, TableConstants.SVT_CONFIGURATIONS).getCachedData();
-
+
for (SvtConfiguration config : collection) {
Document doc = null;
try {
@@ -28,5 +28,5 @@
System.out.println(doc.toString());
}
}
-
+
}
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java Mon Nov 10 00:16:49 2014
@@ -7,54 +7,52 @@
import org.hps.conditions.svt.SvtDaqMapping.SvtDaqMappingCollection;
/**
- * This test checks if the SVT DAQ map was loaded with reasonable values and
- * is being read correctly from the conditions database.
+ * This test checks if the SVT DAQ map was loaded with reasonable values and is
+ * being read correctly from the conditions database.
*
* @author Omar Moreno <[log in to unmask]>
*/
public class SvtDaqMappingTest extends TestCase {
-
- //--- Constants ---//
- //-----------------//
-
- // Total number of SVT sensors
- public static final int TOTAL_NUMBER_OF_SENSORS = 36;
- // Min and max values of front end boad (FEB) hybrid ID's
- public static final int MIN_FEB_HYBRID_ID = 0;
- public static final int MAX_FEB_HYBRID_ID = 3;
-
- //-----------------//
+ // --- Constants ---//
+ // -----------------//
- public void test() throws Exception {
-
- DatabaseConditionsManager conditionsManager = new DatabaseConditionsManager();
- conditionsManager.setDetector("HPS-Proposal2014-v7-2pt2", 0);
-
- TableMetaData metaData = conditionsManager.findTableMetaData(SvtDaqMappingCollection.class);
- SvtDaqMappingCollection daqMappingCollection
- = conditionsManager.getConditionsData(SvtDaqMappingCollection.class, metaData.getTableName());
-
- int totalSensors = 0;
- int febHybridID;
- this.printDebug("");
- for(SvtDaqMapping daqMapping : daqMappingCollection){
-
- this.printDebug("Sensor: \n" + daqMapping.toString());
-
- // Check that the FEB Hybrid ID is within the allowable limits
- febHybridID = daqMapping.getFebHybridID();
- assertTrue("FEB Hybrid ID is out of range!.", febHybridID >= MIN_FEB_HYBRID_ID && febHybridID <= MAX_FEB_HYBRID_ID);
-
- totalSensors++;
- }
-
- this.printDebug("Total number of sensors found: " + totalSensors);
- assertTrue(totalSensors == TOTAL_NUMBER_OF_SENSORS);
-
- }
-
- private void printDebug(String debugMessage) {
- System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
- }
+ // Total number of SVT sensors
+ public static final int TOTAL_NUMBER_OF_SENSORS = 36;
+ // Min and max values of front end boad (FEB) hybrid ID's
+ public static final int MIN_FEB_HYBRID_ID = 0;
+ public static final int MAX_FEB_HYBRID_ID = 3;
+
+ // -----------------//
+
+ public void test() throws Exception {
+
+ DatabaseConditionsManager conditionsManager = new DatabaseConditionsManager();
+ conditionsManager.setDetector("HPS-Proposal2014-v7-2pt2", 0);
+
+ TableMetaData metaData = conditionsManager.findTableMetaData(SvtDaqMappingCollection.class);
+ SvtDaqMappingCollection daqMappingCollection = conditionsManager.getConditionsData(SvtDaqMappingCollection.class, metaData.getTableName());
+
+ int totalSensors = 0;
+ int febHybridID;
+ this.printDebug("");
+ for (SvtDaqMapping daqMapping : daqMappingCollection) {
+
+ this.printDebug("Sensor: \n" + daqMapping.toString());
+
+ // Check that the FEB Hybrid ID is within the allowable limits
+ febHybridID = daqMapping.getFebHybridID();
+ assertTrue("FEB Hybrid ID is out of range!.", febHybridID >= MIN_FEB_HYBRID_ID && febHybridID <= MAX_FEB_HYBRID_ID);
+
+ totalSensors++;
+ }
+
+ this.printDebug("Total number of sensors found: " + totalSensors);
+ assertTrue(totalSensors == TOTAL_NUMBER_OF_SENSORS);
+
+ }
+
+ private void printDebug(String debugMessage) {
+ System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
+ }
}
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java Mon Nov 10 00:16:49 2014
@@ -9,39 +9,40 @@
import org.lcsim.geometry.Detector;
/**
- * This test loads {@link SvtConditions} data onto the detector and then checks that all
- * channels of each sensor have non-zero data values for applicable parameters.
+ * This test loads {@link SvtConditions} data onto the detector and then checks
+ * that all channels of each sensor have non-zero data values for applicable
+ * parameters.
*
* @author Jeremy McCormick <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
*/
// TODO: Update this test with more meaningful test.
public class SvtDetectorSetupTest extends TestCase {
-
-
- //--- Constants ---//
- //-----------------//
- // TODO: Move all of these constants to their own class
-
- // Total number of SVT sensors
- public static final int TOTAL_NUMBER_OF_SENSORS = 36;
- // Max FEB ID
- public static final int MAX_FEB_ID = 9;
- // Max FEB Hybrid ID
- public static final int MAX_FEB_HYBRID_ID = 3;
- // Max channel number
- public static final int MAX_CHANNEL_NUMBER = 639;
- // SVT Subdetector name
- public static final String SVT_SUBDETECTOR_NAME = "Tracker";
-
+
+ // --- Constants ---//
+ // -----------------//
+ // TODO: Move all of these constants to their own class
+
+ // Total number of SVT sensors
+ public static final int TOTAL_NUMBER_OF_SENSORS = 36;
+ // Max FEB ID
+ public static final int MAX_FEB_ID = 9;
+ // Max FEB Hybrid ID
+ public static final int MAX_FEB_HYBRID_ID = 3;
+ // Max channel number
+ public static final int MAX_CHANNEL_NUMBER = 639;
+ // SVT Subdetector name
+ public static final String SVT_SUBDETECTOR_NAME = "Tracker";
+
/**
- * Load SVT conditions data onto the detector and perform basic checks afterwards.
+ * Load SVT conditions data onto the detector and perform basic checks
+ * afterwards.
*/
public void test() throws Exception {
-
- DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
- conditionsManager.setDetector("HPS-Proposal2014-v7-2pt2", 0);
-
+
+ DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+ conditionsManager.setDetector("HPS-Proposal2014-v7-2pt2", 0);
+
// Get the detector.
Detector detector = conditionsManager.getCachedConditions(Detector.class, "compact.xml").getCachedData();
@@ -54,51 +55,46 @@
// Check sensor data.
List<HpsSiSensor> sensors = detector.getSubdetector(SVT_SUBDETECTOR_NAME).getDetectorElement().findDescendants(HpsSiSensor.class);
-
+
// Check for correct number of sensors processed.
- this.printDebug("Total number of sensors found: " + sensors.size());
- assertTrue(sensors.size() == TOTAL_NUMBER_OF_SENSORS);
-
+ this.printDebug("Total number of sensors found: " + sensors.size());
+ assertTrue(sensors.size() == TOTAL_NUMBER_OF_SENSORS);
+
// Loop over sensors.
- int totalSensors = 0;
+ int totalSensors = 0;
for (HpsSiSensor sensor : sensors) {
- int nChannels = sensor.getNumberOfChannels();
- assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
-
- this.printDebug(sensor.toString());
-
- // Check that the FEB ID as within the appropriate range
+ int nChannels = sensor.getNumberOfChannels();
+ assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
+
+ this.printDebug(sensor.toString());
+
+ // Check that the FEB ID as within the appropriate range
int febID = sensor.getFebID();
- assertTrue("FEB ID is invalid. The FEB ID should be less than " + MAX_FEB_ID,
- febID <= MAX_FEB_ID);
-
+ assertTrue("FEB ID is invalid. The FEB ID should be less than " + MAX_FEB_ID, febID <= MAX_FEB_ID);
+
int febHybridID = sensor.getFebHybridID();
- assertTrue("FEB Hybrid ID is invalid. The FEB Hybrid ID should be less than " + MAX_FEB_HYBRID_ID,
- febHybridID <= MAX_FEB_HYBRID_ID);
-
+ assertTrue("FEB Hybrid ID is invalid. The FEB Hybrid ID should be less than " + MAX_FEB_HYBRID_ID, febHybridID <= MAX_FEB_HYBRID_ID);
+
for (int channel = 0; channel < nChannels; channel++) {
-
- //
+
+ //
// Check that channel conditions values are not zero
- //
- for(int sampleN = 0; sampleN < 6; sampleN++){
- assertTrue("Pedestal sample " + sampleN + " is zero.",
- sensor.getPedestal(channel, sampleN) != 0);
- assertTrue("Noise sample " + sampleN + " is zero.",
- sensor.getNoise(channel, sampleN) != 0);
- }
+ //
+ for (int sampleN = 0; sampleN < 6; sampleN++) {
+ assertTrue("Pedestal sample " + sampleN + " is zero.", sensor.getPedestal(channel, sampleN) != 0);
+ assertTrue("Noise sample " + sampleN + " is zero.", sensor.getNoise(channel, sampleN) != 0);
+ }
assertTrue("Gain is zero.", sensor.getGain(channel) != 0);
- assertTrue("Shape fit parameters points to null.",
- sensor.getShapeFitParameters(channel) != null);
-
+ assertTrue("Shape fit parameters points to null.", sensor.getShapeFitParameters(channel) != null);
+
}
}
-
- System.out.println("Successfully loaded conditions data onto " + totalSensors + " SVT sensors!");
+
+ System.out.println("Successfully loaded conditions data onto " + totalSensors + " SVT sensors!");
}
- private void printDebug(String debugMessage){
- System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
- }
+ private void printDebug(String debugMessage) {
+ System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
+ }
}
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java Mon Nov 10 00:16:49 2014
@@ -5,17 +5,17 @@
import org.hps.conditions.DatabaseConditionsManager;
public class TestRunSvtConditionsConverterTest extends TestCase {
-
- public void test() throws Exception {
- DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
- conditionsManager.configure("/org/hps/conditions/config/conditions_database_testrun_2012.xml");
- conditionsManager.setDetector("HPS-TestRun-v5", 1351);
-
+
+ public void test() throws Exception {
+ DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+ conditionsManager.configure("/org/hps/conditions/config/conditions_database_testrun_2012.xml");
+ conditionsManager.setDetector("HPS-TestRun-v5", 1351);
+
TestRunSvtConditions svtConditions = conditionsManager.getCachedConditions(TestRunSvtConditions.class, "svt_conditions").getCachedData();
assertNotNull(svtConditions);
System.out.println("[ " + this.getClass().getSimpleName() + "]: Printing test run SVT conditions.");
System.out.println(svtConditions);
System.out.println("[ " + this.getClass().getSimpleName() + "]: Succussfully loaded test run SVT conditions");
- }
-
+ }
+
}
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java Mon Nov 10 00:16:49 2014
@@ -7,69 +7,65 @@
import org.hps.conditions.svt.TestRunSvtDaqMapping.TestRunSvtDaqMappingCollection;
/**
- * This test checks if the test run SVT DAQ map was loaded with reasonable
+ * This test checks if the test run SVT DAQ map was loaded with reasonable
* values and is being read correctly from the conditions database.
*
* @author Omar Moreno <[log in to unmask]>
*/
public class TestRunSvtDaqMappingTest extends TestCase {
- TableMetaData metaData = null;
-
- //--- Constants ---//
- //-----------------//
-
- // Total number of SVT sensors
- public static final int TOTAL_NUMBER_OF_SENSORS = 20;
- // Min and max values of the FPGA ID's
- public static final int MIN_FPGA_ID = 0;
- public static final int MAX_FPGA_ID = 6;
- // Min and max values of Hybrid ID's
- public static final int MIN_HYBRID_ID = 0;
- public static final int MAX_HYBRID_ID = 2;
- // Min and max layer number values
- public static final int MIN_LAYER_NUMBER = 1;
- public static final int MAX_LAYER_NUMBER = 10;
-
- public void test() throws Exception {
-
- DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+ TableMetaData metaData = null;
+
+ // --- Constants ---//
+ // -----------------//
+
+ // Total number of SVT sensors
+ public static final int TOTAL_NUMBER_OF_SENSORS = 20;
+ // Min and max values of the FPGA ID's
+ public static final int MIN_FPGA_ID = 0;
+ public static final int MAX_FPGA_ID = 6;
+ // Min and max values of Hybrid ID's
+ public static final int MIN_HYBRID_ID = 0;
+ public static final int MAX_HYBRID_ID = 2;
+ // Min and max layer number values
+ public static final int MIN_LAYER_NUMBER = 1;
+ public static final int MAX_LAYER_NUMBER = 10;
+
+ public void test() throws Exception {
+
+ DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
conditionsManager.configure("/org/hps/conditions/config/conditions_database_testrun_2012.xml");
conditionsManager.setDetector("HPS-TestRun-v5", 1351);
- metaData = conditionsManager.findTableMetaData(TestRunSvtDaqMappingCollection.class);
- TestRunSvtDaqMappingCollection daqMappingCollection =
- conditionsManager.getConditionsData(TestRunSvtDaqMappingCollection.class, metaData.getTableName());
-
- int totalSensors = 0;
- this.printDebug("");
- for(TestRunSvtDaqMapping daqMapping : daqMappingCollection){
-
- this.printDebug("Sensor: \n" + daqMapping.toString());
-
- // Check that the FPGA ID is within the allowable limits
- int fpgaID = daqMapping.getFpgaID();
- assertTrue("FPGA ID " + fpgaID + " is out of range!",
- fpgaID >= MIN_FPGA_ID && fpgaID <= MAX_FPGA_ID);
-
- // Check that the Hybrid ID is within the allowable limits
- int hybridID = daqMapping.getHybridID();
- assertTrue("Hybrid ID " + hybridID + " is out of range!",
- hybridID >= MIN_HYBRID_ID && hybridID <= MAX_HYBRID_ID);
-
- // Check that the layer number is within the allowable limits
- int layerNumber = daqMapping.getLayerNumber();
- assertTrue("The layer number " + layerNumber + " is out of range!",
- layerNumber >= MIN_LAYER_NUMBER && layerNumber <= MAX_LAYER_NUMBER);
-
- totalSensors++;
- }
-
- this.printDebug("Total number of sensors found: " + totalSensors);
- assertTrue(totalSensors == TOTAL_NUMBER_OF_SENSORS);
- }
+ metaData = conditionsManager.findTableMetaData(TestRunSvtDaqMappingCollection.class);
+ TestRunSvtDaqMappingCollection daqMappingCollection = conditionsManager.getConditionsData(TestRunSvtDaqMappingCollection.class, metaData.getTableName());
- private void printDebug(String debugMessage) {
- System.out.println("[ " + this.getClass().getSimpleName() + " ]: " + debugMessage);
- }
+ int totalSensors = 0;
+ this.printDebug("");
+ for (TestRunSvtDaqMapping daqMapping : daqMappingCollection) {
+
+ this.printDebug("Sensor: \n" + daqMapping.toString());
+
+ // Check that the FPGA ID is within the allowable limits
+ int fpgaID = daqMapping.getFpgaID();
+ assertTrue("FPGA ID " + fpgaID + " is out of range!", fpgaID >= MIN_FPGA_ID && fpgaID <= MAX_FPGA_ID);
+
+ // Check that the Hybrid ID is within the allowable limits
+ int hybridID = daqMapping.getHybridID();
+ assertTrue("Hybrid ID " + hybridID + " is out of range!", hybridID >= MIN_HYBRID_ID && hybridID <= MAX_HYBRID_ID);
+
+ // Check that the layer number is within the allowable limits
+ int layerNumber = daqMapping.getLayerNumber();
+ assertTrue("The layer number " + layerNumber + " is out of range!", layerNumber >= MIN_LAYER_NUMBER && layerNumber <= MAX_LAYER_NUMBER);
+
+ totalSensors++;
+ }
+
+ this.printDebug("Total number of sensors found: " + totalSensors);
+ assertTrue(totalSensors == TOTAL_NUMBER_OF_SENSORS);
+ }
+
+ private void printDebug(String debugMessage) {
+ System.out.println("[ " + this.getClass().getSimpleName() + " ]: " + debugMessage);
+ }
}
Modified: java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java
=============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java (original)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java Mon Nov 10 00:16:49 2014
@@ -9,95 +9,91 @@
import org.lcsim.geometry.Detector;
/**
- * This test loads {@link TestRunSvtConditions} data onto the detector and then checks that all
- * channels of each sensor have non-zero data values for applicable parameters.
+ * This test loads {@link TestRunSvtConditions} data onto the detector and then
+ * checks that all channels of each sensor have non-zero data values for
+ * applicable parameters.
*
* @author Omar Moreno <[log in to unmask]>
*/
public class TestRunSvtDetectorSetupTest extends TestCase {
- //--- Constants ---//
- //-----------------//
- // TODO: Move all of these constants to their own class
-
- // Total number of SVT sensors
- public static final int TOTAL_NUMBER_OF_SENSORS = 20;
- // Max FEB ID
- public static final int MAX_FPGA_ID = 6;
- // Max FEB Hybrid ID
- public static final int MAX_HYBRID_ID = 2;
- // Max channel number
- public static final int MAX_CHANNEL_NUMBER = 639;
- // SVT Subdetector name
- public static final String SVT_SUBDETECTOR_NAME = "Tracker";
-
+ // --- Constants ---//
+ // -----------------//
+ // TODO: Move all of these constants to their own class
+
+ // Total number of SVT sensors
+ public static final int TOTAL_NUMBER_OF_SENSORS = 20;
+ // Max FEB ID
+ public static final int MAX_FPGA_ID = 6;
+ // Max FEB Hybrid ID
+ public static final int MAX_HYBRID_ID = 2;
+ // Max channel number
+ public static final int MAX_CHANNEL_NUMBER = 639;
+ // SVT Subdetector name
+ public static final String SVT_SUBDETECTOR_NAME = "Tracker";
+
/**
- * Load SVT conditions data onto the detector and perform basic checks afterwards.
+ * Load SVT conditions data onto the detector and perform basic checks
+ * afterwards.
*/
- public void test() throws Exception {
-
- DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+ public void test() throws Exception {
+
+ DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
conditionsManager.configure("/org/hps/conditions/config/conditions_database_testrun_2012.xml");
- conditionsManager.setDetector("HPS-TestRun-v5", 1351);
-
+ conditionsManager.setDetector("HPS-TestRun-v5", 1351);
+
// Get the detector.
Detector detector = conditionsManager.getCachedConditions(Detector.class, "compact.xml").getCachedData();
-
+
// Get all test run SVT conditions.
TestRunSvtConditions conditions = conditionsManager.getCachedConditions(TestRunSvtConditions.class, "svt_conditions").getCachedData();
-
+
// Load the test run SVT conditions onto detector.
TestRunSvtDetectorSetup loader = new TestRunSvtDetectorSetup();
loader.load(detector.getSubdetector(SVT_SUBDETECTOR_NAME), conditions);
-
+
// Check sensor data.
List<HpsTestRunSiSensor> sensors = detector.getSubdetector(SVT_SUBDETECTOR_NAME).getDetectorElement().findDescendants(HpsTestRunSiSensor.class);
-
+
// Check for correct number of sensors processed.
- this.printDebug("Total number of sensors found: " + sensors.size());
- assertTrue(sensors.size() == TOTAL_NUMBER_OF_SENSORS);
-
-
+ this.printDebug("Total number of sensors found: " + sensors.size());
+ assertTrue(sensors.size() == TOTAL_NUMBER_OF_SENSORS);
+
// Loop over sensors.
- int totalSensors = 0;
+ int totalSensors = 0;
for (HpsTestRunSiSensor sensor : sensors) {
-
- int nChannels = sensor.getNumberOfChannels();
- assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
-
- this.printDebug(sensor.toString());
-
- // Check that the FEB ID as within the appropriate range
+
+ int nChannels = sensor.getNumberOfChannels();
+ assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
+
+ this.printDebug(sensor.toString());
+
+ // Check that the FEB ID as within the appropriate range
int fpgaID = sensor.getFpgaID();
- assertTrue("FPGA ID is invalid. The FPGA ID should be less than " + MAX_FPGA_ID,
- fpgaID <= MAX_FPGA_ID);
-
+ assertTrue("FPGA ID is invalid. The FPGA ID should be less than " + MAX_FPGA_ID, fpgaID <= MAX_FPGA_ID);
+
int hybridID = sensor.getHybridID();
- assertTrue("Hybrid ID is invalid. The Hybrid ID should be less than " + MAX_HYBRID_ID,
- hybridID <= MAX_HYBRID_ID);
+ assertTrue("Hybrid ID is invalid. The Hybrid ID should be less than " + MAX_HYBRID_ID, hybridID <= MAX_HYBRID_ID);
for (int channel = 0; channel < nChannels; channel++) {
- //
+ //
// Check that channel conditions values are not zero
- //
- for(int sampleN = 0; sampleN < 6; sampleN++){
- assertTrue("Pedestal sample " + sampleN + " is zero.",
- sensor.getPedestal(channel, sampleN) != 0);
- assertTrue("Noise sample " + sampleN + " is zero.",
- sensor.getNoise(channel, sampleN) != 0);
- }
+ //
+ for (int sampleN = 0; sampleN < 6; sampleN++) {
+ assertTrue("Pedestal sample " + sampleN + " is zero.", sensor.getPedestal(channel, sampleN) != 0);
+ assertTrue("Noise sample " + sampleN + " is zero.", sensor.getNoise(channel, sampleN) != 0);
+ }
assertTrue("Gain is zero.", sensor.getGain(channel) != 0);
- assertTrue("Shape fit parameters points to null.",
- sensor.getShapeFitParameters(channel) != null);
-
+ assertTrue("Shape fit parameters points to null.", sensor.getShapeFitParameters(channel) != null);
+
}
}
- System.out.println("Successfully loaded test run conditions data onto " + totalSensors + " SVT sensors!");
- }
+ System.out.println("Successfully loaded test run conditions data onto " + totalSensors + " SVT sensors!");
+ }
- private void printDebug(String debugMessage){
- System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
- }
-
+ private void printDebug(String debugMessage) {
+ System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
+ }
+
}
|