{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a8d303ad",
   "metadata": {},
   "source": [
    "# Gamma detectors along a path"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "08dda386",
   "metadata": {},
   "source": [
    "## Fluence rate at $\\vec{r}$\n",
    "\n",
    "Let $\\vec{r}_{p} = (x_{p},y_{p},z_{p})$ denote the location of a point source $p$. Let $\\vec{r}_{i} = (x_{i},y_{i},z_{i})$ denote an arbitrary point in space. The primary photon fluence rate at $\\vec{r}$ is then given by\n",
    "\n",
    "$$\n",
    "\\dot{\\phi}(r) = \\frac{A n_\\gamma \\exp(-\\mu_{air} r)}{4\\pi r^2}\n",
    "$$\n",
    "\n",
    "where $r = ||\\vec{r}_p - \\vec{r}_i ||$. The units are $\\dot{\\phi} \\sim \\frac{\\text{photons}}{s \\cdot m^2}$\n",
    "\n",
    "## Count rate\n",
    "\n",
    "Gamma detectors are not perfectly efficient and efficiency is dependent on both photon energy $E_\\gamma$ and incident angle $\\theta$ [1].\n",
    "\n",
    "- the field efficiency $\\varepsilon_D (E_\\gamma) \\in [0, 1]$, in units of area $\\text{m}^2$,\n",
    "- the relative angular efficiency $\\varepsilon_\\theta (E_\\gamma, \\theta) \\in [0, 1]$, dimensionless.\n",
    "\n",
    "The total efficiency of the detector is then defined as\n",
    "\n",
    "$$\n",
    "\\varepsilon(E_\\gamma, \\theta) = \\varepsilon_D (E_\\gamma) \\varepsilon_\\theta (E_\\gamma, \\theta) \\; .\n",
    "$$\n",
    "\n",
    "Where $\\varepsilon(E_\\gamma, \\theta) \\sim \\text{m}^2$.\n",
    "\n",
    "If the detector $D$ is positioned at $\\vec{r}_i$, the **count rate** becomes\n",
    "\n",
    "$$\n",
    "\\dot{N}(r, E_\\gamma, \\theta) = \\varepsilon(E_\\gamma, \\theta) \\phi(r)\n",
    "$$\n",
    "\n",
    "where $\\dot{N} \\sim \\frac{\\text{counts}}{s}$.\n",
    "\n",
    "## Acquisiton time \n",
    "\n",
    "The acquisition time window $t_{w}$ is the time during which counts are accumulated in the detector until readout into the digital system. A typical $t_{w}$ in mobile gamma spectrometry is 1 to 10 seconds [2]. \n",
    "\n",
    "## Integration of counts\n",
    "\n",
    "Suppose an acquisition time of $t_{w}$ seconds and a fixed velocity $v$ in meters per seconds. Let $R(u)$ describe a road of $L$ meters long in the xy-plane, described as a function of arc length $u$ in meters (distance traveled along the road), where $u \\in [0, L]$. The euclidian norm between the point $R(u)$ and point source $\\vec{r}_p$ is then\n",
    "\n",
    "$$\n",
    "r(u) = || \\vec{r}_p - R(u) ||\n",
    "$$\n",
    "\n",
    "Assuming a fixed velocity $v$, the distance traveled during one acquisition window $t_{w}$ is $\\Delta_s \\equiv vt_{w}$ meters. The path is divided into $K = L/\\Delta s$ segments, where the $k$-th segment represents the interval\n",
    "\n",
    "$$\n",
    "u \\in [(k-1) \\Delta_s, k\\Delta_s] \\; , \\; k = 1, 2, \\dots, K\n",
    "$$\n",
    "\n",
    "The total count rate acquired during segment $k$-th is then\n",
    "\n",
    "$$\n",
    "N_{w}(k) = \\frac{1}{v} \\int_{(k-1)\\Delta_s}^{k\\Delta_s} \\underbrace{\\dot{N}(r(u), E_\\gamma, \\theta(u))}_{\\text{CPS}} du\n",
    "$$\n",
    "\n",
    "## Numerical approximation\n",
    "\n",
    "Let us divide each segment into $N$ equally spaced points with step size $\\Delta u = \\Delta s / N$. Applying the trapezoidal rule then gives\n",
    "\n",
    "$$\n",
    "N_w(k) \\approx \\frac{\\Delta u}{v}\n",
    "\\left[\n",
    "\\frac{\\dot{N}_0 + \\dot{N}_N}{2}\n",
    "+ \\sum_{n=1}^{N-1} \\dot{N}_n\n",
    "\\right],\n",
    "$$\n",
    "\n",
    "where\n",
    "\n",
    "$$\n",
    "\\dot{N}_n = \\dot{N}\\big(r(u_n), E_\\gamma, \\theta(u_n)\\big), \\quad\n",
    "u_n = (k-1)\\Delta s + n \\Delta u.\n",
    "$$\n",
    "\n",
    "## References\n",
    "\n",
    "[1] A. Bukartas, ‘Assessment of mobile radiometry data in radiological emergencies using Bayesian statistical methods’, thesis/doccomp, Lund University, 2021. Accessed: Jan. 19, 2026. [Online]. Available: http://lup.lub.lu.se/record/4c298e71-3278-42a7-818a-6f17a5121d56\n",
    "\n",
    "[2] R. Finck, A. Bukartas, M. Jönsson, and C. Rääf, ‘Maximum detection distances for gamma emitting point sources in mobile gamma spectrometry’, Applied Radiation and Isotopes, vol. 184, p. 110195, Jun. 2022, doi: 10.1016/j.apradiso.2022.110195.\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "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.12.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
