Print

Print


Commit in GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd on MAIN
HPSEcal.java+31-51.3 -> 1.4
checkpoint

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
HPSEcal.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- HPSEcal.java	13 Apr 2011 19:47:31 -0000	1.3
+++ HPSEcal.java	13 Apr 2011 20:06:42 -0000	1.4
@@ -29,7 +29,7 @@
  * @author Jeremy McCormick
  * @author Tim Nelson
  * 
- * @version $Id: HPSEcal.java,v 1.3 2011/04/13 19:47:31 jeremy Exp $
+ * @version $Id: HPSEcal.java,v 1.4 2011/04/13 20:06:42 jeremy Exp $
  */
 public class HPSEcal extends LCDDSubdetector
 {
@@ -93,6 +93,17 @@
         // Odd or even number of crystals in X.
         boolean oddx = (nx % 2 != 0);
         
+        // Calculate number of X for loop.
+        if (oddx)
+        {
+            nx -= 1;
+            nx /= 2;
+        }
+        else
+        {
+            nx /= 2;
+        }
+        
         double thetax = 0;
         double ycenter = 0;
         double zcorrtot = 0;
@@ -100,7 +111,7 @@
                         
         //double fudgeFactor = .01;
         
-        for (int ix=0; ix<nx; ix++)
+        for (int ix=0; ix<=nx; ix++)
         {
             System.out.println("ix="+ix);
             
@@ -134,17 +145,32 @@
             System.out.println();
             
             Position ipos = 
-                new Position("crystal"+ix+"_pos", xcenter, ycenter, zcenter);
+                new Position("crystal"+ix+"_pos_pos", xcenter, ycenter, zcenter);
             Rotation irot = 
-                new Rotation("crystal"+ix+"_rot", thetax, -thetay, thetaz);
+                new Rotation("crystal"+ix+"_rot_pos", thetax, -thetay, thetaz);
             
             define.addPosition(ipos);
             define.addRotation(irot);            
                 
             // Place crystal.
-            PhysVol crystalPlacement = new PhysVol(crystalLogVol, mother, ipos, irot);
+            PhysVol posCrystalPlacement = new PhysVol(crystalLogVol, mother, ipos, irot);
             // TODO Add PhysVolID.
             
+            // Reflection to negative.
+            if (ix != 0)
+            {
+                Position iposneg = 
+                    new Position("crystal"+ix+"_pos_neg", -xcenter, ycenter, zcenter);
+                Rotation irotneg =                 
+                    new Rotation("crystal"+ix+"_rot_neg", thetax, thetay, thetaz);
+                
+                define.addPosition(iposneg);
+                define.addRotation(irotneg);
+                
+                PhysVol negCrystalPlacement = new PhysVol(crystalLogVol, mother, iposneg, irotneg);
+                // TODO Add PhysVolID.
+            }
+            
             // Increment running X and Z totals.
             xcorrtot += xcorr;
             zcorrtot += zcorr;
CVSspam 0.2.8