10 modified files
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.9 -r1.10
--- Subdetector.java 28 Oct 2005 00:34:19 -0000 1.9
+++ Subdetector.java 14 Dec 2005 19:56:44 -0000 1.10
@@ -6,7 +6,6 @@
import org.lcsim.geometry.layer.Layering;
import org.lcsim.geometry.IDDecoder;
import org.lcsim.geometry.SubdetectorIDDecoder;
-import org.lcsim.geometry.layer.Layering;
/**
*
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.2 -r1.3
--- CompactElementFactory.java 28 Oct 2005 00:34:18 -0000 1.2
+++ CompactElementFactory.java 14 Dec 2005 19:56:44 -0000 1.3
@@ -1,9 +1,3 @@
-/*
- * CompactElementFactory.java
- *
- * Created on July 14, 2005, 7:23 PM
- */
-
package org.lcsim.geometry.compact;
import org.lcsim.util.xml.DefaultElementFactory;
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.18 -r1.19
--- CompactReader.java 31 Oct 2005 19:06:20 -0000 1.18
+++ CompactReader.java 14 Dec 2005 19:56:44 -0000 1.19
@@ -17,14 +17,13 @@
/**
* A tool for reading xml files containing compact detector descriptions.
- * @author tonyj
- * @version $Id: CompactReader.java,v 1.18 2005/10/31 19:06:20 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
* org.lcsim.geometry.GeometryReader class, which extends this.
*
- * FIXME: Refactor the read() function into different methods corresponding to each tag.
+ * @author tonyj
+ * @version $Id: CompactReader.java,v 1.19 2005/12/14 19:56:44 tonyj Exp $
*
*/
public class CompactReader
@@ -65,7 +64,19 @@
Element lccdd = doc.getRootElement();
Detector det = factory.createElement(Detector.class,lccdd,null);
- /* header */
+ readHeader(lccdd, det, jdom);
+ readRegions(lccdd, det);
+ readLimits(lccdd, det);
+ readMaterials(lccdd, det);
+ Map<String,Readout> readoutMap = readReadouts(lccdd, det);
+ readSubdetectors(lccdd, det, readoutMap);
+ readFields(lccdd, det);
+
+ return det;
+ }
+
+ private void readHeader(Element lccdd, Detector det, JDOMExpressionFactory jdom) throws JDOMException, ElementCreationException
+ {
Element info = lccdd.getChild("info");
det.setHeader(factory.createElement(Header.class,info,null));
Element define = lccdd.getChild("define");
@@ -76,8 +87,9 @@
jdom.addConstant(c.getName(),c.getValue());
det.addConstant(c);
}
-
- /* setup regions */
+ }
+ private void readRegions(Element lccdd, Detector det) throws JDOMException, ElementCreationException
+ {
Element regions = lccdd.getChild("regions");
if ( regions != null )
{
@@ -88,8 +100,9 @@
det.addRegion(r);
}
}
-
- /* setup limits */
+ }
+ private void readLimits(Element lccdd, Detector det) throws JDOMException, ElementCreationException
+ {
Element limits = lccdd.getChild("limits");
if ( limits != null )
{
@@ -100,11 +113,9 @@
det.addLimitSet(ls);
}
}
-
- /* Load materials for this detector. */
- setupMaterials(lccdd, det);
-
- /* setup readouts */
+ }
+ private Map<String,Readout> readReadouts(Element lccdd, Detector det) throws JDOMException, ElementCreationException
+ {
Map<String,Readout> readoutMap = new HashMap<String,Readout>();
Element readouts = lccdd.getChild("readouts");
for (Iterator i = readouts.getChildren("readout").iterator(); i.hasNext();)
@@ -129,8 +140,11 @@
readoutMap.put(r.getName(),r);
det.addReadout(r);
}
-
- /* subdetectors */
+ return readoutMap;
+ }
+
+ private void readSubdetectors(Element lccdd, Detector det, Map<String,Readout> readoutMap) throws JDOMException, ElementCreationException
+ {
Element detectors = lccdd.getChild("detectors");
for (Iterator i = detectors.getChildren("detector").iterator(); i.hasNext(); )
{
@@ -146,9 +160,10 @@
sub.setReadout(r);
}
det.addSubdetector(sub);
- }
-
- /* fields */
+ }
+ }
+ private void readFields(Element lccdd, Detector det) throws JDOMException, ElementCreationException
+ {
Element fields = lccdd.getChild("fields");
if (fields != null)
{
@@ -161,12 +176,11 @@
det.addField(field);
}
}
-
- return det;
}
+
/** Create impl objects of materials and their references. */
- void setupMaterials(org.jdom.Element lccdd, Detector det) throws JDOMException
+ void readMaterials(org.jdom.Element lccdd, Detector det) throws JDOMException
{
XMLMaterialManager matmgr = det.getMaterialManager();
matmgr.addReferencesFromCompact(lccdd);
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.2 -r1.3
--- Region.java 28 Oct 2005 00:34:18 -0000 1.2
+++ Region.java 14 Dec 2005 19:56:45 -0000 1.3
@@ -1,6 +1,3 @@
-/*
- * Region.java
- */
package org.lcsim.geometry.compact;
import org.jdom.Element;
@@ -12,14 +9,14 @@
*/
public class Region
{
- String name;
- boolean storeSecondaries;
- double rangeCut;
- String lunit;
- double energyThreshold;
- String eunit;
+ private String name;
+ private boolean storeSecondaries;
+ private double rangeCut;
+ private String lunit;
+ private double energyThreshold;
+ private String eunit;
- public Region(Element node)
+ protected Region(Element node)
{
name = node.getAttributeValue("name");
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.2 -r1.3
--- Limit.java 28 Oct 2005 00:34:18 -0000 1.2
+++ Limit.java 14 Dec 2005 19:56:45 -0000 1.3
@@ -1,13 +1,3 @@
-/*
- * 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;
@@ -19,13 +9,13 @@
*/
public class Limit
{
- String name;
- String particles;
- String unit;
- double value;
+ private String name;
+ private String particles;
+ private String unit;
+ private double value;
/** Creates a new instance of Limit */
- public Limit(Element node)
+ protected Limit(Element node)
{
name = node.getAttributeValue("name");
particles = node.getAttributeValue("particles");
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.1 -r1.2
--- Field.java 8 Mar 2005 02:58:28 -0000 1.1
+++ Field.java 14 Dec 2005 19:56:45 -0000 1.2
@@ -3,13 +3,13 @@
import org.jdom.Element;
/**
- *
+ * Represents a magnetic field.
* @author tonyj
*/
public class Field
{
private String name;
- public Field(Element field)
+ protected Field(Element field)
{
name = field.getAttributeValue("name");
}
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.8 -r1.9
--- Readout.java 28 Oct 2005 00:34:18 -0000 1.8
+++ Readout.java 14 Dec 2005 19:56:45 -0000 1.9
@@ -12,7 +12,6 @@
/**
*
* @author tonyj
- *
*/
public class Readout implements org.lcsim.geometry.Readout
{
@@ -21,7 +20,7 @@
private IDDescriptor desc;
private boolean hasSegmentation;
- public Readout(Element node) throws JDOMException
+ protected Readout(Element node) throws JDOMException
{
name = node.getAttributeValue("name");
setupIDDescriptor(node);
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.2 -r1.3
--- Constant.java 2 Mar 2005 02:07:41 -0000 1.2
+++ Constant.java 14 Dec 2005 19:56:45 -0000 1.3
@@ -13,7 +13,7 @@
private double value;
/**
* Construct a new Constant
- * @param constant Teh JDOM element corresponding to the constant definition.
+ * @param constant The JDOM element corresponding to the constant definition.
* @throws org.jdom.DataConversionException If an XML error occurs while handling the node.
*/
protected Constant(Element constant) throws DataConversionException
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.2 -r1.3
--- LimitSet.java 28 Oct 2005 00:34:18 -0000 1.2
+++ LimitSet.java 14 Dec 2005 19:56:45 -0000 1.3
@@ -1,7 +1,3 @@
-/*
- * LimitSet.java
- */
-
package org.lcsim.geometry.compact;
import java.util.HashMap;
@@ -15,8 +11,8 @@
*/
public class LimitSet
{
- Map<String, Limit> limits = new HashMap<String, Limit>();
- String name = null;
+ private Map<String, Limit> limits = new HashMap<String, Limit>();
+ private String name;
protected LimitSet(Element node)
{
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.13 -r1.14
--- Detector.java 28 Oct 2005 00:34:18 -0000 1.13
+++ Detector.java 14 Dec 2005 19:56:45 -0000 1.14
@@ -19,8 +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>();
-
- protected XMLMaterialManager materialMgr;
+ private XMLMaterialManager materialMgr;
/**
* Called by the reader to create a new Detector
CVSspam 0.2.8