Exemplo n.º 1
0
 def test_eloss_with_4he(self):
     en = 1.
     m = 4
     z = 2
     res = self.he.energy_loss(en, m, z)
     bth = pytpc.gases.bethe(rel.beta(en, m*p_mc2), z, self.he.electron_density_per_m3, self.he.mean_exc_pot)
     self.assertAlmostEqual(res, bth, delta=10)
Exemplo n.º 2
0
 def test_eloss_with_4he(self):
     en = 1.
     m = 4
     z = 2
     res = self.he.energy_loss(en, m, z)
     bth = pytpc.gases.bethe(rel.beta(en, m * p_mc2), z,
                             self.he.electron_density_per_m3,
                             self.he.mean_exc_pot)
     self.assertAlmostEqual(res, bth, delta=10)
Exemplo n.º 3
0
    def energy_loss(self, en, proj_mass, proj_charge):
        """Finds the energy loss of a projectile in the gas.

        This default version uses the Bethe formula (defined by the function `bethe`) to calculate the energy loss.
        This function may be overridden with an empirical fit to give better results.

        Parameters
        ----------
        en : float
            The kinetic energy of the projectile, in MeV
        proj_mass : int
            The mass number of the projectile
        proj_charge : int
            The charge number of the projectile

        Returns
        -------
        dedx : float
            The stopping power in MeV/m
        """
        beta = rel.beta(en, proj_mass * p_mc2)
        return bethe(beta, proj_charge, self.electron_density_per_m3, self.mean_exc_pot)
Exemplo n.º 4
0
    def energy_loss(self, en, proj_mass, proj_charge):
        """Finds the energy loss of a projectile in the gas.

        This default version uses the Bethe formula (defined by the function `bethe`) to calculate the energy loss.
        This function may be overridden with an empirical fit to give better results.

        Parameters
        ----------
        en : float
            The kinetic energy of the projectile, in MeV
        proj_mass : int
            The mass number of the projectile
        proj_charge : int
            The charge number of the projectile

        Returns
        -------
        dedx : float
            The stopping power in MeV/m
        """
        beta = rel.beta(en, proj_mass * p_mc2)
        return bethe(beta, proj_charge, self.electron_density_per_m3, self.mean_exc_pot)
Exemplo n.º 5
0
 def test_value(self):
     for e in range(1, 40):
         for m in range(1, 40):
             exp = (sqrt(e) * sqrt(e + 2 * m)) / (e + m)
             self.assertAlmostEqual(rel.beta(en=e, mass=m), exp, places=5)
Exemplo n.º 6
0
 def test_zero_energy(self):
     self.assertEqual(rel.beta(0.0, 4), 0)
Exemplo n.º 7
0
 def test_zero_mass(self):
     self.assertEqual(rel.beta(4, 0), 1)
Exemplo n.º 8
0
 def test_value(self):
     for e in range(1, 40):
         for m in range(1, 40):
             exp = (sqrt(e) * sqrt(e + 2*m)) / (e + m)
             self.assertAlmostEqual(rel.beta(en=e, mass=m), exp, places=5)
Exemplo n.º 9
0
 def test_zero_energy(self):
     self.assertEqual(rel.beta(0.0, 4), 0)
Exemplo n.º 10
0
 def test_zero_mass(self):
     self.assertEqual(rel.beta(4, 0), 1)
Exemplo n.º 11
0
 def beta(self):
     """The particle's beta, or v/c"""
     en = self.energy
     m = self.mass
     return rel.beta(en, m)