From 382d2a382b0c296c925adb2b3a61dca3902214c7 Mon Sep 17 00:00:00 2001 From: Johannes Schumann <johannes.schumann@fau.de> Date: Wed, 21 Apr 2021 22:44:03 +0200 Subject: [PATCH] Add first w2list fields --- km3buu/output.py | 41 +++++++++++++++++++++++++++++++------ km3buu/tests/test_output.py | 8 ++++---- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/km3buu/output.py b/km3buu/output.py index 36493c6..6ba0c0e 100644 --- a/km3buu/output.py +++ b/km3buu/output.py @@ -123,6 +123,31 @@ PARTICLE_MC_STATUS = { "NucleonClusterTarget": 16 } +W2LIST_LOOKUP = { + "PS": 0, + "EG": 1, + "XSEC_MEAN": 2, + "COLUMN_DEPTH": 3, + "P_EARTH": 4, + "WATER_INT_LEN": 5, + "P_SCALE": 6, + "BX": 7, + "BY": 8, + "ICHAN": 9, + "CC": 10, + "DISTAMAX": 11, + "WATERXSEC": 12, + "XSEC": 13, + "DXSEC": 14, + "TARGETA": 15, + "TARGETZ": 16, + "VERINCAN": 17, + "LEPINCAN": 18, + "N_RETRIES": 19 +} + +W2LIST_LENGTH = len(W2LIST_LOOKUP) + def read_nu_abs_xsection(filepath): """ @@ -492,6 +517,16 @@ def write_detector_file(gibuu_output, evt.w.push_back(geometry.volume) #w1 (can volume) evt.w.push_back(w2[mc_event_id]) #w2 evt.w.push_back(-1.0) #w3 (= w2*flux) + # Event Information (w2list) + evt.w2list.resize(W2LIST_LENGTH) + + evt.w2list[W2LIST_LOOKUP["TARGETA"]] = gibuu_output.A + evt.w2list[W2LIST_LOOKUP["TARGETZ"]] = gibuu_output.Z + evt.w2list[W2LIST_LOOKUP["BX"]] = bjorkenx[mc_event_id] + evt.w2list[W2LIST_LOOKUP["BY"]] = bjorkeny[mc_event_id] + evt.w2list[W2LIST_LOOKUP["CC"]] = ichan + evt.w2list[W2LIST_LOOKUP["ICHAN"]] = event.evType + # Vertex Position vtx_pos = np.array(geometry.random_pos()) # Direction @@ -535,12 +570,6 @@ def write_detector_file(gibuu_output, lep_out_trk.status = PARTICLE_MC_STATUS["StableFinalState"] evt.mc_trks.push_back(lep_out_trk) - # bjorken_y = 1.0 - float(event.lepOut_E / event.lepIn_E) - nu_in_trk.setusr('bx', bjorkenx[mc_event_id]) - nu_in_trk.setusr('by', bjorkeny[mc_event_id]) - nu_in_trk.setusr('ichan', ichan) - nu_in_trk.setusr("cc", is_cc) - evt.mc_trks.push_back(nu_in_trk) if tau_secondaries is not None: diff --git a/km3buu/tests/test_output.py b/km3buu/tests/test_output.py index 3e41fb1..b103d4c 100644 --- a/km3buu/tests/test_output.py +++ b/km3buu/tests/test_output.py @@ -118,10 +118,10 @@ class TestAANET(unittest.TestCase): np.testing.assert_allclose(evt.mc_tracks.pos_z, 208.57726764) usr = evt.mc_tracks.usr[0] # Bx - np.testing.assert_almost_equal(usr[0], 0.35479262672400624) + np.testing.assert_almost_equal(evt.w2list[7], 0.35479262672400624) # By - np.testing.assert_almost_equal(usr[1], 0.8167222969153614) + np.testing.assert_almost_equal(evt.w2list[8], 0.8167222969153614) # iChannel - np.testing.assert_equal(usr[2], 2) + np.testing.assert_equal(evt.w2list[9], 34) # CC/NC - np.testing.assert_equal(usr[3], 1) + np.testing.assert_equal(evt.w2list[10], 2) -- GitLab