5 modified files
GeomConverter/resources/org/lcsim/schemas/compact/1.0
diff -u -r1.3 -r1.4
--- compact.xsd 16 Mar 2009 22:34:02 -0000 1.3
+++ compact.xsd 16 Mar 2009 23:10:27 -0000 1.4
@@ -207,9 +207,9 @@
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="xs:string" use="required"/>
- <xs:attribute name="id" type="xs:integer" use="optional" />
+ <xs:attribute name="id" type="xs:integer" use="optional" default="0"/>
<xs:attribute name="readout" type="xs:string" use="optional" />
- <xs:attribute name="insideTrackingVolume" type="xs:boolean" use="optional"/>
+ <xs:attribute name="insideTrackingVolume" type="xs:boolean" use="optional" />
<xs:attribute name="reflect" type="xs:boolean" use="optional"/>
<xs:attribute name="combineHits" type="xs:boolean" use="optional"/>
<xs:anyAttribute processContents="lax"/>
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.26 -r1.27
--- Detector.java 14 Dec 2007 21:57:51 -0000 1.26
+++ Detector.java 16 Mar 2009 23:10:28 -0000 1.27
@@ -157,10 +157,22 @@
*/
protected void addSubdetector(Subdetector sub)
{
+ // Check for a duplicate name.
+ if (subdetectors.get(sub.getName()) != null)
+ {
+ throw new RuntimeException("The subdetector " + sub.getName() + " in detector " + this.getDetectorName()
+ + " has the same name as another subdetector, which is not allowed.");
+ }
subdetectors.put(sub.getName(),sub);
- // add subdetector to system ID map
- //System.out.println(getDetectorName() + ": " + sub.getSystemID() + " -> " + sub.getName());
+ // Check for a duplicate system id.
+ if (sub.getSystemID() != 0 && idmap.get(sub.getSystemID()) != null)
+ {
+ throw new RuntimeException("The subdetector " + sub.getName() + " in detector " + this.getDetectorName()
+ + " duplicates the system ID " + sub.getSystemID()
+ + " of the existing subdetector " + idmap.get(sub.getSystemID()));
+ }
+
idmap.add(sub.getSystemID(), sub);
}
@@ -247,7 +259,6 @@
public void addVisAttributes(VisAttributes vis)
{
- //System.out.println("adding vis = " + vis.getName());
display.put(vis.getName(), vis);
}
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.20 -r1.21
--- Subdetector.java 11 Sep 2007 19:21:03 -0000 1.20
+++ Subdetector.java 16 Mar 2009 23:10:28 -0000 1.21
@@ -38,9 +38,8 @@
Attribute r = element.getAttribute("reflect");
reflect = r != null && r.getBooleanValue();
- Attribute id = element.getAttribute("id");
- systemID = 0;
- if (id != null) systemID = id.getIntValue();
+ // Don't need a null check on id, as the compact schema include a default of 0.
+ systemID = element.getAttribute("id").getIntValue();
// Check if inside tracking volume.
Attribute insideAttrib = node.getAttribute("insideTrackingVolume");
@@ -70,6 +69,10 @@
protected void setReadout(Readout r)
{
+ // Require a valid system id.
+ if (systemID == 0)
+ throw new RuntimeException("The detector " + getName() + " cannot have a readout" +
+ " because it does not have a valid system id.");
this.readout = r;
}
GeomConverter/testResources/org/lcsim/detector/converter/compact
diff -u -r1.1 -r1.2
--- DetectorConverterTest.xml 12 Sep 2007 18:24:31 -0000 1.1
+++ DetectorConverterTest.xml 16 Mar 2009 23:10:28 -0000 1.2
@@ -25,30 +25,31 @@
<detectors>
+ <detector id="1" name="tracker" type="MultiLayerTracker" readout="TrackerHits">
+ <layer id="1" inner_r = "10.0*cm" outer_z = "25.0*cm">
+ <slice material="Silicon" thickness="1.0*cm" sensitive="yes" />
+ </layer>
+ <layer id="2" inner_r ="15.0*cm" outer_z = "50.0*cm">
+ <slice material="Silicon" thickness="1.0*cm" sensitive="yes" />
+ </layer>
+ </detector>
+
<!-- Electromagnetic calorimeter -->
- <detector id="1" name="ecal_barrel" type="CylindricalBarrelCalorimeter" readout="EcalBarrHits">
+ <detector id="2" name="ecal_barrel" type="CylindricalBarrelCalorimeter" readout="EcalBarrHits">
<dimensions inner_r = "100.0*cm" outer_z = "200.0*cm" />
<layer repeat="2">
<slice material = "Silicon" thickness = "10.0*cm" sensitive = "yes" />
</layer>
</detector>
- <detector id="2" name="ecal_endcap" reflect="true" type="CylindricalEndcapCalorimeter" readout="EcalEndcapHits">
+ <detector id="3" name="ecal_endcap" reflect="true" type="CylindricalEndcapCalorimeter" readout="EcalEndcapHits">
<dimensions inner_r = "0.0" inner_z = "250.0*cm" outer_r = "100.0*cm" />
<layer repeat="2">
<slice material = "Silicon" thickness = "10.0*cm" sensitive = "yes" />
</layer>
</detector>
- <detector id="0" name="tracker" type="MultiLayerTracker" readout="TrackerHits">
- <layer id="1" inner_r = "10.0*cm" outer_z = "25.0*cm">
- <slice material="Silicon" thickness="1.0*cm" sensitive="yes" />
- </layer>
- <layer id="2" inner_r ="15.0*cm" outer_z = "50.0*cm">
- <slice material="Silicon" thickness="1.0*cm" sensitive="yes" />
- </layer>
- </detector>
</detectors>
<readouts>
GeomConverter/testResources/org/lcsim/geometry/compact
diff -u -r1.1 -r1.2
--- sdjan03_compact.xml 12 Sep 2007 18:24:31 -0000 1.1
+++ sdjan03_compact.xml 16 Mar 2009 23:10:28 -0000 1.2
@@ -65,7 +65,7 @@
<zplane rmin = "((tracking_region_zmax-6.25)*(8.96-1.2)/(185.-6.25)+1.2)" rmax="((tracking_region_zmax-6.25)*(8.96-1.2)/(185.-6.25)+1.3)" z="tracking_region_zmax" />
</detector>
- <detector id="0" name="BarrelVertex" type="MultiLayerTracker" readout="VtxBarrHits">
+ <detector id="11" name="BarrelVertex" type="MultiLayerTracker" readout="VtxBarrHits">
<layer id="1" inner_r = "vertex_inner_r" outer_z = "2.5*cm">
<slice material = "Silicon" thickness = "0.01*cm" sensitive = "yes" limits="MyLimits" />
</layer>
CVSspam 0.2.8