From 4c13908bf8c365c989985d6af1664ca84006346c Mon Sep 17 00:00:00 2001 From: Vitor Shen <17490173+shenvitor@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:22:57 +0200 Subject: [PATCH] temporary more addressing comments version --- docs/report/999.ipynb | 265 ++++++++++++++++++++++++++++++++---------- 1 file changed, 202 insertions(+), 63 deletions(-) diff --git a/docs/report/999.ipynb b/docs/report/999.ipynb index a2a5c7c9..112bdbc3 100644 --- a/docs/report/999.ipynb +++ b/docs/report/999.ipynb @@ -14,10 +14,10 @@ "cell_type": "markdown", "metadata": { "tags": [ - "documentation", - "jupyter", - "sphinx", - "3d" + "3d", + "kinematics", + "physics", + "tutorial" ] }, "source": [ @@ -234,19 +234,32 @@ "Overall,\n", "the $\\eta$, $\\pi^0$ and $p$ are all treated as spin-0 particles.\n", "\n", - "This means that the total intrinsic spin $s$ is ignored in this model,\n", - "the total angular momentum \n", - "$J$ of the system or any subsystems within this model will solely depend on the orbital angular momentum \n", - "$L$, characterized by the quantum number $l$.\n", - "And this simplifies the use of the spherical harmonics $Y_l^m(\\theta,\\phi)$,\n", - "since only the orbital angular momentum component is involved, and thus the combination of contribution is not considered (e.g. Clebsch-Gordan Coefficients).\n", + "The primary motivation for assuming proton to be spin-0 is to avoid the necessity of aligning the amplitudes. \n", + "This assumption enables the intensity $I$ to be written as a coherent sum of the amplitudes of the subsystems without the need for additional Wigner rotations.\n", + "\n", + "This model assumes that the total intrinsic spin $s$ is ignored, \n", + "meaning that the total angular momentum $J$ of the system or any subsystems within this model solely depends on the orbital angular momentum $L$,\n", + "characterized by the quantum number $l$. \n", + "This simplification allows us to use spherical harmonics $Y_l^m(\\theta,\\phi)$ more straightforwardly, \n", + "as only the orbital angular momentum component is involved, \n", + "and combinations such as Clebsch-Gordan coefficients are not considered.\n", + "\n", + "In this context, the spherical harmonics are relevant only to the resonances. \n", + "Here, $l$ represents the spin of the resonances, \n", + "and $m$ represents the spin projection. \n", + "The total angular momentum and coupled spin (for the two-body state of the two decay products of the resonance) are not considered. \n", + "According to Richman and other classical references on helicity, \n", + "this is known as the helicity basis, \n", + "as opposed to the canonical basis where both $L$ and $S$ values are used, \n", + "resulting in a more complex coherent sum. \n", + "The transformation between these bases can be found in resources such as [AmpForm](https://ampform.rtfd.io/stable/usage/helicity/formalism.html).\n", "\n", "In our case: \n", - "- $A^{12}$ amplitude represents a d-wave interaction, as indicated by $l=2$.\n", + "- $A^{12}$ amplitude represents a d-wave interaction, because we assume there is a $a_2$ resonance (spin 2) in this subsystem.\n", " - The possible $m$ values are $−2,−1,0,1,2$. Each of these values corresponds to different orientations of the d-wave. The wave type is solely determined by $l$ and all these $m$ values still describe d-wave characteristics.\n", - "- $A^{23}$ amplitude represents a p-wave interaction, as indicated by $l=1$.\n", + "- $A^{23}$ amplitude represents a p-wave interaction, because we assume this subsystem has a (spin-1) $\\Delta^+$ resonance.\n", " - The possible $m$ values are $−1,0,1$. Each of these values corresponds to different orientations of the p-wave. Similarly, these values are all p-wave orientations.\n", - "- $A^{31}$ amplitude represents a s-wave interaction, as indicated by $l=0$.\n", + "- $A^{31}$ amplitude represents a s-wave interaction, because we assume there is one spin-0 $N^*$ resonance in this subsystem.\n", " - The only possible $m$ value is 0, which is consistent with the spherical symmetry of s-waves.\n", ":::" ] @@ -299,11 +312,11 @@ "In this section, the phase space of this reaction is generated using [`phasespace`](https://github.com/zfit/phasespace) python package.\n", "\n", "Phase space represents the set of all possible states (positions and momenta) of a system.\n", - "It is critical for understanding the outcomes of particle collisions, decays, and interactions.\n", - "It allows physicists to calculate the likelihood of various final states given a set of initial conditions, taking into account conservation laws (energy, momentum, angular momentum, etc.).\n", - "The volume of phase space available for a particular process is directly related to the probability of that process occurring.\n", + "Understanding phase space is essential for analyzing particle collisions, decays, and interactions. It involves calculating the likelihood of different final states from given initial conditions while obeying conservation laws (energy, momentum, angular momentum, etc.). The available phase space volume for a process directly correlates with the probability of that process occurring.\n", "\n", - "Firstly, in center-of-mass (CM) frame the 4-momentum of the total system can be acquired by 4-momentum conservation:" + "In the following, variables that are not labeled with \"lab\" are in the CM frame.\n", + "\n", + "Firstly, some kinematic considerations. In Center-of-Mass (CM) frame the 4-momentum of the total system can be acquired by 4-momentum conservation:" ] }, { @@ -379,9 +392,7 @@ "tags": [] }, "source": [ - "The [GlueX](http://www.gluex.org/) experiment at Jefferson Lab uses a fixed proton target with a linearly polarized photon beam, and the beam energy range in the lab frame is typically from [**8 to 9 GeV**](https://doi.org/10.7566/JPSCP.26.022002).\n", - "\n", - "In the following, the variables without labelling of 'lab' is in the CM frame, those with labels of 'lab' is in the lab frame." + "The [GlueX](http://www.gluex.org/) experiment at Jefferson Lab uses a fixed proton target with a linearly polarized photon beam, and the beam energy range in the lab frame is typically from [**8 to 9 GeV**](https://doi.org/10.7566/JPSCP.26.022002)." ] }, { @@ -394,29 +405,57 @@ "\n", "$$\n", "E_{\\gamma, lab} = 8.5 \\; GeV\n", - "$$ \n", + "$$ (beam_energy_label)\n", + "\n", + "From this, we can calculate the energy of the gamma in the CM frame as follows.\n", "\n", "The four-momentum of photon (beam) in the lab frame:\n", - "$p_{\\gamma,lab} = (E_{\\gamma}, \\vec{p}_{\\gamma,lab})$\n", "\n", - "Since photon is massless $m_{\\gamma}=0$, with $m^2 = E^2 - \\vec{p}^2$ and thus $E_{\\gamma} = |\\vec{p_{\\gamma}}|$\n", + "$$\n", + "p_{\\gamma,lab} = (E_{\\gamma, lab}, \\vec{p}_{\\gamma,lab})\n", + "$$ (beam_four_momentum)\n", + "\n", + "Since photon is massless, \n", + "\n", + "$$\n", + "m_{\\gamma}=0\n", + "$$ (massless_photon)\n", + "\n", + "with \n", + "\n", + "$$\n", + "m^2 = E^2 - \\vec{p}^2\n", + "$$ (four_momentum_conservation)\n", + "\n", + "and thus,\n", + "\n", + "$$\n", + "E_{\\gamma} = |\\vec{p_{\\gamma}}| .\n", + "$$ (gamma_energy)\n", "\n", "The four-momentum of proton (target) in the lab frame:\n", - "$p_{p,lab} = (m_p, \\vec{0})$\n", "\n", - "with $m_p$ is the proton mass\n", + "$$\n", + "p_{p,lab} = (m_p, \\vec{0})\n", + "$$ (four_momentum_target_lab)\n", + "\n", + "where $m_p$ is the proton mass.\n", "\n", "We have the total four-momentum in lab frame:\n", "\n", - "$p_{tot,lab} = p_{\\gamma,lab} + p_{p,lab}$\n", + "$$\n", + "p_{tot,lab} = p_{\\gamma,lab} + p_{p,lab}\n", + "$$ (total_four_momentum_lab_frame)\n", "\n", - "$E_{p} = \\sqrt { p_{p}^2+ m_{p}^2}$\n", + "$$\n", + "E_{p} = \\sqrt { p_{p}^2+ m_{p}^2}\n", + "$$ (label_p_four_momentum)\n", "\n", "From the **lab frame** perspective, the CM total energy with expression in quantities from the **lab frame** is thus:\n", "\n", "$$\n", "\\sqrt{s} = E_0 = m_0 = \\sqrt{2 E_{\\gamma,lab} m_p + m_p^2}\n", - "$$" + "$$ (lab_frame_CM_total_energy)" ] }, { @@ -429,7 +468,7 @@ "\n", "$$\n", "\\sqrt{s} = E_0 = m_0 = |p_{z}|+\\sqrt{p_{z}^2 + m_p^2}\n", - "$$" + "$$ (total_energy_CM_frame_still)" ] }, { @@ -451,9 +490,7 @@ "tags": [] }, "source": [ - ":::{important}\n", - "Beam energy in the Lab frame as input value, and then we find the total energy in the CM frame and do the calculation in CM frame for analysis afterwards. \n", - ":::" + "Our implementation based on Equation {eq}`lab_frame_CM_total_energy` thus becomes:" ] }, { @@ -528,7 +565,7 @@ "tags": [] }, "source": [ - "The [`phasespace`](https://github.com/zfit/phasespace) library is a Python package designed to simulate particle decays according to the principles of relativistic kinematics and phase space distributions. It is particularly useful for high-energy physics experiments where understanding the decay processes and resulting particle distributions is crucial.\n", + "The [`phasespace`](https://github.com/zfit/phasespace) library is a Python package designed to simulate particle decays according to the principles of relativistic kinematics and phase space distributions. \n", "\n", "We use the [`phasespace`](https://github.com/zfit/phasespace) to generate decay particles (4-momentum and weights):" ] @@ -541,14 +578,9 @@ }, "outputs": [], "source": [ - "pγ_mass = m_0\n", - "eta_mass = m_eta\n", - "pi_mass = m_pi\n", - "p_mass = m_proton\n", - "\n", - "weights, particles = phasespace.nbody_decay(\n", - " pγ_mass, [eta_mass, pi_mass, p_mass]\n", - ").generate(n_events=phsp_events)" + "weights, particles = phasespace.nbody_decay(m_0, [m_eta, m_pi, m_proton]).generate(\n", + " n_events=phsp_events\n", + ")" ] }, { @@ -557,8 +589,19 @@ "tags": [] }, "source": [ - ":::{note}\n", - "**Weights**: When generating decay events, weights are used to account for the probability distributions of different decay configurations. These are crucial for simulating realistic physical processes.\n", + ":::{admonition}\n", + "**weights**:\n", + "the statistical weights for each generated event. These weights represent how likely each particular event configuration (set of momenta and energies) is, based on phase space considerations.\n", + ":::" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + ":::{admonition}\n", + "**`particles`**:\n", + "this (python array) contains the information of the generated four-momenta (energy and momentum components) of the decay products for each event. \n", ":::" ] }, @@ -577,7 +620,22 @@ "tags": [] }, "source": [ - "The 4-momentum of decay particles $\\eta$ (1), $\\pi$ (2), and $p$ (3) in phase space to be generated:" + "The following code defines some functions for generating a phase space sample of 4-momenta." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "pγ_mass = m_0\n", + "eta_mass = m_eta\n", + "pi_mass = m_pi\n", + "p_mass = m_proton\n", + "n_final_state = 3" ] }, { @@ -587,13 +645,12 @@ "mystnb": { "code_prompt_show": "(Click to show) These are some functions that we defined for a structured process for generating phase space samples of particle decays and converting them into four-momentum vectors using TensorFlow and the phasespace Python package." }, - "tags": [] + "tags": [ + "scroll-input" + ] }, "outputs": [], "source": [ - "n_final_state = 3\n", - "\n", - "\n", "def generate_phsp_decay(\n", " size: int, seed: int | None = None, bunch_size: int | None = None\n", ") -> tuple[MomentumNumpy4D, MomentumNumpy4D, MomentumNumpy4D]:\n", @@ -650,23 +707,39 @@ "source": [ "A few functions are defined above for generating phase space samples of particle decays and converting them into four-momentum vectors. The main ideas of them are:\n", "\n", + ":::{note}\n", "- Step 1, Generate Phase Space Sample (`generate_phsp_bunch()`)\n", " - Random Number Generator\n", - " - A NumPy random number generator (`rng`) is initialized with a fixed seed for reproducibility. This ensures that every time the simulation is run, it produces the same random numbers, which is crucial for debugging and validating simulation results. \n", + "\n", + " A NumPy random number generator (`rng`) is initialized with a fixed seed for reproducibility. This ensures that every time the simulation is run, it produces the same random numbers, which is crucial for debugging and validating simulation results.\n", + " \n", " - Phase Space Generation\n", - " - The `phasespace` package is used to simulate a decay process where a parent particle decays into three daughter particles. This is set up by specifying the masses of the parent particle (`pγ_mass`) and the daughter particles (`eta_mass`, `pi_mass`, `p_mass`). The function `nbody_decay` followed by generate is used to create the phase space and return both the weights of each decay event and the momenta of the decay products. \n", + "\n", + " \n", + " The `phasespace` package is used to simulate a decay process where a parent particle decays into three daughter particles. This is set up by specifying the masses of the parent particle (`pγ_mass`) and the daughter particles (`eta_mass`, `pi_mass`, `p_mass`). The function `nbody_decay` followed by generate is used to create the phase space and return both the weights of each decay event and the momenta of the decay products.\n", + " \n", + " \n", " - Rejection Sampling\n", - " - To refine the sample, a form of rejection sampling is applied. A random set of weights (`random_weights`) is generated, and only those events where the original weight exceeds the random weight are selected. This step effectively filters the generated events based on their likelihood or probability, improving the physical relevance of the sample. \n", + " \n", + " To refine the sample, rejection sampling is applied. The `phasespace` package generates four-momenta that are not evenly distributed. The distributions appear even only when multiplied by the generated weights. To achieve this, a random set of weights (`random_weights`) is generated, and only those events where the original weight exceeds the random weight are selected. \n", + " \n", + " \n", " \n", "- Step 2, Ensure Sufficient Sample Size (`generate_phsp_decay()`)\n", " - Iterative Sampling\n", - " - The function starts by generating an initial phase space sample. If this initial sample does not meet the required size, more samples are generated and concatenated until the cumulative size is adequate. \n", + " \n", + " The function starts by generating an initial phase space sample. If this initial sample does not meet the required size, more samples are generated and concatenated until the cumulative size is adequate.\n", + " \n", " - Removing Excess\n", - " - Once the target sample size is reached or exceeded, `remove_overflow` trims the sample to precisely match the requested size.\n", "\n", - "- Step 3, Convert to Four-Momentum Vectors (`to_vector()`)\n", + " \n", + " Once the target sample size is reached or exceeded, `remove_overflow` trims the sample to precisely match the requested size.\n", + "\n", + "- Step 3, Convert to [Four-Momentum Vectors](https://vector.readthedocs.io/en/latest/api/backends/vector.backends.numpy.html#vector.backends.numpy.MomentumNumpy4D) (`to_vector()`)\n", " - Four-Momentum Representation\n", - " - For each tensor in the phase space tuple (representing the momentum components like px, py, pz), the `to_vector` function converts them into a structured array (`MomentumNumpy4D`). This structured array includes keys for each momentum component and possibly the energy component, arranged as needed for subsequent physics analysis. " + "\n", + " For each tensor in the phase space tuple (representing the momentum components like px, py, pz), the `to_vector` function converts them into a structured array (`MomentumNumpy4D`). This structured array includes keys for each momentum component and possibly the energy component, arranged as needed for subsequent physics analysis.\n", + ":::" ] }, { @@ -689,7 +762,7 @@ "tags": [] }, "source": [ - "The time is for reference of this phase space generation algorithm (same as later)." + "The time is for reference of this phase space generation algorithm (see also the section of [data sample generation](#data-generation))." ] }, { @@ -698,7 +771,7 @@ "tags": [] }, "source": [ - "### 4 momentum of reaction particles" + "### 4 momentum of initial state particles" ] }, { @@ -707,7 +780,69 @@ "tags": [] }, "source": [ - "The 4 momentum of reaction particles $\\gamma$ (a) and $p$ (b) are generated." + "The initial state, $\\gamma$ (a) and $p$ (b), are generated." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "source": [ + "To find $p_a$ and $p_b$ by 4-momentum conservation, energy conservation in this case.\n", + "\n", + "Given that:\n", + "\n", + "\\begin{align}\n", + "\n", + "m_a = m_{\\gamma} =0 \\\\\n", + "\n", + "m_b = m_p \\\\\n", + "\n", + "p_{a,x} = p_{a,y} = 0 = p_{b,x} = p_{b,y} \\\\\n", + "\n", + "p_{a,z} = - p_{b,z}\n", + "\n", + "\\end{align}\n", + "\n", + "Due to energy conservation, we have:\n", + "\n", + "\\begin{align}\n", + "\n", + "E_a + E_b = E_1 + E_2 + E_3 = E_0 \\\\\n", + "\n", + "E_a+ E_b = \\sqrt{m_a^2 + p_a^2} + \\sqrt{m_b^2 + p_b^2} = E_0\n", + "\n", + "\\end{align}\n", + "\n", + "\n", + "Since $m_a=0$ and $p_a = -p_b$, thus\n", + "$$\n", + "p_a + \\sqrt{m_b^2 + (-p_a)^2} = E_0\n", + "$$\n", + "\n", + "Reorganize and get,\n", + "$$\n", + "p_{a,z} + \\sqrt{m_p^2 + p_a^2} - E_0 = 0\n", + "$$\n", + "\n", + "thus\n", + "\n", + "$$\n", + "p_{a,z} = \\frac{E_0^2 - m_p^2}{2E_0}\n", + "$$\n", + "\n", + "then\n", + "\n", + "\\begin{align}\n", + "p_{b,z} = -p_{a,z}\n", + "\n", + "E_a =p_a \\\\\n", + "\n", + "E_{b} = \\sqrt{m_b^2+p_b^2}\n", + "\\end{align}" ] }, { @@ -730,7 +865,7 @@ "\n", "$p_{a,z} = - p_{b,z}$\n", "\n", - "Due to Energy conservation, we have:\n", + "Due to energy conservation, we have:\n", "\n", "$$\n", "E_a + E_b = E_1 + E_2 + E_3 = E_0\n", @@ -742,11 +877,13 @@ "$$\n", "\n", "Since $m_a=0$ and $p_a = -p_b$, thus\n", + "\n", "$$\n", "p_a + \\sqrt{m_b^2 + (-p_a)^2} = E_0\n", "$$\n", "\n", "Reorganize and get,\n", + "\n", "$$\n", "p_{a,z} + \\sqrt{m_p^2 + p_a^2} - E_0 = 0\n", "$$\n", @@ -779,7 +916,7 @@ "tags": [] }, "source": [ - "And now we can implement the function `compute_pa_pb` to compute four-momentum of $p_a$ and $p_b$ based on equation {eq}`pz`, {eq}`Ea` and {eq}`Eb`." + "And now we can implement the function `compute_pa_pb` to compute four-momentum of $p_a$ and $p_b$ based on Equations {eq}`pz`, {eq}`Ea` and {eq}`Eb`." ] }, { @@ -831,8 +968,8 @@ "tags": [] }, "source": [ - "After testing the feasibility of the functions (`generate_phsp_decay` and `compute_pa_pb`) to generate the four-momentum of decay particles in phase space and computing the corresponding four-momentum of reaction particles.\n", - "We now create a function `generate_phsp_all` to create and compute all particles in phase space all-in-once (put the two functions previously all inside this function)." + "After testing the feasibility of the functions (`generate_phsp_decay()` and `compute_pa_pb()`) to generate the four-momentum of decay particles in phase space and computing the corresponding four-momentum of reaction particles.\n", + "We now create a function `generate_phsp_all()` to create and compute all particles in phase space all-in-once (combine the two functions previously all into this function)." ] }, { @@ -2667,7 +2804,9 @@ "cell_type": "code", "execution_count": null, "metadata": { - "tags": [] + "tags": [ + "scroll-input" + ] }, "outputs": [], "source": [