3 modified files
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.18 -r1.19
--- DiskTracker.java 24 Mar 2007 01:02:50 -0000 1.18
+++ DiskTracker.java 20 Feb 2009 22:19:42 -0000 1.19
@@ -42,11 +42,11 @@
for (Iterator i = node.getChildren("layer").iterator(); i.hasNext(); n++)
{
Element layer = (Element) i.next();
- String name1 = detectorName+"_layer"+n;
- Tube tube1 = new Tube(name1);
- Volume volume1 = new Volume(name1+"_volume");
- volume1.setMaterial(air);
- volume1.setSolid(tube1);
+ String layerName = detectorName+"_layer"+n;
+ Tube tube1 = new Tube(layerName);
+ Volume layerVolume = new Volume(layerName+"_volume");
+ layerVolume.setMaterial(air);
+ layerVolume.setSolid(tube1);
int m = 0;
double zmin = layer.getAttribute("inner_z").getDoubleValue();
@@ -78,39 +78,52 @@
Attribute s = slice.getAttribute("sensitive");
boolean sensitive = s != null && s.getBooleanValue();
- String name = detectorName+"_layer"+n+"_slice"+m;
- Tube tube = new Tube(name);
+ String sliceName = detectorName+"_layer"+n+"_slice"+m;
+ Tube tube = new Tube(sliceName);
tube.setZ(w);
tube.setRMin(rmin);
tube.setRMax(rmax);
tube.setDeltaPhi(Math.PI*2);
solids.addSolid(tube);
- Volume volume = new Volume(name+"_volume");
- volume.setMaterial(lcdd.getMaterial(slice.getAttributeValue("material")));
- volume.setSolid(tube);
- if (sensitive) volume.setSensitiveDetector(sens);
-
- /* FIXME: these need to be called automatically whenever a new volume is created --JM */
- setRegion(lcdd, slice, volume);
- setLimitSet(lcdd, slice, volume);
- setVisAttributes(lcdd, node, volume);
+ Volume sliceVolume = new Volume(sliceName+"_volume");
+ sliceVolume.setMaterial(lcdd.getMaterial(slice.getAttributeValue("material")));
+ sliceVolume.setSolid(tube);
+ if (sensitive) sliceVolume.setSensitiveDetector(sens);
+
+ // Set slice region.
+ setRegion(lcdd, slice, sliceVolume);
+
+ // Set slice limits.
+ setLimitSet(lcdd, slice, sliceVolume);
+
+ // Set slice display.
+ setVisAttributes(lcdd, slice, sliceVolume);
- PhysVol physvol = new PhysVol(volume);
+ PhysVol physvol = new PhysVol(sliceVolume);
physvol.setZ(z-zmin -layerWidth/2 + w/2);
physvol.addPhysVolID("layer",n);
- volume1.addContent(physvol);
- structure.addVolume(volume);
+ layerVolume.addPhysVol(physvol);
+ structure.addVolume(sliceVolume);
z += w;
}
+
+ // Set layer region.
+ setRegion(lcdd, layer, layerVolume);
+
+ // Set layer limits.
+ setLimitSet(lcdd, layer, layerVolume);
+
+ // Set layer display.
+ setVisAttributes(lcdd, layer, layerVolume);
tube1.setZ(layerWidth);
tube1.setRMin(rmin);
tube1.setRMax(rmax);
tube1.setDeltaPhi(Math.PI*2);
- PhysVol physvol = new PhysVol(volume1);
+ PhysVol physvol = new PhysVol(layerVolume);
physvol.setZ(zmin+layerWidth/2);
physvol.addPhysVolID("system",id);
physvol.addPhysVolID("barrel",1);
@@ -118,7 +131,7 @@
if (reflect)
{
- PhysVol physvol2 = new PhysVol(volume1);
+ PhysVol physvol2 = new PhysVol(layerVolume);
physvol2.setZ(-zmin-layerWidth/2);
physvol2.setRotation(reflection);
physvol2.addPhysVolID("system",id);
@@ -126,9 +139,9 @@
trackingVolume.addPhysVol(physvol2);
}
solids.addContent(tube1);
- structure.addContent(volume1);
+ structure.addContent(layerVolume);
- setVisAttributes(lcdd, node, volume1);
+ setVisAttributes(lcdd, node, layerVolume);
}
setCombineHits(node, sens);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.8 -r1.9
--- PolyconeSupport.java 13 Feb 2009 00:21:14 -0000 1.8
+++ PolyconeSupport.java 20 Feb 2009 22:19:42 -0000 1.9
@@ -5,8 +5,6 @@
*/
package org.lcsim.geometry.compact.converter.lcdd;
-import java.util.Iterator;
-import org.jdom.Attribute;
import org.jdom.Element;
import org.jdom.JDOMException;
@@ -20,13 +18,14 @@
import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
/**
- *
+ * -reorganize and rename 090220 JM
* @author jeremym
*/
public class PolyconeSupport extends LCDDSubdetector
{
private Element node;
+
/** Creates a new instance of PolyconeSupport */
public PolyconeSupport(Element node) throws JDOMException
{
@@ -35,20 +34,19 @@
}
public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
- {
- String suppName = node.getAttributeValue("name");
-
- // get LCDD objects
+ {
+ // Get the lcdd data structures.
Solids solids = lcdd.getSolids();
Structure structure = lcdd.getStructure();
-
- Volume worldVolume = lcdd.pickMotherVolume(this);
+
+ // Name of support structure.
+ String supportName = node.getAttributeValue("name");
// polycone solid
- Polycone pc = new Polycone(suppName + "_envelope_polycone", 0, 2.*Math.PI, node);
+ Polycone pc = new Polycone(supportName + "_envelope_polycone", 0, 2.*Math.PI, node);
solids.addSolid(pc);
- // material
+ // Material is required.
Element matElem = node.getChild("material");
if ( matElem == null )
{
@@ -56,24 +54,28 @@
}
Material mat = lcdd.getMaterial(matElem.getAttributeValue("name"));
+ // Material was not found.
if ( mat == null )
{
throw new JDOMException("Material not found in compact file.");
}
- // volume
- Volume vol = new Volume(suppName + "_envelope_volume");
+ // Create the volume.
+ Volume vol = new Volume(supportName + "_envelope_volume");
vol.setMaterial(mat);
vol.setSolid(pc);
- if (node.getAttribute("vis") != null)
- {
- // System.out.println("setting vis for polycone - " + suppName);
- vol.setVisAttributes(lcdd.getVisAttributes(node.getAttributeValue("vis")));
- }
+
+ // Set the volume display.
+ this.setVisAttributes(lcdd, node, vol);
+
+ // Add the volume to lcdd.
structure.addVolume(vol);
- // phys vol
+ // Let lcdd pick the mother volume.
+ Volume motherVolume = lcdd.pickMotherVolume(this);
+
+ // Finally, make the physical volume. (supports have no id)
PhysVol physvol = new PhysVol(vol);
- worldVolume.addPhysVol(physvol);
+ motherVolume.addPhysVol(physvol);
}
-}
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.9 -r1.10
--- PolyhedraEndcapCalorimeter2.java 20 Feb 2009 07:29:45 -0000 1.9
+++ PolyhedraEndcapCalorimeter2.java 20 Feb 2009 22:19:42 -0000 1.10
@@ -18,7 +18,6 @@
import org.lcsim.geometry.layer.LayerStack;
import org.lcsim.geometry.layer.Layering;
-// TODO: rotation to match barrel
public class PolyhedraEndcapCalorimeter2 extends LCDDSubdetector
{
public PolyhedraEndcapCalorimeter2(Element node) throws JDOMException
@@ -99,10 +98,11 @@
}
// Visualization of slice.
- if (sliceElement.getAttribute("vis") != null)
- {
- sliceVolume.setVisAttributes(lcdd.getVisAttributes(sliceElement.getAttributeValue("vis")));
- }
+ this.setVisAttributes(lcdd, sliceElement, sliceVolume);
+ //if (sliceElement.getAttribute("vis") != null)
+ //{
+ // sliceVolume.setVisAttributes(lcdd.getVisAttributes(.getAttributeValue("vis")));
+ //}
structure.addVolume(sliceVolume);
sliceZ += sliceThickness/2;
Position slicePosition = new Position(sliceName + "_position", 0, 0, sliceZ);
CVSspam 0.2.8