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

Merge branch '9-bjorken-y' into 'master'

Resolve "Bjorken Y"

Closes #9

See merge request !31
parents f504b379 32ad7d6f
No related branches found
No related tags found
1 merge request!31Resolve "Bjorken Y"
Pipeline #27871 failed
......@@ -498,14 +498,19 @@ class GiBUUOutput:
def bjorken_y(roottuple_data):
"""
Calculate Bjorken y scaling variable for the GiBUU events
(Lab. frame)
Definition: y = pq/pk
Parameters
----------
roottuple_data: awkward.highlevel.Array
"""
d = roottuple_data
y = 1 - np.divide(np.array(d.lepOut_E), np.array(d.lepIn_E))
q = GiBUUOutput._q(d)
pq = q[0, :] * d.nuc_E - q[1, :] * d.nuc_Px - q[2, :] * d.nuc_Py - q[
3, :] * d.nuc_Pz
pk = d.lepIn_E * d.nuc_E - d.lepIn_Px * d.nuc_Px - d.lepIn_Py * d.nuc_Py - d.lepIn_Pz * d.nuc_Pz
y = pq / pk
return y
@property
......
......@@ -37,6 +37,7 @@ except ModuleNotFoundError:
class TestXSection(unittest.TestCase):
def test_xsection_all(self):
filename = join(TESTDATA_DIR, XSECTION_FILENAMES["all"])
xsection = read_nu_abs_xsection(filename)
......@@ -47,6 +48,7 @@ class TestXSection(unittest.TestCase):
class TestGiBUUOutput(unittest.TestCase):
def setup_class(self):
self.output = GiBUUOutput(TESTDATA_DIR)
......@@ -91,6 +93,7 @@ class TestGiBUUOutput(unittest.TestCase):
@pytest.mark.skipif(not KM3NET_LIB_AVAILABLE,
reason="KM3NeT dataformat required")
class TestOfflineFile(unittest.TestCase):
def setUp(self):
output = GiBUUOutput(TESTDATA_DIR)
datafile = NamedTemporaryFile(suffix=".root")
......@@ -133,7 +136,7 @@ class TestOfflineFile(unittest.TestCase):
# Bx
np.testing.assert_almost_equal(evt.w2list[7], 0.35479262672400624)
# By
np.testing.assert_almost_equal(evt.w2list[8], 0.8167222969153614)
np.testing.assert_almost_equal(evt.w2list[8], 0.8203215908456797)
# iChannel
np.testing.assert_equal(evt.w2list[9], 3)
# CC/NC
......@@ -145,6 +148,7 @@ class TestOfflineFile(unittest.TestCase):
@pytest.mark.skipif(not KM3NET_LIB_AVAILABLE,
reason="KM3NeT dataformat required")
class TestMultiFileOutput(unittest.TestCase):
def setUp(self):
output = GiBUUOutput(TESTDATA_DIR)
datafile = NamedTemporaryFile(suffix=".root")
......@@ -190,7 +194,7 @@ class TestMultiFileOutput(unittest.TestCase):
# Bx
np.testing.assert_almost_equal(evt.w2list[7], 0.35479262672400624)
# By
np.testing.assert_almost_equal(evt.w2list[8], 0.8167222969153614)
np.testing.assert_almost_equal(evt.w2list[8], 0.8203215908456797)
# iChannel
np.testing.assert_equal(evt.w2list[9], 3)
# CC/NC
......@@ -221,7 +225,7 @@ class TestMultiFileOutput(unittest.TestCase):
# Bx
np.testing.assert_almost_equal(evt.w2list[7], 0.35479262672400624)
# By
np.testing.assert_almost_equal(evt.w2list[8], 0.8167222969153614)
np.testing.assert_almost_equal(evt.w2list[8], 0.8203215908456797)
# iChannel
np.testing.assert_equal(evt.w2list[9], 3)
# CC/NC
......
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