Print

Print


Author: [log in to unmask]
Date: Thu Apr  2 11:49:46 2015
New Revision: 3583

Log:
Convert from Geant4 internal units (where 1 Tesla is equal to 0.001) to Tesla

Modified:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/field/FieldMap3D.java
    projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/field/FieldMap3DTest.java

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/field/FieldMap3D.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/field/FieldMap3D.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/field/FieldMap3D.java	Thu Apr  2 11:49:46 2015
@@ -106,7 +106,9 @@
         // now ready to read in the values in the table
         // format is:
         // x y z Bx By Bz
+        // Recall that in Geant4 internal units 1 Tesla is equal to 0.001 so convert
         //
+        int conversionFactor = 1000;
         int ix, iy, iz;
         double xval = 0.;
         double yval = 0.;
@@ -120,9 +122,9 @@
                     xval = Double.parseDouble(st.nextToken());
                     yval = Double.parseDouble(st.nextToken());
                     zval = Double.parseDouble(st.nextToken());
-                    bx = Double.parseDouble(st.nextToken());
-                    by = Double.parseDouble(st.nextToken());
-                    bz = Double.parseDouble(st.nextToken());
+                    bx = Double.parseDouble(st.nextToken())*conversionFactor;
+                    by = Double.parseDouble(st.nextToken())*conversionFactor;
+                    bz = Double.parseDouble(st.nextToken())*conversionFactor;
                     if (ix == 0 && iy == 0 && iz == 0) {
                         _minx = xval;
                         _miny = yval;

Modified: projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/field/FieldMap3DTest.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/field/FieldMap3DTest.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/geometry/field/FieldMap3DTest.java	Thu Apr  2 11:49:46 2015
@@ -40,12 +40,12 @@
         // field at first map position should be zero since we offset the field
         testFieldAt(map, fp[0], fp[1], fp[2], 0, 0, 0);
         // field at first map position with offset included should equal first field values
-        testFieldAt(map, fp[0] + off[0], fp[1] + off[1], fp[2] + off[2], 0, -0.0019, 0);
+        testFieldAt(map, fp[0] + off[0], fp[1] + off[1], fp[2] + off[2], 0, -1.9, 0);
         // field at the origin
-        testFieldAt(map, 0.0 + off[0], -8.9 + off[1], 0.0 + off[2], 0., -0.5006, 0.);
+        testFieldAt(map, 0.0 + off[0], -8.9 + off[1], 0.0 + off[2], 0., -500.6, 0.);
         // this field map is invariant in y, test this...
-        testFieldAt(map, 0.0 + off[0], 0. + off[1], 0.0 + off[2], 0., -0.5006, 0.);
-        testFieldAt(map, 0.0 + off[0], 8.9 + off[1], 0.0 + off[2], 0., -0.5006, 0.);
+        testFieldAt(map, 0.0 + off[0], 0. + off[1], 0.0 + off[2], 0., -500.6, 0.);
+        testFieldAt(map, 0.0 + off[0], 8.9 + off[1], 0.0 + off[2], 0., -500.6, 0.);
 
         //TODO check interpolation more rigorously
         //check all variations of accessor methods (why do we have SO many?!

########################################################################
Use REPLY-ALL to reply to list

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