4 added + 21 modified, total 25 files
GeomConverter/src/org/lcsim/geometry
diff -u -r1.11 -r1.12
--- Subdetector.java 8 Feb 2006 01:01:38 -0000 1.11
+++ Subdetector.java 12 Sep 2006 01:20:51 -0000 1.12
@@ -1,9 +1,9 @@
package org.lcsim.geometry;
import org.lcsim.geometry.compact.ParameterSet;
+import org.lcsim.geometry.compact.VisAttributes;
import org.lcsim.geometry.layer.Layering;
-
/**
* @author jeremym
*/
@@ -15,6 +15,7 @@
public IDDecoder getIDDecoder();
public Layering getLayering();
public ParameterSet getParameters();
+ public VisAttributes getVisAttributes();
public boolean isTracker();
public boolean isCalorimeter();
GeomConverter/src/org/lcsim/geometry/compact
diff -N VisAttributes.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ VisAttributes.java 12 Sep 2006 01:20:52 -0000 1.1
@@ -0,0 +1,35 @@
+package org.lcsim.geometry.compact;
+
+import org.jdom.DataConversionException;
+import org.jdom.Element;
+
+public class VisAttributes
+{
+ double rgba[] = new double[4];
+ String name;
+
+ protected VisAttributes(Element node)
+ {
+ try {
+ name = node.getAttributeValue("name");
+ rgba[0] = node.getAttribute("r").getDoubleValue();
+ rgba[1] = node.getAttribute("g").getDoubleValue();
+ rgba[2] = node.getAttribute("b").getDoubleValue();
+ rgba[3] = node.getAttribute("alpha").getDoubleValue();
+ }
+ catch (DataConversionException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public double[] getRGBA()
+ {
+ return rgba;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.3 -r1.4
--- CompactElementFactory.java 14 Dec 2005 19:56:44 -0000 1.3
+++ CompactElementFactory.java 12 Sep 2006 01:20:52 -0000 1.4
@@ -22,5 +22,6 @@
register(Field.class);
register(LimitSet.class);
register(Region.class);
+ register(VisAttributes.class);
}
}
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.24 -r1.25
--- CompactReader.java 16 Feb 2006 01:57:08 -0000 1.24
+++ CompactReader.java 12 Sep 2006 01:20:52 -0000 1.25
@@ -10,7 +10,6 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
-import org.lcsim.geometry.IDDecoder;
import org.lcsim.material.XMLMaterialManager;
import org.lcsim.util.cache.CachingEntityResolver;
import org.lcsim.util.xml.ElementFactory;
@@ -25,7 +24,7 @@
* org.lcsim.geometry.GeometryReader class, which extends this.
*
* @author tonyj
- * @version $Id: CompactReader.java,v 1.24 2006/02/16 01:57:08 jeremy Exp $
+ * @version $Id: CompactReader.java,v 1.25 2006/09/12 01:20:52 jeremy Exp $
*
*/
public class CompactReader
@@ -79,7 +78,8 @@
readLimits(lccdd, det);
readMaterials(lccdd, det);
Map<String,Readout> readoutMap = readReadouts(lccdd, det);
- readSubdetectors(lccdd, det, readoutMap);
+ readVisAttributes(lccdd, det);
+ readSubdetectors(lccdd, det, readoutMap);
readFields(lccdd, det);
return det;
@@ -213,4 +213,28 @@
matmgr.addReferencesFromCompact(lccdd);
matmgr.makeMaterials(null);
}
+
+ /**
+ * Create the VisAttributes objects from vis elements in the display block.
+ *
+ * @param lccdd
+ * @param det
+ * @throws JDOMException
+ * @throws ElementCreationException
+ */
+ void readVisAttributes(Element lccdd, Detector det) throws JDOMException, ElementCreationException
+ {
+ //System.out.println("readVisAttributes");
+ Element display = lccdd.getChild("display");
+ if ( display != null )
+ {
+ for ( Iterator i = display.getChildren("vis").iterator(); i.hasNext(); )
+ {
+ Element vis = (Element) i.next();
+ assert(vis != null);
+ VisAttributes v = factory.createElement(VisAttributes.class, vis, null);
+ det.addVisAttributes(v);
+ }
+ }
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.16 -r1.17
--- Detector.java 8 Feb 2006 01:03:01 -0000 1.16
+++ Detector.java 12 Sep 2006 01:20:52 -0000 1.17
@@ -19,6 +19,7 @@
private Map<String,Field> fields = new HashMap<String,Field>();
private Map<String,LimitSet> limits = new HashMap<String,LimitSet>();
private Map<String,Region> regions = new HashMap<String,Region>();
+ private Map<String,VisAttributes> display = new HashMap<String,VisAttributes>();
private XMLMaterialManager materialMgr;
private SystemIDMap idmap = new SystemIDMap();
@@ -193,4 +194,15 @@
{
return regions;
}
+
+ public void addVisAttributes(VisAttributes vis)
+ {
+ //System.out.println("adding vis = " + vis.getName());
+ display.put(vis.getName(), vis);
+ }
+
+ public Map<String,VisAttributes> getVisAttributes()
+ {
+ return display;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.13 -r1.14
--- Subdetector.java 7 Feb 2006 17:08:31 -0000 1.13
+++ Subdetector.java 12 Sep 2006 01:20:52 -0000 1.14
@@ -17,6 +17,7 @@
private String name;
private int systemID;
private ParameterSet _parameters;
+ private VisAttributes vis;
protected Subdetector(Element element) throws JDOMException
{
@@ -123,4 +124,14 @@
{
throw new RuntimeException("layers not implemented");
}
+
+ public void setVisAttributes(VisAttributes vis)
+ {
+ this.vis = vis;
+ }
+
+ public VisAttributes getVisAttributes()
+ {
+ return this.vis;
+ }
}
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.5 -r1.6
--- AbstractTestBeam.java 1 Feb 2006 01:33:17 -0000 1.5
+++ AbstractTestBeam.java 12 Sep 2006 01:20:53 -0000 1.6
@@ -168,6 +168,7 @@
/* FIXME: these need to be called automatically whenever a new volume is created --JM */
setRegion(lcdd, slice, sliceVolume);
setLimitSet(lcdd, slice, sliceVolume);
+ setVisAttributes(lcdd, node, sliceVolume);
structure.addVolume(sliceVolume);
@@ -184,6 +185,7 @@
++sliceCount;
}
+ setVisAttributes(lcdd, node, layerVolume);
structure.addVolume(layerVolume);
for ( int i=0; i<repeat; i++)
@@ -206,7 +208,7 @@
}
++layerTypeCount;
}
-
+ setVisAttributes(lcdd, node, envelopeVolume);
structure.addVolume(envelopeVolume);
PhysVol envelopePhysVol = new PhysVol(envelopeVolume);
envelopePhysVol.addPhysVolID("system", id);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.7 -r1.8
--- CylindricalBarrelCalorimeter.java 1 Dec 2005 04:11:10 -0000 1.7
+++ CylindricalBarrelCalorimeter.java 12 Sep 2006 01:20:53 -0000 1.8
@@ -15,7 +15,11 @@
/**
*
+ * Class for converting a compact detector element of type
+ * CylindricalBarrelCalorimeter to the LCDD format.
+ *
* @author tonyj
+ * @version $id: $
*/
class CylindricalBarrelCalorimeter extends LCDDSubdetector
{
@@ -57,7 +61,7 @@
Tube tube1 = new Tube(name1);
Volume volume1 = new Volume(name1+"_volume");
volume1.setMaterial(air);
- volume1.setSolid(tube1);
+ volume1.setSolid(tube1);
int m = 0;
for (Iterator j = layer.getChildren("slice").iterator(); j.hasNext(); m++)
@@ -79,16 +83,20 @@
Volume volume = new Volume(name+"_volume");
volume.setMaterial(lcdd.getMaterial(slice.getAttributeValue("material")));
volume.setSolid(tube);
- if (sensitive) volume.setSensitiveDetector(sens);
+ 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);
+ setLimitSet(lcdd, slice, volume);
+
+ setVisAttributes(lcdd, node, volume);
structure.addVolume(volume);
- volume1.addPhysVol(new PhysVol(volume));
+ volume1.addPhysVol(new PhysVol(volume));
}
+ setVisAttributes(lcdd, node, volume1);
+
tube1.setZ(2*z);
tube1.setRMin(rlayer);
tube1.setRMax(r);
@@ -99,7 +107,7 @@
envelopeVolume.addPhysVol(physvol);
structure.addVolume(volume1);
solids.addSolid(tube1);
- n++;
+ n++;
}
}
@@ -114,6 +122,8 @@
solids.addSolid(envelope);
structure.addVolume(envelopeVolume);
+
+ setVisAttributes(lcdd, node, envelopeVolume);
}
public boolean isCalorimeter()
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.13 -r1.14
--- CylindricalEndcapCalorimeter.java 1 Dec 2005 04:11:10 -0000 1.13
+++ CylindricalEndcapCalorimeter.java 12 Sep 2006 01:20:53 -0000 1.14
@@ -97,8 +97,9 @@
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);
+ setRegion(lcdd, slice, volume);
+ setLimitSet(lcdd, slice, volume);
+ setVisAttributes(lcdd, node, volume);
structure.addVolume(volume);
@@ -121,7 +122,9 @@
structure.addVolume(volume1);
solids.addSolid(tube1);
n++;
- }
+
+ setVisAttributes(lcdd, node, volume1);
+ }
}
envelope.setZ(totWidth);
@@ -147,6 +150,8 @@
solids.addSolid(envelope);
structure.addVolume(envelopeVolume);
+
+ setVisAttributes(lcdd, node, envelopeVolume);
}
public boolean isCalorimeter()
{
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.16 -r1.17
--- DiskTracker.java 22 Mar 2006 00:29:07 -0000 1.16
+++ DiskTracker.java 12 Sep 2006 01:20:53 -0000 1.17
@@ -93,7 +93,8 @@
/* FIXME: these need to be called automatically whenever a new volume is created --JM */
setRegion(lcdd, slice, volume);
- setLimitSet(lcdd, slice, volume);
+ setLimitSet(lcdd, slice, volume);
+ setVisAttributes(lcdd, node, volume);
PhysVol physvol = new PhysVol(volume);
physvol.setZ(z-zmin -layerWidth/2 + w/2);
@@ -126,6 +127,8 @@
}
solids.addContent(tube1);
structure.addContent(volume1);
+
+ setVisAttributes(lcdd, node, volume1);
}
setCombineHits(node, sens);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.6 -r1.7
--- EcalBarrel.java 2 May 2006 22:38:47 -0000 1.6
+++ EcalBarrel.java 12 Sep 2006 01:20:54 -0000 1.7
@@ -30,7 +30,7 @@
* Class to convert from Ecal model similar to Mokka's "ecal02" to LCDD.
*
* @author jeremym
- * @version $Id: EcalBarrel.java,v 1.6 2006/05/02 22:38:47 tonyj Exp $
+ * @version $Id: EcalBarrel.java,v 1.7 2006/09/12 01:20:54 jeremy Exp $
*/
// FIXME: needs subdetector envelope
public class EcalBarrel extends LCDDSubdetector
@@ -145,8 +145,10 @@
throw new RuntimeException("Failed to build layers into "
+ module_volume.getVolumeName(), e);
}
-
- // add the module volume to LCDD
+
+ setVisAttributes(lcdd, node, module_volume);
+
+ // add the module volume to LCDD
lcdd.add(module_volume);
// phi start for a module
@@ -327,6 +329,8 @@
// volume limits
subdetector.setLimitSet(lcdd, slice, sliceVolume);
+ setVisAttributes(lcdd, node, sliceVolume);
+
// add volume to LCDD
lcdd.add(sliceVolume);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.9 -r1.10
--- ForwardDetector.java 1 Dec 2005 04:11:10 -0000 1.9
+++ ForwardDetector.java 12 Sep 2006 01:20:54 -0000 1.10
@@ -292,6 +292,8 @@
setRegion(lcdd, sliceElem, sliceVolume);
setLimitSet(lcdd, sliceElem, sliceVolume);
+ setVisAttributes(lcdd, node, sliceVolume);
+
structure.addVolume(sliceVolume);
/** Slice PV. */
@@ -305,6 +307,8 @@
++sliceCount;
}
+ setVisAttributes(lcdd, node, layerVolume);
+
structure.addVolume(layerVolume);
/** Layer PV. */
@@ -319,9 +323,11 @@
}
}
+ setVisAttributes(lcdd, node, envelopeVolume);
+
/** Add envelope LV. */
structure.addVolume(envelopeVolume);
-
+
/** Add envelope PV. */
PhysVol envelopePV = new PhysVol(envelopeVolume);
envelopePV.setZ(zpos);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.13 -r1.14
--- LCDDDetector.java 28 Oct 2005 00:34:20 -0000 1.13
+++ LCDDDetector.java 12 Sep 2006 01:20:54 -0000 1.14
@@ -7,6 +7,7 @@
import java.util.Map;
import java.util.zip.CRC32;
import java.util.zip.CheckedOutputStream;
+
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
@@ -16,25 +17,25 @@
import org.lcsim.geometry.compact.Field;
import org.lcsim.geometry.compact.Readout;
import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.material.XMLMaterialManager;
import org.lcsim.geometry.compact.converter.lcdd.util.Author;
import org.lcsim.geometry.compact.converter.lcdd.util.Calorimeter;
+import org.lcsim.geometry.compact.converter.lcdd.util.Constant;
import org.lcsim.geometry.compact.converter.lcdd.util.Define;
-import org.lcsim.geometry.compact.converter.lcdd.util.Generator;
-import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
-import org.lcsim.geometry.compact.converter.lcdd.util.Material;
-import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
import org.lcsim.geometry.compact.converter.lcdd.util.Detector;
-import org.lcsim.geometry.compact.converter.lcdd.util.Constant;
+import org.lcsim.geometry.compact.converter.lcdd.util.Generator;
import org.lcsim.geometry.compact.converter.lcdd.util.IDField;
import org.lcsim.geometry.compact.converter.lcdd.util.IDSpec;
+import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
+import org.lcsim.geometry.compact.converter.lcdd.util.Limit;
+import org.lcsim.geometry.compact.converter.lcdd.util.LimitSet;
import org.lcsim.geometry.compact.converter.lcdd.util.Position;
+import org.lcsim.geometry.compact.converter.lcdd.util.Region;
+import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
import org.lcsim.geometry.compact.converter.lcdd.util.Tracker;
-import org.lcsim.geometry.compact.converter.lcdd.util.LimitSet;
-import org.lcsim.geometry.compact.converter.lcdd.util.Limit;
-import org.lcsim.geometry.compact.converter.lcdd.util.Region;
+import org.lcsim.geometry.compact.converter.lcdd.util.VisAttributes;
import org.lcsim.geometry.util.IDDescriptor;
+import org.lcsim.material.XMLMaterialManager;
/**
*
@@ -142,10 +143,22 @@
lcdd.addLimitSet(lcddLimitSet);
}
+ // Visualization attributes.
+ for (org.lcsim.geometry.compact.VisAttributes vis : getVisAttributes().values())
+ {
+ VisAttributes lcddvis = new VisAttributes(vis.getName());
+
+ double rgba[] = vis.getRGBA();
+ lcddvis.setColor(rgba[0],rgba[1],rgba[2],rgba[3]);
+ lcdd.add(lcddvis);
+ }
+
// Write out detectors
for (Subdetector sub : getSubdetectors().values())
{
+ System.out.println("proc " + sub.getName() + " ...");
+
SensitiveDetector sens = null;
Readout readout = sub.getReadout();
if (readout != null)
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.10 -r1.11
--- LCDDSubdetector.java 9 Jun 2006 22:03:37 -0000 1.10
+++ LCDDSubdetector.java 12 Sep 2006 01:20:54 -0000 1.11
@@ -7,8 +7,9 @@
import org.lcsim.geometry.compact.converter.lcdd.util.LimitSet;
import org.lcsim.geometry.compact.converter.lcdd.util.Region;
import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
-import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
import org.lcsim.geometry.compact.converter.lcdd.util.Tracker;
+import org.lcsim.geometry.compact.converter.lcdd.util.VisAttributes;
+import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
import org.lcsim.geometry.layer.Layering;
/**
@@ -18,7 +19,6 @@
public abstract class LCDDSubdetector extends Subdetector
{
protected Element node;
-
protected Layering layers;
LCDDSubdetector(Element c) throws JDOMException
@@ -133,4 +133,27 @@
}
}
}
-}
+
+ public void setVisAttributes(LCDD lcdd, Element node, Volume volume)
+ {
+ //System.out.println("vis --> " + node.getAttributeValue("name"));
+ //System.out.println(" --> " + volume.getAttributeValue("name"));
+
+ if (node.getAttribute("vis") != null)
+ {
+ //System.out.println("setting vis");
+
+ String visref = node.getAttributeValue("vis");
+ VisAttributes vis = lcdd.getVisAttributes(visref);
+ if (vis != null)
+ {
+ volume.setVisAttributes(vis);
+ }
+ else
+ {
+ throw new RuntimeException("vis " + visref
+ + " does not exist");
+ }
+ }
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.15 -r1.16
--- MultiLayerTracker.java 22 Mar 2006 00:29:07 -0000 1.15
+++ MultiLayerTracker.java 12 Sep 2006 01:20:55 -0000 1.16
@@ -75,6 +75,8 @@
setRegion(lcdd, slice, volume);
setLimitSet(lcdd, slice, volume);
+ setVisAttributes(lcdd, node, volume);
+
structure.addContent(volume);
PhysVol physvol = new PhysVol(volume);
physvol.addPhysVolID("layer",n);
@@ -91,6 +93,9 @@
physvol.addPhysVolID("barrel",0);
trackingVolume.addPhysVol(physvol);
solids.addSolid(tube1);
+
+ setVisAttributes(lcdd,node,volume1);
+
structure.addVolume(volume1);
}
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.6 -r1.7
--- PolyconeSupport.java 20 Aug 2005 19:53:36 -0000 1.6
+++ PolyconeSupport.java 12 Sep 2006 01:20:55 -0000 1.7
@@ -65,6 +65,7 @@
Volume vol = new Volume(suppName + "_envelope_volume");
vol.setMaterial(mat);
vol.setSolid(pc);
+ setVisAttributes(lcdd, node, vol);
structure.addVolume(vol);
// phys vol
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.8 -r1.9
--- PolyhedraBarrelCalorimeter.java 21 Jan 2006 02:28:55 -0000 1.8
+++ PolyhedraBarrelCalorimeter.java 12 Sep 2006 01:20:56 -0000 1.9
@@ -21,7 +21,6 @@
import org.lcsim.geometry.compact.converter.lcdd.util.Box;
import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
import org.lcsim.geometry.compact.converter.lcdd.util.Position;
-import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
/**
*
@@ -148,7 +147,8 @@
/* FIXME: these need to be called automatically whenever a new volume is created --JM */
setRegion(lcdd, slice, sliceVolume);
- setLimitSet(lcdd, slice, sliceVolume);
+ setLimitSet(lcdd, slice, sliceVolume);
+ setVisAttributes(lcdd, node, sliceVolume);
structure.addVolume(sliceVolume);
@@ -167,10 +167,13 @@
/* incr slice number */
++sliceNum;
- }
+ }
+
/* incr layer number */
++layerNum;
}
+
+ setVisAttributes(lcdd,node,sectVolume);
}
/* add section volume after all slices */
@@ -214,6 +217,8 @@
posY = sectCenterRadius * cos(rotY);
}
+ setVisAttributes(lcdd,node,envelopeVolume);
+
/* add envelope volume after staves */
structure.addVolume(envelopeVolume);
}
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.5 -r1.6
--- PolyhedraEndcapCalorimeter.java 1 Dec 2005 04:11:11 -0000 1.5
+++ PolyhedraEndcapCalorimeter.java 12 Sep 2006 01:20:56 -0000 1.6
@@ -153,6 +153,7 @@
setRegion(lcdd, slice, sliceVolume);
setLimitSet(lcdd, slice, sliceVolume);
+ setVisAttributes(lcdd, node, sliceVolume);
structure.addVolume(sliceVolume);
/* slice PhysVol */
@@ -174,6 +175,7 @@
}
/* add section volume after all slices */
+ setVisAttributes(lcdd, node, sectVolume);
structure.addVolume(sectVolume);
/* place the staves */
@@ -245,6 +247,7 @@
}
/* add envelope volume after staves */
+ setVisAttributes(lcdd, node, envelopeVolume);
structure.addVolume(envelopeVolume);
}
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.3 -r1.4
--- TPC.java 31 Mar 2006 22:18:59 -0000 1.3
+++ TPC.java 12 Sep 2006 01:20:56 -0000 1.4
@@ -87,6 +87,7 @@
setLimitSet(lcdd, slice, volume);
setRegion(lcdd, slice, volume);
+ setVisAttributes(lcdd, node, volume);
structure.addVolume(volume);
volume1.addPhysVol(new PhysVol(volume));
}
@@ -99,6 +100,7 @@
PhysVol physvol = new PhysVol(volume1);
physvol.addPhysVolID("layer",n);
envelopeVolume.addPhysVol(physvol);
+ setVisAttributes(lcdd, node, volume1);
structure.addVolume(volume1);
solids.addSolid(tube1);
n++;
@@ -115,6 +117,7 @@
motherVolume.addPhysVol(physvol);
solids.addSolid(envelope);
+ setVisAttributes(lcdd, node, envelopeVolume);
structure.addVolume(envelopeVolume);
setCombineHits(node, sens);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -N VisAttributes.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ VisAttributes.java 12 Sep 2006 01:21:07 -0000 1.1
@@ -0,0 +1,32 @@
+package org.lcsim.geometry.compact.converter.lcdd.util;
+
+import org.jdom.Element;
+
+public class VisAttributes extends RefElement
+{
+ public VisAttributes(String name)
+ {
+ super("vis",name);
+
+ this.setAttribute("line_style","unbroken");
+ this.setAttribute("drawing_style","wireframe");
+ this.setAttribute("show_daughters","true");
+ this.setAttribute("visible","true");
+
+ Element color = new Element("color");
+ color.setAttribute("R","1.0");
+ color.setAttribute("G","1.0");
+ color.setAttribute("B","1.0");
+ color.setAttribute("alpha","1.0");
+ this.addContent(color);
+ }
+
+ public final void setColor(double r, double g, double b, double a)
+ {
+ Element color = this.getChild("color");
+ color.setAttribute("R",String.valueOf(r));
+ color.setAttribute("G",String.valueOf(g));
+ color.setAttribute("B",String.valueOf(b));
+ color.setAttribute("alpha",String.valueOf(a));
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -u -r1.18 -r1.19
--- LCDD.java 5 May 2006 23:43:10 -0000 1.18
+++ LCDD.java 12 Sep 2006 01:21:06 -0000 1.19
@@ -181,6 +181,26 @@
getChild("limits").addContent(limitset);
}
+ public void add(VisAttributes vis)
+ {
+ getChild("display").addContent(vis);
+ }
+
+ public VisAttributes getVisAttributes(String name)
+ {
+ VisAttributes vis = null;
+ for (Iterator i = getChild("display").getChildren("vis").iterator(); i.hasNext(); )
+ {
+ VisAttributes thisvis = (VisAttributes) i.next();
+ if (thisvis.getRefName().compareTo(name) == 0)
+ {
+ vis = thisvis;
+ break;
+ }
+ }
+ return vis;
+ }
+
public Structure getStructure()
{
return (Structure) getChild("gdml").getChild("structure");
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -u -r1.3 -r1.4
--- LCDDFactory.java 5 May 2006 23:43:10 -0000 1.3
+++ LCDDFactory.java 12 Sep 2006 01:21:06 -0000 1.4
@@ -8,7 +8,7 @@
* in the org.lcsim.geometry.compact.converter.lcdd.util package.
*
* @author jeremym
- * @version $Id: LCDDFactory.java,v 1.3 2006/05/05 23:43:10 jeremy Exp $
+ * @version $Id: LCDDFactory.java,v 1.4 2006/09/12 01:21:06 jeremy Exp $
*/
public final class LCDDFactory
{
@@ -434,4 +434,14 @@
}
return dipole;
}
+
+ /**
+ * Create a VisAttributes with color settings.
+ */
+ public static VisAttributes createVisAttributes(String name, double r, double g, double b, double a)
+ {
+ VisAttributes vis = new VisAttributes(name);
+ vis.setColor(r,g,b,a);
+ return vis;
+ }
}
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -u -r1.5 -r1.6
--- Volume.java 21 Jan 2006 02:30:01 -0000 1.5
+++ Volume.java 12 Sep 2006 01:21:07 -0000 1.6
@@ -51,6 +51,13 @@
addContent(regionref);
}
+ public void setVisAttributes(VisAttributes vis)
+ {
+ Element visref = new Element("visref");
+ visref.setAttribute("ref",vis.getRefName());
+ addContent(visref);
+ }
+
public String getSolidRef()
{
return getChild("solidref").getAttributeValue("ref");
GeomConverter/test/org/lcsim/geometry/subdetector
diff -N SubdetectorTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SubdetectorTest.java 12 Sep 2006 01:21:13 -0000 1.1
@@ -0,0 +1,40 @@
+package org.lcsim.geometry.subdetector;
+
+import java.io.InputStream;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.GeometryReader;
+
+/**
+ * Test of all types in org.lcsim.geometry.subdetector
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class SubdetectorTest extends TestCase
+{
+ Detector det = null;
+
+ public SubdetectorTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(SubdetectorTest.class);
+ }
+
+ protected void setUp() throws Exception
+ {
+ InputStream in = SubdetectorTest.class.getResourceAsStream("/org/lcsim/geometry/subdetector/subdetectors.xml");
+ GeometryReader reader = new GeometryReader();
+ det = reader.read(in);
+ }
+
+ public void testFoo()
+ {}
+}
\ No newline at end of file
GeomConverter/test/org/lcsim/geometry/subdetector
diff -N subdetectors.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ subdetectors.xml 12 Sep 2006 01:21:14 -0000 1.1
@@ -0,0 +1,153 @@
+<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
+ <info name="subdetectors_test">
+ <comment/>
+ </info>
+ <!-- Constants -->
+ <define>
+ <constant name="cm" value="10"/>
+ <!-- world -->
+ <constant name="world_side" value="30000"/>
+ <constant name="world_x" value="world_side"/>
+ <constant name="world_y" value="world_side"/>
+ <constant name="world_z" value="world_side"/>
+ <!-- tracking region -->
+ <constant name="tracking_region_radius" value="0.1*cm"/>
+ <constant name="tracking_region_zmax" value="0.1*cm"/>
+ </define>
+ <materials>
+ </materials>
+ <display>
+ <vis name="TestVis" alpha="1.0" r="1.0" g="0.0" b="0.0"/>
+ </display>
+ <detectors>
+ <detector id="1" name="MultiLayerTracker" type="MultiLayerTracker" readout="MultiLayerTracker_RO" vis="TestVis">
+ <layer id="1" inner_r="20.0" outer_z="100.0">
+ <slice material="G10" thickness="3.0"/>
+ <slice material="Silicon" thickness="2.0" sensitive="yes"/>
+ </layer>
+ <layer id="2" inner_r="30" outer_z="100.0">
+ <slice material="G10" thickness="3.0"/>
+ <slice material="Silicon" thickness="2.0" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="2" name="DiskTracker" type="DiskTracker" reflect="true" readout="DiskTracker_RO" vis="TestVis">
+ <layer id="1" inner_r="0.0" inner_z="20.0" outer_r="20.0">
+ <slice material="G10" thickness="3.0"/>
+ <slice material="Silicon" thickness="2.0" sensitive="yes"/>
+ </layer>
+ <layer id="1" inner_r="0.0" inner_z="30.0" outer_r="20.0">
+ <slice material="G10" thickness="3.0"/>
+ <slice material="Silicon" thickness="2.0" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="3" name="CylindricalBarrelCalorimeter" type="CylindricalBarrelCalorimeter" readout="CylindricalBarrelCalorimeter_RO" vis="TestVis">
+ <dimensions inner_r="100.0" outer_z="200.0"/>
+ <layer repeat="2">
+ <slice material="G10" thickness="3.0"/>
+ <slice material="Silicon" thickness="2.0" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="4" name="CylindricalEndcapCalorimeter" reflect="true" type="CylindricalEndcapCalorimeter" readout="CylindricalEndcapCalorimeter_RO" vis="TestVis">
+ <dimensions inner_r="20.0" inner_z="200.0" outer_r="125.0"/>
+ <layer repeat="2">
+ <slice material="G10" thickness="3.0"/>
+ <slice material="Silicon" thickness="2.0" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="8" name="PolyhedraBarrelCalorimeter" type="PolyhedraBarrelCalorimeter" readout="PolyhedraBarrelCalorimeter_RO" vis="TestVis">
+ <dimensions numsides="8" z="1000.0" rmin="500.0"/>
+ <layer repeat="20">
+ <slice material="Silicon" thickness="5.0" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="5" name="EcalBarrel" type="EcalBarrel" readout="EcalBarrel_RO" vis="TestVis">
+ <dimensions numsides="8" rmin="1700.0" z="546.0 * 2"/>
+ <layer repeat="8">
+ <slice material="Lead" thickness="23.0" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="6" name="ForwardDetector" type="ForwardDetector" reflect="true" readout="ForwardDetector_RO" vis="TestVis">
+ <dimensions outer_r="800.0" inner_r="0.0" inner_z="2000.0"/>
+ <layer repeat="5">
+ <slice material="Silicon" thickness="100.0" sensitive="yes"/>
+ </layer>
+ <beampipe crossing_angle="0.2" outgoing_r="20.0" incoming_r="10.0"/>
+ </detector>
+ <detector id="7" name="PolyconeSupport" type="PolyconeSupport" insideTrackingVolume="true" vis="TestVis">
+ <material name="Beryllium"/>
+ <zplane rmin="1.2*cm" rmax="1.3*cm" z="-6.251*cm"/>
+ <zplane rmin="1.2*cm" rmax="1.240*cm" z="-6.25*cm"/>
+ <zplane rmin="1.234*cm" rmax="2.234*cm" z="6.25*cm"/>
+ <zplane rmin="1.2*cm" rmax="1.3*cm" z="6.251*cm"/>
+ </detector>
+ <detector id="9" name="PolyhedraEndcapCalorimeter" type="PolyhedraEndcapCalorimeter" readout="PolyhedraEndcapCalorimeter_RO" reflect="true" vis="TestVis">
+ <dimensions numsides="8" zmin="1000.0" rmin="500.0" rmax="1000.0"/>
+ <layer repeat="20">
+ <slice material="Silicon" thickness="5.0" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="10" name="TPC" type="TPC" readout="TPC_RO" vis="TestVis">
+ <dimensions inner_r="100.0*cm" outer_z="150.0*cm"/>
+ <layer repeat="10">
+ <slice material="Nitrogen" thickness="1.0*cm" sensitive="yes"/>
+ </layer>
+ </detector>
+ <detector id="11" name="TestBeamCalorimeter" type="TestBeamCalorimeter" readout="TestBeamCalorimeter_RO" insideTrackingVolume="true" vis="TestVis">
+ <dimensions x="100.0 * cm" y="100.0 * cm"/>
+ <layer repeat="30">
+ <slice material="Polystyrene" thickness="1.0*cm" sensitive="yes"/>
+ <slice material="Lead" thickness="5.0 * cm"/>
+ </layer>
+ </detector>
+ <detector id="12" name="TestBeamTracker" type="TestBeamTracker" readout="TestBeamTracker_RO" insideTrackingVolume="true" vis="TestVis">
+ <dimensions x="10.0 * cm" y="10.0 * cm"/>
+ <layer repeat="5">
+ <slice material="Silicon" thickness="1.0*cm" sensitive="yes"/>
+ </layer>
+ </detector>
+ </detectors>
+ <readouts>
+ <readout name="CylindricalEndcapCalorimeter_RO">
+ <segmentation type="ProjectiveZPlane" thetaBins="1024" phiBins="1024"/>
+ <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+ </readout>
+ <readout name="EcalBarrel_RO">
+ <segmentation type="GridXYZ" gridSizeX="1.0" gridSizeY="1.0"/>
+ <id>layer:8,system:6,barrel:3,module:4,slice:6,x:32:-15,y:-15</id>
+ </readout>
+ <readout name="ForwardDetector_RO">
+ <segmentation type="GridXYZ" gridSizeX="10.0" gridSizeY="10.0"/>
+ <id>layer:7,system:3,barrel:3,x:32:11,y:11</id>
+ </readout>
+ <readout name="CylindricalBarrelCalorimeter_RO">
+ <segmentation type="ProjectiveCylinder" thetaBins="600" phiBins="1200"/>
+ <id>layer:7,system:3,barrel:3,theta:32:11,phi:11</id>
+ </readout>
+ <readout name="MultiLayerTracker_RO">
+ <id>layer:10,system:3,barrel:3</id>
+ </readout>
+ <readout name="DiskTracker_RO">
+ <id>layer:10,system:3,barrel:3</id>
+ </readout>
+ <readout name="PolyhedraBarrelCalorimeter_RO">
+ <segmentation type="GridXYZ" gridSizeX="1.0" gridSizeY="1.0"/>
+ <id>layer:8,system:6,barrel:3,x:32:-10,y:-10</id>
+ </readout>
+ <readout name="PolyhedraEndcapCalorimeter_RO">
+ <segmentation type="GridXYZ" gridSizeX="1.0" gridSizeZ="1.0"/>
+ <id>layer:8,system:6,barrel:3,x:32:-16,z:-16</id>
+ </readout>
+ <readout name="TPC_RO">
+ <id>layer:10,system:3,barrel:3</id>
+ </readout>
+ <readout name="TestBeamCalorimeter_RO">
+ <segmentation type="GridXYZ" gridSizeX="1.0" gridSizeY="1.0"/>
+ <id>layer:8,system:6,barrel:3,x:32:-10,y:-10</id>
+ </readout>
+ <readout name="TestBeamTracker_RO">
+ <id>layer:7,system:3</id>
+ </readout>
+ </readouts>
+ <fields>
+ </fields>
+</lccdd>
CVSspam 0.2.8