Print

Print


Commit in GeomConverter/src/org/lcsim/geometry on MAIN
compact/converter/lcdd/TestBeamCalorimeter.java+1-1841.2 -> 1.3
subdetector/TestBeamCalorimeter.java+8-971.1 -> 1.2
+9-281
2 modified files
Modifications so that TestBeamCalorimeter uses new AbstractTestBeam class.

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
TestBeamCalorimeter.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- TestBeamCalorimeter.java	21 Sep 2005 06:14:15 -0000	1.2
+++ TestBeamCalorimeter.java	26 Sep 2005 18:14:16 -0000	1.3
@@ -19,196 +19,13 @@
  *
  * @author tonyj
  */
-class TestBeamCalorimeter extends LCDDSubdetector
+class TestBeamCalorimeter extends AbstractTestBeam
 {
     TestBeamCalorimeter(Element node) throws JDOMException
     {
         super(node);
     }
     
-    public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
-    {
-        String detectorName = node.getAttributeValue("name");
-        int id = node.getAttribute("id").getIntValue();
-        
-        Material air = lcdd.getMaterial("Air");
-        Solids solids = lcdd.getSolids();
-        Structure structure = lcdd.getStructure();
-        Volume motherVolume = lcdd.pickMotherVolume(this);
-        Define define = lcdd.getDefine();
-        
-        Element dimensions = node.getChild("dimensions");
-        double xdim = dimensions.getAttribute("x").getDoubleValue();
-        double ydim = dimensions.getAttribute("y").getDoubleValue();
-        double zdim = LayerFromCompactCnv.computeDetectorTotalThickness(node);
-        
-        Box envelopeBox = new Box(detectorName + "_box");
-        envelopeBox.setX(xdim);
-        envelopeBox.setY(ydim);
-        envelopeBox.setZ(zdim);
-        solids.addSolid(envelopeBox);
-        Volume envelopeVolume = new Volume(detectorName + "_envelope");
-        envelopeVolume.setSolid(envelopeBox);
-        envelopeVolume.setMaterial(air);
-        
-        double xpos = 0;
-        double ypos = 0;
-        double zpos = 0;
-        
-        Element positionElement = node.getChild("position");
-        
-        if ( positionElement != null )
-        {
-            Attribute posAttribute = positionElement.getAttribute("x");
-            if ( posAttribute != null )
-            {
-                xpos = posAttribute.getDoubleValue();
-            }
-            
-            posAttribute = positionElement.getAttribute("y");
-            if ( posAttribute != null )
-            {
-                ypos = posAttribute.getDoubleValue();
-            }
-            
-            posAttribute = positionElement.getAttribute("z");
-            if ( posAttribute != null )
-            {
-                zpos = posAttribute.getDoubleValue();
-            }
-        }
-        
-        Position envelopePosition = new Position(detectorName + "_position");
-        envelopePosition.setX(xpos);
-        envelopePosition.setY(ypos);
-        envelopePosition.setZ(zpos);
-        define.addPosition(envelopePosition);
-        
-        double layerZPos = -zdim / 2;
-        
-        int layerCount = 0;
-        int layerTypeCount = 0;
-        double maxLayerX = 0;
-        double maxLayerY = 0;
-        for ( Object lo : node.getChildren("layer") )
-        {
-            Element layer = (Element) lo;
-            
-            double layerX = xdim;
-            Attribute xattrib = layer.getAttribute("x");
-            if ( xattrib != null )
-            {
-                layerX = xattrib.getDoubleValue();
-            }
-            
-            double layerY = ydim;
-            Attribute yattrib = layer.getAttribute("y");
-            if ( yattrib != null )
-            {
-                layerY = yattrib.getDoubleValue();
-            }
-            
-            double layerZ = LayerFromCompactCnv.computeSingleLayerThickness(layer);
-            
-            int repeat = 1;
-            Attribute repeatAttrib = layer.getAttribute("repeat");
-            if ( repeatAttrib != null )
-            {
-                repeat = repeatAttrib.getIntValue();
-            }
-            
-            String layerVolumeName = detectorName + "_layerType" + layerTypeCount;
-            Box layerBox = new Box(layerVolumeName + "_box");
-            layerBox.setX(layerX);
-            layerBox.setY(layerY);
-            layerBox.setZ(layerZ);
-            solids.addSolid(layerBox);
-            
-            Volume layerVolume = new Volume(layerVolumeName);
-            layerVolume.setMaterial(air);
-            layerVolume.setSolid(layerBox);
-            
-            int sliceCount = 0;
-            double slicePosZ = -layerZ / 2;
-            for ( Object so : layer.getChildren("slice"))
-            { 
-                Element slice = (Element) so;
-                double sliceX = layerX;
-                double sliceY = layerY;
-                xattrib = slice.getAttribute("x");
-                if ( xattrib != null )
-                {
-                    sliceX = xattrib.getDoubleValue();
-                }
-                
-                yattrib = slice.getAttribute("y");
-                if ( yattrib != null )
-                {
-                    sliceY = yattrib.getDoubleValue();
-                }
-                double sliceZ = slice.getAttribute("thickness").getDoubleValue();
-                
-                Attribute s = slice.getAttribute("sensitive");
-                boolean sensitive = s != null && s.getBooleanValue();
-                
-                String sliceName = layerVolumeName + "_slice" + sliceCount;
-                
-                Box sliceBox = new Box(sliceName + "_box");
-                sliceBox.setX(sliceX);
-                sliceBox.setY(sliceY);
-                sliceBox.setZ(sliceZ);
-                solids.addSolid(sliceBox);
-                
-                Volume sliceVolume = new Volume(sliceName);
-                sliceVolume.setSolid(sliceBox);
-                Material sliceMaterial = lcdd.getMaterial(slice.getAttributeValue("material"));
-                sliceVolume.setMaterial(sliceMaterial);
-                if ( sensitive ) sliceVolume.setSensitiveDetector(sens);
-                structure.addVolume(sliceVolume);
-                
-                PhysVol slicePhysVol = new PhysVol(sliceVolume);
-                slicePhysVol.addPhysVolID("slice", sliceCount);
-                Position slicePosition = new Position(sliceName + "_position");
-                slicePosZ += sliceZ / 2;
-                slicePosition.setZ(slicePosZ);
-                slicePosZ += sliceZ / 2;
-                define.addPosition(slicePosition);
-                slicePhysVol.setPosition(slicePosition);
-                layerVolume.addPhysVol(slicePhysVol);
-                
-                ++sliceCount;
-            }
-            
-            structure.addVolume(layerVolume);
-            
-            for ( int i=0; i<repeat; i++)
-            {
-                String layerPhysVolName = detectorName + "_layer" + layerCount;
-                
-                PhysVol layerPhysVol = new PhysVol(layerVolume);
-                layerPhysVol.addPhysVolID("layer", layerCount);
-                
-                layerZPos += layerZ / 2;
-                Position layerPosition = new Position(layerPhysVolName + "_position");
-                define.addPosition(layerPosition);
-                layerPosition.setZ(layerZPos);
-                layerPhysVol.setPosition(layerPosition);
-                layerZPos += layerZ / 2;
-                
-                envelopeVolume.addPhysVol(layerPhysVol);
-                
-                ++layerCount;
-            }
-            ++layerTypeCount;
-        }
-        
-        structure.addVolume(envelopeVolume);
-        PhysVol envelopePhysVol = new PhysVol(envelopeVolume);
-        envelopePhysVol.addPhysVolID("system", id);
-        envelopePhysVol.setPosition(envelopePosition);
-        motherVolume.addPhysVol(envelopePhysVol);
-    }
-    
     public boolean isCalorimeter()
     {
         return true;

GeomConverter/src/org/lcsim/geometry/subdetector
TestBeamCalorimeter.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- TestBeamCalorimeter.java	3 Sep 2005 01:37:20 -0000	1.1
+++ TestBeamCalorimeter.java	26 Sep 2005 18:14:16 -0000	1.2
@@ -7,6 +7,7 @@
 
 package org.lcsim.geometry.subdetector;
 
+import org.lcsim.geometry.Calorimeter;
 import hep.physics.vec.Hep3Vector;
 import hep.physics.vec.BasicHep3Vector;
 import org.jdom.Attribute;
@@ -22,111 +23,21 @@
 /**
  * @author jeremym
  */
-public class TestBeamCalorimeter extends AbstractCalorimeter
-{
-    double x;
-    double y;
-    double z;
-    
-    Hep3Vector position;
-    
+public class TestBeamCalorimeter extends AbstractTestBeam
+        implements Calorimeter
+{    
     public TestBeamCalorimeter(Element node) throws JDOMException
     {
         super(node);
-        build(node);
-    }
-    
-    private void build(Element node) throws JDOMException
-    {
-        Element dimensions = node.getChild("dimensions");
-        
-        x = dimensions.getAttribute("x").getDoubleValue();
-        y = dimensions.getAttribute("y").getDoubleValue();
-        z = getLayering().getThickness();
-        
-        Element position = node.getChild("position");
-        
-        double posX=0;
-        double posY=0;
-        double posZ=0;
-        if ( position != null )
-        {
-            Attribute posAttrib = position.getAttribute("x");
-            if ( posAttrib != null )
-            {
-                posX = posAttrib.getDoubleValue();
-            }
-            posAttrib = position.getAttribute("y");
-            if ( posAttrib != null )
-            {
-                posY = posAttrib.getDoubleValue();
-            }
-            
-            posAttrib = position.getAttribute("z");
-            if ( posAttrib != null )
-            {
-                posZ = posAttrib.getDoubleValue();
-            }
-        }
-        
-        setPosition(new BasicHep3Vector(posX, posY, posZ));
-    }
-    
-    /** @return full maximum dimension in X */
-    public double getX()
-    {
-        return x;
-    }
-    
-    /** @return full maximum dimension in Y */
-    public double getY()
-    {
-        return y;
-    }
-    
-    /**
-     * @return full maximum dimension in Z, computed and cached at build time from
-     * layering thickness
-     */
-    public double getZ()
-    {
-        return z;
-    }
-    
-    public Hep3Vector getPosition()
-    {
-        return position;
     }
     
-    public void setPosition(Hep3Vector position)
+    public CalorimeterIDDecoder getCalorimeterIDDecoder()
     {
-        this.position = position;
+        return (CalorimeterIDDecoder)(getReadout().getIDDecoder() );
     }
     
-    public void appendHepRep(HepRepFactory factory, HepRep heprep)
+    public boolean isCalorimeter()
     {
-        HepRepInstanceTree instanceTree = heprep.getInstanceTreeTop("Detector","1.0");
-        HepRepTypeTree typeTree = heprep.getTypeTree("DetectorType","1.0");
-        HepRepType barrel = typeTree.getType("Barrel");
-        
-        HepRepType type = factory.createHepRepType(barrel, getName());
-        type.addAttValue("drawAs","Prism");
-        
-        HepRepInstance instance = factory.createHepRepInstance(instanceTree, type);
-        
-        Hep3Vector position = getPosition();
-        double x = getX()/2 + position.x();
-        double y = getY()/2 + position.y();
-        double z = getZ()/2 + position.z();
-        
-        factory.createHepRepPoint(instance, x, y, -z);
-        factory.createHepRepPoint(instance, x, -y, -z);
-        factory.createHepRepPoint(instance, -x, -y, -z);
-        factory.createHepRepPoint(instance, -x, y, -z);
-        
-        factory.createHepRepPoint(instance, x, y, z);
-        factory.createHepRepPoint(instance, x, -y, z);
-        factory.createHepRepPoint(instance, -x, -y, z);
-        factory.createHepRepPoint(instance, -x, y, z);        
+        return true;
     }
 }
\ No newline at end of file
CVSspam 0.2.8