BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSIntegratorDipoleFringeScaling.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "BDSIntegratorDipoleFringeScaling.hh"
20
21#include "G4Mag_EqRhs.hh"
22#include "G4ThreeVector.hh"
23
25 G4double brhoIn,
26 G4Mag_EqRhs* eqOfMIn,
27 G4double minimumRadiusOfCurvatureIn,
28 const G4double& tiltIn):
29 BDSIntegratorDipoleFringe(strengthIn, brhoIn, eqOfMIn, minimumRadiusOfCurvatureIn, tiltIn),
30 bRho(brhoIn*(*strengthIn)["scaling"]) // scale here otherwise calculation of rho in base class will be unscaled
31{;}
32
34 const G4double dydx[],
35 const G4double h,
36 G4double yOut[],
37 G4double yErr[])
38{
39 // momentum magnitude for scaling, doesn't matter if global or local as only the magnitude is needed
40 G4ThreeVector mom = G4ThreeVector(yIn[3], yIn[4], yIn[5]);
41 G4double momInMag = mom.mag();
42
43 // unit normalisation
44 const G4double fcof = eqOfM->FCof();
45
46 // normalise to momentum only, charge normalisation in base stepper
47 G4double momScaling = std::abs(momInMag / (fcof * bRho));
48
49 BaseStepper(yIn, dydx, h, yOut, yErr, fcof, momScaling);
50}
51
BDSIntegratorDipoleFringeScaling()=delete
Private default constructor to enforce use of supplied constructor.
const G4double bRho
Nominal magnetic rigidity.
virtual void Stepper(const G4double yIn[], const G4double dydx[], const G4double h, G4double yOut[], G4double yErr[])
Integrator that ignores the field and uses the analytical solution for a dipole kick.
void BaseStepper(const G4double yIn[6], const G4double dydx[6], const G4double &h, G4double yOut[6], G4double yErr[6], const G4double &fcof, const G4double &momScaling)
G4Mag_EqRhs * eqOfM
Cache of equation of motion. This class does not own it.
Efficient storage of magnet strengths.