{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# SMIPP 21/22 - Exercise Sheet 4\n", "\n", "## Prof. Dr. K. Reygers, Dr. R. Stamen, Dr. M. Völkl\n", "\n", "## Hand in by: Thursday, November 18th: 12:00\n", "### Submit the file(s) through the Übungsgruppenverwaltung\n", "\n", "\n", "### Names (up to two):\n", "### Points: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.1 Error Propagation including systematics (10 points)\n", "\n", "A current $I$ is determined by measuring the voltage $U$, using a meter of resolution $\\sigma_U$, across a standard resistance $R\\pm \\sigma_R$.\n", "\n", "a) Determine the formula for the square of the relativ error of the current $I$: $\\frac{\\sigma_I^2}{I^2} = ?$\n", "\n", "b) Consider now the measurement of two currents $I_1$ and $I_2$. The measured voltages have independent errors $\\sigma_{U_1} = \\sigma_{U_2}=\\sigma_U$. The resistance is the same for both measurements and the error on it is thus systematic. We rename it therefore to $S_R$. \n", "\n", "Write down the formulas for the square of the relative errors of the currents $I_1$ and $I_2$.\n", "\n", "c) Determine the error matrix $U= A V A^T$ (see lecture 3, slide 17) for the measurement of two currents $I_1$ and $I_2$. Note that the measurement consists of the measurement of three parameters: $U_1$, $U_2$ and $R$.\n", "\n", "d) Calculate the Variance for the measurment of the difference of the two currents $I_1 - I_2$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Solution" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.2 Random sampling with the Metropolis algorithm (10 points)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We want to calculate the variance and mean of the distribution \n", "$$ f(x) \\sim (\\sin(5x)+2)\\cdot \\exp(-x^2/2)$$\n", "This is difficult to calculate by hand, but can be done by randomly sampling from it.\n", "\n", "a) \n", "Fill an array of at least $10^5$ numbers, by moving from one element to the next step by step. The first element is 0. To move from one element ($i$) to the next ($i+1$), do the following:\n", "\n", "1. Draw a random value $d$ in the range $(-1,1)$\n", "\n", "2. add this number to $x_i$ (this is the proposal)\n", "\n", "3. If $x_i+d$ is in the range $(-2, 2)$, then $x_{i+1}=x_i+d$, otherwise $x_{i+1}=x_i$\n", "\n", "b) \n", "Plot the distribution of the values and confirm (by eye) that it is a flat distribution in the interval (-2,2)\n", "\n", "c)\n", "Now do a similar random walk with the Metropolis algorithm:\n", "\n", "1. Draw a random value $d$ in the range $(-1,1)$\n", "\n", "2. add this number to $x_i$\n", "\n", "3. Calculate the ratio of the function at the proposal value and at the current step: $r = \\frac{f(x_i+d)}{f(x_i)}$\n", "\n", "4. Now draw a random number $r^{\\prime}$ in the interval $(0,1)$\n", "\n", "5. If $r^{\\prime}\n", "Hint 1: One can use [sympy.utilities.lambdify](https://docs.sympy.org/latest/modules/utilities/lambdify.html) to numerically evaluate a ``sympy``expression in python.
\n", "Hint 2: the option ``density=True`` of [matplotlib.pyplot.hist](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html) is a convenient way to draw a normalized histogram. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Solution" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.4 Geometrical acceptance of a detector (10 points)\n", "\n", "The neutral pion predominantly decays into two photons ($\\pi^0 \\to \\gamma \\gamma$, branching ratio 98.2\\%). Suppose a photon detector at a collider subtends the pseudo-rapidity range $|\\eta|$ < 0.5 and the full azimuthal angle. The pseudo-rapidity $\\eta$ is a function of the polar angle $\\theta$ with respect to the beam axis which is taken to be the $z$ axis (see below). The pseudo-rapidity $\\eta = 0$ corresponds to particles produced perpendicular to the beam axis.\n", "\n", "In this we problem we are interested in the geometrical acceptance of this detector for the detection of neutral pions, i.e., we would like to determine the probability for measuring both photons of the $\\pi^0 \\to \\gamma \\gamma$ decay. \n", "\n", "a) Determine the geometrical acceptance for neutral pions that move with a momentum $p_{\\pi^0} = 0.5~\\mathrm{GeV}/c$ along the $x$ axis (i.e., $\\vec p = (p_{\\pi^0}, 0, 0)$)\n", "\n", "b) The opening angle between the two decay photons in the lab system on average decreases with increasing momentum of the neutral pion. What is the geomentrial acceptance in case of $p_{\\pi^0} = 5~\\mathrm{GeV}/c$? \n", "\n", "Hint: In the rest system of the neutral pion the two photons are produced back-to-back ($\\vec p_1^* = - \\vec p_2^*$). The direction of the decay photons is uniformly distributed over a sphere. The four-momentum of a decay photon in the neutral pion rest frame can be written as\n", "\n", "$$ k_\\mathrm{\\gamma}^* = (E^*, p_x^*, p_y^*, p_z^*) =(\\frac{m}{2}, \\frac{m}{2} \\sin \\theta^* \\cos \\phi^*, \\frac{m}{2} \\sin \\theta^* \\sin \\phi^*, \\frac{m}{2} \\cos \\theta^*)$$\n", "\n", "where $m$ is the mass of the neutral pion.\n", "\n", "Procedure for determining the acceptance: \n", "\n", "1. Create the four-vectors of the two decay photons in the rest frame of the neutral pion\n", "2. Boost the four-vectors to the lab frame using the the routine ``boost_to_lab`` given below\n", "3. Determine the rapidity of the photon using the function ``rapidity`` given below\n", "4. Check if both decay photons satisfy $|\\eta| < 0.5$\n", "5. Repeat steps 1-4 many times\n", "\n", "Explanations:\n", "Let the polar angle $\\theta$ of a particle be the angle with respect to the beam axis (= $z$ axis). The pseudo-rapidity $\\eta$ is defined as \n", "\n", "$$ \\eta = - \\ln \\tan \\frac{\\theta}{2}$$.\n", "\n", "The rapidity of a particle with energy $E$ and longitudinal momentum $p_z$ is given by\n", "\n", "$$ y = \\frac{1}{2} \\ln \\frac{E + p_z}{E - p_z}$$\n", "\n", "For massless particles the rapidity and the pseudo-rapidit are identical, i.e., $\\eta = y$." ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [], "source": [ "def boost_to_lab(p4vec, beta3vec):\n", " \"\"\"\n", " Lorentz boost from the particle rest frame to the lab frame.\n", " p4vec: 4-vector of a (decay) particle in the rest frame (of the mother particle)\n", " beta3vec: 3-vector of the velocity of the (mother) particle in the lab frame \n", " \"\"\"\n", "\n", " # beta: velocity in units of the speed of light, gamma = Lorentz gamma\n", " beta = np.sqrt(beta3vec[0]**2 + beta3vec[1]**2 + beta3vec[2]**2)\n", " gamma = 1./np.sqrt(1-beta**2)\n", " \n", " # minus sign: boost from particle rest frame to lab system \n", " nx, ny, nz = -beta3vec[0] / beta, -beta3vec[1] / beta, -beta3vec[2] / beta\n", " B = np.array([[gamma, - gamma * beta * nx, - gamma * beta * ny, - gamma * beta * nz],\n", " [- gamma * beta * nx, 1. + (gamma - 1) * nx * nx, (gamma - 1) * ny * nx, (gamma - 1) * nz * nx],\n", " [- gamma * beta * ny, (gamma - 1) * nx * ny, 1. + (gamma - 1) * ny * ny, (gamma - 1) * nz * ny],\n", " [- gamma * beta * nz, (gamma - 1) * nx * nz, (gamma - 1) * ny * nz, 1. + (gamma - 1) * nz * nz]])\n", "\n", " return np.dot(B, p4vec)" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [], "source": [ "def rapidity(p4):\n", " \"\"\"Calculate the rapidity of a particle with energy E and longitudinal momentum p\"\"\"\n", " E, pz = p4[0], p4[3]\n", " return 0.5 * np.log((E + pz)/(E - pz))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Solution" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }