Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HelixExplicitEuler Class Reference

G4HelixExplicitEuler implements an Explicit Euler stepper for magnetic field: x_1 = x_0 + helix(h), with helix(h) being a helix piece of length h. A simple approach for solving linear differential equations. Takes the current derivative and adds it to the current position. More...

#include <G4HelixExplicitEuler.hh>

Inheritance diagram for G4HelixExplicitEuler:

Public Member Functions

 G4HelixExplicitEuler (G4Mag_EqRhs *EqRhs)
 ~G4HelixExplicitEuler () override=default
void Stepper (const G4double y[], const G4double *na, G4double h, G4double yout[], G4double yerr[]) override
void DumbStepper (const G4double y[], G4ThreeVector Bfld, G4double h, G4double yout[]) override
G4double DistChord () const override
G4int IntegratorOrder () const override
G4StepperType StepperType () const override
Public Member Functions inherited from G4MagHelicalStepper
 G4MagHelicalStepper (G4Mag_EqRhs *EqRhs)
 ~G4MagHelicalStepper () override=default
 G4MagHelicalStepper (const G4MagHelicalStepper &)=delete
G4MagHelicalStepperoperator= (const G4MagHelicalStepper &)=delete
void Stepper (const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[]) override
G4double DistChord () const override
Public Member Functions inherited from G4MagIntegratorStepper
 G4MagIntegratorStepper (G4EquationOfMotion *Equation, G4int numIntegrationVariables, G4int numStateVariables=12, G4bool isFSAL=false)
virtual ~G4MagIntegratorStepper ()=default
 G4MagIntegratorStepper (const G4MagIntegratorStepper &)=delete
G4MagIntegratorStepperoperator= (const G4MagIntegratorStepper &)=delete
void NormaliseTangentVector (G4double vec[6])
void NormalisePolarizationVector (G4double vec[12])
void RightHandSide (const G4double y[], G4double dydx[]) const
void RightHandSide (const G4double y[], G4double dydx[], G4double field[]) const
G4int GetNumberOfVariables () const
G4int GetNumberOfStateVariables () const
G4int IntegrationOrder ()
G4EquationOfMotionGetEquationOfMotion ()
const G4EquationOfMotionGetEquationOfMotion () const
void SetEquationOfMotion (G4EquationOfMotion *newEquation)
unsigned long GetfNoRHSCalls ()
void ResetfNORHSCalls ()
G4bool IsFSAL () const
G4bool isQSS () const
void SetIsQSS (G4bool val)

Additional Inherited Members

Protected Member Functions inherited from G4MagHelicalStepper
void LinearStep (const G4double yIn[], G4double h, G4double yHelix[]) const
void AdvanceHelix (const G4double yIn[], const G4ThreeVector &Bfld, G4double h, G4double yHelix[], G4double yHelix2[]=nullptr)
void MagFieldEvaluate (const G4double y[], G4ThreeVector &Bfield)
G4double GetInverseCurve (const G4double Momentum, const G4double Bmag)
void SetAngCurve (const G4double Ang)
G4double GetAngCurve () const
void SetCurve (const G4double Curve)
G4double GetCurve () const
void SetRadHelix (const G4double Rad)
G4double GetRadHelix () const
Protected Member Functions inherited from G4MagIntegratorStepper
void SetIntegrationOrder (G4int order)
void SetFSAL (G4bool flag=true)

Detailed Description

G4HelixExplicitEuler implements an Explicit Euler stepper for magnetic field: x_1 = x_0 + helix(h), with helix(h) being a helix piece of length h. A simple approach for solving linear differential equations. Takes the current derivative and adds it to the current position.

Definition at line 49 of file G4HelixExplicitEuler.hh.

Constructor & Destructor Documentation

◆ G4HelixExplicitEuler()

G4HelixExplicitEuler::G4HelixExplicitEuler ( G4Mag_EqRhs * EqRhs)

Constructor for G4HelixExplicitEuler.

Parameters
[in]EqRhsPointer to the provided equation of motion.

Definition at line 40 of file G4HelixExplicitEuler.cc.

41 : G4MagHelicalStepper(EqRhs)
42{
43}
G4MagHelicalStepper(G4Mag_EqRhs *EqRhs)

◆ ~G4HelixExplicitEuler()

G4HelixExplicitEuler::~G4HelixExplicitEuler ( )
overridedefault

Default Destructor.

Member Function Documentation

◆ DistChord()

G4double G4HelixExplicitEuler::DistChord ( ) const
overridevirtual

Returns the distance from chord line.

Implements G4MagIntegratorStepper.

Definition at line 85 of file G4HelixExplicitEuler.cc.

86{
87 // Implementation : must check whether h/R > 2 pi !!
88 // If( h/R < pi) use G4LineSection::DistLine
89 // Else DistChord=R_helix
90 //
91 G4double distChord;
92 G4double Ang_curve=GetAngCurve();
93
94 if(Ang_curve<=pi)
95 {
96 distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve));
97 }
98 else if(Ang_curve<twopi)
99 {
100 distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve)));
101 }
102 else
103 {
104 distChord=2.*GetRadHelix();
105 }
106
107 return distChord;
108}
double G4double
Definition G4Types.hh:83
G4double GetRadHelix() const
G4double GetAngCurve() const

◆ DumbStepper()

void G4HelixExplicitEuler::DumbStepper ( const G4double y[],
G4ThreeVector Bfld,
G4double h,
G4double yout[] )
overridevirtual

The stepper function for the integration.

Parameters
[in]yStarting values array of integration variables.
[in]BfldDerivatives array.
[in]hThe given step size.
[out]youtIntegration output.

Implements G4MagHelicalStepper.

Definition at line 110 of file G4HelixExplicitEuler.cc.

114{
115 AdvanceHelix(yIn, Bfld, h, yOut);
116}
void AdvanceHelix(const G4double yIn[], const G4ThreeVector &Bfld, G4double h, G4double yHelix[], G4double yHelix2[]=nullptr)

◆ IntegratorOrder()

G4int G4HelixExplicitEuler::IntegratorOrder ( ) const
inlineoverridevirtual

Returns the order, 1, of integration.

Implements G4MagIntegratorStepper.

Definition at line 98 of file G4HelixExplicitEuler.hh.

98{ return 1; }

◆ Stepper()

void G4HelixExplicitEuler::Stepper ( const G4double y[],
const G4double * na,
G4double h,
G4double yout[],
G4double yerr[] )
override

The stepper function for the integration.

Parameters
[in]yStarting values array of integration variables.
[in]naNot used.
[in]hThe given step size.
[out]youtIntegration output.
[out]yerrIntegration error.

Definition at line 45 of file G4HelixExplicitEuler.cc.

50{
51 // Estimation of the Stepping Angle
52 //
53 G4ThreeVector Bfld;
54 MagFieldEvaluate(yInput, Bfld);
55
56 const G4int nvar = 6 ;
57 G4double yTemp[8], yIn[8] ;
58 G4ThreeVector Bfld_midpoint;
59
60 // Saving yInput because yInput and yOut can be aliases for same array
61 //
62 for(G4int i=0; i<nvar; ++i)
63 {
64 yIn[i] = yInput[i];
65 }
66
67 G4double h = Step * 0.5;
68
69 // Do full step and two half steps
70 //
71 G4double yTemp2[7];
72 AdvanceHelix(yIn, Bfld, h, yTemp2,yTemp);
73 MagFieldEvaluate(yTemp2, Bfld_midpoint) ;
74 AdvanceHelix(yTemp2, Bfld_midpoint, h, yOut);
76
77 // Error estimation
78 //
79 for(G4int i=0; i<nvar; ++i)
80 {
81 yErr[i] = yOut[i] - yTemp[i];
82 }
83}
CLHEP::Hep3Vector G4ThreeVector
int G4int
Definition G4Types.hh:85
void MagFieldEvaluate(const G4double y[], G4ThreeVector &Bfield)
void SetAngCurve(const G4double Ang)

◆ StepperType()

G4StepperType G4HelixExplicitEuler::StepperType ( ) const
inlineoverridevirtual

Returns the stepper type-ID, "kHelixExplicitEuler".

Reimplemented from G4MagIntegratorStepper.

Definition at line 103 of file G4HelixExplicitEuler.hh.

103{ return kHelixExplicitEuler; }
@ kHelixExplicitEuler
G4HelixExplicitEuler.

The documentation for this class was generated from the following files: