BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSIntegratorDipoleFringe.hh
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#ifndef BDSINTEGRATORDIPOLEFRINGEBASE_H
19#define BDSINTEGRATORDIPOLEFRINGEBASE_H
20
21#include "BDSAuxiliaryNavigator.hh"
22#include "BDSIntegratorDipoleRodrigues2.hh"
23#include "BDSIntegratorDipoleQuadrupole.hh"
24#include "BDSIntegratorMultipoleThin.hh"
25
26#include "globals.hh"
27
28namespace BDS
29{
31 G4double FringeFieldCorrection(BDSMagnetStrength const* strength, G4bool entranceOrExit);
32
34 G4double SecondFringeFieldCorrection(BDSMagnetStrength const* strength, G4bool entranceOrExit);
35}
36
37class G4Mag_EqRhs;
39
47{
48public:
50 G4double brhoIn,
51 G4Mag_EqRhs* eqOfMIn,
53 const G4double& tiltIn = 0);
54
56
61
63 virtual void Stepper(const G4double yIn[6],
64 const G4double dydx[6],
65 const G4double h,
66 G4double yOut[6],
67 G4double yErr[6]);
68
72 void BaseStepper(const G4double yIn[6],
73 const G4double dydx[6],
74 const G4double& h,
75 G4double yOut[6],
76 G4double yErr[6],
77 const G4double& fcof,
78 const G4double& momScaling);
79
80
84 void OneStep(const G4ThreeVector& posIn,
85 const G4ThreeVector& momUIn, // assumed unit momentum of momIn
86 G4ThreeVector& posOut,
87 G4ThreeVector& momOut,
88 const G4double& bendingRadius) const;
89
92 void MultipoleStep(const G4double yIn[6],
93 G4double yMultipoleOut[6],
94 const G4double& h);
95
98 inline G4double GetPolefaceAngle() {return polefaceAngle;}
99 inline G4double GetFringeCorr() {return fringeCorr;}
100 inline G4double GetSecondFringeCorr() {return secondFringeCorr;}
101 inline G4double GetPolefaceCurv() {return polefaceCurvature;}
102
103protected:
107 G4double fringeCorr;
113 G4double rho;
114
115 G4ThreeVector unitField;
116 const G4double fieldArcLength;
117 const G4double fieldAngle;
118
119 const G4double tilt;
120 const G4bool finiteTilt;
121 G4double bx;
122 G4double by;
126
129 static G4double thinElementLength;
130
131 BDSIntegratorMultipoleThin* multipoleIntegrator;
132
133 G4bool isEntrance;
134
138
139private:
142};
143
144#endif
Extra G4Navigator to get coordinate transforms.
Integrator that ignores the field and uses the analytical solution for a dipole kick.
G4double secondFringeCorr
Second fringe field correction term.
void OneStep(const G4ThreeVector &posIn, const G4ThreeVector &momUIn, G4ThreeVector &posOut, G4ThreeVector &momOut, const G4double &bendingRadius) const
G4double rho
Nominal magnet bending radius.
G4double polefaceAngle
Poleface rotation angle.
G4double polefaceCurvature
Poleface curvature.
G4bool isEntrance
store if fringe is entrance or exit
BDSIntegratorDipoleFringe(BDSIntegratorDipoleFringe &)=delete
Assignment and copy constructor not implemented nor used.
G4double fringeCorr
Fringe field correction term.
const G4double fieldArcLength
Cache of the field arc length.
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)
BDSIntegratorDipoleFringe & operator=(const BDSIntegratorDipoleFringe &)=delete
Assignment and copy constructor not implemented nor used.
virtual void Stepper(const G4double yIn[6], const G4double dydx[6], const G4double h, G4double yOut[6], G4double yErr[6])
The stepper for integration. Calls base class stepper.
BDSIntegratorDipoleFringe()=delete
Private default constructor to enforce use of supplied constructor.
G4ThreeVector unitField
Cache of the unit field direction.
const G4double fieldAngle
Cache of the field angle.
void MultipoleStep(const G4double yIn[6], G4double yMultipoleOut[6], const G4double &h)
Exact helix through pure dipole field.
Integrator that ignores the field and uses the analytical solution to a multipole.
Efficient storage of magnet strengths.
Return either G4Tubs or G4CutTubs depending on flat face.
G4double SecondFringeFieldCorrection(BDSMagnetStrength const *strength, G4bool entranceOrExit)
Function to calculate the value of the second fringe field correction term.
G4double FringeFieldCorrection(BDSMagnetStrength const *strength, G4bool entranceOrExit)
Function to calculate the value of the fringe field correction term.