faculty of mathematics and natural sciences van swinderen institute for particle physics and gravity

Investigation of Transient Eff ects in a Time-Dependent Magnetic Kicker

Sietse Buijsman University of Groningen

J-PARC Muon g-2 EDM Experiment

Master Thesis

Investigation of Transient Effects in a Time-Dependent Magnetic Kicker

Supervisors Author Dr. ir. C.J.G. Onderwater S.F. Buijsman Prof. dr. K.H.K.J. Jungmann

26 June, 2019 Abstract

The most recent developments in the experimental determination of the muon anomalous magnetic dipole moment (g − 2) have indicated a difference of 3.6 standard deviations between the theory and experiment. The muon g − 2 EDM experiment situated at J-PARC is designed to simultaneously measure g − 2 and the electric dipole moment (EDM) at low energies by measuring the spin precession vector. This is done by measuring trajectories of decay positrons, which are, by violation of parity conservation, preferably emitted in the direction of the spin of the muon in the muon rest frame. The J-PARC experiment aims to improve upon the previous measurement to a precision of 0.1 ppm (from 0.54 ppm, by BNL), in parallel with the experiment situated at Fermilab, which aims for similar precision goals. The muons are injected in a storage ring of a 33 cm radius in a 3 T magnetic field. A weak magnetic focusing field keeps the muons in the storage region. A time-dependent magnetic kicker brings the muons from the injection volume to the storage volume. Various systematic effects caused by the magnetic kicker have been investigated. The electric field induced by the time-varying kicker field has a negligible effect on the dynamics of the injected muons. The electric field decayed below the desired 10 mV/cm after about 150 ns after the kicker was switched off. The volume of acceptance was determined to reduce calculation time. The muon spin was successfully tracked using a numerical method that preserves the length of the spin vector. Oscillations in the pitch angle have been observed. The frequencies present in this oscillation 5 6 correspond well with theory. Their values are found to be ω1 = 4.5 · 10 · 2π rad/s and ω2 = 1.4 · 10 · 2π rad/s. Effects caused by retardation, transient currents and broadening of the current waveform due to dispersion have been investigated. Muon injection did not succeed for effective current speeds below ∼ 7/10 c. It has been shown that successful injection is prevented for a kicker coil of multiple turns. Retardation effects are negligible compared to transient and dispersion effects. Broadening of the current waveform prevents injection for a broadening greater than ∼ 1/12 ns for each ns of propagation time. To still successfully trap muons while taking these effects into account, the kicker parameters need to be adjusted accordingly. When these effects are taken into account, muon injection is expected to be successful. Contents

1 Context and Motivation 3

2 Introduction 4 2.1 Physics ...... 4 2.1.1 Anomalous Magnetic Dipole Moment ...... 4 2.1.2 Electric Dipole Moment ...... 5 2.2 Recent Developments ...... 6 2.2.1 Theoretical ...... 6 2.2.2 Experimental ...... 6 2.2.3 Future Experiments ...... 7 2.3 J-PARC ...... 7 2.3.1 The Muon Beam Line ...... 7 2.3.2 Muon Injection and Storage ...... 8 2.3.3 Measurement of Decay Positrons ...... 8 2.4 Goal of this Thesis ...... 10

3 Numerical Calculation of Magnetic Fields 11 3.1 Numerical Calculation of Magnetic Fields ...... 11 3.1.1 Loop ...... 11 3.1.2 Coil ...... 12 3.2 The Magnetic Field Class ...... 12 3.3 Fitting the Fields ...... 13 3.3.1 Fitting the Main Field ...... 14 3.3.2 Fitting the Weak Focusing Field ...... 16 3.3.3 The Kicker Coils ...... 18 3.4 Precision and Accuracy ...... 19 3.4.1 Main Field ...... 19 3.4.2 Focus Field ...... 20 3.5 Conclusions ...... 20

4 Muon Injection 21 4.1 Dynamics ...... 21 4.1.1 The Equation of Motion ...... 21 4.1.2 The Runge-Kutta Fourth Order Algorithm ...... 21 4.2 Trapping of a Muon ...... 22 4.2.1 Weak Focusing ...... 22 4.2.2 Kicker ...... 22 4.2.3 Injection ...... 24 4.3 The Effect of Electric Fields on Dynamics ...... 24 4.3.1 Adjusting the Equation of Motion ...... 24 4.3.2 The RK4 Algorithm for Electric Fields ...... 25 4.3.3 Electric Field of a Thin Circular Wire ...... 26 4.3.4 Results for Electric Field Simulations ...... 27 4.3.5 Electric Field Inside the Storage Volume ...... 27 4.4 Conclusions ...... 28

1 5 Phase Space 29 5.1 Concepts and Dimensionality ...... 29 5.1.1 Emittance and Acceptance ...... 29 5.1.2 Determining the Acceptance ...... 29 5.2 Integrating Over Phase Space ...... 31 5.3 Conclusions ...... 31

6 Spin Tracking 32 6.1 Spin Precession ...... 32 6.1.1 The T-BMT Equation ...... 32 6.1.2 The RK4 for Spin Tracking ...... 33 6.2 Results of Spin Tracking ...... 34 6.2.1 Injection ...... 34 6.2.2 Trapping ...... 34 6.3 Conclusions ...... 36 6.3.1 Injection ...... 37 6.3.2 Trapping ...... 37

7 Transient Currents and Retardation 38 7.1 Retardation ...... 38 7.2 Transient Current ...... 40 7.2.1 Finite Propagation Speed ...... 40 7.2.2 Dispersive Effects ...... 40 7.3 Results ...... 41 7.3.1 Single Turn Kicker ...... 41 7.3.2 Multiple Turn Kicker ...... 42 7.3.3 Dispersion ...... 43 7.4 Conclusions ...... 43

8 Overall Conclusions and Outlook 45 8.1 Magnetic Field Calculation ...... 45 8.2 Muon Injection ...... 45 8.3 Phase Space Acceptance ...... 45 8.4 Spin Tracking ...... 46 8.5 Transients and Retardation ...... 46 8.6 Outlook ...... 46

Acknowledgements 47

Appendices 50

A Runge-Kutta Spin Vectors 51

B Magnetic Field Class 52

C Muon Tracking 59

2 Chapter 1

Context and Motivation

For a long time, science has been the practice of trying to understand, explain and predict natural phenom- ena. Ever since Newton formulated his laws, physics has succeeded in explaining many of these phenomena. Planetary motion, refraction of light, transport of heat and electromagnetic fields have all been successfully explained by physicists. At the advent of the twentieth century, many of these phenomena could be explained using the known laws. However, from the few unexplained phenomena sprang two entirely new theories; special and general relativity and quantum mechanics.

Both these theories were successful in explaining many phenomena and even vastly expanded our understanding of the universe. General relativity succeeded in explaining the universe at a large distance scale and quantum mechanics was combined with special relativity to form quantum field theory. The Standard Model of Parti- cle Physics (SM) was developed, explaining fundamental interactions at small distance scales, with its maybe greatest victory the experimental observation of the Higgs boson in 2012. However, the SM proved difficult to combine with general relativity.

This was not the only problem which needed solving. Observations in galaxy rotation curves revealed that there was too little visible matter to explain the rotation speed of galaxies. In the Standard Model of , this discrepancy is explained by matter that does not interact through the electromagnetic interaction. Furthermore, the accelerating expansion of the universe demands the existence of additional energy. It turned out that the majority of the matter and energy in our universe cannot be attributed to known particles and interactions. This matter and energy is called and .

Since the SM predicts neither of these, it is believed to be incomplete. Many experiments have been performed to test the SM and look for possible deviations from this model. These deviations may hint at physics beyond the SM and allows physicists to include or exclude alternatives to the SM. These deviations may be found in the observation of a new particle or interaction, or in a deviation of a property of a known particle or interaction from the SM prediction. The latter is the main goal of the muon g − 2 experiments.

The theoretical value for g − 2 as predicted by the SM is known to high precision. It is also possible to measure this quantity in an experiment to high precision. This makes the experimental determination of g−2 a good test for the SM, with its most recent measurement by Brookhaven National Laboratory (BNL). So far, there is a 3.6 standard deviation difference between experiment and the SM. This is not quite enough to claim a discovery, but it may hint towards physics beyond the SM. Another quantity that may be measured is the muon electric dipole moment (EDM). The SM predicts a small value for the muon EDM. If experiments succeed in observing an EDM that exceeds the SM prediction, this would allow for interesting new developments in alternatives to the SM.

The goal of the muon g − 2 experiment at J-PARC is to measure the muon g − 2 and EDM to greater precision than previous experiments. To be able to measure these quantities to this precision, the systematics of the experiment need to be known to similar precision. The goal of this research project is to investigate some of these systematics and quantify their significance to the experiment. This thesis is a report on the investigation of these systematics.

3 Chapter 2

Introduction

Since the late 1950s the muon has been a probe for new physics and it continues to be to this day. The spin precession frequency of the muon can be measured very precisely. This makes the muon a good candidate for probing physics beyond the SM in two ways. One way is by measuring the anomalous magnetic dipole moment, gµ − 2 precisely. This quantity is sensitive to various corrections from the interactions predicted by the SM and measuring gµ − 2 very precisely provides a test of the SM. The second way is by measuring the EDM of the muon, as the value for the muon EDM is predicted by the SM. Any deviation from this prediction points at physics beyond the SM.

In section 2.1 the physics underlying gµ − 2 and the EDM is outlined. Section 2.2 discusses theoretical and experimental developments so far and concludes with two new experiments to measure gµ −2 to higher precision. Section 2.3 gives a more detailed outline of the new experiment at J-PARC, which will be the focus of this thesis. Section 2.4 will give an outline of the contents of this thesis per chapter.

2.1 Physics 2.1.1 Anomalous Magnetic Dipole Moment When a muon is placed inside a homogeneous magnetic field, it will, according to the Lorentz force law (in SI units), orbit in a circle of radius p r = , eB where p is the momentum of the muon, e is its electric charge and B is the magnitude of the dipole magnetic field strength. The angular frequency of this cyclotron motion is given by eB ωc = . (2.1) γmµ

Here, mµ is the muon mass and γ is the relativistic gamma-factor. The muon is a lepton and thus a spin-1/2 particle. A muon has a magnetic dipole moment related to its spin by e µ = gµ s. (2.2) 2mµ

Here, µ is the magnetic dipole moment of the muon, m is the muon mass, s is the muon spin vector and gµ is the muon g-factor. The g-factor is a dimensionless quantity that determines the magnetic dipole moment of a particle. For the muon, the g-factor has a value close to 2. In a magnetic field, when the muon is moving, the spin will undergo both Larmor and Thomas precession. The motion of this precession is described by the T-BMT Equation.[1] The spin precession frequency is then given by [2] eB eB ωs = gµ + (1 − γ) . (2.3) 2mµ γmµ Subtracting these two equations yields the spin precession frequency in a frame that is co-rotating with the muon,   eB eB eB eB gµ − 2 eB eB ωa = ωs − ωc = gµ − + − = = aµ , (2.4) 2mµ mµ γmµ γmµ 2 mµ mµ

4 where aµ = (gµ − 2)/2 is the anomalous magnetic dipole moment and ωa is the anomalous precession frequency. −10 The value for aµ has been determined experimentally to high precision to be 1659208.0(5.4)(3.3) · 10 . [3] The physical interpretation of ωa is as follows. The spin precession frequency exceeds the cyclotron frequency by a factor gµ/2. When the muon is placed inside a homogeneous magnetic field, its spin will precess faster than the momentum vector. Thus, when the muon starts with its spin vector aligned with the momentum vector, the spin vector will precess away from the momentum vector. This process is illustrated in Figure 2.1.

Figure 2.1: Schematic of the anomalous spin precession. The momentum vector (blue) rotates with the cyclotron frequency. The spin (red) precesses faster than the momentum. The spin precession in a frame co-moving with the muon can be calculated by subtracting the two frequencies. This difference is the anomalous spin precession frequency ωa. [4].

2.1.2 Electric Dipole Moment If the muon has an EDM, it may be expressed as e dµ = η s. 2mµ Here, η plays the role of g in Equation (2.2). A nonzero EDM violates Charge-Parity symmetry (CP). In the SM, CP violation is suppressed and this puts a limit on the EDM, making it negligibly small compared to gµ. This experiment is sensitive to an EDM of 10−21 e·cm, corresponding to η ∼ 10−8, but the SM predicts an EDM of 10−38 e·cm, corresponding to a value of η ∼ 10−25. [5, 6] Due to this EDM, the muon spin will precess about the electric field in the center of mass frame of the muon. In the lab frame, this electric field is proportional to β × B, which perpendicular to both the direction of the magnetic field and the velocity vector, [7] e ωη = η β × B. 2mµ

Here, ωη is the precession frequency caused by the EDM, β is the relativistic dimensionless velocity and B is the magnetic field vector. In the presence of a homogeneous magnetic field, the precession due to aµ, ωa is in the direction of the magnetic field, whereas ωη is pointing radially outward.

5 2.2 Recent Developments 2.2.1 Theoretical Theoretical research had been done in calculating radiative corrections to the electron magnetic dipole moment, ge. [8, 9] Other studies calculated contributions to gµ of QED, the strong and electroweak interactions. Figure 2.2 displays how measuring gµ is a test for the SM. A more detailed description on the contributions from various field corrections is given in [10].

Figure 2.2: Contributions to gµ from loop corrections in QED, the strong interaction and the electroweak inter- action. The last term represents possible physics beyond the SM. [8].

2.2.2 Experimental

The value of aµ has been measured several times in the past, to increasingly high precision. The very first experimental measurement of gµ (to 10% precision) was also a proof of parity violation in the weak interaction (in 1957), which was predicted earlier (in 1956) by Lee and Yang. [11, 12] Shortly thereafter an additional measurement of gµ was performed by [13], measuring gµ to 1% precision. They also proposed to measure gµ −2, instead of gµ, directly. This has been done by subsequent experiments.

CERN

CERN has performed three experiments to determine aµ. The first experiment consisted of a large dipole magnet with a small gradient. In this setup the muons would spiral down the dipole magnet, where the decay positrons were detected. This experiment yielded a result in the year 1962 of [14]

−6 aµ = 1162(5) · 10 . This result was later improved upon by using a muon storage ring in the second CERN experiment. In this experiment, contrary to the first CERN experiment, the muons were relativistic, improving the time in which measurements may be taken. The result of this experiment (1968) was [15]

−7 aµ = 11661.6(3.1) · 10 .

The final muon aµ experiment by CERN improved upon the previous result by focusing the muon beam with electric fields instead of magnetic fields. By accelerating muons to the “Magic Gamma” of γ = 29.3, the electric field term in the T-BMT Equation vanishes. In this way, precise knowledge of the electric field at the position of the muon beam is not necessary, while still having a relativistic muon beam, allowing for long measurement times. They used a magnetic field strength of about 1.5 T, with a ring diameter of about 14 m. The result of the third CERN experiment (1979) was [16]

−9 aµ = 1165924(8.5) · 10 . This precision required to include sixth order QED and hadronic contributions. This precision was not sufficient to probe the electroweak interaction.

Brookhaven National Laboratory The subsequent experiment in Brookhaven National Laboratory aimed to improve upon the previous CERN measurements by a factor of 14. To achieve this, many improvements upon the previous CERN experiment had been made. The magnetic field strength and the radius of orbit were comparable to the third CERN experiment. For a more elaborate overview, see [8]. The final result of aµ was [3]

6 −10 aµ = 1659208.0(5.4)(3.3) · 10 , which is the most precise experimental determination of aµ to date, with a 0.54 ppm uncertainty. The first and second errors represent the systematic and statistical error respectively. This measurement is sensitive to QED, hadronic and electroweak contributions. This result differs from the theoretical value from the SM by 3.6 standard deviations. [10] Whether this deviation points to physics beyond the SM is yet to be determined either experimentally by means of more precise measurement, or by theory by means of including higher order corrections or physics beyond the SM.

Figure 2.3: Theoretical values of aµ for various models (black) and the current world average experimental value (blue region). There exists a difference of 3.6 standard deviations between theory and experiment for aµ. Source: [10].

2.2.3 Future Experiments At the time of writing, there are two new experiments planned to improve upon the BNL measurement. One is performed by using the same storage ring as in the BNL experiment at Fermilab. The aim is to use a cleaner and more intense muon beam. The goal is to improve the BNL measurement by a factor four. For a more detailed description of this experiment, refer to [17].

The experiment with which this thesis is concerned is a new experiment at the Japan Proton Accelerator Research Complex, J-PARC. This experiment differs from its more recent predecessors (and its new peer at Fermilab) and is outlined in Section 2.3.

2.3 J-PARC

The ultimate goal of the J-PARC muon gµ − 2 and EDM experiment is to measure aµ to a precision of 0.1 ppm, a factor of 5 improvement on the previous BNL precision. Furthermore, this experiment aims to measure the −21 −19 EDM to 10 e·cm (10 e·cm at BNL). Not only does this experiment aim to improve the precision of aµ, but more importantly to provide an independent measurement of aµ from a different experiment with different systematics.

This experiment will use a storage ring of about 67 cm (smaller than BNL) in diameter in a magnetic field of 3 T (greater than BNL). The momentum of the muons will be lower than the “magic gamma” used by CERN and BNL. However, this experiment will only use magnetic fields to focus the muons, no electric fields.

2.3.1 The Muon Beam Line Muons are created as a decay product of pions,

+ + π → µ + νµ.

7 These pions are created by directing a proton beam on a graphite target. The pions that decay near the surface of the target create so-called surface muons, which have a well-defined energy and polarisation. The proton beam (and thus the muon beam) is pulsed with a repitition rate of 25 Hz. This muon beam is then thermalised and focused on a target to produce muonium atoms. These atoms will diffuse in a vacuum, where they are ionised by laser excitation. Muons created in this way are at room temperature. To bring the muons to the desired energy of 300 MeV, they are accelerated in a linear accelerator. After being accelerated, the muons are injected in the injection region. This is where the scope of this thesis begins. For a more detailed description of the muon creation and acceleration process, refer to [18]. The beam line is also displayed in Figure 2.4.

Figure 2.4: The beam line of the muon g − 2 EDM experiment at J-PARC. The proton beam creates pions, which decay into surface muons, which are then thermalised and made into muonium. The muonium is ionised and accelerated to the muon storage. [18].

2.3.2 Muon Injection and Storage After being accelerated, the muons are injected at a downward angle in the experimental setup. There, muons will start to orbit in circles in the dipole field. The fringe fields of this dipole field will bend the muons in the z-direction. A radial kicker field will bend the muons in a plane, where they will remain in a focused beam by a weak-focusing magnetic quadrupole field until they decay. The scope of this thesis is to track the muons from injection to storage, so this process is not elaborated upon further in this section. Refer to Chapter 3 for a more detailed description of the magnetic fields and to Chapter 4 for more on the injection process.

2.3.3 Measurement of Decay Positrons The spin precession frequency may be measured through the decay of the muons. The muon decays into a positron and two neutrinos,

+ + µ → e +ν ¯µ + νe. The neutrinos escape the setup undetected. In the center-of-mass frame of the muon, the positrons are mainly emitted in the direction of the muon spin, due to parity violation in the weak interaction. [11] In the lab frame, where the muon is moving, decay positrons have a higher energy when the muon spin is aligned with its momentum, and less when the muon spin is anti-parallel with the momentum. [19] High energy positrons are counted using a lower cut-off energy. This count rate should be modulated with frequency ωa, which can be directly related to aµ if the magnetic field in the setup and the muon charge-to-mass ratio are known to

8 sufficient precision. The muon EDM may be measured in a similar way as aµ, but for the EDM, the precession vector is not in the z-direction, but in the radial direction.

There are two precession vectors present in the experiment: The anomalous precession and the EDM precession. Let the magnetic field define the z-axis of a cylindrical coordinate system. The total precession vector will then become

ω = ωa + ωη = ωaˆz + ωηˆr.

If the total precession vector ω can be measured, aµ and the EDM may be determined simultaneously. Since η is several orders of magnitude smaller than aµ, the precession in the z-direction will dominate the precession in the radial direction. The expected observation will be a modulation in the count rate of high energy positrons due to aµ, superimposed by a slow up/down oscillation caused by ωη. This asymmetry is π/2 out of phase with the modulation due to aµ

Decay positrons will have a lower momentum than the muons and therefore travel inward and are detected by detection plates which are situated inside the storage ring. Using these detectors, the trajectory of the positron can be reconstructed to determine the spin direction of the muon at the time of decay. This will enable the measurement of ω as a vector and thus the determination of aµ and the EDM simultaneously.

9 Figure 2.5: The detectors of the decay positron tracks. Positrons will travel inward and their tracks hold information on the orientation of the muon spin at the time of decay. [18].

2.4 Goal of this Thesis

To measure gµ −2 to 0.1 ppm precision, systematic errors should be understood to similar precision. This thesis aims to provide a framework in which various systematic errors may be investigated by means of a simulation. This simulation will track muons from the moment of injection to the storage region. To be able to do this, a working model of the magnetic fields present in the setup needs to be built. This study has been outlined in Chapter 3. Once the magnetic field calculations yielded desirable results, the injection process using a kicker magnet was simulated. The effects of time-varying electric fields caused by the kicker has been investigated. This simulation is elaborated upon in Chapter 4. With the full injection process under control, the acceptance of the storage region has been determined in Chapter 5. Time-varying magnetic and electric fields during injection process has an effect on the orientation of the spin. Furthermore, the weak focusing field will cause the spin precession due to aµ to precess out of the horizontal plane during extended periods of trapping. This process has been studied and outlined in Chapter 6. The current through the kicker coils propagates at a finite speed through the conducting medium. This causes the current (and thus the magnetic field) to become dependent on the position along the wire. Furthermore, dispersive spreading of the current waveform may influence the injection efficiency. These effects have been outlined in Chapter 7. Concluding remarks and an outlook for further research is given in Chapter 8.

10 Chapter 3

Numerical Calculation of Magnetic Fields

A realistic model of the experiments requires the magnetic field to be accurately described. For this reason, a simple-to-use model of the magnetic field induced by the coils in the experiment is preferred over a detailed calculation. In this chapter the employed method will be elaborated on. In section 3.1 the methods employed to calculate the magnetic fields inside the setup are outlined. Section 3.2 gives a brief explanation on how the magnetic field calculation was implemented in the final code. Section 3.3 explains how the fields were fitted to data from the experiment and the results. Section 3.4 comments on the physical accuracy of the calculated magnetic fields and their correspondence to the magnetic fields in the experiment and Section 3.5 provides some concluding remarks.

3.1 Numerical Calculation of Magnetic Fields 3.1.1 Loop The magnetic field induced by a circular loop of wire of zero thickness can be found analytically for any point in space, apart from points inside the wire itself. This magnetic field, written in terms of elliptic integrals, is given in cylindrical coordinates as [20]

µ (z − z )I B (r, z) = 0 0 (r2 + r2 + (z − z )2)E(k) − α2K(k) , (3.1) r 2πα2βr 0 0 µ I B (r, z) = 0 (r2 − r2 − (z − z )2)E(k) + α2K(k) . (3.2) z 2πα2β 0 0

Here, α2, β2 and k2 are

2 2 2 α = (r − r0) + (z − z0) , (3.3) 2 2 2 β = (r + r0) + (z − z0) , (3.4) 2 2 α 4r0r k = 1 − 2 = 2 2 , (3.5) β (r + r0) + (z − z0) where r0 is the radius of the loop, z0 is the z-position of the centre of the loop, I is the current, µ0 is the magnetic permeability of the vacuum and K(k) and E(k) are the complete elliptic integrals of the first and second kind respectively, defined as

π Z 2 dθ K(k) = q , 0 1 − k2 sin2(θ)

π Z 2 q E(k) = 1 − k2 sin2(θ)dθ. 0 The expression for the magnetic field as given in equation (3.2) can readily be used, as the elliptic integrals are standard functions in the ROOT library. Therefore, the magnetic field due to coils that can be approximated by a current carrying circular loop of zero thickness is calculated using this method.

11 3.1.2 Coil The magnetic field along the axis of a solenoid of finite length and thickness can be calculated analytically. There exist methods to calculate the magnetic field of such a coil off-axis. Some of these methods are outlined in [21] and [22]. These methods require calculating several numerical integrals. As the magnetic field eventually needs to be calculated at O(105) locations, this method is expected to be slow. It is still desirable to calculate the magnetic field at points that are not on the axis of symmetry, as the muon will spend most of its time away from this axis. For fast magnetic field calculation, a simple numerical approximation of the magnetic fields present is advantageous. There are various methods to achieve this, one of which is outlined in [23] and is briefly explained here.

Assuming cylindrical symmetry and in the absence of current sources (there are no currents present within the storage region, as the coils are outside of this region), the radial and axial magnetic field components, Br(r, z) and Bz(r, z) respectively, can be written as

∞ n+1 X (−1) (2n+1) B (r, z) = B (z) r2n+1, (3.6) r 22n+1n!(n + 1)! 0 n=0

∞ n X (−1) (2n) B (r, z) = B (z) r2n. (3.7) z 22n(n!)2 0 n=0

Here r and z are the radial and axial coordinates in a cylindrical coordinate system, B0(z) is the on-axis (i) magnetic field, which is only a function of z, and B0 (z) denotes its i-th derivative to z. These parameters are also explained in figure 3.1. If the magnetic field on the axis of a cylindrically symmetric system is known analytically, the off-axis fields can be calculated using the equations above. The on-axis magnetic field for this configuration is calculated to be

  " p 2 2 ! p 2 2 !# µ0Jr0 ρ + ρ + κ ρ + ρ + (κ − η) Bz(0, z) = κ ln √ − (κ − η) ln . (3.8) 2 1 + 1 + κ2 1 + p1 + (κ − η)2

2 Here, J is the current density in units of A/m , r0 is the inner diameter of the coil and z0 is the z-coordinate of the ‘bottom’ of the coil. The other parameters are given below. Note that the only variable is κ, which depends on z. The other parameters are constants determined by the geometry of the coil.

z − z κ = 0 , r0 ∆z η = , r0 r + ∆r ρ = 0 . r0 Thus, only the derivatives of equation (3.8) need to be known to perform the expansions as given in equations (3.6) and (3.7). These derivatives can be found analytically and are given up to tenth order in [23], beyond which they can no longer be represented using double precision floating point parameters. This method does not require taking numerical derivatives or performing numerical integration and the expressions used are analytic. The magnetic field vector at any point can be calculated by inserting a coordinate, which makes this method very convenient and easy to use.

3.2 The Magnetic Field Class

A magnetic field class was developed using ROOT. To summarise, a class is a functionality in the C++ programming language (on which ROOT is based) that allows the programmer to make a type of object that has certain parameters and functions associated with it. It is in many ways similar to physically placing an object with certain parameters at a certain position. In the context of the magnetic field class, these parameters are:

• The current density through the coil, • The number of windings,

• The inner radius of the coil (r0),

12 Figure 3.1: Schematic to display the meaning of the parameters employed in the calculation of the magnetic field. The shaded area is a cross section of the coil.

• The position of the coil (z0), • The thickness of the coil (∆r), • The height of the coil (∆z).

Upon creation of an object of the class ‘magnetic field’ (called BField), these parameters are inserted and quantities like the current density J, ρ and η are immediately calculated and stored in memory for later use. The input parameters for a coil are different from those for a circular loop; those for a coil include ∆r and ∆z, whereas those for a loop do not. Using this information, the class has been designed to register whether it has to calculate the field of a loop or a coil. If an object of the class ‘magnetic field’ is made without ∆r and ∆z as input parameters, it will calculate the magnetic field of a wire. If ∆r and ∆z are given, it calculates the field of a coil.

Some important functions in the magnetic field class are:

• A function expecting a position vector as an input parameter and returning a magnetic field vector as an output (TVector3 BField::getB(TVector3)),

• A function calculating the Br and Bz components, expecting a position vector as input parameter (e.g. Double_t BField::calcBr(TVector3)),

• A function containing the derivatives of Bz(0, z), expecting the z coordinate as input.

Thus, a magnetic field vector of any cylindrically symmetric coil at some position given by a vector x can be found by making an object of the class BField, inserting the geometrical parameters of the setup and calling the function getB() with x as an input parameter. The code for the magnetic field class has been given in Appendix B.

3.3 Fitting the Fields

In the setup of this experiment there are three magnetic fields.[5] Two of these fields are static and one of them is dynamic. These three fields are:

• The main dipole field. A mostly homogeneous magnetic field of 3 T, • The weak focusing quadrupole, which focuses the muons in a stable oribt, about 10−4 T/m,

• The magnetic kicker field, time dependent, meant to bring muons in the trapping region.

13 The main field in the experiment is generated by four coils, placed symmetrically above and below the xy-plane. The main field is also strongly affected by the iron yoke that is positioned outside the coils, as it generates its own field once it is exposed to an external magnetic field. The weak focusing field is generated by seven coils, also symmetrically placed above and below the xy-plane. These coils generate a quadrupole field that is meant to keep the particles within the storage region. Finally, the kicker field is generated by two pairs of anti-Helmholtz coils. This field is time-dependent, as it is meant to bend the trajectory of the muon in the xy-plane. The entire setup is displayed in figure 3.2.

1 1 1 1

2 2 2 2 3 3

4 4

5 5 3 3 6 6

7 7 4 4

Figure 3.2: Schematic display of the setup of the coils. The main coils are given in red, the focus coils in green and the kicker coils in black. The gray rectangle represents the iron yoke. The numbering as indicated in this figure will be used to describe which coils are meant throughout this report. The dashed line is a sketch of a particle trajectory. The solid black lines represent a cartesian coordinate system. The vertical line represents the z-axis and the horizontal line represents the xy-plane. The system is cylindrically symmetric around the z-axis.

The setup of the magnetic field was fitted to the data from [5]. For the fitting procedure, geometrical parameters like the inner radius of the coils, its position, the current etc. were taken as free parameters. This resulted in an ‘effective’ setup, which did not necessarily correspond to the physical setup of the experiment, but did effectively recreate the magnetic field in the actual experiment. Part of the reason for recreating the experimental magnetic field in this way is to account for the field of the iron yoke, which strongly affects the magnetic field. The fitting of the fields generated by all these coils is outlined below.

3.3.1 Fitting the Main Field As stated above, the iron yoke affects the magnetic field arising from a current in the main coils. The iron yoke was approximated as an additional large coil around the entire setup. This approximation is justified by the fact that the iron yoke in the experiment is used to enhance the magnetic dipole field strength generated by the coils.[24][5] In this calculation it is not of importance how the magnetic field is generated, but that it has the desired shape. For this reason, it has been decided to enhance the field not by inserting an iron yoke, but by introducing an additional coil, which is simpler to implement. This approximation allowed for reasonable fitting of the magnetic field to the realistic case. Furthermore, an additional coil in the centre of the setup was added to improve the homogeneity in the trapping region.

14 The fitted parameters for the main coil are given in Table 3.1. Some parameters were kept fixed in the fitting process, as these were required by the symmetry of the system. For example, the iron yoke and the centre coil must have their centres at z = 0. Furthermore, coil 1 and 4 should be placed symmetrically about the central plane. As z0 is the position of the bottom of the coil, z0 of the coils that are positioned below the central plane is actually z0,z<0 = −(z0,z>0 + ∆z). In this way, the iron yoke and centre coil actually have a nonzero z0, as z0 = −∆z/2.

I [Ampere × Turns] z0 [m] r0 [m] ∆z [m] ∆r [m] Coil 1 1.75526 · 106 0.446714 0.807651 0.24176 0.0272952 Coil 2 1.05565 · 106 1.22632 0.214255 0.0749495 0.16298 Coil 3 1.05565 · 106 -1.30127 0.214255 0.0749495 0.16298 Coil 4 1.75526 · 106 -0.688474 0.807651 0.24176 0.0272952 Iron Yoke 4.18211 · 106 -1.80815 2.07891 3.6163 0.199342 Centre Coil 5.20241 · 105 -0.259255 0.594368 0.51851 0.018832

Table 3.1: Fitted parameters for the main coils.

The resulting magnetic fields as a function of position are given in Figure 3.3 and 3.4. The red curve is the sum of all magnetic fields. The other curves display the magnetic fields of all components. The fields are only plotted between z ∈ [−1 m, +1 m]. The magnetic fields start to deviate from the realistic case beyond this region, as the field was approximated as a polynomial expansion. Any finite polynomial expansion has a finite region of validity, beyond which it will deviate from the realistic case. This is not an issue, however, as these are also the physical boundaries of the experiment, beyond which the iron yoke is positioned. Calculating trajectories beyond this region does not carry physical significance.

Main Coils Legend Outer Coils Inner Coils 3 Iron Yoke

Bz [T] Centre Coil Total 2.5

2

1.5

1

0.5

0 −1 −0.5 0 0.5 1 Axial coordinate, z [m]

Figure 3.3: The axial component of the magnetic field Bz as a function of the axial coordinate z of all individual coils and their sum (red). The radial position was taken to be r = 0.332 m.

15 Main Coils Legend

3 Bz B [T] Br 2.5

2

1.5

1

0.5

0

−0.5

−1 −0.5 0 0.5 1 z position [m]

Figure 3.4: The axial and radial components of the total magnetic field as a function of the axial coordinate z. The radial position was taken to be r = 0.332 m. The radial field bends the muons to the xy-plane.

To get an impression for the structure of the magnetic field, a field map was plotted in figure 3.5.

Main Coils 1 0.8 9 0.6 8 0.4 7 0.2 6 Axial coordinate, z [m] 0 5

0.2− 4

0.4− 3

0.6− 2

0.8− 1 1− 0 0.1 0.2 0.3 0.4 0.5 0.6 Radial coordinate, r [m]

Figure 3.5: A magnetic field map of the fitted main coils. The colour palette on the right indicates the magnetic field strength in units of Tesla. The black bar on the left is the centre coil. The other coils are not positioned in this region and are therefore not displayed. The blue ellipse in the centre is an estimate of trajectory of the muons.

3.3.2 Fitting the Weak Focusing Field The weak focusing field was fitted to Figure 7.14 in [5]. The coils were approximated as ideal current loops. This means that ∆z = ∆r = 0. The direction of the current of the coils alternates between clockwise and anti-clockwise, represented by a minus-sign in front of the current. The fitted parameters of the weak focusing coils are given in Table 3.2. The magnetic fields generated by this data are given in Figure 3.6 and 3.7.

16 I [Ampere × Turns] z0 [m] r0 [m] Coil 1/7 1.26467 · 103 0.835378 0.303265 Coil 2/6 −4.56576 · 102 0.269852 0.543780 Coil 3/5 1.57015 · 103 0.232429 0.919956 Coil 4 −1.55012 · 103 0 0.750588

Table 3.2: Fitted parameters for the weak focus coils.

Weak Focus Coils − ×10 3 0.8 Bz [T] 0.6

0.4

0.2

0

−0.2

−0.4 Legend Outer Coils Middle Coils −0.6 Inner Coils Centre Coil Total −0.8 −1 −0.5 0 0.5 1 z position [m]

Figure 3.6: The axial component of the magnetic field Bz as a function of the axial coordinate z of all individual coils and their sum (red). The radial position was taken to be r = 0.332 m.

Weak Focus Coils − ×10 3 0.4 Legend Bz 0.3 Br

0.2

0.1 Magnetic Field Strength [T] 0

−0.1

−0.2

−0.3

−0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 z position [m]

Figure 3.7: The axial and radial components of the total focus field as a function of the axial coordinate z. The radial position was taken to be r = 0.332 m. The axial component of the field is close to zero, to not influence the cyclotron motion. The radial field causes a restoring force on the muon in the vertical direction, causing it to remain trapped.

17 Observe that the radial magnetic field between |z| < 20 cm depends approximately linear on z. With this, the force causing the focusing is linear in z in this region, causing harmonic oscillation along the z-direction. For impression of the structure of the magnetic field, a field map is given in Figure 3.8.

Weak Focusing Coils 3− 0.4 10× 0.9 0.3 0.8

0.2 0.7

0.1 0.6 Axial coordinate, z [m] 0 0.5 0.1− 0.4 0.3 0.2− 0.2 0.3− 0.1 0.4− 0 0.1 0.2 0.3 0.4 0.5 0.6 Radial coordinate, r [m]

Figure 3.8: A magnetic field map of the fitted focus coils. The colour palette on the right indicates the magnetic field strength in units of Tesla. The blue ellipse in the centre is an estimate for the trajectory of the muons.

3.3.3 The Kicker Coils The kicker coils in the experimental setup are approximated by circular loops of wire of zero thickness. Since the positions and dimensions of these coils are already dictated by [5], it was not required to fit these parameters. The magnitude of the field generated by the kicker coils can be controlled by adjusting the current. Examples of the magnetic field profile are given in figures 3.9 and 3.10 below. Kicker Coils

0.015 Legend Radial Field 0.01 Axial Field 0.005

Magnetic Field Strength [T] 0

−0.005

−0.01

−0.015 −1 −0.5 0 0.5 1 Axial coordinate, z [m]

Figure 3.9: The axial and radial components of the magnetic field generated by a constant current of 5000 Ampère×Turns through the kicker.

18 Kicker Coils 0.6

0.4 0.05

0.2 0.04 Axial coordinate, z [m] 0 0.03

0.2− 0.02

0.4− 0.01

0.6− 0.2 0.25 0.3 0.35 0.4 0.45 0.5 Radial coordinate, r [m]

Figure 3.10: A magnetic field map of the kicker coils. The colour palette on the right indicates the magnetic field strength in units of Tesla. Note that the magnetic field strength in this map is taken at a constant current. The actual kicker field varies in strength with time according to a chosen. The black ellipses do not carry information related to the modeling of the field, but are only there to mark the position of the kicker coils. The transparent ellipse in the centre is an estimate for the trajectory of the muons.

3.4 Precision and Accuracy

Several approximations have been made to arrive at the field configuration given in this chapter. These approx- imations may lead to deviations in the fields from the experimental values.

3.4.1 Main Field To test whether the magnetic field calculated by this method yield physical results, the magnetic field is com- pared to magnetic field measurements given in Figure 2 of [25]. The magnetic field was calculated from the given parameters in the experimental setup. The results of this calculation are given in Figure 3.11.

ATLAS Coils

B [T] 2

1.5 Legend Br, R = 1.058m 1 Br, R = 0.538m Br, R = 0.118m Bz, R = 1.058m Bz, R = 0.538m 0.5 Bz, R = 0.118m

0

−0.5 −3 −2 −1 0 1 2 3 z [m]

Figure 3.11: Magnetic fields generated by the ATLAS coils, calculated using the BField class. The magnetic field is separated into a radial and an axial component.

19 The magnetic field at R = 1.058 m deviates by about 5% from the measured magnetic field given in [25]. This is to be expected, as [23] states that the magnetic field calculations correspond to the exact solutions by 0.1% for up to 70% of the radius of the coil. R = 1.058 m is approximately 85% of the radius of the coil and the deviation from the exact field is expected to be greater than 0.1%. The other magnetic fields appear to differ from the measured field by about 2% to 5% for R = 0.538 m and R = 0.118 m respectively. This deviation is accounted for by observing that there is a 4% contribution to the field measurements by magnetised iron. We conclude that the magnetic field calculations correspond to the physical reality they are meant to represent, up to the limitations of the numerical approximation given in [23].

The quality of the main field is determined by its homogeneity in the storage region. To measure the spin precession vector of the muon to a precision on the order of 0.1 ppm, this homogeneity should be better than 1 ppm. The homogeneity of the field as calculated by the means outlined in this chapter is on the order of 10−3. This is not good enough to perform useful simulations of the spin precession frequency. For performing calculations on the injection process it is good enough, however, as the most important effect here is the bending of the muon trajectory by the fringe fields.

To still make the magnetic field useful for spin precession calculations, the magnetic field is defined in two regions. Outside the storage region, the magnetic field as calculated in this chapter is used to perform a realistic injection process. Once the muon enters the storage region, the magnetic field will be defined as an ideal dipole field of 3 T, pointing in the z-direction.

3.4.2 Focus Field The degree of focusing by the focus field is determined by the field index n, defined in [5] as R δB n = − 0 z . (3.9) B0 δR −4 Calculating the field index for the focus coils yields nsimulated = 1.4 · 10 . This is comparable to the field index −4 required in the experiment, which is nexperiment = 1.5 · 10 .

3.5 Conclusions

Methods for describing the magnetic fields in the experiment have been successfully implemented. Their accu- racy has been quantified. With this, all relevant magnetic fields are described to sufficient accuracy to perform realistic simulations of the setup of the experiment. This has been described further in the following chapters.

20 Chapter 4

Muon Injection

The magnetic fields have been calculated in Chapter 3. It is now possible to perform calculations on the orbits of the muons through the experiment. Section 4.1 describes the equation of motion for a muon through magnetic fields and how the Runge-Kutta Fourth Order algorithm is employed to solve this equation of motion numerically. Section 4.2 displays the injection scheme and how the kicker was employed to perform a realistic trapping process. The effect of electric fields induced by the kicker is given in Section 4.3 and Section 4.4 provides concluding remarks on this chapter.

4.1 Dynamics 4.1.1 The Equation of Motion The equation of motion (EOM) for a charged particle in a magnetic field B is given by the Lorentz force law,

˙p = qv × B. (4.1) Here ˙p is the time rate of change in the muon momentum, v is its velocity and q its charge. It is desired to calculate the position as a function of time. This is achieved by expressing the momentum in terms of the velocity,

p = γmv. (4.2) As magnetic fields do not perform work, |v| and thus γ are constant. Solving Equation (4.2) for v and inserting the result in (4.1) gives q ˙v = v × B. (4.3) γm The position can then be calculated from ˙x = v. This is a first order differential equation of a form which can be used in the Runge-Kutta fourth order (RK4) algorithm, which is outlined in the next section.

4.1.2 The Runge-Kutta Fourth Order Algorithm The RK4 algorithm can be applied to differential equations of the form

dy(t) = f(y(t), t), dt where y and f are 3-vectors. With the initial condition given by

y(t0) = y0. It is now shown how the RK4 algorithm is applied specifically to this problem. The position at a time t + δ can be found from

x(t + δ) = x(t) + v(t)δ. The reason for not using the RK4 algorithm in this step is because it has been found that Euler integration is sufficiently precise and improved calculation times. To find v(t), the RK4 algorithm is employed as follows. The velocity at time t + δ is given by

21 δ v(t + δ) = v(t) + (k + 2k + 2k + k ). 6 1 2 3 4

Where the ki vectors are given by

q k = v × B(x, t), 1 γm q δ δ k = (v + k ) × B(x, t + ), 2 γm 2 1 2 q δ δ k = (v + k ) × B(x, t + ), 3 γm 2 2 2 q k = (v + δk ) × B(x, t + δ). 4 γm 3 This set of equations fully determines the position at time t + δ if an initial velocity and position are given. Using x(t + δ) and v(t + δ) as initial conditions, x(t + 2δ) and v(t + 2δ) can be calculated and so on. The error in a single step is on the order of O(δ5), whereas the cumulative error is on the order of O(δ4). [26] Iteration over many of these steps yields a particle trajectory for an arbitrary length.

4.2 Trapping of a Muon 4.2.1 Weak Focusing To demonstrate the workings of the weak focusing field the muon was first trapped in the weak focusing field without a kicker. The muon was given an initial momentum of 300 MeV/c (comparable to the experiment) in the xy-plane, with a small component in the z-direction. The results of this are shown in Figures 4.1 and 4.2. The z-position of the muon as a function of time during an extended period of trapping is displayed in Figure 4.3.

Figure 4.1: A two dimensional projection of the muon trajectory for about 30 orbital periods. The muon is Figure 4.2: The three dimensional trajectory of the bent to keep orbiting in the trapping region. The black muon for about 30 orbital periods. The black dot sig- dot signifies the starting position of the muon. The nifies the starting position of the muon. The initial initial pitch angle of the muon was greater than in pitch angle of the muon was greater than in the ex- the experiment, to improve the visibility of the orbits. periment, to improve the visibility of the orbits.

4.2.2 Kicker The kicker field is introduced to bend the muon into the trapping region. In [5] the current shape is chosen to be a (half) sine curve. This, however, comes with a discontinuity at the start and end of the pulse. This discontinuity causes strong transient effects, as a discontinuous rate of change of the magnetic field induces a high peak electric field, by Maxwell’s equations. In this calculation a kicker that is already switched on when the muons enter the injection region and switches off by the time the muons have reached their desired orbits was tested. The current shape of the kicker was given by

22 Figure 4.3: The z-position of the muon as a function of time, for a realistic pitch angle of 0.1 mrad and for 500 orbital periods. The muon remains trapped and undergoes simple harmonic motion, as expected.

" # 1 I(t) = I 1 − . (4.4) 0 t−t0  1 + exp − τ

Here I0 is the amplitude of the current, t0 is a parameter defining the start of the current pulse and τ defines a timescale of the pulse. This particular shape of the current was chosen as it is continuous and differentiable ev- erywhere, making it convenient to use. This way the transient effects when switching on the current are reduced.

The kicker parameters were tested by placing a muon in the trapping region and switching on the kicker for various kicker parameters. Once the kicker was able to eject a muon from the trapping region, the process can be reversed to trap incoming muons in the trapping region. The trajectory of a muon starting in the trapping region and being ejected by the kicker is called a reverse trajectory, as it is the reverse of an injection trajectory. The kicker parameters were found by trial-and-error. The parameters that resulted in an ejected muon are given in table 4.1

I0 750 Ampère × Turns 100 . I0 . 1500 Ampère × Turns t0 70 ns 40 . t0 . 130 ns τ 20 ns 0 . τ . 130 ns Table 4.1: The parameters for the kicker current. The middle column displays the kicker parameters used in this simulation. The right column gives a rough range of parameters for which injection was successful, be it suboptimal. For most of the values in this range, the amplitude of vertical oscillations in the trapping region was greater than desired. The current shape approaches a step function as τ → 0.

The corresponding current and its derivative have been plotted in Figures 4.4 and 4.5. The slope in Figure 4.4 is steepest at t = t0 and thus coincides with the peak in Figure 4.5. In this way, t0 defines the point of symmetry, whereas τ defines the width of the distribution.

23 6 Derivative of the Current as a Function of Time Current as a Function of Time 10× 700 9000

600 8000 7000 500 6000 400 5000

300 4000

Current*Turns [A] 3000 200 2000 100 1000 −6 Derivative of Current [A/s] 6− 0 ×10 0 10× 0 0.05 0.1 0.15 0.2 0.25 0 0.05 0.1 0.15 0.2 0.25 Time [s] Time [s] Figure 4.4: Current through the kicker coils as a func- Figure 4.5: Derivative of the current displayed in Fig- tion of time. This function decays to zero continu- ure 4.4 as a function of time. This function will be ously and is differentiable everywhere. The thick ver- used in Section 4.3, for calculating the electric field. tical solid line indicates t = t0. The thick vertical solid line indicates t = t0.

4.2.3 Injection After tracking muons through the ejection process, the final position and velocity were recorded. The velocity and the magnetic field were then reversed in direction to now accommodate an injected muon. The starting time for the kicker (parametrised by t0) was adjusted to switch off at the appropriate time. This resulted in the successful trapping of a muon, as shown in Figures 4.6 and 4.7. The z-position of the muon as a function of time during injection has been given in Figure 4.8.

Figure 4.6: A two dimensional projection of the muon Figure 4.7: The three dimensional trajectory of the trajectory during injection for about 300 orbits. The muon. The muon starts at x = 0 m, y ≈ 0.38 m and muon starts at the top right of the image. The solid z ≈ 0.85 m. The solid rectange around z = 0 is a rectange around z = 0 is a dense projection of many dense projection of many orbits. orbits.

4.3 The Effect of Electric Fields on Dynamics

For measuring the spin precession vector to 0.1 ppm precision, the electric field in the storage volume must be less than 10 mV/cm. [5] Furthermore, the electric field induced by the kicker may influence the dynamics of the muon and interfere with the injection process. These effects have been studied and their results are listed here.

4.3.1 Adjusting the Equation of Motion In the presence of electric fields, it can no longer be assumed that γ remains constant, because the electric field performs work on the muon. The EOM for a charged particle in an electric and magnetic field is given by the Lorentz force law,

˙p = q(E + v × B). (4.5)

24 Figure 4.8: The z-position of the muon as a function of time during injection, for 300 orbital periods. The muon is successfully injected and remains trapped by the weak focusing field.

It is desired to solve this EOM using the RK4 algorithm. This is achieved by rewriting the EOM in terms of ˙p and p alone. The latter is given by v p = γmv = . q |v|2 1 − c2 Solving for v gives

c2 c2 v = p = p. pm2c2 + |p|2c2 (p) Here (p) is the relativistic energy of the muon and it is a function of p. This expression for v can be inserted into Equation (4.5) to give

c2 ˙p = q(E + p × B). (4.6) (p) The EOM is now in the form to include the work done by the electric field and to be used in the RK4 algorithm.

4.3.2 The RK4 Algorithm for Electric Fields To accomodate for the new EOM (4.6), the RK4 algorithm needs to be adjusted accordingly. Calculating the position is now performed using the momentum δ x(t + δ) = x(t ) + (k + 2k + 2k + k ) . 0 0 6 x,1 x,2 x,3 x,4

Where the kx,i are given by

2 p(t0)c kx,1 = , (p(t0)) δ 2 p(t0 + 2 )c kx,2 = δ , (p(t0 + 2 )) kx,3 = kx,2, 2 p(t0 + δ)c kx,4 = . (p(t0 + δ))

25 Where kx,2 = kx,3 because there is no explicit x dependence, so there is no dependence of kx,3 on kx,2, making them equal. To proceed, p must be known for both t0 + δ/2 and for t0 + δ. This means that for each time step δ of δ in x, the RK4 algorithm needs to be applied twice for p, with a step size of 2 . Applying the RK4 algorithm to Equation 4.6 gives δ p(t + δ) = p(t ) + (k + 2k + 2k + k ) . 0 0 6 p,1 p,2 p,3 p,4 Abbreviate p(t0) as p0. The kp,i vectors are given by

 c2  kp,1 = q E(t0) + p0 × B(t0) , (p0) 2   ! δ c kp,1 δ kp,2 = q E(t0 + ) + p0 + × B(t0 + ) , 2 kp,1 2 2 (p0 + 2 ) 2   ! δ c kp,2 δ kp,3 = q E(t0 + ) + p0 + × B(t0 + ) , 2 kp,2 2 2 (p0 + 2 )  c2  kp,4 = q E(t0 + δ) + (p0 + kp,3) × B(t0 + δ) . (p0 + kp,3) Putting this all together, the position of the particle is calculated using the following steps:

1. Calculate kx,1 from the initial momentum,

δ 2. Apply the RK4 algorithm to calculate p(t0 + 2 ) from the initial momentum,

δ 3. Calculate kx,2 and kx,3 from p(t0 + 2 ),

δ 4. Apply the RK4 algorithm to calculate p(t0 + δ) from p(t0 + 2 ),

5. Calculate kx,4 from p(t0 + δ),

6. Calculate x(t0 + δ) from all kx,i. This algorithm can be iterated over as many times as is needed. It is very general, as it directly employs the EOM of the charged particle and includes relativistic effects. It is possible to find E and B as functions of the particle’s position and the time and use these to calculate the momentum at the next time step.

4.3.3 Electric Field of a Thin Circular Wire The electric field is calculated using the Maxwell Equation ∂A E = − . ∂t Where A is the magnetic vector potential. The vector potential of a thin current-carrying circular wire is given in [20] in cylindrical coordinates as

µ 4r I(t) (2 − k2)K(k) − 2E(k) A(r, z, t) = 0 0 φ.ˆ (4.7) p 2 2 2 4π (r + r0) + (z − z0) k

Here r0 is the radius of the loop and z0 is its position along the vertical axis and I(t) is the current. The factor k is given in Equation (3.5) and K(k) and E(k) are the complete elliptic integrals of the first and second kind respectively.

As all time dependence of A is due to I(t), it suffices to calculate the time derivative of the current given in Equation (4.4) and insert it in Equation (4.7) to calculate E. The derivative of the function for the current given by

I exp( t−t0 ) I˙(t) = − 0 τ . (4.8) t−t0 2 τ (1 + exp( τ )) This function is also plotted in Figure 4.5.

26 4.3.4 Results for Electric Field Simulations The electric field has been included in the EOM and its effect on the dynamics has been determined. Below are graphs that display the electric and magnetic field at the position of the particle in the lab frame as a function of time. The electric field should drop off to zero as the particle enters the trapping region, because the electric fields generated by the bottom kicker is equal and in opposite direction to that of the top kicker. The electric fields cancel right in the xy-plane.

Figure 4.9: The kicker field at the radius of the muon orbit as a function of time.

Figure 4.10: The electic field at the position of the Figure 4.11: The kicker field at the position of the muon in the lab frame as a function of time. The muon in the lab frame as a function of time. The electric field is zero when the muon crosses the xy- sharp dip corresponds to when the muon is right be- plane. tween the two kicker coils, where the magnetic fields of both almost cancel.

An estimate for the effect of the electric field is acquired by integrating the field shape in figure 4.10 and multiplying by the charge of the muon

Z tend ∆p = q E dt. t0 The electric field increases the muon momentum by a factor on the order of 10−6. If the incoming muon has a higher momentum, its gyroradius will increase accordingly. The nominal gyroradius is 0.333 m, so the error on the gyroradius will be on the order of 10−7 m.

4.3.5 Electric Field Inside the Storage Volume As stated before, the electric field in the storage volume must be less than 10 mV/cm (= 1 V/m). The storage volume is toroidal shaped, with an inner radius of 33.3 - 1.5 cm and an outer radius of 33.3 + 1.5 cm. The height of the toroid runs from z = −10 cm to z = +10 cm. The electric field during injection at x = (33.3, 0, 10) cm was determined to estimate the time before which the electric field is still above the 10 mV/cm threshold. The results are displayed in Figures 4.12 and 4.13.

27 Figure 4.12: The electic field at x = (33.3, 0, 10) Figure 4.13: Zoomed in on the region where the elec- cm. The vertical line represents the peak field. tric field drops below 10 mV/cm (1 V/m).

The thick solid horizontal line in Figure 4.13 corresponds to a field strength of 10 mV/cm. The field is less than 10 mV/cm approximately 210 ns after the start of injection. It is more convenient to express this time in terms of the start time of the kicker, defined by t0. The electric field drops below 10 mV/cm after t − t0 ≈ 180 ns.

4.4 Conclusions

The calculations have successfully reproduced the process of trapping a muon by the use of the magnetic fields involved. The relative effect of the electric field due to the time-varying kicker field on the muon momentum has been investigated and is on the order of 10−6. This causes an error on the muon gyroradius on the order of 10−7 m. This is still well within the desired phase space distribution, which has a width of about 5 mm (figure 7.11 in [5]). It is concluded that the effect of electric fields generated by the kicker coils can be neglected in the dynamics of the injection process.

The electric field in the storage region may exceed the 10 mV/cm threshold, shortly after the kicker has been switched off. It is advisable to only start measurements once the electric field has decayed below the 10 mV/cm threshold. For this particular current shape this is approximately 180 ns after t0. This result may differ for different shapes of the current.

28 Chapter 5

Phase Space

In Chapter 4 the trapping of a single muon has been demonstrated. In the experiment there are on the order of 106 muons per injection. It would be intractable to calculate the orbit of every single muon, as this would take on the order of 107 s. It is desirable to find a faster way to track a bundle of muons through the experimental setup. It is possible to reduce the problem of tracking a bundle of particles to tracking a single particle. This can be done by tracking the particle that occupies the outermost orbit through phase space and using the fact that all other particles must be situated within the volume enclosed by the orbit of the outer particle. This method is outlined in more detail in Chapter 8 of [27]. To this end, the outermost boundary of the phase space occupied by the muons needs to be determined. Section 5.1 describes the most important concepts to this method. Section 5.2 gives the results of integrating over the phase space of the acceptance region. Concluding remarks are given in Section 5.3.

5.1 Concepts and Dimensionality 5.1.1 Emittance and Acceptance One way to manage the number of particles and with that the calculation time required is to determine the volume of acceptance. The particle beam that enters the injection region will occupy a volume in phase space, referred to as the emittance. A fraction of all particles (and thus a fraction of the emittance) will have the right initial conditions to be trapped in the storage region. The volume in phase space corresponding to the trapped particles is referred to as the acceptance.

Disregarding the kicker, there are six relevant parameters. These parameters are the position coordinates of the particle (x, y, z) and all components of the momentum vector (px, py, pz). For all these parameters, there exist combinations that will result in a trapped particle and combinations that do not. All combinations that result in a trapped particle are lying within a volume in phase space. Since there are six parameters, this volume is six-dimensional. If the shape of the acceptance is known, it can be compared to the emittance and it will yield information on which muons will be trapped and which ones will be ejected.

A configuration of static magnetic fields cannot trap a particle coming from outside of the storage region if no other effects are present. However, if a particle were to be placed in the storage region with given initial conditions, it can be determined whether the particle will remain trapped, or whether it will escape the storage region. The role of the kicker magnet is to bring particles (preferably as many as possible) in phase space from the emittance to within the acceptance. This process is illustrated in figure 5.1.

The emittance is determined from the initial conditions of the muons, which are determined by the processes that occur before the muons enter the injection region. The acceptance is determined by the weak focusing field and this volume in phase space has to be calculated.

5.1.2 Determining the Acceptance The boundary of the volume of acceptance can be found by Gauss integration. In this way, points in phase space are randomly chosen. For each of these is checked whether they result in a trapped particle or not. A quick calculation shows that this calculation does not seem feasible. If the acceptance is to be found for on the order of 10 distinct values for all six parameters, this will require 106 calculations of the particle trajectory, each of which will take a few seconds. Thus, exploring all of phase space takes on the order 106 seconds, which is more than eleven weeks. It is desirable to find a clever way of reducing this calculation time. One way of

29 x' x'

Kicker

x x Figure 5.1: A graphical representation of the action of the kicker. The left image shows a cutout of the emittance (more specifically its boundary). No particle within the emittance is accepted in the storage region. The kicker aims to bring a fraction of all particles in the acceptance volume, which is shown in green. reducing the calculation time is by relating some of the six parameters to each other. Below is outlined which parameters can be related to reduce the dimensionality of this problem.

First of all it is possible to employ the cylindrical symmetry of the system. In doing this, x and y may be combined into r by

r2 = x2 + y2.

This reduces the number of dimensions of this problem by one. This does not quite work for px and py, as these have to be separated into the radial component, pr and the azimuthal component, pφ.

2 2 2 2 px + py = pr + pφ Furthermore, in the absence of electric fields, the energy of the muon is constant due to the fact that magnetic fields cannot do work on the muon. This implies that |p| is a constant of motion throughout the injection process. This has two effects: It does not have to be taken into account in the calculation of the acceptance, as it is determined by the initial conditions and it can be used to relate the two momenta:

2 2 2 2 2 2 2 |p| = px + py + pz = pr + pφ + pz (5.1) This means there are only two distinct momenta, which can be related by the knowledge of the total momentum. For the purpose of this test, it is assumed that the magnitude of the momentum has a very narrow distribution such that it has essentially a single value. It has been verified that all energies within the distribution referred to in Figure 7.12 [5] are in fact accepted.

Instead of using various values for pr, pφ or pz, with Equation (5.1) as a condition, it is more intuitive and practical to consider the motion in terms of two angles: the polar angle, θ and the azimuthal angle φ. The former is the angle the trajectory of the muon makes with the z-axis. The latter is the angle by which the trajectory deviates from the ideal trajectory in the x-y plane. They are related to the momenta as

p sin(θ) = z , |p| p sin(φ) = r , |p| provided θ and φ are small. By the reasoning above, the number of free parameters has been reduced from six to four.

30 5.2 Integrating Over Phase Space

The integration has been performed over phase space by picking 105 random combinations of r, z, φ and θ and checking whether the combination results in a trapped particle. The random numbers were generated by the Mersenne-Twister algorithm, which has a period of recurrence on the order of 219937. [28] A muon is no longer considered trapped when it enters the r < 29 cm region, as the detectors are positioned there. The results of this integration are given in Figures 5.2 and 5.3.

Figure 5.2: Two dimensional projection of the phase Figure 5.3: Two dimensional projection of the phase space of acceptance, corresponding to the r −φ plane. space of acceptance, corresponding to the z − θ plane. The black curve is the separatrix, the boundary of the The black curve is the separatrix, the boundary of the phase space. phase space.

The separatrix is approximated as an ellipse. The parameters of this ellipse are given in Table

Parameters for r − φ Parameters for z − θ

r0 0.332149 m z0 0 m φ0 0.0315595 rad θ0 0 rad ar 0.0421328 m az 0.199804 br 0.128221 rad bz 0.0499331

Table 5.1: The parameters defining the separatrix. The parameters r0, z0, φ0 and θ0 define the centre of the ellipse, ar and az are the semi-major axes and br and bz are the semi-minor axes.

Figure 5.2 shows that the acceptance of r − φ is not perfectly elliptic, but egg-shaped. This is because the acceptance is considerably larger than the trapping region. The trapping region runs from r = 33.3 − 1.5 cm to r = 33.3 + 1.5 cm, whereas the acceptance runs from r = 29 cm to r = 38 cm. Over this region, the magnetic field is not an ideal dipole. This causes deviations from the ideal dipole field orbit and with that the muon orbits that are accepted.

5.3 Conclusions

The boundary of the acceptance has been determined and is roughly parametrised by two ellipses, one in terms of r and φ and one in z and θ. Computation time can now be reduced, as it is sufficient to only track a muon until its location in phase space falls within the acceptance. Once it has succeeded to bring a muon inside the acceptance, it is not necessary to track it further, as it will remain trapped from then on.

The emittance can be determined from [5]. The influence and efficiency of the kicker may then be investigated. This could yield useful results on the effect of various electric and magnetic fields on the muon phase space volume and the number of muons that can be trapped. This, however, goes beyond the scope of this thesis.

31 Chapter 6

Spin Tracking

The spin precession caused by the magnetic (and electric) fields need to be well understood to measure g − 2 to the desired precision of 0.1 ppm. In this chapter the motion of the spin through the experimental setup is examined. Section 6.1 outlines the T-BMT Equation and how it is used in the RK4 algorithm to track the spin precession. Secion 6.2 gives the results of the simulations during the injection and during an extended period of trapping. This chapter is concluded in Section 6.3.

6.1 Spin Precession 6.1.1 The T-BMT Equation The EOM describing the spin precession of a charged particle with spin in cyclotron motion is given by the T-BMT Equation [29]      ds e 1 aµγ 1 β × E = s × aµ + B − β(β · B) − aµ + . (6.1) dt mµ γ γ + 1 γ + 1 c

Here s is the classical spin precession vector, e is the elementary charge, mµ is the mass of the muon, aµ is the anomalous magnetic dipole moment (g−2)/2, γ is the relativistic gamma factor, β is the velocity vector, defined by β = v/c and c is the speed of light. The blue (red) terms indicate contributions to the spin precession by the magnetic (electric) field. When the muon EDM is taken into account, the T-BMT Equation may be generalised to include electric dipole moments, [7]

    ds e 1 aµγ 1 β × E = s× aµ + B − β(β · B) − aµ + (6.2) dt mµ γ γ + 1 γ + 1 c η E γ β(β · E)  + − + β × B . (6.3) 2 c γ + 1 c The first (second) line represents the contribution to the spin by the magnetic (electric) dipole moment. Here η is a dimensionless number determining the magnitude of the muon EDM. It is related to the muon EDM, dµ, in a similar way to how g is related to the magnetic dipole moment by e dµ = η s. (6.4) 2mµc To use Equation (6.3), η has to be known. The experiment aims to measure the muon EDM to 10−21 e·cm. By inserting this into Equation 6.4 and solving for η yields

η ∼ 10−8. It is important to note that this is by no means an established value for η. This is the precision to which this experiment aims to measure η. For the spin calculations this value for η will be used, as this is the order of magnitude to which effects due to the EDM may play a role in the measurement data. Equation (6.3) is more easily understood by observing that the first term in each line represents the component of the field perpendicular to the the direction of motion,

B⊥ ∼ (aµ + 1) B,  η  E ∼ E . ⊥ 2c

32 The second term in each line represents the component parallel to the direction of motion

a γ B ∼ µ β(β · B), k γ + 1 η a γ E ∼ µ β(β · E). k 2c γ + 1

Equation (6.3) is of a similar form as (4.3) and can also be solved using the RK4 algorithm.

6.1.2 The RK4 for Spin Tracking One of the difficulties with tracking spin using a discretised approach is that the length of the spin vector is not constrained and may start to vary when the step size is too large. This is nonphysical and it is desirable to find a way to constrain the RK4 algorithm to make each time step in the spin precession correspond to a pure rotation. This can be solved by translating the RK4 algorithm to, instead of adding a vector, rotate the vector at each time step. Recall the RK4 algorithm, now applied to Equation (6.3). The spin vector s(t + δ) can then be written as δ s(t + δ) = s(t) + (k + 2k + 2k + k ). 6 s,1 s,2 s,3 s,4

Here the ks,i vectors are given by the RHS of Equation (6.3), evaluated at t, t + δ/2 and t + δ and s, s + δ/2ks,1, s + δ/2ks,2 and s + δks,3. They are not listed here for the sake of brevity, but are given in Appendix A. The addition of the ks,i vectors can be pictured as in Figure 6.1.

Figure 6.1: The effect of the addition of a short vector in the RK4 algorithm. The length of s must remain constant. The addition of the ks,i vectors is abbreviated to ∆s. The angle θ can be found by geometrical analysis.

From this configuration, θ can be found by writing

1 |∆s| sin(θ/2) = 2 . |s| Solving for θ yields

|∆s| θ = 2 arcsin 2|s| p The length of the spin vector is known to be |s| = 3/4~ and ∆s is found from the RK4 algorithm. To include directionality in this context, it is observed that the spin will precess around the vectors in between the square brackets in Equation 6.3 (B, β, β × B etc.).

Using this method, the spin precession can be tracked by performing successive rotations at each time step. These rotations may be performed using rotation matrices. In this calculation, these rotation matrices are not explicitly calculated, as the TVector3 class, embedded in ROOT has a TVector3::Rotate member function. This function allows the user to rotate a vector around any other vector by any specified angle. Through this method the spin vector will retain its length to machine precision.

33 6.2 Results of Spin Tracking 6.2.1 Injection The muon spin has been tracked through the injection process using the methods outlined above. Figure 6.2 shows the three components of s as a function of time. Note that the magnitude of s indeed remains constant. The z-component of the spin vector goes to zero during the injection process. This is expected from Equation (6.3). Once the muon enters the storage region, β · B and β × E approach zero, because B is perpendicular to the direction of motion and E is parallel to the direction of motion. If the EDM contribution is neglected, ds/dt lies in the xy-plane.

Figure 6.2: Spin precession during the injection process. The particle enters the injection region at t = 0. The z-component of the spin approaches zero during injection.

The effect of the electric field is not visible in Figure 6.2. This effect was determined by calculating the total angle by which the electric field rotated s, including the EDM contribution. During injection, this total angle was on the order of 2π · 10−6. After the injection process, the accumulative effect remained within this order of magnitude. It is therefore expected that the electric field has no long-term effects on the spin greater than 2π · 10−6. The electric field does not cause the spin to precess out of the xy-plane by a significant amount. Therefore, the effect of the electric field induced by the kicker coils on the spin can safely be neglected during the injection process.

6.2.2 Trapping The effects of the magnetic fields on the trapped muon have been investigated separately. The muon was placed inside the trapping region, at a pitch angle of 0.1 mrad. This is the pitch angle the trapped muons should have, as described in [5]. The results of the spin tracking have been shown in Figure 6.3.

The z-component of the spin vector does not remain zero for all time. The radial component of the weak focusing field tilts the plane of ds/dt and thus inducing motion in the z-direction. The vertical motion can be described by the EOM ev ∆B z¨ + z = 0, γmµ ∆z where ∆B/∆z is the gradient of the focusing field in the z-direction. As the quadrupole field increases linearly with z in the trapping region, the gradient is a constant, determined to be ∆B/∆z = 4 · 10−4 T/m. The frequency of this oscillation is then given by s ev ∆B 6 ωz = ≈ 5.7 · 10 rad/s. (6.5) γmµ ∆z

34 Figure 6.3: Spin precession during an extended period of trapping. The z-component of the spin precession vector remains close to zero.

The vertical motion and the spin oscillations have been shown in Figure 6.4 and 6.5 respectively.

Figure 6.4: Muon motional oscillations in the z-direction, for about 675 orbital periods. The frequency of this oscillation is 5.8 · 106 rad/s.

35 Figure 6.5: The z-component of the spin vector, for approximately 800 orbital periods.

The frequency of vertical oscillations has been found by fitting the curve in Figure 6.4 and found to be ωz = 6 0.91·10 · 2π rad/s, consistent with Equation (6.5). The oscillations in sz are described by a linear combination of sinusoidal functions

sz(t) = C1 cos(ω1t) + C2 cos(ω2t), where C1, C2, ω1 and ω2 are amplitudes and frequencies to be determined. Figure 6.5 has been fitted. The frequencies of the two components are given by

5 ω1 = 4.5 · 10 · 2π rad/s, (6.6) 6 ω2 = 1.4 · 10 · 2π rad/s. (6.7)

Both of these frequencies are dependent on ωz. These oscillations affect the final outcome for ωa and need to be included in the final determination thereof. This is called pitch correction and has been described in [30, 31]. According to [30], the angle of s with the z-axis, θ is described by a linear combination of two sinusoidal curves,

A1 A2 θ(t) = sin [(ωz + ωa)t] − sin [(ωz − ωa)t] , (6.8) ωz + ωa ωz − ωa where A1 and A2 are amplitudes determined by the initial pitch angle. Note that the second term is invariant under interchange of ωz and ωa. The angle θ(t) can directly be related to sz(t) and is therefore composed of the same frequencies. Thus, the two frequencies in Figure 6.5 are given by

6 ωa = 0.47 · 10 · 2π rad/s, 6 ωz = 0.91 · 10 · 2π rad/s, 6 6 6 ω1 = ωz − ωa = 0.91 · 10 − 0.47 · 10 = 0.44 · 10 · 2π rad/s, 6 6 6 ω2 = ωz + ωa = 0.91 · 10 + 0.47 · 10 = 1.4 · 10 · 2π rad/s.

These frequencies correspond well with the ones found in Equation (6.7).

6.3 Conclusions

The spin precession of the muon has been successfully tracked through the injection process and during a period of trapping of about 800 orbital periods. A method was found to preserve the magnitude of s in a discretised approach.

36 6.3.1 Injection The spin precession during the injection process has been shown to evolve as expected. The z-component of s approaches zero after injection, making the spin precess mostly in the xy-plane. The effect of electric fields induced by the kicker have shown to be negligible during injection; the electric field rotates the spin vector by 2π · 10−6 during injection. The spin precession out of the xy-plane due to electric fields is negligible.

6.3.2 Trapping Motional oscillations of the muon within the trapping region cause the spin precession to move out of the xy- plane, on a timescale of ∼ 100 orbital periods. This effect is of order 10−4 relative to the horizontal components of s. The oscillation of the z-component of s (sz) has been described using a linear combination of two sinusoidal oscillations with frequencies ω1 and ω2. These frequencies can be attributed to ωz and ωa, where the former is the frequency of vertical oscillations of the muon in the weak focusing field. The frequencies determined through the fitting procedure correspond well to the frequencies obtained from theory.

If for every muon with pitch angle θ there is a muon with pitch angle close to −θ, the oscillations in sz interfere destructively. This is not expected to be the case in the experiment, as the muon bundle enters the storage region from above and then starts to oscillate vertically. As the distance scale corresponding to one full vertical oscillation is greater than the longitudinal length of the muon bundle, the pitch angles of individual muons are not expected to fully cancel and a persisting vertical oscillation is expected. This effect should be investigated and well understood and the resulting up/down asymmetry should be subtracted from the signal.

37 Chapter 7

Transient Currents and Retardation

The current through the kicker coils travels with a finite speed. This implies that the current in the kicker does not switch on and off at each position in the loop at the same time. Furthermore, the shape of the current pulse may change due to dispersive effects. [32] This may cause a disturbance on the kicker field at the position of the muon, affecting the injection process.

Additionally, the information of a change in the electromagnetic field travels with the speed of light. The size of the setup is on the order of a few meters. Therefore, the information about a change in the electromagnetic field on one side of the experiment takes a few nanoseconds to reach the other side of the experiment, which is also the timescale of the orbital period of the muons.

The significance of both of these effects are investigated in this chapter. A model for calculating the retarded fields is developed in Section 7.1. Section 7.2 expands this model to transient currents and dispersive effects. Results of these calculations are discussed in Section 7.3. The accuracy of the model used and the relevance to the experiment is discussed in 7.4. The code used in this chapter is given in Appendix C

7.1 Retardation

Jefimenko’s equations are used to calculate electric and magnetic fields taking into account the effects of re- tardation. The effect of electric fields has already been investigated and shown to be negligible for both the particle injection and the spin precession (Chapter 6). For this reason, only Jefimenko’s equation for magnetic fields is considered here, [33]

Z " 0 ˙ 0 # µ0 J(r , tr) J(r , tr) 0 0 B(r, t) = 0 3 + 0 2 × (r − r )dV . (7.1) 4π V |r − r | c|r − r |

Here, µ0 is the magnetic permeability of vacuum, J and J˙ are the volume current distribution and its time derivative respectively, r is the coordinate vector from the origin, r0 is the coordinate vector to the current 0 source, c is the speed of light, dV is an infinitesimal volume element and tr is the retarded time defined by |r − r0| t = t − . (7.2) r c The separation vector is abbreviated as R and is given in Cartesian coordinates by

R ≡ r − r0 = (r cos φ − r0 cos φ0)ˆx + (r sin φ − r0 sin φ0)ˆy + (z − z0)ˆz. Expressing this in cylindrical coordinates, R becomes

R = pr2 + r02 − 2rr0 cos(φ − φ0)ˆr + (z − z0)ˆz. This is a coordinate vector and has no φˆ-component. All information regarding the azimuthal position is contained within the cos(φ − φ0) term. The magnitude of R, R is

R = |R| = pr2 + r02 − 2rr0 cos(φ − φ0) + (z − z0)2. The aim is to find an expression for the retarded potential of a circular loop of wire, which represents a single kicker coil. The current J and its derivative J˙ for a circular loop of wire are given by

38 0 0 0 J(r , t) = I(t)δ(r − r0)δ(z − z0)φˆ, 0 0 0 J˙ (r , t) = I˙(t)δ(r − r0)δ(z − z0)φˆ.

Here, I(t) and I˙(t) are given by Equation (4.4) and (4.8) respectively, r0 is the radius of the loop and z0 is its position along the z-axis. Inserting all the above in Equation (7.1), gives

Z ∞ Z ∞ Z 2π " 0 0 ˙ 0 0 # µ0 0 0 0 0 I(tr)δ(r − r0)δ(z − z0) I(tr)δ(r − r0)δ(z − z0) ˆ B(r, t) = dr dz r dφ 3 + 2 φ × R. 4π 0 −∞ 0 R cR

In this expression, r0 and z0 can immediately be integrated using the delta functions,

µ r Z 2π  I(t ) B(r, t) = 0 0 dφ0 r + 2 2 0 2 3/2 4π 0 (r + r0 − 2rr0 cos(φ − φ ) + (z − z0) ) ˙ # I(tr) ˆ 2 2 0 2 φ × R. c(r + r0 − 2rr0 cos(φ − φ ) + (z − z0) )

Here, R has been written out in full to show it no longer depends on the primed coordinates r0 and z0. Restoring R and performing the cross product φˆ × R gives

Z π " ˙ # µ0r0 0 I(tr) I(tr) B(r, t) = dφ 3 + 2 [Rzˆr − Rrˆz] . (7.3) 2π 0 R cR

Here, Rr and Rz denote the radial and axial component pf R respectively. It is still assumed that the current changes everywhere at the same time in the wire. The integral has been changed to run from 0 to π, as both sides of the loop contribute equally to the magnetic field. As expected, the magnetic field has no component in the φˆ-direction and it reduces to the Biot-Savart expression for a circular loop of wire if c → ∞. Note 0 that tr and R both depend on φ . This expression cannot be integrated analytically in general and has to be numerically evaluated at each time step.

A graphical depiction of Equation (7.3) is shown in Figure 7.1.

Figure 7.1: Geometrical configuration of the calculation of the retarded magnetic field. Here O is the origin and P is the point at which the field is to be calculated, i.e. the position of the muon. During integration, the r0 vectors rotate along the loop of wire, adding up small field contributions due to current elements dI(tr). Because both small current elements contribute the same amount to the field, the integral may be calculated from 0 to π instead of 2π, in exchange for counting it twice. This figure may be regarded as a geometrical representation of Equation (7.3).

39 7.2 Transient Current 7.2.1 Finite Propagation Speed An additional effect in the kicker coils is that of transient currents. With this, it is meant that the electromag- netic wave causing the free charges to flow through the coils propagates at a finite speed. This effect will cause the current to become a function of φ0 and will therefore be inhomogeneously distributed over the wire at each moment in time. Due to this, the muon may experience a changing magnetic field as it orbits around the setup. The propagation speed depends on the conducting material.

To account for this transient effect, it is possible to add an additional term to the retarded time given in Equation (7.2), such that the current becomes

 0  r0φ I(tr) → I tr − , vc where vc is the propagation speed of the current through the wire. The current may now be interpreted as a traveling wave through the kicker coils and is thus no longer changing at every location in the wire at the same time. Figure 7.2 shows a graphical depiction of the current distribution as a function of time. In this study it is assumed that the magnetic fields induced by the two vertical wires cancel. In the integration, the position of the wires is taken to be at φ0 = 0.

Figure 7.2: Graphical depiction of the current distribution at some time t. The black lines are wires. The magnetic fields induced by the vertical wires are assumed to cancel. The red curve is the magnitude of the current at some each location in the wire.

As the exact design of the kicker coils is unknown at the time of writing, vc cannot be determined. To investigate this effect, various values for vc have been tested.

The current distribution is no longer symmetric about any point along the wire. Equation (7.1) therefore needs to be integrated from 0 to 2π, instead of π.

7.2.2 Dispersive Effects The model outlined in Subsection 7.2.1 is not complete. Realistic pulses can be Fourier-decomposed in sinusoidal waves of different frequencies, Z ∞ 0 1 0 I(φ , t) = √ A(k) exp [i(kr0φ − ω(k)t)] dk. 2π −∞ Here, A(k) are the amplitudes of the constituent waves, determined from the initial conditions, k is the wave number and ω(k) is the angular frequency as a function of k. If the medium is dispersive, i.e. the propagation

40 speed of the wave depends on its frequency, these constituent waves will travel at different speeds. This will change the shape of the waveform. [32]

When the current is discontinuously switched on, the discontinuity will travel ahead of the rest of the pulse. The discontinuity will be followed by two precursors, short wave pulses (the first, called the Sommerfeld precursor and the second, called the Brillouin precursor), after which the main signal follows. [34, 35] Note that the speed of the discontinuity does not exceed c.

To determine the way in which the waveform changes, ω(k) needs to be known. The shape of the waveform depends on the material through which the wave travels. The determination of this function goes beyond the scope of this thesis, and only some crude models will be tested here.

To investigate the effect of broadening the wave packet, the kicker parameter τ, specified in Table 4.1 is adjusted to depend on time,

τ → τ + t/α, (7.4) where α is a dimensionless number determining the time over which the waveform broadens.

7.3 Results 7.3.1 Single Turn Kicker

Three values for vc have been investigated; vc = 7/10 c, vc = 4/5 c and vc = c. The kicker coil is modeled to have only one turn. The effect of multiple turns is studied in Subsection 7.3.2. The kicker field at the position of the muon during injection are given for all values of vc in Figures 7.3 and 7.5. A close-up of the difference between the field including retardation and excluding retardation is shown in figures 7.4, and 7.6.

Figure 7.3: The magnetic field at the position of the Figure 7.4: The magnetic field at the position of the muon for vc = c. The purple (blue) curve represents particle for vc = c, zoomed in to emphasise the differ- the magnetic field at the position of the muon includ- ence. These modulation is caused by the muon trav- ing (excluding) retardation or transient effects. The eling through regions of high and low field. red curve is the difference between the two curves.

41 Figure 7.5: The magnetic field at the position of the Figure 7.6: The magnetic field at the position of the muon for vc = 4/5c. The purple (blue) curve repre- particle for vc = 4/5c, zoomed in to emphasise the sents the magnetic field at the position of the muon difference. including (excluding) retardation or transient effects. The red curve is the difference between the two curves.

The figures above show that the magnetic field at the position of the muon fluctuates and is greater than the nominal field (blue) everywhere. This is caused by the transient current. When the current does not decrease everywhere at the same time inside the kicker coil, the magnetic field at the position of the muon is greater than the nominal field. The modulation is caused by the orbital motion of te muon. As the muon orbits around the kicker coils, it will pass regions of low current and thus low magnetic field and regions of high current and thus high magnetic field. The minima (maxima) are when the muon passes a region of low (high) current.

For vc = c there is still visible modulation in the magnetic field at the position of the muon, even though the muon travels slower than c. This is explained by the fact that the current in the inner kicker coil indeed has a higher angular frequency than the muon. The current in the outer kicker coil, however, has a larger radius and thus a lower angular frequency and the muon will still pass regions of low and high field.

The effects of retardation are not visible in the figures above. These effects are on the order of 10−5 T, which is a 10−2 effect relative to the magnitude of the kicker field at the position of the muon. The effect of transient currents is 10−4 T, which is a 10−1 relative effect. For the rest of this study, the effects of retardation are neglected, as the kicker field at the position of the muon is dominated by transient currents.

It is observed however, that trapping using the parameters specified in Table 4.1 does no longer work for vc . 7/10 c. The reason for this is that the residual field caused by the transient current will continue to kick the muon until it is ejected again. and these parameters need to be adjusted to still be able to successfully inject a muon.

7.3.2 Multiple Turn Kicker When the kicker coils have multiple turns, it takes longer for the current to fully decay inside the coils. This can be accounted for by integrating expression (7.3) not from to 2π, but from 0 to 2πN, where N is the number of turns in the kicker coil. To test the injection process, the muon was injected using the nominal kicker field. The magnetic field was recorded at the position of the muon, both for the nominal and for the transient coil. The results are given in Figures 7.7 and 7.8.

42 Figure 7.7: The kicker shape at the position of the Figure 7.8: The kicker shape at the position of the muon for a kicker coil with 10 turns, for vc = c. muon for a kicker coil with 100 turns, for vc = c.

The shape of the kicker field is significantly influenced by the number of turns in the coil, even for ten turns. From two turns and higher, the muon is not successfully injected, and the kicker parameters need to be adjusted to inject a muon successfully.

7.3.3 Dispersion Dispersive effects have been investigated using Equation (7.4) for α = 12. The kicker field at the position of the muon is given in Figure 7.9.

Figure 7.9: The kicker field at the position of the muon for α = 12. The kicker pulse is spread out over time, caused by the broadening of the wave.

Various values for α have been tested for whether it was still possible to trap a muon. The injection scheme did not succeed for values of α . 12, meaning that τ increases by one twelfth of a nanosecond for each nanosecond the pulse traveled through the kicker coil. If the effects of the finite propagation speed was neglected, i.e. vc → ∞, the injection scheme did not succeed for α . 9.

7.4 Conclusions

A model for calculating magnetic fields due to current-carrying circular loops, including retardation and transient effects has been developed. This model has been used to study the injection process of the muon. Retardation effects are found to be insignificant in comparison with transient effects. Transient currents caused by the finite propagation speed of the current through the kicker prohibited injection by use of the nominal kicker parameters for propagation speeds vc below approximately 7/10 of the speed of light.

Furthermore, calculations on a kicker coil with up to 100 windings showed that the kicker pulse may be signifi- cantly disturbed by the transient current. Successful injection was no longer feasible using the nominal kicker parameters for more than one turn, assuming a propagation speed of c.

43 Lastly, broadening of the waveform due to dissipative effects was investigated. It has been shown that broad- ening of the waveform may perturb the injection scheme.

Realistic motion of the kicker pulse through the coil is more complicated than the model used in this chapter suggests. However, it has been shown that some properties, namely finite propagation speed and broadening of the current waveform, may significantly influence the muon injection scheme. To understand whether these effects play a significant role in the experiment, it is advised to further investigate the current waveform as it propagates through the kicker coils. More on this topic has been discussed in [34].

44 Chapter 8

Overall Conclusions and Outlook

Several aspects of the J-PARC g − 2 EDM experiment have been investigated and conclusions formulated. This chapter is meant to summarise these conclusions and provide an outlook for future research.

8.1 Magnetic Field Calculation

The magnetic field in the setup was calculated using a numerical approximation. The calculated fields corre- sponded to the physical reality they should represent. The homogeneity of the main field was not sufficient for precise spin tracking. It has been decided to use the calculated main field to track the injection process, where the effect of the fringe fields is important, and to replace it with an ideal dipole field to track spin during storage.

The weak focusing field was successfully calculated and the calculated field index corresponded well with the field index in the experiment.

The reason why these particular methods have been employed to calculate the magnetic field is that it allowed for fast calculation and easy implementation. There are, however, two shortcomings to these methods. One is that the numerical approximation of the magnetic field of the coils has a finite region of validity. To improve on this method, higher order polynomial corrections need to be taken into account, which requires higher numerical precision. It may be preferable to look for a different (more accurate) method altogether.

The second shortcoming is that these methods provided no means of accounting for iron present in the setup, including the iron yoke. In this case, the iron yoke was approximated as an additional coil surrounding the entire setup. This is still a crude model and should be improved by including magnetic effects caused by ferromagnetism.

8.2 Muon Injection

Calculations of muon trajectories have successfully reproduced the injection process. It has been shown that the effect of electric fields induced by the time-varying magnetic field of the kicker coils did not have a significant effect on the dynamics of the injection process.

It has been shown, however that electric fields in the storage region may exceed 10 mV/cm up until 180 ns after the switching of the kicker pulse. This electric field is dependent on the shape of the kicker pulse. For a different pulse, the electric field in the storage region needs to be investigated separately.

8.3 Phase Space Acceptance

The boundary of the phase space volume has been determined. This result may be used to reduce computing time, as tracking the injection process now only has to be performed until the muon is within the phase space trapping volume.

Future investigations can be done on the emittance and the effect of the kicker on the beam acceptance. This will enable tracking a muon beam through the setup as a whole, without tracking each muon individually.

45 8.4 Spin Tracking

A method for preserving the length of the spin vector in the RK4 algorithm was developed and successfully im- plemented to track the spin vector through the setup. The spin precession after injection was predominantly in the horizontal plane. The effect of the electric field caused by the time-varying kicker did not have a significant effect on the spin precession during injection.

It has been found that the spin precessed out of the horizontal plane after extended periods of trapping. This is caused by the motion of the muon through the quadrupole field. Oscillations in the z-component of the spin can be attributed to ωa and ωz, where the latter is the frequency of vertical oscillations. These oscillations are expected to persist, even when more muons are present. This effect should be further investigated and well understood.

8.5 Transients and Retardation

A model for the retarded fields and transient effects has been developed and tested in the context of this experi- ment. It has been found that retardation effects are insignificant in comparison with transient effects. Transient effects had a significant effect on the injection process and prohibited successful injection for vc . 7/10c, for which the kicker parameters needed to be adjusted.

Furthermore, transient effects in a coil of several windings caused the kicker field to decay slower than desired, preventing trapping.

Lastly, broadening of the current waveform due to dispersive effects has been investigated. This effect may also causes slower decay of the kicker field.

The effects studied here still need further refinement to make predictions specific to this experiment. It is suggested that the broadening and the propagation speed of the current waveform is calculated for this setup and its effects are quantified.

8.6 Outlook

Several aspects of the time-dependent kicker in the J-PARC experiment have been investigated. Challenges regarding the injection scheme have been observed, mainly due to transient effects described in Chapter 7. For future simulations, it would be useful to track the muon beam through phase space and quantify the injection efficiency for various injection schemes, e.g. kicker pulse shapes, electric fields and transients. This requires a more complete and accurate description of the transient current effect than has been listed in this thesis. Once the theoretical model for this effect has been described, it can easily be implemented in the simulation used in this work, as it already provides a general framework for muon orbit tracking.

Furthermore, a full end-to-end simulation, including the decay of the muons, the trajectories of their decay positrons and finally their detection would be useful to investigate the effect of various phenomena on the de- tection signal.

Finally, it is important to test the results of this thesis by means of experimental measurement. Specifically the magnitude of the electric field in the storage region as well as the effect of transient current and retardation on the kicker field. Once these effects have been taken into account, the injection scheme is expected to succeed and the measurement of the muon g − 2 and EDM can proceed.

46 Acknowledgments

First of all, I would like to thank my two supervisors, Gerco Onderwater and Klaus Jungmann. Their knowledge and guidance has been invaluable during the past year. It has been a great pleasure to work with and learn from you, both on a professional and personal level. I would also like to thank Tsutomu Mibe, for the fruitful discussions we had at the start of the year. It was a pleasure meeting you and I hope we will meet again in the future. Finally I would like to thank Elwin Dijck, for helping me understand some aspects of ROOT and LaTeX bibliographies. I would like to thank my parents, for their continued support during my time in Groningen. Their patience and faith in me has made it all possible for me to get where I am now. This also goes for my sister Mirthe and brother Lennart. Thanks for being there for me and believing in me.

Furthermore, I would like to thank Martin, Rinus, Leon and Julien, for always being there for me when I needed your help and for supporting me throughout my studies in Groningen. I am very happy that we still stick together and I hope we will keep doing so for a long time. Adam, Sander, Berend and Anouk, thanks for the great times we had together during our studies. Your companionship, be it while we were studying at the faculty, be it when we were just hanging out, has made my life in Groningen not only educative, but also a fun experience. You were the people for whom I even decided to move to Groningen in the first place. Thanks to Jowzick, for being a fun and interesting research partner. In addition, thanks to Harmjan, Thomas and Tobias for the great time we had during our board year at the FMF and beyond.

I would like to thank the FMF and its members, for providing fun activities and facilitating meeting new peo- ple. It has always been great fun to be there and I hope we can stay in touch for a long time after I’ve graduated.

This work is dedicated to everyone who has been mentioned above.

47 Bibliography

[1] V. Bargmann, L. Michel and V. L. Telegdi, Precession of the Polarization of Particles Moving in a Homo- geneous Electromagnetic Field, Physical Review Letters 2, 435 (1959). [2] L. H. Thomas, The Motion of the Spinning Electron, Nature 117, 514 (1926). [3] G. W. Bennett et al., Final Report of the E821 Muon Anomalous Magnetic Moment Measurement at BNL, Physical Review D 73, 072003 (2006).

[4] Y. K. Semertzidis, Probing the Deuteron EDM at the 10−26 e·cm Level with a new Experimental Technique, Accessed: 2019-05-24. [5] T. Mibe et al., Technical Design Report for the Measurement of the Muon Anomalous Magnetic Moment g - 2 and Electric Dipole Moment at J-PARC, Technical report, KEK (2017).

[6] M. Booth, The Electric Dipole Moment of the W and Electron in the Standard Model, arXiv preprint hep-ph/9301293 (1993). [7] E. M. Metodiev, Thomas-BMT Equation Generalized to Electric Dipole Moments and Field Gradients, arXiv preprint arXiv:1507.04440 (2015). [8] B. L. Roberts, The History of the Muon (g-2) Experiments, SciPost Physics Proceedings p. 032 (2019).

[9] J. Schwinger, On Quantum-Electrodynamics and the Magnetic Moment of the Electron, Physical Review 73, 416 (1948). [10] C. Patrignani et al., Review of Particle Physics, Chinese physics C 40 (2016). [11] R. L. Garwin, L. M. Lederman and M. Weinrich, Observations of the Failure of Conservation of Parity and Charge Conjugation in Meson Decays: The Magnetic Moment of the Free Muon, Physical Review 105, 1415 (1957). [12] T. D. Lee and C. N. Yang, Question of Parity Conservation in Weak Interactions, Physical Review 104, 254 (1956).

[13] J. Cassels, T. O’Keeffe, M. Rigby, A. Wetherell and J. Wormald, Experiments with a Polarized Muon Beam, Proceedings of the Physical Society. Section A 70, 543 (1957). [14] G. Charpak et al., A New Measurement of the Anomalous Magnetic Moment of the Muon, Physics Letters 1, 16 (1962). [15] J. M. Paley, in The Launching Of La Belle Epoque Of High Energy Physics And Cosmology: A Festschrift for Paul Frampton in His 60th Year and Memorial Tributes to Behram Kursunoglu (1922–2003), pp. 256– 263 (World Scientific, 2004). [16] J. Bailey et al., Final Report on the CERN Muon Storage Ring Including the Anomalous Magnetic Moment and the Electric Dipole Moment of the Muon, and a Direct Test of Relativistic Time Dilation, Nuclear Physics B 150, 1 (1979).

[17] J. Grange et al., Muon (g-2) Technical Design Report, Technical report, Fermilab (2015). [18] M. Abe et al., A New Approach for Measuring the Muon Anomalous Magnetic Moment and Electric Dipole Moment, arXiv preprint arXiv:1901.03047 (2019). [19] L. Michel, Interaction Between Four Half-Spin Particles and the Decay of the µ-Meson, Proceedings of the Physical Society. Section A 63, 514 (1950).

48 [20] J. C. Simpson, J. E. Lane, C. D. Immer and R. C. Youngquist, Simple Analytic Expressions for the Magnetic Field of a Circular Current Loop, NASA 0 (2001). [21] S. Babic, A. Z and K. B, Analytic Calculation of the 3d Magnetostatic Field of a Torroidal Conductor with Rectangular Cross Section, IEEE Transactions on Magnetics 24, 3162 (1988).

[22] R. Ravaud, G. Lemarquand, V. Lemarquand, S. Babic and C. Akyel, Calculation of the Magnetic Field Created by a Thick Coil, Journal of Electromagnetic Waves and Applications 24, 1405 (2010). [23] R. H. Jackson, Off-Axis Expansion Solution of Laplace’s Equation: Application to Accurate and Rapid Calculation of Coil Magnetic Fields, IEEE Transactions on Electron Devices 46, 1050 (1999).

[24] S. Kawabata, Magnetic Permeability of the Iron Yoke in High Field Superconducting Magnets, Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and As- sociated Equipment 329, 1 (1993). [25] M. Aleksa et al., Measurement of the ATLAS Solenoid Magnetic Field, Journal of Instrumentation 3, P04003 (2008).

[26] M. N. Spijker, Error Propagation in Runge-Kutta Methods, Applied numerical Mathematics 22, 309 (1996). [27] H. Wiedemann, Particle Accelerator Physics (Springer, 2015). [28] M. Matsumoto and T. Nishimura, Mersenne Twister: a 623-Dimensionally Equidistributed Uni- form Pseudo-Random Number Generator, ACM Transactions on Modeling and Computer Simulation (TOMACS) 8, 3 (1998). [29] S. Y. Lee, Spin Dynamics and Snakes in Synchrotrons (World Scientific Publishing Company, 1997). [30] F. Farley, Pitch Correction in (g-2) Experiments, Physics Letters B 42, 66 (1972). [31] D. Rubin et al., Muon Beam Dynamics and Spin Dynamics in the g-2 Storage Ring, Technical report, Fermi National Accelerator Lab.(FNAL), Batavia, IL (United States) (2018). [32] J. D. Jackson, Classical Electrodynamics (AAPT, 1999). [33] O. D. Jefimenko, Electricity and Magnetism: An Introduction to the Theory of Electric and Magnetic Fields (Springer, 1966).

[34] L. Brillouin, Wave Propagation and Group Velocity (New York, NY, and London, 1960); Chapter II contains a translation of A. Sommerfeld, Ann der Phys 44, 177 (1914). [35] R. Chiao, Superluminal Phase and Group Velocities: A Tutorial on Sommerfeld’s Phase, Group, and Front Velocities for Wave Motion in a Medium, with Applications to the "Instantaneous Superluminality" of Electrons, arXiv preprint arXiv:1111.2402 (2011).

49 Appendices

50 Appendix A

Runge-Kutta Spin Vectors

Chapter 6 describes a method of tracking the spin vector through the setup without changing its length. The ks,i vectors used there are listed here for completion.

    e 1 aµγ 1 β × E(t) ks,1 = s× aµ + B(t) − β(β · B(t) − aµ + mµ γ γ + 1 γ + 1 c η E(t) γ β(β · E(t))  + − + β × B(t) , 2 c γ + 1 c

      e δ 1 aµγ 1 β × E(t + δ/2) ks,2 = s + ks,1 × aµ + B(t + δ/2) − β(β · B(t + δ/2) − aµ + mµ 2 γ γ + 1 γ + 1 c η E(t + δ/2) γ β(β · E(t + δ/2))  + − + β × B(t + δ/2) , 2 c γ + 1 c

      e δ 1 aµγ 1 β × E(t + δ/2) ks,3 = s + ks,2 × aµ + B(t + δ/2) − β(β · B(t + δ/2) − aµ + mµ 2 γ γ + 1 γ + 1 c η E(t + δ/2) γ β(β · E(t + δ/2))  + − + β × B(t + δ/2) , 2 c γ + 1 c

    e 1 aµγ 1 β × E(t + δ) ks,4 = (s + δks,3) × aµ + B(t + δ) − β(β · B(t + δ) − aµ + mµ γ γ + 1 γ + 1 c η E(t + δ) γ β(β · E(t + δ))  + − + β × B(t + δ) . 2 c γ + 1 c

These vectors can be added up to form δ ∆s = (k + 2k + 2k + k ) . 6 s,1 s,2 s,3 s,4 The derivation of the spin rotation continues from here in Subsection 6.1.2.

51 Appendix B

Magnetic Field Class

Below is the code used for calculating the magnetic fields. The same method was used for calculating the field of the kicker magnets. #ifndef INCLUDED_BFIELD_ #define INCLUDED_BFIELD_

#include "/home/sietse/CERN_Root/root/include/TVector3.h" #include "TMath . h" #include "Math/SpecFunc .h" #include using namespace TMath ;

// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// The class interface.

class BField { // The four systems under consideration and a default one. enum d_System {Dipole , Loop, Coil , None}; UShort_t d_Sys; // Stores which system we are treating: A loop, a solenoid, a disk or a full coil. Double_t d_B_0; // The "amplitude" of the magnetic field. B_0 = mu_0 ∗ J ∗ r_0 / 2. J has units of [A/m^2]. Double_t d_r_0 ; // Inner radius of coil. Double_t d_z_0; // The "lower end" of the coil. Double_t d_eta; // Defined as eta = Deltaz / r_0; Double_t d_rho; // Defined as rho = (r_0 + Deltar) / r_0; // TVector3 ∗d_dip; // Dipole moment.

public :

// Constructors (time dependent): // D e f a u l t . BField ( ) ; // Dipole . //BField(TVector3 Dipole); // Loop . BField(Double_t Current , Double_t Windings, Double_t r_0, Double_t z_0); // Coil . BField(Double_t Current , Double_t Windings, Double_t r_0, Double_t z_0, Double_t Delta_r , Double_t Delta_z);

// Destructor

52 ~BField ( ) ;

// Getter TVector3 getB(TVector3 X);

// S e t t e r s void setB(Double_t Current , Double_t Windings, Double_t r_0, Double_t z_0); void setB(Double_t Current , Double_t Windings, Double_t r_0, Double_t z_0, Double_t Delta_r , Double_t Delta_z);

private :

// Functions calculate vector components of B. Double_t calcBr(TVector3 X); Double_t calcBz(TVector3 X);

// Support functions that calculate polynomials and the functional part of B . Double_t Pn(Double_t x, UShort_t n); Double_t Qn(Double_t x, UShort_t n); Double_t bn(Double_t x, UShort_t n); };

// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Constructors

// Assigns the given values and calculates geometrical parameters. // Also calculates the magnetic field "amplitude". // Note that the current density is calculated by first multiplying the current by the number of windings. // The current density is then calculated by dividing the total current by the cross sectional area of the coil.

// Constructor without arguments. // Assigns zero to all parameters. inline BField :: BField() : d_Sys {None}, d_r_0 {0} , d_z_0 {0} , d_B_0 {0} , d_eta {0} , d_rho {0} //d_dip {nullptr} {}

// Constructor for loop. inline BField :: BField(Double_t Current , Double_t Windings, Double_t r_0, Double_t z_0) : d_Sys {Loop}, d_r_0 {r_0 } , d_z_0 {z_0} , d_B_0 {2e−7 ∗ Current ∗ Windings } , d_eta {0} , d_rho {1} { // Further constructor tasks. }

53 // Constructor for full coil. inline BField :: BField(Double_t Current , Double_t Windings, Double_t r_0, Double_t z_0, Double_t Delta_r, Double_t Delta_z) : d_Sys {Coil}, d_r_0 {r_0 } , d_z_0 {z_0} , d_B_0 {TwoPi ( ) ∗ 1e−7 ∗ Windings ∗ r_0 ∗ Current / (Delta_z ∗ Delta_r ) } , d_eta {Delta_z / r_0}, d_rho {(r_0 + Delta_r) / r_0}

{ // Further constructor tasks. }

// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Destructor.

inline BField::~BField() {}

// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Getter . // Calls the calcBr and calcBz functions, which calculate the radial and axial components of B. // A vector B is initialised with these components.

inline TVector3 BField ::getB(TVector3 X) { // These conditions set the physical boundaries of the experiment. // If the particle is higher than 1m and .6m from the axis, it exceeds the limits for which this magnetic field is still accurate. // This way, calculation of the field at a position which is not relevant to this experiment (for example, at 30m from the origin) is avoided. //if (X.Z() > 1 || X.Z() < −1 || X.Perp() > .6) //{ //TVector3 B(0, 0, 0); // return B; //}

// e l s e //{ Double_t Br = calcBr(X); TVector3 B(Br ∗ Cos(X.Phi()), Br ∗ Sin(X.Phi()), calcBz(X));

return B; //} }

// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Support: Setters.

// For loop . inline void BField ::setB(Double_t Current , Double_t Windings, Double_t r_0,

54 Double_t z_0) { d_Sys = Loop; d_r_0 = r_0 ; d_z_0 = z_0 ; d_B_0 = 2e−7 ∗ Current ∗ Windings ; d_eta = 0 ; d_rho = 1 ;

return ; }

// For c o i l . inline void BField ::setB(Double_t Current , Double_t Windings, Double_t r_0, Double_t z_0, Double_t Delta_r, Double_t Delta_z) { d_Sys = Coil; d_r_0 = r_0 ; d_z_0 = z_0 ; d_B_0 = TwoPi ( ) ∗ 1e−7 ∗ Windings ∗ r_0 ∗ Current / (Delta_z ∗ Delta_r ) ; d_eta = Delta_z / r_0; d_rho = (r_0 + Delta_r) / r_0;

return ; }

// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Support: Calculate the r and z components of B.

// Calculates the radial component of the magnetic field. // This function calls bn.

inline Double_t BField :: calcBr(TVector3 X) { switch ( d_Sys ) { case Coil : { Double_t x = (X.Z() − d_z_0) / d_r_0 ; Double_t ksi = x / d_rho; Double_t Br = 0;

for (UShort_t idx = 0; idx <= 5; ++idx) // ////// // Br += pow( −1., idx + 1) / (pow(2, 2 ∗ idx + 1) ∗ Factorial(idx) ∗ Factorial(idx + 1)) ∗ ( bn ( x , 2 ∗ idx ) − bn ( ksi , 2 ∗ idx ) − bn ( x − d_eta , 2 ∗ idx) + bn(ksi − d_eta/d_rho, 2 ∗ idx ) ) ∗ pow(X. Perp ( ) / d_r_0 , 2 ∗ idx + 1) ;

return d_B_0 ∗ Br ; }

case Loop : { Double_t s = X.Perp(); Double_t z = X.Z();

55 Double_t alpha_2 = (s − d_r_0) ∗( s − d_r_0) + ( z − d_z_0) ∗( z − d_z_0) ; Double_t beta_2 = ( s + d_r_0) ∗( s + d_r_0) + ( z − d_z_0) ∗( z − d_z_0) ; Double_t k_2 = 1 − alpha_2 / beta_2;

return d_B_0 ∗ ( z − d_z_0) / (alpha_2 ∗ Sqrt(beta_2) ∗ s ) ∗ ( ( d_r_0∗ d_r_0 + s ∗ s + ( z − d_z_0) ∗( z − d_z_0) ) ∗ ROOT: : Math : : comp_ellint_2(Sqrt(k_2)) − alpha_2 ∗ ROOT::Math:: comp_ellint_1( Sqrt(k_2))) ;; }

default : return −1; } }

// Calculates the axial component of the magnetic field. // This function calls bn. inline Double_t BField :: calcBz(TVector3 X) { switch ( d_Sys ) { case Coil : { Double_t x = (X.Z() − d_z_0) / d_r_0 ; Double_t ksi = x / d_rho; Double_t Bz = x ∗ (log((1 + sqrt(1 + ksi ∗ ksi)) / (1 + sqrt(1 + x ∗ x ) ) ) ) − ( x − d_eta ) ∗ (log((1 + sqrt(1 + pow(ksi − d_eta/d_rho , 2))) / (1 + sqrt(1 + pow(x − d_eta, 2))))) + d_eta ∗ log(d_rho);

for (UShort_t idx = 1; idx <= 5; ++idx) Bz += pow( −1., idx) / (pow(2., 2 ∗ idx ) ∗ pow(Factorial(idx), 2) ) ∗ ( bn ( x , 2 ∗ idx − 1) − pow(1. / d_rho, 2 ∗ idx ) ∗ bn ( ksi , 2 ∗ idx − 1) − bn ( x − d_eta , 2 ∗ idx − 1) + pow(1. / d_rho, 2 ∗ idx ) ∗ bn ( k s i − d_eta/d_rho, 2 ∗ idx − 1) ) ∗ pow(X.Perp() / d_r_0 , 2 ∗ idx ) ;

return d_B_0 ∗ Bz ; }

case Loop : { Double_t s = X.Perp(); Double_t z = X.Z();

Double_t alpha_2 = (s − d_r_0) ∗ ( s − d_r_0) + ( z − d_z_0) ∗ ( z − d_z_0) ; Double_t beta_2 = ( s + d_r_0) ∗ ( s + d_r_0) + ( z − d_z_0) ∗ ( z − d_z_0) ; Double_t k_2 = 1 − alpha_2 / beta_2;

return d_B_0 / (alpha_2 ∗ Sqrt(beta_2)) ∗ ( ( d_r_0 ∗ d_r_0 − s ∗ s − ( z − d_z_0) ∗( z − d_z_0) ) ∗ ROOT::Math:: comp_ellint_2(Sqrt(k_2)) + alpha_2 ∗ ROOT::Math:: comp_ellint_1(Sqrt(k_2))) ; }

default : return −1; } }

// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

56 // Support: Calculates the derivatives for the disk and the coil

// Calculates the functional component of the magnetic field. // This is actually the functional component of the magnetic field of a flat d i s k . // According to the paper by Robert H. Jackson, this can be used to calculate the magnetic field of a coil of finite length and thickness. // This function calls Pn and Qn. inline Double_t BField ::bn(Double_t x, UShort_t number) { i f (number < 11) return Pn(x, number) / pow((sqrt(x ∗ x + 1) + 1) ∗ ( x ∗ x + 1), number) + Qn(x, number) / (pow((sqrt(x ∗ x + 1) + 1) ∗ ( x ∗ x + 1), number) ∗ s q r t ( x ∗ x + 1) ) ;

else return −1; }

// The Pn polynomials as given in the paper by Robert H. Jackson (for a coil). // Double checked. inline Double_t BField ::Pn(Double_t x, UShort_t number) { switch ( number ) { case 0 : return − log(1 + sqrt(1 + x ∗ x ) ) ; // r case 1 : return −x ; // z case 2 : return pow( x , 4) + 4 ∗ x ∗ x − 3 ; // r case 3 : return −3 ∗ (2 ∗ pow( x , 5) + 2 ∗ pow( x , 3) − 15 ∗ x ) ; // z case 4 : return 6 ∗ (pow(x, 8) + 12 ∗ pow( x , 6) − 34 ∗ pow( x , 4) − 100 ∗ x ∗ x + 15) ; // r case 5 : return −15 ∗ (8 ∗ pow(x, 9) + 16 ∗ pow( x , 7) − 412 ∗ pow( x , 5) − 455 ∗ pow(x, 3) + 280 ∗ x ) ; // z case 6 : return 30 ∗ (4 ∗ pow(x, 12) + 96 ∗ pow( x , 10) − 660 ∗ pow( x , 8) − 4392 ∗ pow( x , 6) − 924 ∗ pow(x, 4) + 4515 ∗ x ∗ x − 280) ; // r case 7 : return −315 ∗ (16 ∗ pow(x, 13) + 48 ∗ pow( x , 11) − 2976 ∗ pow( x , 9) − 6872 ∗ pow(x, 7) + 6867 ∗ pow(x, 5) + 11214 ∗ pow( x , 3) − 2520 ∗ x ) ; // z case 8 : return 2520 ∗ (2 ∗ pow(x, 16) + 80 ∗ pow( x , 14) − 1032 ∗ pow( x , 12) − 11536 ∗ pow( x , 10) − 4756 ∗ pow(x, 8) + 45288 ∗ pow( x , 6) + 26775 ∗ pow( x , 4) − 18648 ∗ x ∗ x + 630) ; // r case 9 : return −2835 ∗ (128 ∗ pow(x, 17) + 512 ∗ pow( x , 15) − 62592 ∗ pow( x , 13) − 226528 ∗ pow(x, 11) + 422968 ∗ pow(x, 9) + 1372437 ∗ pow (x, 7) + 42768 ∗ pow( x , 5) − 763840 ∗ pow(x, 3) + 88704 ∗ x ) ; // z case 1 0 : return 5670 ∗ (64 ∗ pow(x, 20) + 3840 ∗ pow( x , 18) − 80320 ∗ pow( x , 16) − 1329920 ∗ pow( x , 14) − 587520 ∗ pow(x, 12) + 13983440 ∗ pow(x, 10) + 16604060 ∗ pow( x , 8) − 13785255 ∗ pow( x , 6) − 13953720 ∗ pow(x, 4) + 4176480 ∗ x ∗ x − 88704) ; // r default : return 0 ; // } }

// The Qn polynomials as given in the paper by Robert H. Jackson (for a coil). // Double checked. inline Double_t BField ::Qn(Double_t x, UShort_t number) { switch ( number ) { case 0 : return 1 ; // r case 1 : return − (pow(x, 3) + 2 ∗ x ) ; // z

57 case 2 : return 2 ∗ pow( x , 4) + 2 ∗ x ∗ x − 3 ; // r case 3 : return − (2 ∗ pow(x, 7) + 16 ∗ pow( x , 5) − 16 ∗ pow( x , 3) − 45 ∗ x ) ; // z case 4 : return 3 ∗ (8 ∗ pow(x, 8) + 16 ∗ pow( x , 6) − 172 ∗ pow( x , 4) − 185 ∗ x ∗ x + 30) ; // r case 5 : return −3 ∗ (8 ∗ pow(x, 11) + 144 ∗ pow( x , 9) − 576 ∗ pow( x , 7) − 3372 ∗ pow( x , 5) − 1575 ∗ pow(x, 3) + 1400 ∗ x ) ; // z case 6 : return 15 ∗ (48 ∗ pow(x, 12) + 144 ∗ pow( x , 10) − 4896 ∗ pow( x , 8) − 10872 ∗ pow(x, 6) + 2737 ∗ pow(x, 4) + 8750 ∗ x ∗ x − 560) ; // r case 7 : return −45 ∗ (16 ∗ pow(x, 15) + 512 ∗ pow( x , 13) − 4608 ∗ pow( x , 11) − 45296 ∗ pow( x , 9) − 34984 ∗ pow(x, 7) + 89523 ∗ pow( x , 5) − 17640 ∗ x ) ; // z case 8 : return 315 ∗ (128 ∗ pow(x, 16) + 512 ∗ pow( x , 14) − 39552 ∗ pow ( x , 12) − 137248 ∗ pow(x, 10) + 106808 ∗ pow(x, 8) + 488367 ∗ pow( x , 6) + 138978 ∗ pow( x , 4) − 146664 ∗ x ∗ x + 5040) ; // r case 9 : return −315 ∗ (128 ∗ pow(x, 19) + 6400 ∗ pow( x , 17) − 102400 ∗ pow( x , 1 5 ) − 1505920 ∗ pow( x , 13) − 1364960 ∗ pow(x, 11) + 9473720 ∗ pow(x, 9) + 13453605 ∗ pow( x , 7) − 3152160 ∗ pow( x , 5) − 6475392 ∗ pow(x, 3) + 798336 ∗ x ) ; // z case 1 0 : return 2835 ∗ (1280 ∗ pow(x, 20) + 6400 ∗ pow( x , 18) − 937600 ∗ pow( x , 16) − 4528000 ∗ pow(x, 14) + 8256400 ∗ pow(x, 12) + 45941900 ∗ pow(x, 10) + 23440285 ∗ pow( x , 8) − 42579438 ∗ pow( x , 6) − 23708784 ∗ pow( x , 6) − 23708784 ∗ pow(x, 4) + 8264256 ∗ x ∗ x − 177408) ; // r default : return 0 ; // } }

#endif

58 Appendix C

Muon Tracking

This code was used for tracking muons through the setup. This is the most general simulation used in this thesis, including the effects of magnetic and electric fields, spin, retardation, transients and dispersion. Any other code that has been used may be regarded as a subset of this one. R__LOAD_LIBRARY( libMathMore ) ;

#include "./BField/BField.h" #include "./BField/Kicker.h" #include "TCanvas.h" #include "TMultiGraph.h" #include "TGraph . h" #include "TF1 . h" #include "TLegend.h" #include "TEllipse.h"

#include #include #include "TRotation.h" #include "TCanvas.h" #include "TROOT. h" #include "TGraphErrors.h" #include "TGraph2D. h" #include "TF1 . h" #include "TLegend.h" #include "TMath . h" #include "TStopwatch.h" using namespace std ;

// Kicker is off. Double_t Current0(Double_t Time) { return 0 ; }

// Kicker Current for reverse trajectory (starts at 0). Double_t Current(Double_t Time) { Double_t Tau = 20e −9;//20 Double_t I0 = 1500;

Bool_t Forward = true ;

i f ( ! Forward ) { Double_t Delay = 70e −9;

59 return I0 − I0 / (1 + exp(− ( Time − Delay) / Tau)); }

else i f ( Forward ) { Double_t Norbits = 13.5; Double_t Delay = Norbits ∗ 7.3865626855978862e−9 − 70e −9;

return −I0 + I0 / (1 + exp(− ( Time − Delay) / Tau)); }

else return 0 ; }

// Kicker Current for reverse trajectory (starts at 0). Double_t CurrentTransient(Double_t Time) { Double_t Tau = 20e−9 + Time /11; //20 Double_t I0 = 1500;

Bool_t Forward = true ;

i f ( ! Forward ) { Double_t Delay = 70e −9;

return I0 − I0 / (1 + exp(− ( Time − Delay) / Tau)); }

else i f ( Forward ) { Double_t Norbits = 13.5; Double_t Delay = Norbits ∗ 7.3865626855978862e−9 − 70e −9;

return −I0 + I0 / (1 + exp(− ( Time − Delay) / Tau)); }

else return 0 ; }

// Derivative of Kicker Current. Double_t CurrentDer(Double_t Time) { // Tau is the length of the pulse. // I0 is the current through the kicker Double_t Tau = 20e −9;//20 Double_t I0 = 1500;

// This defines whether the trajectory is forward or reverse. // true = forward, false = reverse. Bool_t Forward = true ;

i f ( ! Forward ) // !Forward = Reverse. { Double_t Delay = 70e −9;

return I0 ∗ exp ( ( Time − Delay) / Tau) / (pow(1 + exp((Time − Delay ) / Tau) , 2) ∗ Tau) ;

60 }

else { Double_t Norbits = 13.5; Double_t Delay = Norbits ∗ 7.3865626855978862e−9 − 70e −9; return −I0 ∗ exp ( ( Time − Delay) / Tau) / (pow(1 + exp((Time − Delay ) / Tau) , 2) ∗ Tau) ; } }

// Retarded E −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Calculates electric field. TVector3 calcE(TVector3 X, Double_t Time, Double_t Radius, Double_t Height) { Double_t const c = 299792458; Double_t const epsilon0 = 8.854187817e −12;

ULong_t Number = 100; Double_t dPhi = TwoPi()/Number; TVector3 E;

for (ULong_t idx = 0; idx != Number; ++idx) { Double_t Phi = −Pi ( ) + idx ∗ dPhi ; TVector3 rprime(Radius ∗ Cos(Phi) , Radius ∗ Sin(Phi), Height); TVector3 Separation = X − rprime ; Double_t dr = Separation.Mag(); Double_t tr = Time; // − Radius ∗ Phi / (3./5 ∗ c ) − dr /c ; TVector3 I(−Sin(Phi), Cos(Phi), 0);

E += Radius ∗ CurrentDer(tr) ∗ dPhi / (2 ∗ TwoPi ( ) ∗ e p s i l o n 0 ∗ c∗c ∗ dr ) ∗ I; }

return E; }

// Kicker retarded electric field. TVector3 KgetE(TVector3 X, Double_t Time) { // The radii and the heights of the kicker coils. Double_t const Radius[2] = {.3, .36}; Double_t const Height[2] = { −.4 , . 4 } ; TVector3 E;

for (ULong_t idr = 0; idr != 2; ++idr) for (ULong_t idz = 0; idz != 2; ++idz) { E += Height[idz] / abs(Height[idz]) ∗ calcE(X, Time, Radius[idr], Height [ i d z ] ) ; }

return E; }

// Retarded B −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

61 TVector3 calcB(TVector3 X, Double_t Time, Double_t Radius, Double_t Height) { Double_t const c = 299792458; Double_t const mu0 = 2∗TwoPi ( ) ∗ 1e −7; Double_t const Turns = 1 ;

ULong_t Number = Turns ∗ 100; Double_t dPhi = Turns∗TwoPi()/Number; TVector3 B;

for (ULong_t idx = 0; idx != Number; ++idx) { Double_t Phi = idx ∗ dPhi ; TVector3 rprime(Radius ∗ Cos(Phi) , Radius ∗ Sin(Phi), Height); TVector3 Separation = X − rprime ; Double_t dr = Separation.Mag(); Double_t tr = Time − Radius ∗ Phi / (c/100) − dr /c ; TVector3 I(−Sin(Phi), Cos(Phi), 0);

B += Radius ∗ mu0 ∗ (CurrentTransient(tr) ∗ dPhi / (Turns ∗ 2 ∗ TwoPi ( ) ∗ dr ∗ dr ∗ dr ) ∗ I.Cross(Separation)); // + CurrentDer(tr) ∗ dPhi / ( Turns ∗ 2 ∗ TwoPi () ∗ c∗ dr ∗ dr ) ∗ I.Cross(Separation)); }

return B; }

TVector3 CrossIntegralDer(TVector3 X, Double_t Time, Double_t Radius, Double_t Height ) { Double_t const c = 299792458; Double_t const mu0 = 2∗TwoPi ( ) ∗ 1e −7;

ULong_t Number = 100; Double_t dPhi = TwoPi()/Number; TVector3 B;

for (ULong_t idx = 0; idx != Number; ++idx) { Double_t Phi = −Pi ( ) + idx ∗ dPhi ; TVector3 rprime(Radius ∗ Cos(Phi) , Radius ∗ Sin(Phi), Height); TVector3 Separation = X − rprime ; Double_t dr = Separation.Mag(); Double_t tr = Time − Radius ∗ Phi / ( 3 . / 5 ∗ c ) − dr /c ; TVector3 I(−Sin(Phi), Cos(Phi), 0);

B += Radius ∗ mu0 ∗ CurrentDer(tr) ∗ dPhi / (2 ∗ TwoPi ( ) ∗ c ∗ dr ∗ dr ) ∗ I.Cross(Separation); }

return B; }

TVector3 KgetB(TVector3 X, Double_t Time) { // The radii and the heights of the kicker coils. Double_t const Radius[2] = {.3, .36}; Double_t const Height[2] = { −.4 , . 4 } ; Double_t Br = 0; Double_t Bz = 0; TVector3 B;

62 for (ULong_t idr = 0; idr != 2; ++idr) for (ULong_t idz = 0; idz != 2; ++idz) { //Br += Height[idz] / abs(Height[idz]) ∗ Integral21(X, Time, Radius[idr ], Radius[idz]);// + Integral31(X, Time, Radius[idr], Radius[idz])); //Bz += Height[idz] / abs(Height[idz]) ∗ Integral22(X, Time, Radius[idr ], Radius[idz]);// + Integral32(X, Time, Radius[idr], Radius[idz])); B += −Height[idz] / abs(Height[idz]) ∗ calcB(X, Time, Radius[idr], Height[idz]) ; // CrossIntegralDer(X, Time, Radius[idr], Height[idz]); }

//TVector3 B(Br ∗ Cos(X.Phi()), Br ∗ Sin(X.Phi()), Bz);

return B; } void ParticleEBField() { TStopwatch sw;

ULong_t Number = 60000; // Number of steps. Directly related to step size.

// Function declaration −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− TVector3 KgetE(TVector3 X, Double_t Time); TVector3 KgetB(TVector3 X, Double_t Time); TVector3 CrossIntegral(TVector3 X, Double_t Time, Double_t Radius, Double_t Height ) ; TVector3 calcE(TVector3 X, Double_t Time, Double_t Radius, Double_t Height);

// Natural Constants −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Double_t gamma = 3; // Relativistic gamma factor. Double_t const c = 299792458; // Speed of light [m/s]. Double_t const c_2 = pow(c, 2); // Squared [(m/s)^2]. Double_t const hbar = 1.05457126e −34; // Reduced Planck’s constant [Js]. Double_t const g = 2.002331846; // Magnetic dipole moment ( g f a c t o r ) . Double_t const eta = 1e −6; // Electric dipole moment (eta factor). Double_t const a_mu = g / 2 − 1 ; // Anamolous g factor. Double_t const e_charge = 1.60217662e −19; // Elementary charge [C]. Double_t const mu_mass = 1.883531594e −28; // Muon mass [kg]. Double_t const mu_mass2 = pow(mu_mass ∗ c_2 , 2) ; // Squared [J^2]

// Main Coils −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Double_t Sign = −1;

Double_t zm1 = 4.46714e −1; Double_t zm2 = 1.22632;

Double_t Im1 = 1.75526e6; Double_t Im2 = 1.05565e6; Double_t Im3 = 4.18211e6;

63 Double_t Im4 = 5.20241e5;

Double_t rm1 = 8.07651e −1; Double_t rm2 = 2.14255e −1; Double_t rm3 = 2.07891; Double_t rm4 = 5.94368e −1;

Double_t drm1 = 2.72952e −2; Double_t drm2 = 1.62980e −1; Double_t drm3 = 1.99342e −1; Double_t drm4 = 1.88320e −2;

Double_t dzm1 = 2.47176e −1; Double_t dzm2 = 7.49495e −2; Double_t dzm3 = 3.61630; Double_t dzm4 = 5.18510e −1;

BField B1(Im1, Sign, rm1, zm1, drm1, dzm1); BField B2(Im2, Sign, rm2, zm2, drm2, dzm2);

BField B3(Im2, Sign, rm2, −zm2 − dzm2, drm2, dzm2); BField B4(Im1, Sign, rm1, −zm1 − dzm1, drm1, dzm1);

// Effective Iron Yoke. BField B5(Im3, Sign, rm3, −dzm3/2, drm3, dzm3);

// For homogeneity. BField B6(Im4, Sign, rm4, −dzm4/2, drm4, dzm4);

// Weak Focusing Coils −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Double_t zw1 = 8.35378e −1; Double_t zw2 = 2.69852e −1; Double_t zw3 = 2.32429e −1;

Double_t Iw1 = 1.26467e3; Double_t Iw2 = 4.56576e2; Double_t Iw3 = 1.57015e3; Double_t Iw4 = 1.55012e3;

Double_t rw1 = 3.03265e −1; Double_t rw2 = 5.43780e −1; Double_t rw3 = 9.19956e −1; Double_t rw4 = 7.50588e −1;

BField BW1(Iw1, Sign, rw1, zw1); BField BW2(−Iw2, Sign, rw2, zw2); BField BW3(Iw3, Sign, rw3, zw3); BField BW4(−Iw4, Sign, rw4, 0); BField BW5(Iw3, Sign, rw3, −zw3 ) ; BField BW6(−Iw2, Sign, rw2, −zw2 ) ; BField BW7(Iw1, Sign, rw1, −zw1 ) ;

// Kicker Coils −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Kicker K1(Current , CurrentDer);

// Background Field −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

64 TVector3 B_3T(0, 0, Sign ∗ 3) ;

// Initial Conditions −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− // Initial momentum [kg m / s]. // For p_0: gamma∗v = sqrt(gamma^2 − 1) ∗c. More convenient. Double_t const p_0 = mu_mass ∗ c ∗ sqrt(pow(gamma, 2) − 1) ; Double_t const v_0 = p_0 / (gamma ∗ mu_mass) ;

// Working momentum : //TVector3 PWorks(1.3576332427912342e −19, 7.0026729496707596e −20, −4.6611416163428041e −20) ; TVector3 P(1.3576332427912342e −19, 7.0026729496707596e −20, −4.6611416163428041e −20) ; //TVector3 P(−p_0 , 0 , 0) ; TVector3 V = 1./(gamma ∗ mu_mass) ∗ P;

// Radius of orbit [m]. Double_t R = p_0 / (e_charge ∗ 3) ;

// Initial energy [J]. Double_t const epsilon_0 = sqrt(pow(mu_mass, 2) ∗ pow(c, 4) + P.Mag2() ∗ c_2 );

// Position vector of particle [m]. Double_t const x_i = 0 ; Double_t const y_i = R; Double_t const z_i = 0 ; // Working initial position: //TVector3 XWorks(0.14674242396212422, −0.35008473314047334, 0.84082012140991158); TVector3 X(0.14674242396212422, −0.35008473314047334, 0.84082012140991158); //TVector3 X(x_i, y_i, z_i);

// Rotation of initial position and momentum, to make the particle start at (R, 0 , Z) . TRotation Rot; Rot.RotateZ(ATan(X.X() / X.Y()) + Pi()); X ∗= Rot ; P ∗= Rot ; V ∗= Rot ;

// Rotation of initial momentum, to check for deviations. TRotation PRot; PRot.RotateY(0) ; P ∗= PRot ;

// Gives the incoming angle Theta. cout << "Incoming␣angle␣=␣" << PiOver2() − ATan(V.Z() / V.Y()) << "␣rad␣\n";

// Spin vector of particle [Js]. // Magnitude of S multiplied with unit vector of V to get spin vector in the direction of motion. TVector3 S = hbar ∗ s q r t ( 3 ) / 2 ∗ V. Unit ( ) ;

// Grid Parameters −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Calculates the orbit time after which it calculates the step size. Double_t const tau = 2 ∗ TMath : : Pi ( ) ∗ epsilon_0 / (e_charge ∗ c_2 ∗ 3) ;

65 Double_t const Norbits = 30; Double_t const dt = 13./11 ∗ Norbits ∗ tau / Number; Double_t const dx = 15e −4;

cout.precision(17); cout << "Tau␣=␣" << tau << "␣s\n";

TVector3 X0(.43, 0, 0);

// Position arrays. Double_t x_pos[Number]; Double_t y_pos[Number]; Double_t z_pos[Number]; Double_t r_pos[Number];

// Spin arrays. Double_t s_m[Number]; Double_t s_x[Number]; Double_t s_y[Number]; Double_t s_z[Number];

// Magnetic field arrays. Double_t B_r[Number]; Double_t B_z[Number]; Double_t B_k[Number]; Double_t B_kOld[Number]; Double_t E_k[Number]; Double_t E_kOld [ Number ] ; Double_t B_kDifference [Number];

// Momentum arrays . Double_t z_mom[Number ] ;

// Initial positions. x_pos[0] = X(0); y_pos[0] = X(1); z_pos[0] = X(2);

// Time . Double_t Time[Number]; Time [ 0 ] = 0 ;

// The Runge−Kutta numerical parameters (position). TVector3 k_1; TVector3 k_2; TVector3 k_3; TVector3 k_4;

// The Runge−Kutta numerical parameters (momentum). TVector3 kp_1; TVector3 kp_2; TVector3 kp_3; TVector3 kp_4;

// Intermediate momenta. TVector3 P1; TVector3 P2; TVector3 P3;

// This magnetic field is the static one. All time dependence is contained within the Kicker object.

66 TVector3 B_Static = B1.getB(X) + B2.getB(X) + B3.getB(X) + B4.getB(X) + B5. getB(X) + B6.getB(X) + BW1.getB(X) + BW2.getB(X) + BW3.getB(X) + BW4.getB (X) + BW5.getB(X) + BW6.getB(X) + BW7.getB(X); TVector3 E = KgetE(X, Time[0]) ;

B_z[0] = B_Static.Z(); B_r[0] = B_Static.X() ∗ Cos(X.Phi()) + B_Static.Y() ∗ Sin(X.Phi());

// Integrated electric field. Used to calculate its influence on the p a r t i c l e ’ s momentum . TVector3 E_int(0, 0, 0); Double_t SThetaIntE = 0; Double_t SThetaIntB = 0; Double_t SThetaInt = 0;

// Recurring constant. Double_t Alpha = e_charge / (gamma ∗ mu_mass) ;

cout << "p␣=␣" << P.Mag() << "␣kg␣m/s\n\n";

// The Runge−Kutta 4 algorithm −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− for (ULong_t idx = 0; idx != Number; ++idx) {

Time[idx] = idx ∗ dt ; // This magnetic field is the static one. All time dependence is contained within the Kicker object. i f (abs(X.Z()) > .35) B_Static = B1.getB(X) + B2.getB(X) + B3.getB(X) + B4.getB(X) + B5.getB(X) + B6.getB(X) + BW1.getB(X) + BW2.getB(X) + BW3. getB(X) + BW4.getB(X) + BW5.getB(X) + BW6.getB(X) + BW7.getB( X);

else B_Static = B_3T + BW1.getB(X) + BW2.getB(X) + BW3.getB(X) + BW4. getB(X) + BW5.getB(X) + BW6.getB(X) + BW7.getB(X) ;;

// These vectors for B and E are used in the RK4 algorithm. TVector3 BNoStep = B_Static + K1.getB(X, Time[idx]) ; TVector3 BHalfStep = B_Static + K1.getB(X, Time[idx] + .5 ∗ dt ) ; TVector3 BWholeStep = B_Static + K1.getB(X, Time[idx] + dt);

TVector3 ENoStep = K1.getE(X, Time[idx]) ; TVector3 EHalfStep = K1.getE(X, Time[idx] ∗ . 5 ∗ dt ) ; TVector3 EWholeStep = K1.getE(X, Time[idx] + dt);

B_r[idx] = B_Static.X() ∗ Cos(X.Phi()) + B_Static.Y() ∗ Sin(X.Phi()) ; B_z[idx] = B_Static.Z(); B_k[idx] = KgetB(X, Time[idx]) .Mag(); B_kOld[idx] = K1.getB(X, Time[idx]) .Mag(); E_k[idx] = KgetE(X, Time[idx]) .Mag(); E_kOld [ idx ] = ENoStep . Mag( ) ; B_kDifference[idx] = B_k[idx] − B_kOld [ idx ] ;

E_int += ENoStep ∗ dt ;

// Transformation of spin −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− TVector3 SPlaceHolder = S;

67 TVector3 Beta = 1./c ∗ V;

k_1 = e_charge / mu_mass ∗ SPlaceHolder . Cross((a_mu + 1/gamma) ∗ BNoStep − a_mu ∗ gamma / (1 + gamma) ∗ Beta ∗ Beta.Dot(BNoStep) + eta /2 ∗ Beta.Cross(BNoStep)) ; SPlaceHolder .Rotate(−2 ∗ ASin ( dt ∗ k_1 . Mag( ) / (2 ∗ S . Mag( ) ) ) , BNoStep ) ; // Addition of a k_i vector is equivalent to a r o t a t i o n . k_2 = e_charge / mu_mass ∗ SPlaceHolder . Cross((a_mu + 1/gamma) ∗ BHalfStep − a_mu ∗ gamma / (1 + gamma) ∗ Beta ∗ Beta . Dot ( BHalfStep) + eta/2 ∗ Beta.Cross(BHalfStep)); SPlaceHolder = S; SPlaceHolder .Rotate(−2 ∗ ASin ( dt ∗ k_2 . Mag( ) / (2 ∗ S . Mag( ) ) ) , BHalfStep); // Addition of a k_i vector is equivalent to a r o t a t i o n . k_3 = e_charge / mu_mass ∗ SPlaceHolder . Cross((a_mu + 1/gamma) ∗ BHalfStep − a_mu ∗ gamma / (1 + gamma) ∗ Beta ∗ Beta . Dot ( BHalfStep) + eta/2 ∗ Beta.Cross(BHalfStep)); SPlaceHolder = S; SPlaceHolder .Rotate(−2 ∗ ASin (2 ∗ dt ∗ k_3 . Mag( ) / S . Mag( ) ) , BHalfStep); // Addition of a k_i vector is equivalent to a r o t a t i o n . k_4 = e_charge / mu_mass ∗ SPlaceHolder . Cross((a_mu + 1/gamma) ∗ BWholeStep − a_mu ∗ gamma / (1 + gamma) ∗ Beta ∗ Beta . Dot ( BWholeStep) + eta/2 ∗ Beta. Cross(BWholeStep)) ;

// The total transformation of S is a rotation about B. SThetaInt += dt ∗ (k_1 + 2∗k_2 + 2∗k_3 + k_4) . Mag( ) / (12 ∗ S . Mag( ) ) ; S . Rotate(−2 ∗ ASin ( dt ∗ (k_1 + 2∗k_2 + 2∗k_3 + k_4) . Mag( ) / (12 ∗ S. Mag())) , BNoStep);

s_x[idx] = S.X(); s_y[idx] = S.Y(); s_z[idx] = S.Z(); s_m[idx] = S.Mag();

// Transformation of position −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− k_1 = Alpha ∗ V. Cross(BNoStep) ; k_2 = Alpha ∗ (V + dt /2 ∗ k_1).Cross(BHalfStep); k_3 = Alpha ∗ (V + dt /2 ∗ k_2).Cross(BHalfStep); k_4 = Alpha ∗ (V + dt ∗ k_3) . Cross(BWholeStep) ;

V += dt /6 ∗ (k_1 + 2∗k_2 + 2∗k_3 + k_4) ;

X += dt ∗ V;

i f (idx%1000 == 0) cout << idx << ’/’ << Number << ’␣’ << B_Static.Mag() ∗ X. Mag( ) ∗ e_charge / P.Mag() << ’␣’ << B_Static.Mag() << ’␣’ << X.Mag ( ) << ’ \n ’ ;

x_pos[idx] = X(0); y_pos[idx] = X(1); z_pos[idx] = X(2); r_pos[idx] = X.Perp(); z_mom[idx] = ASin(P.Z() / P.Mag());

}

68 cout << ’\n’ << Time[Number − 1 ] << "␣ s \n" << "␣X␣=␣(" << X(0) << ",␣" << X(1) << ",␣" << X(2) << ")\n" << "␣P␣=␣(" << P(0) << ",␣" << P(1) << ",␣" << P(2) << ")\n" << "␣E_int␣=␣" << e_charge ∗ E_int.Mag() / p_0 << ’\n’ << "␣Spin␣Precessions␣=␣" << SThetaInt / TwoPi() << ’\n’; // Spin Plotting −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Spin Canvas. TCanvas ∗ cSpin = new TCanvas("Spin", "Spin", 600, 500); cSpin−>SetGrid() ;

// Instance of the Spin graph. TGraph ∗gSx = new TGraph(Number, Time, s_x); gSx−>SetMarkerStyle(20) ; gSx−>SetMarkerSize(.4) ; gSx−>SetMarkerColor(kBlue) ;

TGraph ∗gSy = new TGraph(Number, Time, s_y); gSy−>SetMarkerStyle(20) ; gSy−>SetMarkerSize(.4) ; gSy−>SetMarkerColor(kViolet);

TGraph ∗gSz = new TGraph(Number, Time, s_z); gSz−>SetMarkerStyle(20) ; gSz−>SetMarkerSize(.4) ; gSz−>SetMarkerColor(kRed) ;

TGraph ∗gSm = new TGraph(Number, Time, s_m) ; gSm−>SetMarkerStyle(20) ; gSm−>SetMarkerSize(.4) ; gSm−>SetMarkerColor(kOrange) ;

// Instance of TMulti. TMultiGraph ∗ multis = new TMultiGraph() ; multis−>SetTitle("Spin␣Precession ;Time␣[s ];Component␣of␣spin␣vector␣[Js]"); multis−>Add( gSx ) ; multis−>Add( gSy ) ; multis−>Add( gSz ) ; multis−>Add(gSm) ;

multis−>DrawClone("AP") ;

// Build and Draw a legend. TLegend ∗ l e g s = new TLegend(.1 ,.7 ,.3 ,.9 ,"Legend"); l e g s −>SetFillColor(0); gSx−>SetFillColor(kBlue); gSy−>SetFillColor(kViolet); gSz−>SetFillColor(kRed); gSm−>SetFillColor(kOrange); l e g s −>AddEntry(gSx, "x␣component") ; l e g s −>AddEntry(gSy, "y␣component") ; l e g s −>AddEntry(gSz , "z␣component") ; l e g s −>AddEntry(gSm, "Magnitude") ; l e g s −>DrawClone("") ;

// YZ Graph −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

69 // Instance of the yz graph. TGraph ∗yz = new TGraph(Number, y_pos, z_pos); yz−>SetTitle("Relativistic␣particle␣EB−Field␣(yz␣plane);y␣−␣pos␣[m];z␣−␣ pos ␣ [m] " ) ; yz−>SetMarkerStyle(7) ; yz−>SetMarkerColor(kRed) ;

// Create a canvas for yz. TCanvas ∗ cyz = new TCanvas("YZ", "YZ", 600, 500); cyz−>SetGrid() ;

// Draw simulated yz graph. yz−>DrawClone("APE") ;

// Build and Draw a legend. TLegend legyz(.1 ,.7 ,.3 ,.9 ,"Legend"); legyz.SetFillColor(0); yz−>SetFillColor(0); legyz .AddEntry(yz ,"RK4") ; legyz .DrawClone("Same") ;

// Phase Diagram −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Instance of phase diagram. TGraph ∗PhaseX = new TGraph(Number, z_pos , z_mom) ; PhaseX−>SetTitle("Phase␣Diagram;z␣[m]; Pitch␣angle␣[rad]"); PhaseX−>SetMarkerStyle(7) ; PhaseX−>SetMarkerColor(kRed) ;

TCanvas ∗cPhaseX = new TCanvas("PhaseX", "PhaseX", 600, 500); cPhaseX−>SetGrid() ;

PhaseX−>DrawClone("APE") ;

// 3D Curve −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Instance of 3D curve. TGraph2D ∗xyz = new TGraph2D(Number, x_pos, y_pos, z_pos); xyz−>SetTitle("Relativistic␣particle␣EB−F i e l d ; x␣−␣pos␣[m];y␣−␣pos␣[m];z␣−␣ pos ␣ [m] " ) ; xyz−>SetMarkerStyle(7) ; xyz−>SetMarkerColor(29) ;

// Create a canvas for 3D curve. TCanvas ∗ cxyz = new TCanvas("XYZ", "XYZ", 600, 500);

// Draw simulated 3D curve. xyz−>DrawClone("LP") ;

// Kicker Magnetic Field −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

TMultiGraph ∗ multiBt = new TMultiGraph() ; multiBt−>SetTitle("Magnetic␣Field␣as␣a␣function␣of␣t;Time␣[s ];|B|␣[T]");

// Instance of the Br graph. TGraph BtDifference(Number, Time, B_kDifference);

70 BtDifference .SetMarkerStyle(20); BtDifference.SetMarkerSize(.4) ; BtDifference .SetMarkerColor(kRed);

TGraph BtRetarded(Number, Time, B_k); BtRetarded.SetMarkerStyle(20) ; BtRetarded.SetMarkerSize(.4) ; BtRetarded.SetMarkerColor(kViolet);

TGraph Bt(Number, Time, B_kOld); Bt.SetMarkerStyle(20) ; Bt.SetMarkerSize(.4) ; Bt.SetMarkerColor(kBlue);

multiBt−>Add(&Bt ) ; multiBt−>Add(&BtRetarded) ; multiBt−>Add(&BtDifference) ;

// Create a canvas for Br. TCanvas ∗cBt = new TCanvas("Bt", "Bt", 600, 500); cBt−>SetGrid() ;

// Draw simulated Br graph. multiBt−>DrawClone("ape") ; //BtDifference.SetTitle("Magnetic Field as a Function of t;Time [s];Br [T]") ; //BtDifference .DrawClone("ap");

// Legend . TLegend legBt(.1 ,.7 ,.3 ,.9 ,"Legend"); legBt.SetFillColor(0); Bt. SetFillColor(kBlue); BtDifference. SetFillColor(kRed); BtRetarded. SetFillColor(kViolet); legBt.AddEntry(&Bt,"Excl.␣Retardation/transients"); legBt.AddEntry(&BtRetarded , "Incl .␣retardation/transients"); legBt.AddEntry(&BtDifference , "Difference"); legBt .DrawClone("Same") ;

// Kicker Electric Field −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

TMultiGraph ∗ multiEt = new TMultiGraph() ; multiEt−>SetTitle("Electric␣Field␣as␣a␣function␣of␣t;Time␣[s ];E␣[V/m]");

// Instance of the Ek graph. TGraph EtRetarded(Number, z_pos, E_k); EtRetarded.SetMarkerStyle(7) ; EtRetarded. SetMarkerColor(kRed) ;

TGraph Et (Number , z_pos , E_kOld) ; Et.SetMarkerStyle(7) ; Et.SetMarkerColor(kBlue);

multiEt−>Add(&Et ) ; multiEt−>Add(&EtRetarded) ;

// Create canvas for Et. TCanvas ∗cEt = new TCanvas("Et", "Et", 600, 500); cEt−>SetGrid() ;

71 // Draw . multiEt−>DrawClone("ape") ;

// RZ Graph −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// Instance of RZ graph. TGraph RZ(Number, r_pos, z_pos); RZ. SetTitle("R␣vs␣Z;r␣[m]; z␣[m]"); RZ.SetMarkerStyle(7) ; RZ. SetMarkerColor(kRed) ; RZ.GetXaxis()−>SetLimits(.28, .40);

// Create canvas. TCanvas ∗cRZ = new TCanvas("RZ", "RZ", 600, 500); cRZ−>SetGrid() ;

// Draw RZ.DrawClone("ape") ;

TEllipse Kick1(.3, .4, .01); TEllipse Kick2(.36, .4, .01); TEllipse Kick3(.3, −.4 , . 0 1 ) ; TEllipse Kick4(.36, −.4 , . 0 1 ) ;

Kick1. SetFillColor(kBlack); Kick2. SetFillColor(kBlack); Kick3. SetFillColor(kBlack); Kick4. SetFillColor(kBlack);

Kick1.DrawClone() ; Kick2.DrawClone() ; Kick3.DrawClone() ; Kick4.DrawClone() ;

cout << sw.RealTime() << "␣s\n";

}

72