Print

Print


Commit in GeomConverter/src/org/lcsim/detector/converter/compact on MAIN
HPSTrackerConverter.java+35-261.1 -> 1.2
work in progress on new HPS tracker module; added embedded sensor geom with optional dead area around it

GeomConverter/src/org/lcsim/detector/converter/compact
HPSTrackerConverter.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- HPSTrackerConverter.java	13 Jan 2012 00:02:51 -0000	1.1
+++ HPSTrackerConverter.java	13 Jan 2012 21:34:23 -0000	1.2
@@ -27,7 +27,6 @@
 import org.lcsim.detector.material.IMaterial;
 import org.lcsim.detector.material.MaterialStore;
 import org.lcsim.detector.solids.Box;
-import org.lcsim.detector.solids.Trd;
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
 import org.lcsim.detector.tracker.silicon.SiTrackerModule;
@@ -218,62 +217,67 @@
         
         Box box = new Box(params.getName() + "Box", x / 2, y / 2, thickness / 2);
         LogicalVolume volume = new LogicalVolume(params.getName() + "Volume", box, vacuum);
+        
         makeModuleComponents(volume, params);
+        
         return volume;
     }
 
     private void makeModuleComponents(LogicalVolume moduleVolume, ModuleParameters moduleParameters)
     {
         double moduleX = moduleParameters.getDimension(0);
-        double moduleY = moduleParameters.getDimension(1);
-        
+        double moduleY = moduleParameters.getDimension(1);        
         Box box = (Box)moduleVolume.getSolid();
-        double moduleZ = box.getZHalfLength() * 2;
-                        
+        double moduleZ = box.getZHalfLength() * 2;                        
         double posZ = -moduleZ / 2;
-
         String moduleName = moduleVolume.getName();
-
-        int sensor = 0;
+        int sensorNumber = 0;       
         for (ModuleComponentParameters component : moduleParameters)
         {
             double componentThickness = component.getThickness();
-
             IMaterial material = MaterialStore.getInstance().get(component.getMaterialName());
             if (material == null)
             {
                 throw new RuntimeException("The material " + component.getMaterialName() + " does not exist in the materials database.");
-            }
-            boolean sensitive = component.isSensitive();
+            }           
+            boolean sensitive = component.isSensitive();            
             int componentNumber = component.getComponentNumber();
-
             posZ += componentThickness / 2;
-
             String componentName = moduleName + "_component" + componentNumber;
-
             Box componentBox = new Box(componentName + "Box", moduleX / 2, moduleY / 2, componentThickness / 2);
-
-            LogicalVolume volume = new LogicalVolume(componentName, componentBox, material);
-
+            LogicalVolume componentVolume = new LogicalVolume(componentName, componentBox, material);
             double zrot = 0;
             if (sensitive)
             {
-                if (sensor > 1)
+                // TODO Place embedded sensor here with possible dead area in outside (see LCDD converter).
+                if (sensorNumber > 1)
                 {
                     throw new RuntimeException("Exceeded maximum of 2 sensors per module.");
                 }
                 // Flip 180 deg for 1st sensor.
-                if (sensor == 0)
+                if (sensorNumber == 0)
                 {
                     zrot = Math.PI;
-                }
-                ++sensor;
+                }                
+                String sensorName = componentName + "Sensor" + sensorNumber;
+                double sensorX = component.getDimensionX();
+                if (sensorX > moduleX)
+                    throw new RuntimeException("Sensor X dimension " + sensorX + " is too big for module.");
+                double sensorY = component.getDimensionY();
+                if (sensorY > moduleY)
+                    throw new RuntimeException("Sensor Y dimension " + sensorY + " is too big for module.");
+                Box sensorBox = new Box(sensorName + "Box", sensorX / 2, sensorY / 2, componentThickness / 2);
+                LogicalVolume sensorVol = new LogicalVolume(sensorName, sensorBox, material);                
+                Translation3D sensorPosition = new Translation3D(0, 0, 0);
+                RotationGeant sensorRotation = new RotationGeant(0, 0, 0);
+                PhysicalVolume sensorPhysVol = new PhysicalVolume(new Transform3D(sensorPosition, sensorRotation), sensorName, sensorVol, componentVolume, sensorNumber);
+                //sensorPhysVol.addPhysVolID("sensor", sensor);                               
+                ++sensorNumber;
             }
             Translation3D position = new Translation3D(0., 0., posZ);
             RotationGeant rotation = new RotationGeant(0, 0, zrot);
-            PhysicalVolume pv = new PhysicalVolume(new Transform3D(position, rotation), componentName, volume, moduleVolume, componentNumber);
+            PhysicalVolume pv = new PhysicalVolume(new Transform3D(position, rotation), componentName, componentVolume, moduleVolume, componentNumber);
             pv.setSensitive(sensitive);
-
             posZ += componentThickness / 2;
         }
     }
@@ -291,10 +295,14 @@
                     IPhysicalVolume modulePhysVol = module.getGeometry().getPhysicalVolume();
                     IPhysicalVolumePath modulePath = module.getGeometry().getPath();
                     int sensorId = 0;
-                    for (IPhysicalVolume pv : modulePhysVol.getLogicalVolume().getDaughters())
+                    for (IPhysicalVolume componentPhysVol : modulePhysVol.getLogicalVolume().getDaughters())
                     {
-                        if (pv.isSensitive())
+                        if (componentPhysVol.getLogicalVolume().getDaughters().size() != 0)
                         {
+                        //if (pv.isSensitive())
+                        //{
+                            IPhysicalVolume sensorPhysVol = componentPhysVol.getLogicalVolume().getDaughters().get(0);
+                            
                             IIdentifierDictionary iddict = subdet.getDetectorElement().getIdentifierHelper().getIdentifierDictionary();
 
                             ExpandedIdentifier expId = new ExpandedIdentifier(iddict.getNumberOfFields());
@@ -322,13 +330,14 @@
 
                             IIdentifier id = iddict.pack(expId);
 
-                            String sensorPath = modulePath.toString() + "/" + pv.getName();
+                            String sensorPath = modulePath.toString() + "/" + componentPhysVol.getName() + "/" + sensorPhysVol.getName();
                             String sensorName = module.getName() + "_sensor" + sensorId;
 
                             SiSensor sensor = new SiSensor(sensorId, sensorName, module, sensorPath, id);
 
                             ++sensorId;
                         }
+                    //    }
                     }
                 }
             }
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