Print

Print


Commit in GeomConverter on MAIN
src/org/lcsim/material/MaterialCalculator.java+19-171.6 -> 1.7
test/org/lcsim/material/BetheBlockTest.java+1-11.1 -> 1.2
+20-18
2 modified files
JM: Fixes to Bethe-Bloch function from Jason Gray.

GeomConverter/src/org/lcsim/material
MaterialCalculator.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- MaterialCalculator.java	11 Jan 2006 00:18:44 -0000	1.6
+++ MaterialCalculator.java	14 Jan 2006 00:47:32 -0000	1.7
@@ -109,29 +109,28 @@
     //public static final double clight = 2.99792458e08; // m/s
     
     // FIXME: add path length as in Lelaps
-    // FIXME: add delta term
     // FIXME: debug and check output (Matprop)
     // FIXME: take out debug prints when completed
-    public static double computeBetheBlock(Material material, double[] particleMomentum, double particleMass, double particleCharge)
+    public static double computeBetheBloch(Material material, double[] pT, double mass, double charge)
     {
-        assert( particleMomentum.length == 3);
+        assert( pT.length == 3);
         
         double zeff = material.getZeff();
         double aeff = material.getAeff();
-        
-        /* K matches PDG, pg. 238 --> 0.307075 in MeV g-1 cm2 */
-        double K = ( (4*PI) * N_A * (r_e * r_e) * M_e ) / aeff;
         double ZoverA = zeff / aeff;
         
-        double z2 = particleCharge * particleCharge;
+        /* K matches PDG, pg. 238 --> 0.307075 in MeV g-1 cm2 */
+        double K = ( (4*PI) * N_A * (r_e * r_e) * M_e );         
+                
+        double z2 = charge * charge;
         
         double mag2 =
-                particleMomentum[0] * particleMomentum[0] +
-                particleMomentum[1] * particleMomentum[1] +
-                particleMomentum[2] * particleMomentum[2];
+                pT[0] * pT[0] +
+                pT[1] * pT[1] +
+                pT[2] * pT[2];
         
         double beta2 =
-                mag2 / (particleMass * particleMass + mag2);
+                mag2 / (mass * mass + mag2);
         
         System.out.println("beta2 = " + beta2);
         
@@ -139,7 +138,7 @@
         System.out.println("coeff1 = " + coeff1);
         // end first coefficient calc
         
-        double gamma = 1 / ( sqrt(1 + beta2) );
+        double gamma = 1 / ( sqrt(1 - beta2) );
         double gamma2 = gamma * gamma;
         
         System.out.println("gamma2 = " + gamma2);
@@ -149,7 +148,7 @@
         
         System.out.println("numer_T_max = " + numer_T_max);        
         double denom_T_max =
-                1 + ( 2 * gamma * M_e / particleMass ) + pow( ( M_e / particleMass), 2);
+                1 + ( 2 * gamma * M_e / mass ) + pow( ( M_e / mass), 2);
         System.out.println("denom_T_max = " + denom_T_max);
         
         double T_max = numer_T_max / denom_T_max;
@@ -195,7 +194,7 @@
         plasmaE *= 1e-6;
         //
         
-        double delta = log(plasmaE / I) + log((sqrt(beta2) * gamma)) - 1/2;
+        double delta = log(plasmaE / I) + log((sqrt(beta2) * gamma)) - 0.5;
         System.out.println("delta = " + delta);
         
         double coeff2 = 0.5 * ( log ( ( 2 * M_e * beta2 * gamma2 * T_max ) / I2 ));
@@ -205,12 +204,15 @@
         _num = _num / I2;
         System.out.println("numerator / i2 = " + _num);
         System.out.println("coeff2 = " + coeff2);
+
         coeff2 -= beta2;
-//        coeff2 -= ( delta / 2 );
-        System.out.println("coeff2 (final) = " + coeff2);
+        System.out.println("coeff2 - beta2 = " + coeff2);
+        
+        coeff2 -= delta;
+        System.out.println("coeff2 - delta = " + coeff2);
         
         double result = coeff1 * coeff2;
-        System.out.println("final dEdX = " + result);
+        System.out.println("dEdX result = " + result);
         System.out.println("----");
         return result;
     }

GeomConverter/test/org/lcsim/material
BetheBlockTest.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- BetheBlockTest.java	11 Jan 2006 00:18:44 -0000	1.1
+++ BetheBlockTest.java	14 Jan 2006 00:47:33 -0000	1.2
@@ -43,7 +43,7 @@
         double mass = 1.0;
         //double mass = 1.0;
         
-        double dEdx = MaterialCalculator.computeBetheBlock(material, pT, mass, 1.0);
+        double dEdx = MaterialCalculator.computeBetheBloch(material, pT, mass, 1.0);
         System.out.println("result = " + dEdx);
     }
 }
\ No newline at end of file
CVSspam 0.2.8