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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "BDSIntegratorDipoleFringeScaling.hh"
19
20#include "G4Mag_EqRhs.hh"
21#include "G4ThreeVector.hh"
22
24 G4double brhoIn,
25 G4Mag_EqRhs* eqOfMIn,
26 G4double minimumRadiusOfCurvatureIn,
27 const G4double& tiltIn):
28 BDSIntegratorDipoleFringe(strengthIn, brhoIn, eqOfMIn, minimumRadiusOfCurvatureIn, tiltIn),
29 bRho(brhoIn*(*strengthIn)["scaling"]) // scale here otherwise calculation of rho in base class will be unscaled
30{;}
31
33 const G4double dydx[],
34 const G4double h,
35 G4double yOut[],
36 G4double yErr[])
37{
38 // momentum magnitude for scaling, doesn't matter if global or local as only the magnitude is needed
39 G4ThreeVector mom = G4ThreeVector(yIn[3], yIn[4], yIn[5]);
40 G4double momInMag = mom.mag();
41
42 // unit normalisation
43 const G4double fcof = eqOfM->FCof();
44
45 // normalise to momentum only, charge normalisation in base stepper
46 G4double momScaling = std::abs(momInMag / (fcof * bRho));
47
48 BaseStepper(yIn, dydx, h, yOut, yErr, fcof, momScaling);
49}
50
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.