GeomConverter/src/org/lcsim/detector
diff -u -r1.15 -r1.16
--- PhysicalVolumeNavigator.java 10 Oct 2007 22:35:44 -0000 1.15
+++ PhysicalVolumeNavigator.java 9 Feb 2011 01:30:15 -0000 1.16
@@ -3,6 +3,8 @@
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
+import java.util.Collection;
+
import org.lcsim.detector.solids.Inside;
/**
@@ -418,4 +420,29 @@
{
return name;
}
+
+ /**
+ * Utility method for getting String paths to leaf volumes.
+ * @param paths List of paths passed in by caller.
+ * @param node The top node to traverse.
+ * @param path The recursive path String.
+ */
+ public static void getLeafPaths(Collection<String> paths, IPhysicalVolume node, String path)
+ {
+ if (node == null)
+ {
+ return;
+ }
+ if (node.getLogicalVolume().getDaughters().size() == 0)
+ {
+ paths.add(path + "/" + node.getName());
+ return;
+ }
+
+ path += "/" + node.getName();
+ for (IPhysicalVolume dau : node.getLogicalVolume().getDaughters())
+ {
+ getLeafPaths(paths, dau, path);
+ }
+ }
}
\ No newline at end of file