GeomConverter/src/org/lcsim/geometry/subdetector
diff -u -r1.8 -r1.9
--- SiTrackerBarrel.java 9 Apr 2007 23:19:52 -0000 1.8
+++ SiTrackerBarrel.java 19 Apr 2007 23:06:13 -0000 1.9
@@ -17,11 +17,11 @@
import org.lcsim.geometry.layer.LayerSlice;
import org.lcsim.geometry.layer.LayerStack;
import org.lcsim.geometry.layer.Layering;
-import org.lcsim.geometry.subdetector.tracker.silicon.Box;
-import org.lcsim.geometry.subdetector.tracker.silicon.Component;
-import org.lcsim.geometry.subdetector.tracker.silicon.SiTrackerBarrelLayer;
-import org.lcsim.geometry.subdetector.tracker.silicon.SiTrackerModule;
-import org.lcsim.geometry.subdetector.tracker.silicon.Solid;
+//import org.lcsim.geometry.subdetector.tracker.silicon.Box;
+//import org.lcsim.geometry.subdetector.tracker.silicon.Component;
+//import org.lcsim.geometry.subdetector.tracker.silicon.SiTrackerBarrelLayer;
+//import org.lcsim.geometry.subdetector.tracker.silicon.SiTrackerModule;
+//import org.lcsim.geometry.subdetector.tracker.silicon.Solid;
import org.lcsim.material.Material;
import org.lcsim.material.MaterialManager;
import org.lcsim.material.MaterialNotFoundException;
@@ -38,228 +38,228 @@
public class SiTrackerBarrel extends AbstractTracker
{
- // Fields
- //=======
- Map<String, SiTrackerModule> _modules = new HashMap<String, SiTrackerModule>();
- List<SiTrackerBarrelLayer> _layers = new ArrayList<SiTrackerBarrelLayer>();
+// // Fields
+// //=======
+// Map<String, SiTrackerModule> _modules = new HashMap<String, SiTrackerModule>();
+// List<SiTrackerBarrelLayer> _layers = new ArrayList<SiTrackerBarrelLayer>();
SiTrackerBarrel(Element node) throws JDOMException
{
super(node);
- build(node);
- makeLayering();
+// build(node);
+// makeLayering();
}
- private void build(Element node) throws DataConversionException
- {
- //System.out.println("SiTrackerBarrel.build");
-
- Element detector = node;
-
- // Loop over modules.
- for (Iterator i = detector.getChildren("module").iterator(); i.hasNext();)
- {
- Element module_element = (Element) i.next();
-
- String module_name = module_element.getAttributeValue("name");
- Element module_envelope = module_element.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();
-
- // Make basic logical module object
- SiTrackerModule module = new SiTrackerModule(new Box(module_width, module_length, module_thickness));
-
- // Loop over module components
- for (Iterator j = module_element.getChildren("module_component").iterator(); j.hasNext();)
- {
- Element module_component_element = (Element) j.next();
-
- // module_component parameters.
- double module_component_length = module_component_element.getAttribute("width").getDoubleValue();
- double module_component_thickness = module_component_element.getAttribute("thickness").getDoubleValue();
- double module_component_width = module_component_element.getAttribute("width").getDoubleValue();
- //System.out.println("looking up material --> " + module_component_element.getAttributeValue("material"));
-
- Material module_component_material;
- try
- {
- module_component_material = MaterialManager.findMaterial(module_component_element.getAttributeValue("material"));
- }
- catch (MaterialNotFoundException x)
- {
- throw new RuntimeException(x);
- }
-
- //System.out.println("module_component_material="+module_component_material.getName());
-
- boolean sensitive = (module_component_element.getAttribute("sensitive") == null) ? false : module_component_element.getAttribute("sensitive").getBooleanValue();
-
- // Build component
- Component component = new Component(new Box(module_component_width, module_component_length, module_component_thickness), module_component_material, sensitive);
-
- // module_component positions
- double module_component_x, module_component_y, module_component_z = 0.0;
- if (module_component_element.getChild("position") != null)
- {
- Element position = (Element) module_component_element.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 rotations
- double module_component_rx, module_component_ry, module_component_rz = 0.0;
- if (module_component_element.getChild("rotation") != null)
- {
- Element rotation = (Element) module_component_element.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: position the component
-
- // Add the module_component to the module.
- module.addComponent(component);
-
- }
-
- // Store the module
- _modules.put(module_name, module);
-
- }
-
- // Loop over layers.
- int layern = 0;
- for (Iterator i = detector.getChildren("layer").iterator(); i.hasNext(); ++layern)
- {
- Element layer_element = (Element) i.next();
-
- // Name of the module associated with this layer.
- String module_lkp = layer_element.getAttributeValue("module");
-
- // barrel_envelope parameters.
- Element barrel_envelope = layer_element.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_element.getChild("rphi_layout");
- double phi_tilt = rphi_layout.getAttribute("phi_tilt").getDoubleValue();
- int 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_element.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();
-
- // Make layer object.
- SiTrackerBarrelLayer layer = new SiTrackerBarrelLayer(layer_inner_r, layer_outer_r, layer_z_length);
- layer.setPhiLayout(rc, nphi, phi0, phi_tilt, dr);
- layer.setZLayout(nz, z0, z_dr);
- layer.setModule(_modules.get(module_lkp));
- this._layers.add(layer);
- }
- }
-
- private void makeLayering()
- {
- LayerStack layerStack = new LayerStack();
- for (SiTrackerBarrelLayer tkrlayer : this._layers)
- {
- Map<Material, Double> matMap = new HashMap<Material, Double>();
-
- double ir = tkrlayer.getInnerRadius();
- double z = tkrlayer.getZLength();
-
- SiTrackerModule module = tkrlayer.getModule();
-
- int n_modules = tkrlayer.getNModules();
-
- for (Component component : module.getComponents())
- {
- Solid solid = component.getSolid();
- Double volume = Double.valueOf(solid.getVolume()) * ((double) n_modules);
- Material material = component.getMaterial();
-
- assert (material != null);
- //System.out.println("component material=" + material.getName());
-
- if (matMap.get(material) == null)
- {
- matMap.put(material, volume);
- }
- else
- {
- Double volume_update = matMap.get(material);
- volume_update += volume;
- matMap.put(material, volume_update);
- }
- }
-
- List<LayerSlice> slices = new ArrayList<LayerSlice>();
-
- for (Material material : matMap.keySet())
- {
- double volume = matMap.get(material);
-
- double mat_or = Math.sqrt((volume / (Math.PI * z)) + ir * ir);
-
- double thickness = mat_or - ir;
-
- LayerSlice slice = new LayerSlice();
- slice.setMaterial(material);
- slice.setThickness(thickness);
- slices.add(slice);
- }
-
- Layer l = new Layer(slices);
- l.setPreOffset(ir);
- layerStack.addLayer(l);
- }
-
- setLayering(new Layering(layerStack));
- }
-
- public void appendHepRep(HepRepFactory factory, HepRep heprep)
- {
- //System.out.println("SiTrackerBarrel.appendHepRep");
- DetectorElementToHepRepConverter.convert(this, factory, heprep, true);
- }
-
- public boolean isBarrel()
- {
- return true;
- }
+// private void build(Element node) throws DataConversionException
+// {
+// //System.out.println("SiTrackerBarrel.build");
+//
+// Element detector = node;
+//
+// // Loop over modules.
+// for (Iterator i = detector.getChildren("module").iterator(); i.hasNext();)
+// {
+// Element module_element = (Element) i.next();
+//
+// String module_name = module_element.getAttributeValue("name");
+// Element module_envelope = module_element.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();
+//
+// // Make basic logical module object
+// SiTrackerModule module = new SiTrackerModule(new Box(module_width, module_length, module_thickness));
+//
+// // Loop over module components
+// for (Iterator j = module_element.getChildren("module_component").iterator(); j.hasNext();)
+// {
+// Element module_component_element = (Element) j.next();
+//
+// // module_component parameters.
+// double module_component_length = module_component_element.getAttribute("width").getDoubleValue();
+// double module_component_thickness = module_component_element.getAttribute("thickness").getDoubleValue();
+// double module_component_width = module_component_element.getAttribute("width").getDoubleValue();
+// //System.out.println("looking up material --> " + module_component_element.getAttributeValue("material"));
+//
+// Material module_component_material;
+// try
+// {
+// module_component_material = MaterialManager.findMaterial(module_component_element.getAttributeValue("material"));
+// }
+// catch (MaterialNotFoundException x)
+// {
+// throw new RuntimeException(x);
+// }
+//
+// //System.out.println("module_component_material="+module_component_material.getName());
+//
+// boolean sensitive = (module_component_element.getAttribute("sensitive") == null) ? false : module_component_element.getAttribute("sensitive").getBooleanValue();
+//
+// // Build component
+// Component component = new Component(new Box(module_component_width, module_component_length, module_component_thickness), module_component_material, sensitive);
+//
+// // module_component positions
+// double module_component_x, module_component_y, module_component_z = 0.0;
+// if (module_component_element.getChild("position") != null)
+// {
+// Element position = (Element) module_component_element.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 rotations
+// double module_component_rx, module_component_ry, module_component_rz = 0.0;
+// if (module_component_element.getChild("rotation") != null)
+// {
+// Element rotation = (Element) module_component_element.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: position the component
+//
+// // Add the module_component to the module.
+// module.addComponent(component);
+//
+// }
+//
+// // Store the module
+// _modules.put(module_name, module);
+//
+// }
+//
+// // Loop over layers.
+// int layern = 0;
+// for (Iterator i = detector.getChildren("layer").iterator(); i.hasNext(); ++layern)
+// {
+// Element layer_element = (Element) i.next();
+//
+// // Name of the module associated with this layer.
+// String module_lkp = layer_element.getAttributeValue("module");
+//
+// // barrel_envelope parameters.
+// Element barrel_envelope = layer_element.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_element.getChild("rphi_layout");
+// double phi_tilt = rphi_layout.getAttribute("phi_tilt").getDoubleValue();
+// int 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_element.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();
+//
+// // Make layer object.
+// SiTrackerBarrelLayer layer = new SiTrackerBarrelLayer(layer_inner_r, layer_outer_r, layer_z_length);
+// layer.setPhiLayout(rc, nphi, phi0, phi_tilt, dr);
+// layer.setZLayout(nz, z0, z_dr);
+// layer.setModule(_modules.get(module_lkp));
+// this._layers.add(layer);
+// }
+// }
+//
+// private void makeLayering()
+// {
+// LayerStack layerStack = new LayerStack();
+// for (SiTrackerBarrelLayer tkrlayer : this._layers)
+// {
+// Map<Material, Double> matMap = new HashMap<Material, Double>();
+//
+// double ir = tkrlayer.getInnerRadius();
+// double z = tkrlayer.getZLength();
+//
+// SiTrackerModule module = tkrlayer.getModule();
+//
+// int n_modules = tkrlayer.getNModules();
+//
+// for (Component component : module.getComponents())
+// {
+// Solid solid = component.getSolid();
+// Double volume = Double.valueOf(solid.getVolume()) * ((double) n_modules);
+// Material material = component.getMaterial();
+//
+// assert (material != null);
+// //System.out.println("component material=" + material.getName());
+//
+// if (matMap.get(material) == null)
+// {
+// matMap.put(material, volume);
+// }
+// else
+// {
+// Double volume_update = matMap.get(material);
+// volume_update += volume;
+// matMap.put(material, volume_update);
+// }
+// }
+//
+// List<LayerSlice> slices = new ArrayList<LayerSlice>();
+//
+// for (Material material : matMap.keySet())
+// {
+// double volume = matMap.get(material);
+//
+// double mat_or = Math.sqrt((volume / (Math.PI * z)) + ir * ir);
+//
+// double thickness = mat_or - ir;
+//
+// LayerSlice slice = new LayerSlice();
+// slice.setMaterial(material);
+// slice.setThickness(thickness);
+// slices.add(slice);
+// }
+//
+// Layer l = new Layer(slices);
+// l.setPreOffset(ir);
+// layerStack.addLayer(l);
+// }
+//
+// setLayering(new Layering(layerStack));
+// }
+//
+// public void appendHepRep(HepRepFactory factory, HepRep heprep)
+// {
+// //System.out.println("SiTrackerBarrel.appendHepRep");
+// DetectorElementToHepRepConverter.convert(this, factory, heprep, true);
+// }
+//
+// public boolean isBarrel()
+// {
+// return true;
+// }
}
\ No newline at end of file