4 added + 11 modified, total 15 files
GeomConverter/src/org/lcsim/geometry
diff -u -r1.7.2.3 -r1.7.2.4
--- Calorimeter.java 29 Sep 2005 21:18:25 -0000 1.7.2.3
+++ Calorimeter.java 27 Oct 2005 20:49:37 -0000 1.7.2.4
@@ -9,7 +9,7 @@
*
* @author tonyj
*/
-public interface Calorimeter
+public interface Calorimeter extends Subdetector
{
CalorimeterIDDecoder getCalorimeterIDDecoder();
// Fixme: This would make sense, but is not provided by compact reader
GeomConverter/src/org/lcsim/geometry
diff -u -r1.5.2.1 -r1.5.2.2
--- Tracker.java 28 Sep 2005 00:10:30 -0000 1.5.2.1
+++ Tracker.java 27 Oct 2005 20:49:37 -0000 1.5.2.2
@@ -5,8 +5,7 @@
*
* @author tonyj
*/
-public interface Tracker
- //extends Layered
+public interface Tracker extends Subdetector
{
TrackerIDDecoder getTrackerIDDecoder();
}
GeomConverter/src/org/lcsim/geometry/compact
diff -N Limit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Limit.java 27 Oct 2005 20:49:38 -0000 1.1.2.1
@@ -0,0 +1,64 @@
+/*
+ * Limit.java
+ *
+ * Created on October 26, 2005, 5:55 PM
+ *
+ * To change this template, choose Tools | Options and locate the template under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+package org.lcsim.geometry.compact;
+
+import org.jdom.Element;
+import org.jdom.DataConversionException;
+
+/**
+ *
+ * @author jeremym
+ */
+public class Limit
+{
+ String name;
+ String particles;
+ String unit;
+ double value;
+
+ /** Creates a new instance of Limit */
+ public Limit(Element node)
+ {
+ name = node.getAttributeValue("name");
+ particles = node.getAttributeValue("particles");
+
+ try
+ {
+ value = node.getAttribute("value").getDoubleValue();
+ }
+ catch (DataConversionException dce)
+ {
+ throw new RuntimeException("invalid value attribute: " + value, dce);
+ }
+
+ unit = node.getAttributeValue("unit");
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getParticles()
+ {
+ return particles;
+ }
+
+ public String getUnit()
+ {
+ return unit;
+ }
+
+ public double getValue()
+ {
+ return value;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact
diff -N LimitSet.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LimitSet.java 27 Oct 2005 20:49:38 -0000 1.1.2.1
@@ -0,0 +1,56 @@
+/*
+ * LimitSet.java
+ */
+
+package org.lcsim.geometry.compact;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.jdom.Element;
+
+/**
+ *
+ * @author jeremym
+ */
+public class LimitSet
+{
+ Map<String, Limit> limits = new HashMap<String, Limit>();
+ String name = null;
+
+ protected LimitSet(Element node)
+ {
+ name = node.getAttributeValue("name");
+ addLimits(node);
+ }
+
+ public void addLimit(String name, Limit limit)
+ {
+ limits.put(name, limit);
+ }
+
+ private void addLimits(Element node)
+ {
+ for (Iterator i = node.getChildren("limit").iterator(); i.hasNext(); )
+ {
+ Element e = (Element) i.next();
+ Limit l = new Limit(e);
+ addLimit(l.getName(), l);
+ }
+ }
+
+ public Limit getLimit(String name)
+ {
+ return limits.get(name);
+ }
+
+ public Map<String, Limit> getLimits()
+ {
+ return limits;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.1 -r1.1.2.1
--- CompactElementFactory.java 15 Jul 2005 02:54:57 -0000 1.1
+++ CompactElementFactory.java 27 Oct 2005 20:49:37 -0000 1.1.2.1
@@ -26,5 +26,6 @@
register(Subdetector.class);
register(Segmentation.class);
register(Field.class);
+ register(LimitSet.class);
}
}
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.16.2.1 -r1.16.2.2
--- CompactReader.java 29 Sep 2005 21:18:26 -0000 1.16.2.1
+++ CompactReader.java 27 Oct 2005 20:49:37 -0000 1.16.2.2
@@ -18,7 +18,7 @@
/**
* A tool for reading xml files containing compact detector descriptions.
* @author tonyj
- * @version $Id: CompactReader.java,v 1.16.2.1 2005/09/29 21:18:26 jeremy Exp $
+ * @version $Id: CompactReader.java,v 1.16.2.2 2005/10/27 20:49:37 jeremy Exp $
*
* This class does not create subclass objects. For example, CylindricalBarrelCalorimeter
* is inserted into Detector as a generic Subdetector. To get subclasses, use the
@@ -76,6 +76,18 @@
det.addConstant(c);
}
+ /* setup limits */
+ Element limits = lccdd.getChild("limits");
+ if ( limits != null )
+ {
+ for ( Iterator i = limits.getChildren("limitset").iterator(); i.hasNext(); )
+ {
+ Element limitset = (Element) i.next();
+ LimitSet ls = factory.createElement(LimitSet.class, limitset, null);
+ det.addLimitSet(ls);
+ }
+ }
+
/* Load materials for this detector. */
setupMaterials(lccdd, det);
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.12 -r1.12.2.1
--- Detector.java 20 Jul 2005 19:11:58 -0000 1.12
+++ Detector.java 27 Oct 2005 20:49:37 -0000 1.12.2.1
@@ -16,6 +16,7 @@
private Map<String,Subdetector> subdetectors = new HashMap<String,Subdetector>();
private Map<String,Readout> readouts = new HashMap<String,Readout>();
private Map<String,Field> fields = new HashMap<String,Field>();
+ private Map<String,LimitSet> limits = new HashMap<String,LimitSet>();
protected XMLMaterialManager materialMgr;
@@ -146,4 +147,19 @@
{
return materialMgr;
}
+
+ public void addLimitSet(LimitSet limitset)
+ {
+ limits.put(limitset.getName(), limitset);
+ }
+
+ public LimitSet getLimitSet(String name)
+ {
+ return limits.get(name);
+ }
+
+ public Map<String, LimitSet> getLimits()
+ {
+ return limits;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.13 -r1.13.2.1
--- DiskTracker.java 20 Aug 2005 21:57:00 -0000 1.13
+++ DiskTracker.java 27 Oct 2005 20:49:38 -0000 1.13.2.1
@@ -63,9 +63,9 @@
{
w = slice.getAttribute("thickness").getDoubleValue();
}
- else
+ else
{
- throw new JDOMException("Disk Tracker " + detectorName +
+ throw new JDOMException("Disk Tracker " + detectorName +
" is missing required thickness attribute in layer #" + n + " .");
}
layerWidth += w;
@@ -91,6 +91,9 @@
volume.setSolid(tube);
if (sensitive) volume.setSensitiveDetector(sens);
+ /* FIXME: this needs to be called automatically whenever a new volume is created --JM */
+ setLimitSet(lcdd, slice, volume);
+
PhysVol physvol = new PhysVol(volume);
physvol.setZ(z-zmin -layerWidth/2 + w/2);
physvol.addPhysVolID("layer",n);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.12 -r1.12.2.1
--- LCDDDetector.java 1 Jul 2005 00:15:30 -0000 1.12
+++ LCDDDetector.java 27 Oct 2005 20:49:38 -0000 1.12.2.1
@@ -31,6 +31,8 @@
import org.lcsim.geometry.compact.converter.lcdd.util.Position;
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.util.IDDescriptor;
/**
@@ -56,7 +58,7 @@
checksum = calculateChecksum(lccdd);
Detector detector = lcdd.getHeader().getDetector();
- detector.setTitle(getHeader().getDetectorName());
+ detector.setTitle(getHeader().getDetectorName());
lcdd.getHeader().setComment(getHeader().getComment());
Generator generator = lcdd.getHeader().getGenerator();
@@ -82,7 +84,7 @@
for (org.lcsim.geometry.compact.Constant c : getConstants().values())
{
define.addConstant(new Constant(c.getName(),String.valueOf(c.getValue())));
- }
+ }
/* Setup materials. */
setupMaterials(lcdd);
@@ -108,6 +110,22 @@
idMap.put(readout,idspec);
}
+ /* limits */
+ for (org.lcsim.geometry.compact.LimitSet limitset : getLimits().values() )
+ {
+ LimitSet lcddLimitSet = new LimitSet(limitset.getName());
+ for ( org.lcsim.geometry.compact.Limit limit : limitset.getLimits().values() )
+ {
+ Limit lcddLimit = new Limit(limit.getName());
+
+ lcddLimit.setParticles(limit.getParticles());
+ lcddLimit.setUnit(limit.getUnit());
+ lcddLimit.setValue(limit.getValue());
+
+ lcddLimitSet.addLimit(lcddLimit);
+ }
+ lcdd.addLimitSet(lcddLimitSet);
+ }
// Write out detectors
@@ -141,11 +159,11 @@
}
}
- if ( sub instanceof LCDDSubdetector )
+ if ( sub instanceof LCDDSubdetector )
{
((LCDDSubdetector) sub).addToLCDD(lcdd,sens);
}
- else
+ else
{
throw new RuntimeException("Subdetector is not an instanceof LCDDSubdetector.");
}
@@ -164,13 +182,13 @@
}
private void setupMaterials(LCDD lcdd) throws JDOMException
- {
+ {
/** Get materials root element. */
Element materials = lccdd.getChild("materials");
-
+
/** Clone materials root from LCCD document to the manager. */
- XMLMaterialManager mgr = getMaterialManager();
- mgr.setMaterialsRoot(materials);
+ XMLMaterialManager mgr = getMaterialManager();
+ mgr.setMaterialsRoot(materials);
/** Add materials plus their references from the compact into the manager. */
mgr.addReferencesFromCompact(lccdd);
@@ -179,7 +197,7 @@
mgr.copyToLCDD(lcdd);
}
- private String getName()
+ public String getName()
{
return "GeomConverter";
}
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.6 -r1.6.2.1
--- LCDDSubdetector.java 18 Jul 2005 22:04:11 -0000 1.6
+++ LCDDSubdetector.java 27 Oct 2005 20:49:39 -0000 1.6.2.1
@@ -4,7 +4,9 @@
import org.jdom.JDOMException;
import org.lcsim.geometry.compact.Subdetector;
import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
+import org.lcsim.geometry.compact.converter.lcdd.util.LimitSet;
import org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector;
+import org.lcsim.geometry.compact.converter.lcdd.util.Volume;
import org.lcsim.geometry.layer.Layering;
/**
@@ -34,4 +36,21 @@
{
return node;
}
+
+ public void setLimitSet(LCDD lcdd, Element currNode, Volume currVolume)
+ {
+ if ( currNode.getAttribute("limits") != null )
+ {
+ String limitref = currNode.getAttributeValue("limits");
+ LimitSet limitset = lcdd.getLimitSet(limitref);
+ if ( limitset != null )
+ {
+ currVolume.setLimitSet(limitset);
+ }
+ else
+ {
+ throw new RuntimeException("limitset " + limitref + " does not exist");
+ }
+ }
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.11.2.1 -r1.11.2.2
--- MultiLayerTracker.java 28 Sep 2005 05:44:17 -0000 1.11.2.1
+++ MultiLayerTracker.java 27 Oct 2005 20:49:39 -0000 1.11.2.2
@@ -72,6 +72,9 @@
volume.setSolid(tube);
if (sensitive) volume.setSensitiveDetector(sens);
+ /* FIXME: this needs to be called automatically whenever a new volume is created --JM */
+ setLimitSet(lcdd, slice, volume);
+
structure.addContent(volume);
PhysVol physvol = new PhysVol(volume);
physvol.addPhysVolID("layer",n);
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -N Limit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Limit.java 27 Oct 2005 20:49:40 -0000 1.1.2.1
@@ -0,0 +1,50 @@
+/*
+ * Limit.java
+ *
+ * Created on October 26, 2005, 5:38 PM
+ *
+ * To change this template, choose Tools | Options and locate the template under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+package org.lcsim.geometry.compact.converter.lcdd.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jdom.Element;
+
+/**
+ *
+ * @author jeremym
+ */
+public class Limit extends Element
+{
+ /** Creates a new instance of Limit */
+ public Limit(String name)
+ {
+ super("limit");
+ setAttribute("name", name);
+ setUnit("mm");
+ setParticles("*");
+ }
+
+ /**
+ * Set comma delimited list of particles to which limit applies. These are
+ * the Geant4 particle names. "*" for all particles.
+ */
+ public void setParticles(String particleNames)
+ {
+ setAttribute("particles", particleNames);
+ }
+
+ public void setValue(double value)
+ {
+ setAttribute("value", String.valueOf(value));
+ }
+
+ public void setUnit(String unit)
+ {
+ setAttribute("unit", unit);
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -N LimitSet.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LimitSet.java 27 Oct 2005 20:49:40 -0000 1.1.2.1
@@ -0,0 +1,28 @@
+/*
+ * LimitSet.java
+ *
+ * Created on October 26, 2005, 5:30 PM
+ *
+ * To change this template, choose Tools | Options and locate the template under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+package org.lcsim.geometry.compact.converter.lcdd.util;
+
+/**
+ *
+ * @author jeremym
+ */
+public class LimitSet extends RefElement
+{
+ public LimitSet(String name)
+ {
+ super("limitset",name);
+ }
+
+ public void addLimit(Limit limit)
+ {
+ addContent(limit);
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -u -r1.15 -r1.15.2.1
--- LCDD.java 22 Aug 2005 03:58:21 -0000 1.15
+++ LCDD.java 27 Oct 2005 20:49:39 -0000 1.15.2.1
@@ -1,6 +1,7 @@
package org.lcsim.geometry.compact.converter.lcdd.util;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import org.jdom.Element;
import org.jdom.JDOMException;
@@ -44,7 +45,7 @@
addContent(limits);
Element regions = new Element("regions");
- addContent(regions);
+ addContent(regions);
Element display = new Element("display");
addContent(display);
@@ -275,4 +276,24 @@
return motherVolume;
}
+
+ public void addLimitSet(LimitSet limitset)
+ {
+ getChild("limits").addContent(limitset);
+ }
+
+ public LimitSet getLimitSet(String name)
+ {
+ LimitSet limitset = null;
+ for (Iterator i = getChild("limits").getChildren("limitset").iterator(); i.hasNext(); )
+ {
+ LimitSet thislimitset = (LimitSet) i.next();
+ if (thislimitset.getRefName().compareTo(name) == 0)
+ {
+ limitset = thislimitset;
+ break;
+ }
+ }
+ return limitset;
+ }
}
\ No newline at end of file
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -u -r1.3 -r1.3.2.1
--- Volume.java 8 Mar 2005 05:35:04 -0000 1.3
+++ Volume.java 27 Oct 2005 20:49:40 -0000 1.3.2.1
@@ -8,38 +8,46 @@
*/
public class Volume extends RefElement
{
-
- /** Creates a new instance of Volume */
- public Volume(String name)
- {
- super("volume",name);
- Element materialref = new Element("materialref");
- addContent(materialref);
- Element solidref = new Element("solidref");
- addContent(solidref);
- }
- public void setMaterial(Material mat)
- {
- getChild("materialref").setAttribute("ref",mat.getRefName());
- }
- public void setSolid(Solid solid)
- {
- getChild("solidref").setAttribute("ref",solid.getRefName());
- }
- public void setSensitiveDetector(SensitiveDetector sens)
- {
- Element sdref = new Element("sdref");
- sdref.setAttribute("ref",sens.getRefName());
- addContent(sdref);
- }
- public void addPhysVol(PhysVol vol)
- {
- addContent(vol);
- }
- public void setRegion(Region region)
- {
- Element regionref = new Element("regionref");
- regionref.setAttribute("ref",region.getRefName());
- addContent(regionref);
- }
+
+ /** Creates a new instance of Volume */
+ public Volume(String name)
+ {
+ super("volume",name);
+ Element materialref = new Element("materialref");
+ addContent(materialref);
+ Element solidref = new Element("solidref");
+ addContent(solidref);
+ }
+ public void setMaterial(Material mat)
+ {
+ getChild("materialref").setAttribute("ref",mat.getRefName());
+ }
+ public void setSolid(Solid solid)
+ {
+ getChild("solidref").setAttribute("ref",solid.getRefName());
+ }
+ public void setSensitiveDetector(SensitiveDetector sens)
+ {
+ Element sdref = new Element("sdref");
+ sdref.setAttribute("ref",sens.getRefName());
+ addContent(sdref);
+ }
+
+ public void setLimitSet(LimitSet limitset)
+ {
+ Element limitsetref = new Element("limitsetref");
+ limitsetref.setAttribute("ref",limitset.getRefName());
+ addContent(limitsetref);
+ }
+
+ public void addPhysVol(PhysVol vol)
+ {
+ addContent(vol);
+ }
+ public void setRegion(Region region)
+ {
+ Element regionref = new Element("regionref");
+ regionref.setAttribute("ref",region.getRefName());
+ addContent(regionref);
+ }
}
CVSspam 0.2.8