9 modified files
GeomConverter/src/org/lcsim/detector
diff -u -r1.34 -r1.35
--- DetectorElement.java 28 Aug 2007 03:21:32 -0000 1.34
+++ DetectorElement.java 28 Aug 2007 22:26:33 -0000 1.35
@@ -9,13 +9,14 @@
import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.identifier.IIdentifierHelper;
import org.lcsim.detector.identifier.Identifier;
+import org.lcsim.detector.identifier.IIdentifierDictionary.InvalidIndexException;
import org.lcsim.detector.solids.Inside;
/**
* Implementation of {@link IDetectorElement}.
*
* @author Jeremy McCormick
- * @version $Id: DetectorElement.java,v 1.34 2007/08/28 03:21:32 jeremy Exp $
+ * @version $Id: DetectorElement.java,v 1.35 2007/08/28 22:26:33 jeremy Exp $
*/
public class DetectorElement
extends Named
@@ -275,7 +276,13 @@
public IExpandedIdentifier getExpandedIdentifier()
{
- return getIdentifierHelper().unpack( id );
+ try {
+ return getIdentifierHelper().unpack( id );
+ }
+ catch (Exception x)
+ {
+ throw new RuntimeException(x);
+ }
}
public IIdentifier getIdentifier()
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.19 -r1.20
--- DetectorConverter.java 25 May 2007 20:16:26 -0000 1.19
+++ DetectorConverter.java 28 Aug 2007 22:26:34 -0000 1.20
@@ -24,6 +24,7 @@
import org.lcsim.detector.identifier.IdentifierDictionaryManager;
import org.lcsim.detector.identifier.IdentifierField;
import org.lcsim.detector.identifier.IdentifierHelper;
+import org.lcsim.detector.identifier.IIdentifierDictionary.DuplicateFieldException;
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialStore;
import org.lcsim.detector.solids.Box;
@@ -196,7 +197,13 @@
String name = desc.fieldName(i);
IIdentifierField field = new IdentifierField(name,nbits,start,signed,i);
- iddict.addField(field);
+ try {
+ iddict.addField(field);
+ }
+ catch (DuplicateFieldException x)
+ {
+ throw new RuntimeException(x);
+ }
}
}
return iddict;
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.12 -r1.13
--- DiskTrackerConverter.java 28 Aug 2007 03:07:35 -0000 1.12
+++ DiskTrackerConverter.java 28 Aug 2007 22:26:34 -0000 1.13
@@ -1,26 +1,30 @@
package org.lcsim.detector.converter.compact;
-import org.lcsim.geometry.IDDecoder;
import org.lcsim.detector.DetectorElement;
import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.IDetectorElementContainer;
import org.lcsim.detector.ILogicalVolume;
+import org.lcsim.detector.IRotation3D;
import org.lcsim.detector.LogicalVolume;
import org.lcsim.detector.PhysicalVolume;
-import org.lcsim.detector.IRotation3D;
import org.lcsim.detector.RotationPassiveXYZ;
-import org.lcsim.detector.Translation3D;
import org.lcsim.detector.Transform3D;
+import org.lcsim.detector.Translation3D;
+import org.lcsim.detector.identifier.ExpandedIdentifier;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierDictionary;
+import org.lcsim.detector.identifier.IdentifierDictionaryManager;
+import org.lcsim.detector.identifier.IdentifierUtil;
+import org.lcsim.detector.identifier.IIdentifierDictionary.InvalidIndexException;
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialStore;
import org.lcsim.detector.solids.Tube;
+import org.lcsim.geometry.IDDecoder;
import org.lcsim.geometry.compact.Detector;
import org.lcsim.geometry.compact.Subdetector;
import org.lcsim.geometry.layer.Layer;
import org.lcsim.geometry.layer.LayerSlice;
import org.lcsim.geometry.layer.Layering;
import org.lcsim.geometry.subdetector.DiskTracker;
-import org.lcsim.detector.identifier.*;
/**
* Convert a DiskTracker to the detailed geometry description.
@@ -154,7 +158,14 @@
ExpandedIdentifier expid = makeExpandedIdentifier(decoder, systemNumber, 1, i);
IIdentifierDictionary iddict = IdentifierDictionaryManager.getInstance().getIdentifierDictionary( subdet.getReadout().getName() );
- IIdentifier id = IdentifierUtil.pack(iddict, expid);
+ IIdentifier id = null;
+ try {
+ id = IdentifierUtil.pack(iddict, expid);
+ }
+ catch (InvalidIndexException x)
+ {
+ throw new RuntimeException(x);
+ }
DiskTrackerSensorLayer northEndcapLayer =
new DiskTrackerSensorLayer(
name + "_positive_sensor" + sensorNum,
@@ -167,7 +178,13 @@
path = "/tracking_region/" + name + "_negative_layer" +i + "/slice" + j;
expid = makeExpandedIdentifier(decoder, systemNumber, 2, i);
- id = IdentifierUtil.pack(iddict, expid);
+ try {
+ id = IdentifierUtil.pack(iddict, expid);
+ }
+ catch (InvalidIndexException x)
+ {
+ throw new RuntimeException(x);
+ }
DiskTrackerSensorLayer southEndcapLayer =
new DiskTrackerSensorLayer(
name + "_negative_sensor" + sensorNum,
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.9 -r1.10
--- MultiLayerTrackerConverter.java 28 Aug 2007 03:07:36 -0000 1.9
+++ MultiLayerTrackerConverter.java 28 Aug 2007 22:26:34 -0000 1.10
@@ -5,17 +5,22 @@
import org.lcsim.detector.ILogicalVolume;
import org.lcsim.detector.LogicalVolume;
import org.lcsim.detector.PhysicalVolume;
+import org.lcsim.detector.identifier.ExpandedIdentifier;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierDictionary;
+import org.lcsim.detector.identifier.IdentifierDictionaryManager;
+import org.lcsim.detector.identifier.IdentifierUtil;
+import org.lcsim.detector.identifier.IIdentifierDictionary.InvalidIndexException;
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialStore;
import org.lcsim.detector.solids.Tube;
+import org.lcsim.geometry.IDDecoder;
import org.lcsim.geometry.compact.Detector;
import org.lcsim.geometry.compact.Subdetector;
import org.lcsim.geometry.layer.Layer;
import org.lcsim.geometry.layer.LayerSlice;
import org.lcsim.geometry.layer.Layering;
import org.lcsim.geometry.subdetector.MultiLayerTracker;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.detector.identifier.*;
/**
* Convert a MultiLayerTracker into the org.lcsim.detector geometry representation.
@@ -105,9 +110,16 @@
ExpandedIdentifier expid = makeExpandedIdentifier(subdet.getIDDecoder(),tracker.getIDDecoder().getSystemNumber(),i);
IIdentifierDictionary iddict = IdentifierDictionaryManager.getInstance().getIdentifierDictionary( subdet.getReadout().getName() );
- IIdentifier id = IdentifierUtil.pack( iddict, expid );
+ IIdentifier id = null;
+ try {
+ id = IdentifierUtil.pack( iddict, expid );
+ }
+ catch (InvalidIndexException x)
+ {
+ throw new RuntimeException(x);
+ }
+
MultiLayerTrackerSensorLayer layerDetectorElement = new MultiLayerTrackerSensorLayer(name + "_layer" + layerNumber, tracker.getDetectorElement(), path, id);
- //layerDetectorElement.setIdentifier(id);
++layerNumber;
}
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.21 -r1.22
--- SiTrackerBarrelConverter.java 7 Aug 2007 18:11:39 -0000 1.21
+++ SiTrackerBarrelConverter.java 28 Aug 2007 22:26:34 -0000 1.22
@@ -14,18 +14,19 @@
import org.lcsim.detector.ILogicalVolume;
import org.lcsim.detector.IPhysicalVolume;
import org.lcsim.detector.IPhysicalVolumePath;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.ITranslation3D;
import org.lcsim.detector.LogicalVolume;
import org.lcsim.detector.PhysicalVolume;
-import org.lcsim.detector.IRotation3D;
import org.lcsim.detector.RotationPassiveXYZ;
-import org.lcsim.detector.ITranslation3D;
-import org.lcsim.detector.Translation3D;
import org.lcsim.detector.Transform3D;
+import org.lcsim.detector.Translation3D;
import org.lcsim.detector.identifier.ExpandedIdentifier;
import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.identifier.IIdentifierDictionary;
import org.lcsim.detector.identifier.IdentifierDictionaryManager;
import org.lcsim.detector.identifier.IdentifierUtil;
+import org.lcsim.detector.identifier.IIdentifierDictionary.InvalidIndexException;
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialStore;
import org.lcsim.detector.solids.Box;
@@ -521,7 +522,14 @@
// Create the packed id using util method.
// No IdentifierHelper is available yet.
- IIdentifier id = IdentifierUtil.pack( iddict, expId );
+ IIdentifier id = null;
+ try {
+ id = IdentifierUtil.pack( iddict, expId );
+ }
+ catch (InvalidIndexException x)
+ {
+ throw new RuntimeException(x);
+ }
//System.out.println(pv.getName() + " is sens");
//System.out.println("path : " + modulePath.toString() + "/" + pv.getName());
GeomConverter/src/org/lcsim/detector/tracker/silicon
diff -u -r1.2 -r1.3
--- DeSiTrackerBarrel.java 3 Jul 2007 23:29:49 -0000 1.2
+++ DeSiTrackerBarrel.java 28 Aug 2007 22:26:35 -0000 1.3
@@ -6,12 +6,14 @@
import org.lcsim.detector.identifier.IExpandedIdentifier;
import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.identifier.IIdentifierHelper;
+import org.lcsim.detector.identifier.IIdentifierDictionary.FieldNotFoundException;
+import org.lcsim.detector.identifier.IIdentifierDictionary.InvalidIndexException;
/**
* A {@link IDetectorElement} for SiTrackerBarrel.
*
* @author Jeremy McCormick
- * @version $Id: DeSiTrackerBarrel.java,v 1.2 2007/07/03 23:29:49 jeremy Exp $
+ * @version $Id: DeSiTrackerBarrel.java,v 1.3 2007/08/28 22:26:35 jeremy Exp $
*/
public class DeSiTrackerBarrel
@@ -27,12 +29,23 @@
// Get the IdentifierHelper.
IIdentifierHelper helper = getIdentifierHelper();
- // Make an expanded identifier containing only geometric fields.
- IExpandedIdentifier expId =
- helper.unpack(id, 0, helper.getIdentifierDictionary().getFieldIndex("side") - 1);
+ IIdentifier geomId = null;
+ try {
+ // Make an expanded identifier containing only geometric fields.
+ IExpandedIdentifier expId =
+ helper.unpack(id, 0, helper.getIdentifierDictionary().getFieldIndex("side") - 1);
- // Repack the Identifier.
- IIdentifier geomId = helper.pack(expId);
+ // Repack the Identifier.
+ geomId = helper.pack(expId);
+ }
+ catch (InvalidIndexException x)
+ {
+ throw new RuntimeException(x);
+ }
+ catch (FieldNotFoundException x)
+ {
+ throw new RuntimeException(x);
+ }
// Use super method once non-geometric fields have been stripped out.
return super.findDetectorElement(geomId);
GeomConverter/test/org/lcsim/detector/converter/compact
diff -u -r1.6 -r1.7
--- DiskTrackerTest.java 12 Jul 2007 06:56:30 -0000 1.6
+++ DiskTrackerTest.java 28 Aug 2007 22:26:35 -0000 1.7
@@ -70,10 +70,16 @@
IDetectorElementContainer layers = endcap.getChildren();
assertEquals("Expected number of sensors is wrong!",layers.size(),2);
IDetectorElement layer = layers.get(0);
- assertEquals(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "system"),compact.getIDDecoder().getSystemNumber());
- int barrel=layer.getIdentifierHelper().getValue(layer.getIdentifier(), "barrel");
- assertTrue(barrel == 1 || barrel == 2);
- assertTrue(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "layer") == 0);
+ try {
+ assertEquals(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "system"),compact.getIDDecoder().getSystemNumber());
+ int barrel=layer.getIdentifierHelper().getValue(layer.getIdentifier(), "barrel");
+ assertTrue(barrel == 1 || barrel == 2);
+ assertTrue(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "layer") == 0);
+ }
+ catch (Exception x)
+ {
+ throw new RuntimeException(x);
+ }
}
}
GeomConverter/test/org/lcsim/detector/converter/compact
diff -u -r1.1 -r1.2
--- MultiLayerTrackerTest.java 12 Jul 2007 06:56:30 -0000 1.1
+++ MultiLayerTrackerTest.java 28 Aug 2007 22:26:35 -0000 1.2
@@ -68,9 +68,15 @@
IDetectorElementContainer layers = subdet.getChildren();
assertEquals("Expected number of sensors is wrong!",layers.size(),2);
IDetectorElement layer = layers.get(0);
- assertEquals(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "system"),compact.getIDDecoder().getSystemNumber());
- assertEquals(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "barrel"),0);
- assertTrue(layers.get(0).getIdentifierHelper().getValue(layers.get(0).getIdentifier(), "layer") == 0);
- assertTrue(layers.get(1).getIdentifierHelper().getValue(layers.get(1).getIdentifier(), "layer") == 1);
+ try {
+ assertEquals(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "system"),compact.getIDDecoder().getSystemNumber());
+ assertEquals(layer.getIdentifierHelper().getValue(layer.getIdentifier(), "barrel"),0);
+ assertTrue(layers.get(0).getIdentifierHelper().getValue(layers.get(0).getIdentifier(), "layer") == 0);
+ assertTrue(layers.get(1).getIdentifierHelper().getValue(layers.get(1).getIdentifier(), "layer") == 1);
+ }
+ catch (Exception x)
+ {
+ throw new RuntimeException(x);
+ }
}
}
GeomConverter/test/org/lcsim/detector/identifier
diff -u -r1.5 -r1.6
--- IdentifierHelperTest.java 19 May 2007 00:39:51 -0000 1.5
+++ IdentifierHelperTest.java 28 Aug 2007 22:26:35 -0000 1.6
@@ -10,7 +10,7 @@
* on {@link IIdentifierHelper}.
*
* @author Jeremy McCormick
- * @version $Id: IdentifierHelperTest.java,v 1.5 2007/05/19 00:39:51 jeremy Exp $
+ * @version $Id: IdentifierHelperTest.java,v 1.6 2007/08/28 22:26:35 jeremy Exp $
*/
public class IdentifierHelperTest
@@ -26,7 +26,7 @@
return new TestSuite(IdentifierHelperTest.class);
}
- public void testGetValue()
+ public void testGetValue() throws Exception
{
IIdentifierDictionary iddict = new IdentifierDictionary("test1");
iddict.addField(new IdentifierField("field1",8, 0, false, 0 ));
@@ -67,7 +67,7 @@
assertEquals("ffffffffffff00ff", Long.toHexString(iddict.getField(1).getMaskOff()));
}
- public void testUnpack()
+ public void testUnpack() throws Exception
{
IIdentifierDictionary iddict = new IdentifierDictionary("test2");
iddict.addField(new IdentifierField("field1",8,0,false, 0));
@@ -93,7 +93,7 @@
assertTrue( expIdCheck3.toString().equals("/1/-1/0") );
}
- public void testPack()
+ public void testPack() throws Exception
{
IIdentifierDictionary iddict = new IdentifierDictionary("test3");
@@ -122,7 +122,7 @@
assertTrue( "ExpandedIdentifiers do not match!", expId.equals( expIdCheck ));
}
- public void testFieldPack()
+ public void testFieldPack() throws Exception
{
IIdentifierDictionary iddict = new IdentifierDictionary("test3");
CVSspam 0.2.8