Python simulation code for g-2 EDM studies, without the faff of running the official code.
- Option: main running mode. Two options:
- MCgen: generates events according to an exponential time distribution, bins counts for both g-2 wiggle with an energy cut and average angle modulo the g-2 period for EDM analysis.
- test: used for a single time snapshot, good for debugging
- n_events: the total number of events to generate.
- t_start and t_end: define the time range over which to generate events.
- n_bins: the number of time bins to use.
The n_events and n_bins have the usual tradeoff for good statistics per bin.
The decayMuons function is the main options block within the code - any methods for the decay class can be switched on and off here.
Radial field This is implemented by the radial_field function - when running, make sure the method is uncommented in decayMuons. The value of the radial field wanted can be set as a parameter of this function.
Acceptance There are several parts to the acceptance cut. These are applied to the MC data after it has been generated as a filter, with the default detectorAcceptanceCut applying both vertical and momentum cuts. The vertical cut value is a parameter of this function, and the momentum cut is fixed based on what positrons will hit the tracker. Each cut can be applied separately if wanted.
Running with ring geometry This uses the ring_decay.py module (see below) to run a more physical setup, with decays happening at random points around a ring. This will calculate full tracks for each decay, check whether it hits the defined tracker area, and then only return those which do hit. To run with this, the momentum acceptance should be switched off (as otherwise it will be applied twice) the ring_decay module must be imported. Running with full ring is not reccomended as it is much slower and gives significantly worse statistics.
This is a module with ring geometry, which can be run independently or imported into gm2sim. Includes functions for calculting full track paths, whether they hit the tracker, and distances between the tracker and the decay vertex.
Run this on the output text files generated by gm2Sim to fit the wiggle plot or vertical angle oscillation. Calculates parameters, their errors, and the chi-squared of the fit. If the input files have no injected EDM signal, will also calculate the limit set on the EDM by the generate data, if there is an EDM the results are nonsensical at the moment (planning to implement a check later).
Copying the ROOT 'hadd' method for combining historgrams and datasets to allow gm2sim's output txt files to be combined sensibly. Only works on gm2sim output patterns atm.
This is the official matplotlib style file for the g-2 experiment, needed to make the plots look nice.
Two methods for setting more rigorious EDM limits than the vanilla confidence interval.