Thomas Griffiths — Data Analysis and Machine Learning, University of Edinburgh
This notebook (AsymmetryAnalysis.ipynb) simulates a measurement of the decay
iminuit) recovers the lifetime
(
Repeating the generate-and-fit cycle over many pseudoexperiments quantifies how biased and how precise each parameter estimate is, and how that changes once a background is mixed in.
Signal PDF (unnormalized):
Background PDF, fixed width
Combined model with background fraction
Both PDFs are re-normalized over the detector's recorded window,
quad-based version was tried first but was too slow for repeated use across
hundreds of pseudoexperiments).
Nominal parameter values used to generate pseudo-data throughout:
-
Step 1 — Signal-only fit
- Event generation by inverse-CDF sampling (an accept/reject "box method" was also implemented but is ~5x slower and left commented out for reference).
- A single dataset (10,000 events) generated and fit with an unbinned NLL to sanity-check the pipeline before scaling up.
- 100 pseudoexperiments to determine the bias and precision on
$\tau$ ,$\Delta m$ ,$V$ .
-
Step 2 — Adding a background
- Background model and combined signal+background PDF (above).
- Mixed datasets generated at three background fractions: 1%, 10%, 20%.
- For each fraction, every pseudoexperiment's mixed dataset is fit twice — once with a signal-only model (which ignores the background) and once with the correct signal+background model — to directly measure the bias introduced by ignoring a real background.
Step 1 (signal-only, 100 pseudoexperiments, no background):
| Parameter | Outcome |
|---|---|
| Effectively unbiased — bias ~0.06 standard errors from zero | |
| Bias not statistically significant (within 1σ); tightly constrained | |
| Biased high — mean is ~1.14 standard errors above the true value |
Step 2 (effect of an unmodeled background):
| Background fraction | Signal-only fit (mis-specified) | Signal+background fit |
|---|---|---|
| 1% | Negligible deviation from Step 1 | Negligible deviation |
| 10% |
|
All parameters recovered with negligible bias |
| 20% | Bias grows further on |
|
The mechanism: the background peaks near
No external data files are needed — this is a fully self-contained simulation
notebook. Requirements: numpy, pandas, matplotlib, scipy, iminuit.
Run top to bottom: later cells depend on variables defined earlier (events,
the f_bkg list, results_sig / results_mix), so cells aren't safe to run
out of order.
- In the Step 2 pseudoexperiment loop, both the signal-only and signal+background
fits call only
migrad()(nothesse()), so their reported parameter errors come from MIGRAD's internal estimate rather than the Hessian-refined errors used in Step 1. Worth revisiting if the Step 2 uncertainties are used quantitatively elsewhere. -
f_bkgis used both as the list of background fractions and as a per-iteration loop variable in the Step 2 histogram cell, which overwrites it; the later pseudoexperiment loop happens to redefine the list before using it, but the two shouldn't share a name. - Only three background fractions and one background shape are tested; a natural
extension would be a finer scan over
$f_{bkg}$ or an alternative background model.
Project specification: DAML Project 1 — Particle Asymmetry Decay, William Barter, University of Edinburgh, October 2025.