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

Merge branch 'Qsquared' into 'master'

Add Q² to the output dataset

See merge request !15
parents 41f5df54 c7bb7619
No related branches found
No related tags found
1 merge request!15Add Q² to the output dataset
Pipeline #22707 passed
......@@ -346,13 +346,10 @@ class GiBUUOutput:
return retval
@staticmethod
def bjorken_x(roottuple_data):
def _q(roottuple_data):
"""
Calculate Bjorken x variable for the GiBUU events
Parameters
----------
roottuple_data: awkward.highlevel.Array
Calculate the difference of the four vectors from
in and out going lepton (k_in - k_out)
"""
d = roottuple_data
k_in = np.vstack([
......@@ -368,8 +365,39 @@ class GiBUUOutput:
np.array(d.lepOut_Pz)
])
q = k_in - k_out
return q
@staticmethod
def Qsquared(roottuple_data):
"""
Calculate the passed energy from the neutrino interaction to the
nucleus denoted by the variable Q²
Parameters
----------
roottuple_data: awkward.highlevel.Array
Returns
-------
"""
q = GiBUUOutput._q(roottuple_data)
qtmp = np.power(q, 2)
q2 = qtmp[0, :] - np.sum(qtmp[1:4, :], axis=0)
return q2
@staticmethod
def bjorken_x(roottuple_data):
"""
Calculate Bjorken x variable for the GiBUU events
Parameters
----------
roottuple_data: awkward.highlevel.Array
"""
d = roottuple_data
q = GiBUUOutput._q(d)
q2 = GiBUUOutput.Qsquared(d)
pq = q[0, :] * d.nuc_E - q[1, :] * d.nuc_Px - q[2, :] * d.nuc_Py - q[
3, :] * d.nuc_Pz
x = np.divide(-q2, 2 * pq)
......@@ -439,6 +467,7 @@ class GiBUUOutput:
retval["xsec"] = self._event_xsec(retval)
retval["Bx"] = GiBUUOutput.bjorken_x(retval)
retval["By"] = GiBUUOutput.bjorken_y(retval)
retval["Q2"] = GiBUUOutput.Qsquared(retval)
return retval
@property
......
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