GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.1 -r1.2
--- SiTrackerBarrel.java 6 Oct 2006 19:11:29 -0000 1.1
+++ SiTrackerBarrel.java 6 Oct 2006 23:24:48 -0000 1.2
@@ -3,12 +3,19 @@
import hep.graphics.heprep.HepRep;
import hep.graphics.heprep.HepRepFactory;
+import java.util.Iterator;
+
import org.jdom.DataConversionException;
import org.jdom.Element;
import org.jdom.JDOMException;
+import org.lcsim.material.Material;
+import org.lcsim.material.MaterialManager;
/**
*
+ * Reconstruction object for a planar silicon tracker
+ * of type SiTrackerBarrel.
+ *
* @author Jeremy McCormick <[log in to unmask]>
* @author Tim Nelson <[log in to unmask]>
*
@@ -23,7 +30,113 @@
private void build(Element node) throws DataConversionException
{
- System.out.println("SiTrackerBarrel.build");
+ //System.out.println("SiTrackerBarrel.build");
+
+ Element detector = node;
+
+ // Loop over modules.
+ for (Iterator i = detector.getChildren("module").iterator(); i.hasNext();)
+ {
+ Element module = (Element)i.next();
+
+ Element module_envelope = module.getChild("module_envelope");
+ double module_width = module_envelope.getAttribute("width").getDoubleValue();
+ double module_length = module_envelope.getAttribute("length").getDoubleValue();
+ double module_thickness = module_envelope.getAttribute("thickness").getDoubleValue();
+
+ // FIXME: Make basic logical module object here. (e.g. non-placed)
+
+ // Loop over module components.
+ for (Iterator j = module.getChildren("module_component").iterator(); j.hasNext();)
+ {
+ Element module_component = (Element)j.next();
+
+ // module_component parameters.
+ double module_component_length = module_component.getAttribute("width").getDoubleValue();
+ double module_component_thickness = module_component.getAttribute("thickness").getDoubleValue();
+ double module_component_width = module_component.getAttribute("width").getDoubleValue();
+ Material material = MaterialManager.getMaterial(module_component.getAttributeValue("material"));
+ boolean sensitive = (module_component.getAttribute("sensitive") == null) ? false : module_component.getAttribute("sensitive").getBooleanValue();
+
+ // module_component position.
+ double module_component_x, module_component_y, module_component_z = 0.0;
+ if (module_component.getChild("position") != null)
+ {
+ Element position = (Element)module_component.getChild("position");
+
+ if (position.getAttribute("x") != null)
+ {
+ module_component_x = position.getAttribute("x").getDoubleValue();
+ }
+
+ if (position.getAttribute("y") != null)
+ {
+ module_component_y = position.getAttribute("y").getDoubleValue();
+ }
+
+ if (position.getAttribute("z") != null)
+ {
+ module_component_z = position.getAttribute("z").getDoubleValue();
+ }
+ }
+
+ // module_component rotation.
+ double module_component_rx, module_component_ry, module_component_rz = 0.0;
+ if (module_component.getChild("rotation") != null)
+ {
+ Element rotation = (Element)module_component.getChild("rotation");
+
+ if (rotation.getAttribute("x") != null)
+ {
+ module_component_x = rotation.getAttribute("x").getDoubleValue();
+ }
+
+ if (rotation.getAttribute("y") != null)
+ {
+ module_component_y = rotation.getAttribute("y").getDoubleValue();
+ }
+
+ if (rotation.getAttribute("z") != null)
+ {
+ module_component_z = rotation.getAttribute("z").getDoubleValue();
+ }
+ }
+
+ // FIXME: Add the module_component to the module here. --JM
+ }
+ }
+
+ // Loop over layers.
+ int layern=0;
+ for (Iterator i = detector.getChildren("layer").iterator(); i.hasNext(); ++layern)
+ {
+ Element layer = (Element)i.next();
+
+ // Name of the module associated with this layer.
+ String module_lkp = layer.getAttributeValue("module");
+
+ // barrel_envelope parameters.
+ Element barrel_envelope = layer.getChild("barrel_envelope");
+ double layer_inner_r = barrel_envelope.getAttribute("inner_r").getDoubleValue();
+ double layer_outer_r = barrel_envelope.getAttribute("outer_r").getDoubleValue();
+ double layer_z_length = barrel_envelope.getAttribute("z_length").getDoubleValue();
+
+ // rphi_layout parameters.
+ Element rphi_layout = layer.getChild("rphi_layout");
+ double phi_tilt = rphi_layout.getAttribute("phi_tilt").getDoubleValue();
+ double nphi = rphi_layout.getAttribute("nphi").getIntValue();
+ double phi0 = rphi_layout.getAttribute("phi0").getDoubleValue();
+ double rc = rphi_layout.getAttribute("rc").getDoubleValue();
+ double dr = rphi_layout.getAttribute("dr").getDoubleValue();
+
+ // z_layout parameters.
+ Element z_layout = layer.getChild("z_layout");
+ double z_dr = z_layout.getAttribute("dr").getDoubleValue();
+ double z0 = z_layout.getAttribute("z0").getDoubleValue();
+ int nz = z_layout.getAttribute("nz").getIntValue();
+
+ // FIXME: Make layer object here. --JM
+ }
}
public void appendHepRep(HepRepFactory factory, HepRep heprep)