|
85 | 85 | "import ampform\n",
|
86 | 86 | "import graphviz\n",
|
87 | 87 | "import matplotlib.pyplot as plt\n",
|
88 |
| - "import pandas as pd\n", |
89 | 88 | "import qrules\n",
|
90 | 89 | "from IPython.display import Math\n",
|
91 | 90 | "\n",
|
92 | 91 | "from tensorwaves.data import (\n",
|
93 |
| - " IntensityDistributionGenerator,\n", |
94 | 92 | " SympyDataTransformer,\n",
|
95 | 93 | " TFPhaseSpaceGenerator,\n",
|
96 | 94 | " TFUniformRealNumberGenerator,\n",
|
|
120 | 118 | "reaction = qrules.generate_transitions(\n",
|
121 | 119 | " initial_state=\"D0\",\n",
|
122 | 120 | " final_state=[\"K-\", \"K+\", \"K0\"],\n",
|
123 |
| - " allowed_intermediate_particles=[\"a(0)(980)0\", \"a(2)(1320)+\"],\n", |
| 121 | + " allowed_intermediate_particles=[\"a(0)(980)0\", \"a(2)(1320)0\"],\n", |
124 | 122 | " formalism=\"canonical-helicity\",\n",
|
125 | 123 | ")\n",
|
126 | 124 | "dot = qrules.io.asdot(\n",
|
|
172 | 170 | "cell_type": "markdown",
|
173 | 171 | "metadata": {},
|
174 | 172 | "source": [
|
175 |
| - "To correctly describe the dynamics for this resonance, we should use make use of {doc}`analytic continuation <ampform:usage/dynamics/analytic-continuation>`. As opposed to {ref}`compwa-step-1`, we now use {func}`~ampform.dynamics.builder.create_analytic_breit_wigner` (a relativistic Breit-Wigner with analytic continuation) instead of {func}`~ampform.dynamics.builder.create_relativistic_breit_wigner_with_ff`:" |
| 173 | + "To correctly describe the dynamics for this resonance, we should use make use of {doc}`analytic continuation <ampform:usage/dynamics/analytic-continuation>`. As opposed to {ref}`compwa-step-1`, we now construct a {class}`~ampform.dynamics.builder.RelativisticBreitWignerBuilder` where we set its phase space factor to {class}`~ampform.dynamics.phasespace.PhaseSpaceFactorSWave`:" |
176 | 174 | ]
|
177 | 175 | },
|
178 | 176 | {
|
|
181 | 179 | "metadata": {},
|
182 | 180 | "outputs": [],
|
183 | 181 | "source": [
|
| 182 | + "from ampform.dynamics import PhaseSpaceFactorSWave\n", |
184 | 183 | "from ampform.dynamics.builder import (\n",
|
185 |
| - " create_analytic_breit_wigner,\n", |
| 184 | + " RelativisticBreitWignerBuilder,\n", |
186 | 185 | " create_non_dynamic_with_ff,\n",
|
187 | 186 | " create_relativistic_breit_wigner_with_ff,\n",
|
188 | 187 | ")\n",
|
189 | 188 | "\n",
|
190 | 189 | "model_builder = ampform.get_builder(reaction)\n",
|
| 190 | + "analytic_breit_wigner_builder = RelativisticBreitWignerBuilder(\n", |
| 191 | + " form_factor=True,\n", |
| 192 | + " energy_dependent_width=True,\n", |
| 193 | + " phsp_factor=PhaseSpaceFactorSWave,\n", |
| 194 | + ")\n", |
191 | 195 | "model_builder.set_dynamics(\n",
|
192 | 196 | " \"J/psi(1S)\",\n",
|
193 | 197 | " create_non_dynamic_with_ff,\n",
|
194 | 198 | ")\n",
|
195 | 199 | "model_builder.set_dynamics(\n",
|
196 | 200 | " \"a(0)(980)0\",\n",
|
197 |
| - " create_analytic_breit_wigner,\n", |
| 201 | + " analytic_breit_wigner_builder,\n", |
198 | 202 | ")\n",
|
199 | 203 | "model_builder.set_dynamics(\n",
|
200 |
| - " \"a(2)(1320)+\",\n", |
| 204 | + " \"a(2)(1320)0\",\n", |
201 | 205 | " create_relativistic_breit_wigner_with_ff,\n",
|
202 | 206 | ")\n",
|
203 | 207 | "model = model_builder.formulate()"
|
|
207 | 211 | "cell_type": "markdown",
|
208 | 212 | "metadata": {},
|
209 | 213 | "source": [
|
| 214 | + ":::{margin}\n", |
| 215 | + "\n", |
| 216 | + "Note that we have reduced the coupling for the sub-threshold resonance $a_0(980)^0$, so that it doesn't dominate over $$\n", |
| 217 | + "\n", |
| 218 | + ":::\n", |
| 219 | + "\n", |
210 | 220 | "The effect can be seen once we generate data. Despite the fact that the resonance lies outside phase space, there is still a contribution to the intensity:"
|
211 | 221 | ]
|
212 | 222 | },
|
|
216 | 226 | "metadata": {},
|
217 | 227 | "outputs": [],
|
218 | 228 | "source": [
|
| 229 | + "for par in model.parameter_defaults:\n", |
| 230 | + " if not par.name.startswith(\"C\") or \"a_{0}(980)^{0}\" not in par.name:\n", |
| 231 | + " continue\n", |
| 232 | + " model.parameter_defaults[par] = 0.1\n", |
| 233 | + "\n", |
219 | 234 | "intensity = create_parametrized_function(\n",
|
220 | 235 | " expression=model.expression.doit(),\n",
|
221 | 236 | " parameters=model.parameter_defaults,\n",
|
|
229 | 244 | " initial_state_mass=reaction.initial_state[-1].mass,\n",
|
230 | 245 | " final_state_masses={i: p.mass for i, p in reaction.final_state.items()},\n",
|
231 | 246 | ")\n",
|
232 |
| - "data_generator = IntensityDistributionGenerator(\n", |
233 |
| - " domain_generator=phsp_generator,\n", |
234 |
| - " function=intensity,\n", |
235 |
| - " domain_transformer=helicity_transformer,\n", |
236 |
| - ")\n", |
237 |
| - "data_momenta = data_generator.generate(2_000, rng)" |
| 247 | + "phsp_momenta = phsp_generator.generate(100_000, rng)" |
238 | 248 | ]
|
239 | 249 | },
|
240 | 250 | {
|
|
245 | 255 | "source_hidden": true
|
246 | 256 | },
|
247 | 257 | "tags": [
|
248 |
| - "hide-cell" |
| 258 | + "hide-input" |
249 | 259 | ]
|
250 | 260 | },
|
251 | 261 | "outputs": [],
|
252 | 262 | "source": [
|
253 | 263 | "import numpy as np\n",
|
254 | 264 | "from matplotlib import cm\n",
|
255 | 265 | "\n",
|
| 266 | + "phsp = helicity_transformer(phsp_momenta)\n", |
| 267 | + "intensities = np.array(intensity(phsp))\n", |
| 268 | + "\n", |
256 | 269 | "resonances = sorted(\n",
|
257 | 270 | " reaction.get_intermediate_particles(),\n",
|
258 | 271 | " key=lambda p: p.mass,\n",
|
259 | 272 | ")\n",
|
260 |
| - "\n", |
261 | 273 | "evenly_spaced_interval = np.linspace(0, 1, len(resonances))\n",
|
262 | 274 | "colors = [cm.rainbow(x) for x in evenly_spaced_interval]\n",
|
263 | 275 | "\n",
|
264 |
| - "\n", |
265 |
| - "def indicate_masses():\n", |
266 |
| - " plt.xlabel(\"$m_{02}$ [GeV]\")\n", |
267 |
| - " for i, p in enumerate(resonances):\n", |
268 |
| - " plt.gca().axvline(\n", |
269 |
| - " x=p.mass, linestyle=\"dotted\", label=p.name, color=colors[i]\n", |
270 |
| - " )" |
271 |
| - ] |
272 |
| - }, |
273 |
| - { |
274 |
| - "cell_type": "code", |
275 |
| - "execution_count": null, |
276 |
| - "metadata": {}, |
277 |
| - "outputs": [], |
278 |
| - "source": [ |
279 |
| - "data = helicity_transformer(data_momenta)\n", |
280 |
| - "data_frame = pd.DataFrame(data)\n", |
281 |
| - "data_frame[\"m_02\"].hist(bins=50, alpha=0.5, density=True)\n", |
282 |
| - "indicate_masses()\n", |
283 |
| - "plt.legend();" |
| 276 | + "fig, ax = plt.subplots()\n", |
| 277 | + "ax.set_xlabel(\"$m_{02}$ [GeV]\")\n", |
| 278 | + "for p, color in zip(resonances, colors):\n", |
| 279 | + " ax.axvline(x=p.mass, linestyle=\"dotted\", label=p.name, color=color)\n", |
| 280 | + "ax.set_yticks([])\n", |
| 281 | + "ax.hist(phsp[\"m_02\"], bins=100, alpha=0.5, weights=intensities)\n", |
| 282 | + "ax.legend()\n", |
| 283 | + "plt.show()" |
284 | 284 | ]
|
285 | 285 | }
|
286 | 286 | ],
|
|
292 | 292 | },
|
293 | 293 | "language_info": {
|
294 | 294 | "name": "python",
|
295 |
| - "version": "3.8.12" |
| 295 | + "version": "3.8.13" |
296 | 296 | }
|
297 | 297 | },
|
298 | 298 | "nbformat": 4,
|
|
0 commit comments