Commit in GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd on MAIN
SiTrackerEndcap.java+42-161.8 -> 1.9
JM: corrections to SiTrackerEndcap LCDD converter

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
SiTrackerEndcap.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- SiTrackerEndcap.java	1 Nov 2007 23:46:01 -0000	1.8
+++ SiTrackerEndcap.java	2 Nov 2007 20:10:28 -0000	1.9
@@ -84,7 +84,8 @@
             lcdd.add(position);
 
             // Positive endcap.
-            new PhysVol(layerVolume, lcdd.getTrackingVolume(), position, rotation);
+            PhysVol posEC = new PhysVol(layerVolume, lcdd.getTrackingVolume(), position, rotation);
+            posEC.addPhysVolID("barrel", 1);
 
             // Negative endcap.
             Rotation rotationReflect = new Rotation(layerName + "_rotation_reflect");
@@ -93,7 +94,8 @@
             positionReflect.setZ(-layerZ);
             lcdd.add(rotationReflect);
             lcdd.add(positionReflect);
-            new PhysVol(layerVolume, lcdd.getTrackingVolume(), positionReflect, rotationReflect);
+            PhysVol negEC = new PhysVol(layerVolume, lcdd.getTrackingVolume(), positionReflect, rotationReflect);
+            negEC.addPhysVolID("barrel", 2);
         }
 
         moduleParameters = null;
@@ -120,7 +122,7 @@
         tubeOuterR = outerR / Math.cos(dphi);
 
         // FIXME: The z dimension should go in as a half length, but GDML does not use Geant4's convention.
-        Tube layerTube = new Tube(layerName + "_tube", tubeInnerR, tubeOuterR, thickness);
+        Tube layerTube = new Tube(layerName + "_tube", tubeInnerR, tubeOuterR, thickness/2);
 
         lcdd.add(layerTube);
 
@@ -156,7 +158,8 @@
             lcdd.add(p);
             lcdd.add(rot);
 
-            new PhysVol(wedgeLV, layerLV, p, rot);
+            PhysVol wedgePV = new PhysVol(wedgeLV, layerLV, p, rot);
+            wedgePV.addPhysVolID("wedge", i);            
         }
 
         // Set the layer envelope to invisible to help Geant4 visualization.
@@ -413,11 +416,13 @@
         Box moduleBox = (Box)lcdd.getSolid(moduleVolume.getSolidRef());
 
         double moduleX = moduleBox.getX();
-        double posY = moduleBox.getY() / 2;
+        double posY = -(moduleBox.getY() / 2);
         double moduleZ = moduleBox.getZ();    	
 
         String moduleName = moduleVolume.getVolumeName();
 
+        int sensor=0;
+        
         for (ModuleComponentParameters component : moduleParameters)
         {
             double thickness = component.getThickness();
@@ -442,9 +447,6 @@
             Volume volume = new Volume(componentName, sliceBox, material);
             lcdd.add(volume);
 
-            if (sensitive)
-                volume.setSensitiveDetector(this.sd);
-
             Position position = new Position(componentName + "_position", 0., posY, 0.); 
             lcdd.add(position);
             Rotation rotation = new Rotation(componentName + "_rotation");
@@ -452,10 +454,19 @@
             lcdd.add(rotation);
             PhysVol pv = new PhysVol(volume, moduleVolume, position, rotation);
             pv.addPhysVolID("component", componentNumber);
+            
+            if (sensitive)
+            {
+                if (sensor > 1)
+                {
+                    throw new RuntimeException("Maximum of 2 sensors per module.");
+                }
+                volume.setSensitiveDetector(this.sd);
+                pv.addPhysVolID("sensor", sensor);
+                ++sensor;
+            }            
            
             posY += thickness / 2;
-
-            break;
         }    	
     }
 
@@ -472,6 +483,7 @@
 
         String moduleName = moduleVolume.getVolumeName();
 
+        int sensor=0;
         for (ModuleComponentParameters component : moduleParameters)
         {
             double thickness = component.getThickness();
@@ -500,14 +512,21 @@
             Position position = new Position(componentName + "_position",0.,posY,0);
             lcdd.add(position);
             Rotation rotation = new Rotation(componentName + "_rotation");
-            rotation.setY(Math.PI);
             lcdd.add(rotation);
 
             PhysVol pv = new PhysVol(volume, moduleVolume, position, rotation);
             pv.addPhysVolID("component", componentNumber);
 
             if (sensitive)
+            {
+                if (sensor > 1)
+                {
+                    throw new RuntimeException("Maximum of 2 sensors per module.");
+                }
+                pv.addPhysVolID("sensor", sensor);
                 volume.setSensitiveDetector(this.sd);
+                ++sensor;
+            }
 
             posY += thickness / 2;
         }   
@@ -530,6 +549,8 @@
 
         double posY = -y1;
 
+        int sensor = 0;
+        
         for (ModuleComponentParameters component : moduleParameters)
         {
             double thickness = component.getThickness();
@@ -557,14 +578,21 @@
             Position position = new Position(componentName + "_position",0,posY,0);
             lcdd.add(position);
             Rotation rotation = new Rotation(componentName + "_rotation");
-            rotation.setY(Math.PI);
             lcdd.add(rotation);
 
             PhysVol pv = new PhysVol(volume, module, position, rotation);
             pv.addPhysVolID("component", componentNumber);
             
             if (sensitive)
+            {
+                if (sensor > 1)
+                {
+                    throw new RuntimeException("Maximum of 2 sensors per module.");
+                }
                 volume.setSensitiveDetector(this.sd);
+                pv.addPhysVolID("sensor", sensor);
+                ++sensor;
+            }           
 
             posY += thickness / 2;
         }   
@@ -575,8 +603,7 @@
         return true;
     }
 
-    // FIXME: Duplicates class in org.lcsim.detector.compact.converter.SiTrackerEndcapConverter,
-    //        because I didn't want to introduce a dependency on the org.lcsim.detector package. 
+    // FIXME: Duplicates class in org.lcsim.detector.converter.compact.SiTrackerEndcapConverter to avoid dependency.
     public static class ModuleComponentParameters
     {
         String materialName;
@@ -613,8 +640,7 @@
         }
     }
 
-    // FIXME: Duplicates class in org.lcsim.detector.compact.converter.SiTrackerEndcapConverter,
-    //        because I didn't want to introduce a dependency on the org.lcsim.detector package. 
+    // FIXME: Duplicates class in org.lcsim.detector.converter.compact.SiTrackerEndcapConverter to avoid dependency.       
     public static class ModuleParameters
     extends ArrayList<ModuleComponentParameters>
     {
CVSspam 0.2.8