Skip to content
Snippets Groups Projects
Commit 979dfc91 authored by Johannes Schumann's avatar Johannes Schumann
Browse files

Update tests for tau propagation/decay

parent 1c10a924
No related branches found
No related tags found
1 merge request!47Resolve "Muon Propagation"
...@@ -21,59 +21,49 @@ from thepipe.logger import get_logger ...@@ -21,59 +21,49 @@ from thepipe.logger import get_logger
import proposal as pp import proposal as pp
import awkward as ak import awkward as ak
from km3buu.propagation import propagate_lepton
from km3buu.geometry import *
from km3buu.propagation import *
pp.RandomGenerator.get().set_seed(1234) pp.RandomGenerator.get().set_seed(1234)
np.random.seed(1234)
class TestTauPropagation(unittest.TestCase): class TestTauPropagation(unittest.TestCase):
def setUp(self): def setUp(self):
data = ak.Array({ prop = Propagator([15, -15], CANVolume().make_proposal_geometries())
"lepOut_E": [ self.position = np.array([10.0, 10.0, 100.0])
17.45830624434573, 3.1180989952362594, 21.270059768902005, self.direction = np.array([1., 1., 0])
5.262659790136034, 23.52185741888274 self.energy = 10.0
], self.sec = prop.propagate(15, self.energy, self.position,
"lepOut_Px": [ self.direction)
-0.42224402086330426, -1.0232258668453014, -0.5801431899058521,
-0.9038349288874724, 0.9022573877437422
],
"lepOut_Py": [
0.3644190693190108, -0.24542303987320932, 0.24499631087268617,
-1.1060562370375715, -3.982173292871768
],
"lepOut_Pz": [
17.35867612031871, 2.336148261778657, 21.186342871282157,
4.743161507744377, 23.096499191566885
]
})
self.sec = propagate_lepton(data, 15)
def test_secondary_momenta(self): def test_secondary_momenta(self):
np.testing.assert_array_almost_equal(np.array(self.sec[0].E), np.testing.assert_array_almost_equal(np.array(self.sec.E),
[2.182, 13.348, 1.928], [4.141, 5.761, 0.098],
decimal=3) decimal=3)
np.testing.assert_array_almost_equal(np.array(self.sec[0].Px), np.testing.assert_array_almost_equal(np.array(self.sec.Px),
[0.295, -0.48, -0.237], [3.271, 3.696, -0.009],
decimal=3) decimal=3)
np.testing.assert_array_almost_equal(np.array(self.sec[0].Py), np.testing.assert_array_almost_equal(np.array(self.sec.Py),
[-0.375, 0.784, -0.044], [2.48 , 4.382, 0.097],
decimal=3) decimal=3)
np.testing.assert_array_almost_equal(np.array(self.sec[0].Pz), np.testing.assert_array_almost_equal(np.array(self.sec.Pz),
[2.129, 13.316, 1.913], [-0.549, 0.564, -0.015],
decimal=3) decimal=3)
def test_secondary_types(self): def test_secondary_types(self):
np.testing.assert_array_equal(np.array(self.sec[0].barcode), np.testing.assert_array_equal(np.array(self.sec.barcode),
[13, 16, -14]) [11, 16, -12])
def test_secondary_positions(self): def test_secondary_positions(self):
np.testing.assert_array_almost_equal(np.array(self.sec[0].x), np.testing.assert_array_almost_equal(np.array(self.sec.x),
[-1.4e-05, -1.4e-05, -1.4e-05], [10.0,10.0,10.0],
decimal=1) decimal=1)
np.testing.assert_array_almost_equal(np.array(self.sec[0].y), np.testing.assert_array_almost_equal(np.array(self.sec.y),
[1.2e-05, 1.2e-05, 1.2e-05], [10.0,10.0,10.0],
decimal=1) decimal=1)
np.testing.assert_array_almost_equal(np.array(self.sec[0].z), np.testing.assert_array_almost_equal(np.array(self.sec.z),
[0., 0., 0.], [100., 100., 100.],
decimal=1) decimal=1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment