Print

Print


Commit in GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd on MAIN
HPSMuonCalorimeter.java+45-261.2 -> 1.3
current version of hps mu cal

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
HPSMuonCalorimeter.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- HPSMuonCalorimeter.java	4 Dec 2012 01:11:38 -0000	1.2
+++ HPSMuonCalorimeter.java	6 Dec 2012 00:22:36 -0000	1.3
@@ -13,7 +13,7 @@
 
 /**
  * @author jeremym
- * @version $Id: HPSMuonCalorimeter.java,v 1.2 2012/12/04 01:11:38 jeremy Exp $
+ * @version $Id: HPSMuonCalorimeter.java,v 1.3 2012/12/06 00:22:36 jeremy Exp $
  */
 public class HPSMuonCalorimeter extends LCDDSubdetector {
 
@@ -27,38 +27,52 @@
         int id = node.getAttribute("id").getIntValue();
         Volume mother = lcdd.pickMotherVolume(this);
         
-        for (Object layerObject : node.getChildren("layer")) {            
+        for (Object layerObject : node.getChildren("layer")) {        
+            
             Element layer = (Element)layerObject;
             int layerId = layer.getAttribute("id").getIntValue();
-            
-            //System.out.println("making layer:" + layerId);
-            
+                        
             int slice = 1;
             for (Object boxObject : layer.getChildren("box")) {
-                
-                //System.out.println("making shape: " + slice);
-                
+                                
                 Element element = (Element)boxObject;
                 
                 double x, y, z, px, py, pz, rx, ry, rz;
+                x = y = z = px = py = pz = rx = ry = rz = 0.;
                 
-                x = element.getAttribute("x").getDoubleValue();
-                y = element.getAttribute("y").getDoubleValue();
-                z = element.getAttribute("z").getDoubleValue();
-                
-                px = element.getAttribute("px").getDoubleValue();
-                py = element.getAttribute("py").getDoubleValue();
-                pz = element.getAttribute("pz").getDoubleValue();
-                
-                rx = element.getAttribute("rx").getDoubleValue();
-                ry = element.getAttribute("ry").getDoubleValue();
-                rz = element.getAttribute("rz").getDoubleValue();
+                if (element.getAttribute("x") != null) {
+                    x = element.getAttribute("x").getDoubleValue();
+                } else {
+                    throw new RuntimeException("x is required.");
+                }                
+                if (element.getAttribute("y") != null) {
+                    y = element.getAttribute("y").getDoubleValue();
+                } else {
+                    throw new RuntimeException("y is required.");
+                }                
+                if (element.getAttribute("z") != null) {
+                    z = element.getAttribute("z").getDoubleValue();
+                } else {
+                    throw new RuntimeException("z is required.");
+                }
+                
+                if (element.getAttribute("px") != null)
+                    px = element.getAttribute("px").getDoubleValue();
+                if (element.getAttribute("py") != null)
+                    py = element.getAttribute("py").getDoubleValue();
+                if (element.getAttribute("pz") != null)
+                    pz = element.getAttribute("pz").getDoubleValue();
+                
+                if (element.getAttribute("rx") != null)
+                    rx = element.getAttribute("rx").getDoubleValue();
+                if (element.getAttribute("ry") != null)
+                    ry = element.getAttribute("ry").getDoubleValue();
+                if (element.getAttribute("rz") != null)
+                    rz = element.getAttribute("rz").getDoubleValue();
                 
                 String materialString = element.getAttributeValue("material");
                 Material material = lcdd.getMaterial(materialString);
-                
-                boolean sensitive = element.getAttribute("sensitive").getBooleanValue(); 
-                
+                                
                 String shapeBaseName = name + "_layer" + layerId + "_sublayer" + slice; 
                 
                 Box box = new Box(shapeBaseName + "_box", x, y, z);
@@ -71,11 +85,16 @@
                 lcdd.add(rot);
                 
                 Volume vol = new Volume(shapeBaseName + "_vol", box, material);
-                lcdd.add(vol);
+                                                              
+                boolean sensitive = false;
+                if (element.getAttribute("sensitive") != null)
+                    sensitive = element.getAttribute("sensitive").getBooleanValue(); 
+                                
+                if (sensitive) {
+                    vol.setSensitiveDetector(sens);
+                }
                 
-                //System.out.println("made volume: " + vol.getName());
-                
-                if (sensitive) vol.setSensitiveDetector(sens);
+                lcdd.add(vol);
                 
                 PhysVol physVol = new PhysVol(vol, mother, pos, rot);
                 physVol.addPhysVolID("layer", layerId);
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1