Author: [log in to unmask]
Date: Wed May 27 12:52:56 2015
New Revision: 3037
Log:
Merge HPSJAVA-499 into trunk.
Added:
java/trunk/detector-model/
- copied from r3036, java/branches/HPSJAVA-499/detector-model/
Modified:
java/trunk/ (props changed)
java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java
java/trunk/distribution/ (props changed)
java/trunk/distribution/pom.xml
java/trunk/parent/pom.xml
java/trunk/pom.xml
java/trunk/tracking/pom.xml
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 Wed May 27 12:52:56 2015
@@ -12,7 +12,6 @@
* translation or rotation of a detector component.
* <p>
* The format of the keys is ABCDE where:<br>
- *
* <pre>
* A == half == [1,2]
* B == alignment type == [1,2]
@@ -29,164 +28,21 @@
public final class SvtAlignmentConstant extends BaseConditionsObject {
/**
- * The alignment constant type which is rotation or translation.
- */
- public enum AlignmentType {
- /** Rotation alignment type. */
- ROTATION(1),
- /** Translation alignment type. */
- TRANSLATION(2);
-
- /**
- * The value of the alignment type constants.
- */
- private final int value;
-
- /**
- * Constructor that has value of constant.
- *
- * @param value the value of the constant
- */
- private AlignmentType(final int value) {
- this.value = value;
- }
-
- /**
- * Get the value for the alignment constant type.
- *
- * @return the value of the constant
- */
- int getValue() {
- return this.value;
- }
- }
-
- /**
- * Top or bottom half.
- */
- public enum Half {
- /** Bottom half. */
- BOTTOM(2),
- /** Top half. */
- TOP(1);
-
- /**
- * The integer value designating top or bottom half.
- */
- private final int value;
-
- /**
- * Create from top or bottom value.
- *
- * @param value the value for half
- */
- private Half(final int value) {
- this.value = value;
- }
-
- /**
- * Get the value for the half.
- *
- * @return the value
- */
- int getValue() {
- return this.value;
- }
- };
-
- /**
* Collection implementation for {@link SvtAlignmentConstant}.
*/
@SuppressWarnings("serial")
public static class SvtAlignmentConstantCollection extends BaseConditionsObjectCollection<SvtAlignmentConstant> {
+
+ public SvtAlignmentConstant find(int id) {
+ for (SvtAlignmentConstant constant : this) {
+ if (constant.getParameter().equals(id)) {
+ return constant;
+ }
+ }
+ return null;
+ }
+
};
-
- /**
- * The unit axis which for translations maps to XYZ. (Convention for rotation???)
- */
- public enum UnitAxis {
- /** U unit axis. */
- U(1),
- /** V unit axis. */
- V(2),
- /** W unit axis. */
- W(3);
-
- /**
- * Value for the constant.
- */
- private final int value;
-
- /**
- * Create from value.
- *
- * @param value the value
- */
- private UnitAxis(final int value) {
- this.value = value;
- }
-
- /**
- * Get the value for the unit axis.
- *
- * @return the value
- */
- int getValue() {
- return this.value;
- }
- };
-
- /**
- * Maximum value of the module number.
- */
- private static final int MAX_MODULE_NUMBER = 10;
-
- /**
- * Decode the AlignmentType value from the key.
- *
- * @return the AlignmentType value from the key
- * @see AlignmentType
- */
- public AlignmentType getAlignmentType() {
- final int alignmentType = Integer.parseInt(getParameter().substring(1, 2));
- if (alignmentType == AlignmentType.TRANSLATION.getValue()) {
- return AlignmentType.TRANSLATION;
- } else if (alignmentType == AlignmentType.ROTATION.getValue()) {
- return AlignmentType.ROTATION;
- } else {
- throw new IllegalArgumentException("Could not parse valid AlignmentType from " + getParameter());
- }
- }
-
- /**
- * Decode the Half value from the key.
- *
- * @return the Half value from the key
- * @see Half
- */
- public Half getHalf() {
- final int half = Integer.parseInt(getParameter().substring(0, 1));
- if (half == Half.TOP.getValue()) {
- return Half.TOP;
- } else if (half == Half.BOTTOM.getValue()) {
- return Half.BOTTOM;
- } else {
- throw new IllegalArgumentException("Could not parse valid Half from " + getParameter());
- }
- }
-
- /**
- * Decode the module number from the key.
- *
- * @return the module number from the key
- */
- public int getModuleNumber() {
- final int moduleNumber = Integer.parseInt(getParameter().substring(3, 5));
- if (moduleNumber > MAX_MODULE_NUMBER || moduleNumber == 0) {
- throw new IllegalArgumentException("The decoded module number " + moduleNumber + " is invalid.");
- }
- return moduleNumber;
- }
/**
* Get the alignment constant's encoded, raw value.
@@ -194,27 +50,9 @@
* @return the alignment constant's key
*/
@Field(names = { "parameter" })
- public String getParameter() {
+ public Integer getParameter() {
+ //System.out.println("parameter = " + this.getFieldValues().get("parameter") + "; type = " + this.getFieldValues().get("parameter").getClass());
return getFieldValue("parameter");
- }
-
- /**
- * Decode the UnitAxis from the key.
- *
- * @return the UnitAxis v
- * @see UnitAxis
- */
- public UnitAxis getUnitAxis() {
- final int unitAxis = Integer.parseInt(getParameter().substring(2, 3));
- if (unitAxis == UnitAxis.U.getValue()) {
- return UnitAxis.U;
- } else if (unitAxis == UnitAxis.V.getValue()) {
- return UnitAxis.V;
- } else if (unitAxis == UnitAxis.W.getValue()) {
- return UnitAxis.W;
- } else {
- throw new IllegalArgumentException("Could not parse valid UnitAxis from " + getParameter());
- }
}
/**
@@ -223,7 +61,7 @@
* @return the alignment constant's value as a double
*/
@Field(names = { "value" })
- public double getValue() {
+ public Double getValue() {
return getFieldValue("value");
}
@@ -234,12 +72,6 @@
*/
@Override
public String toString() {
- final 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');
- return buff.toString();
+ return "SvtAlignmentConstant parameter = " + this.getParameter() + "; value = " + this.getValue();
}
}
Modified: java/trunk/distribution/pom.xml
=============================================================================
--- java/trunk/distribution/pom.xml (original)
+++ java/trunk/distribution/pom.xml Wed May 27 12:52:56 2015
@@ -84,5 +84,9 @@
<groupId>org.hps</groupId>
<artifactId>hps-evio</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.hps</groupId>
+ <artifactId>hps-detector-model</artifactId>
+ </dependency>
</dependencies>
</project>
Modified: java/trunk/parent/pom.xml
=============================================================================
--- java/trunk/parent/pom.xml (original)
+++ java/trunk/parent/pom.xml Wed May 27 12:52:56 2015
@@ -146,6 +146,11 @@
</dependency>
<dependency>
<groupId>org.hps</groupId>
+ <artifactId>hps-detector-model</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hps</groupId>
<artifactId>hps-conditions</artifactId>
<version>3.3.1-SNAPSHOT</version>
</dependency>
Modified: java/trunk/pom.xml
=============================================================================
--- java/trunk/pom.xml (original)
+++ java/trunk/pom.xml Wed May 27 12:52:56 2015
@@ -132,6 +132,7 @@
<module>datacat</module>
-->
<module>detector-data</module>
+ <module>detector-model</module>
<module>distribution</module>
<module>ecal-event-display</module>
<module>ecal-readout-sim</module>
Modified: java/trunk/tracking/pom.xml
=============================================================================
--- java/trunk/tracking/pom.xml (original)
+++ java/trunk/tracking/pom.xml Wed May 27 12:52:56 2015
@@ -36,7 +36,7 @@
<dependencies>
<dependency>
<groupId>org.hps</groupId>
- <artifactId>hps-conditions</artifactId>
+ <artifactId>hps-detector-model</artifactId>
</dependency>
<dependency>
<groupId>org.hps</groupId>
|