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

G4ExactHelixStepper is a concrete class for particle motion in constant magnetic field. Helix a-la-Explicity Euler: x_1 = x_0 + helix(h) with helix(h) being a helix piece of length h. As the field is assumed constant, an error is not calculated. More...

#include <G4ExactHelixStepper.hh>

Inheritance diagram for G4ExactHelixStepper:

Public Member Functions

 G4ExactHelixStepper (G4Mag_EqRhs *EqRhs)
 ~G4ExactHelixStepper () override=default
 G4ExactHelixStepper (const G4ExactHelixStepper &)=delete
G4ExactHelixStepperoperator= (const G4ExactHelixStepper &)=delete
void Stepper (const G4double y[], const G4double dydx[], 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

G4ExactHelixStepper is a concrete class for particle motion in constant magnetic field. Helix a-la-Explicity Euler: x_1 = x_0 + helix(h) with helix(h) being a helix piece of length h. As the field is assumed constant, an error is not calculated.

Definition at line 58 of file G4ExactHelixStepper.hh.

Constructor & Destructor Documentation

◆ G4ExactHelixStepper() [1/2]

G4ExactHelixStepper::G4ExactHelixStepper ( G4Mag_EqRhs * EqRhs)

Constructor for G4ExactHelixStepper.

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

Definition at line 37 of file G4ExactHelixStepper.cc.

38 : G4MagHelicalStepper(EqRhs),
39 fBfieldValue(DBL_MAX, DBL_MAX, DBL_MAX)
40{
41}
G4MagHelicalStepper(G4Mag_EqRhs *EqRhs)
#define DBL_MAX
Definition templates.hh:62

Referenced by G4ExactHelixStepper(), and operator=().

◆ ~G4ExactHelixStepper()

G4ExactHelixStepper::~G4ExactHelixStepper ( )
overridedefault

Default Destructor.

◆ G4ExactHelixStepper() [2/2]

G4ExactHelixStepper::G4ExactHelixStepper ( const G4ExactHelixStepper & )
delete

Copy constructor and assignment operator not allowed.

Member Function Documentation

◆ DistChord()

G4double G4ExactHelixStepper::DistChord ( ) const
overridevirtual

Estimates the maximum distance of curved solution and chord.

Implements G4MagIntegratorStepper.

Definition at line 91 of file G4ExactHelixStepper.cc.

92{
93 // Implementation : must check whether h/R > pi !!
94 // If( h/R < pi) DistChord=h/2*std::tan(Ang_curve/4)
95 // Else DistChord=R_helix
96
97 G4double distChord;
98 G4double Ang_curve=GetAngCurve();
99
100 if (Ang_curve<=pi)
101 {
102 distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve));
103 }
104 else if(Ang_curve<twopi)
105 {
106 distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve)));
107 }
108 else
109 {
110 distChord=2.*GetRadHelix();
111 }
112
113 return distChord;
114}
double G4double
Definition G4Types.hh:83
G4double GetRadHelix() const
G4double GetAngCurve() const

◆ DumbStepper()

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

Same as Stepper() function above, but should perform a 'dump' step without error calculation. Assuming a constant field, the solution is a helix. Should NOT be called; issues a fatal exception as the Stepper must do all the work.

Implements G4MagHelicalStepper.

Definition at line 73 of file G4ExactHelixStepper.cc.

77{
78 // Assuming a constant field: solution is a helix
79
80 AdvanceHelix(yIn, Bfld, h, yOut);
81
82 G4Exception("G4ExactHelixStepper::DumbStepper",
83 "GeomField0002", FatalException,
84 "Should not be called. Stepper must do all the work." );
85}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void AdvanceHelix(const G4double yIn[], const G4ThreeVector &Bfld, G4double h, G4double yHelix[], G4double yHelix2[]=nullptr)

◆ IntegratorOrder()

G4int G4ExactHelixStepper::IntegratorOrder ( ) const
inlineoverridevirtual

Returns the order, 1, of integration.

Implements G4MagIntegratorStepper.

Definition at line 115 of file G4ExactHelixStepper.hh.

115{ return 1; }

◆ operator=()

G4ExactHelixStepper & G4ExactHelixStepper::operator= ( const G4ExactHelixStepper & )
delete

◆ Stepper()

void G4ExactHelixStepper::Stepper ( const G4double y[],
const G4double dydx[],
G4double h,
G4double yout[],
G4double yerr[] )
overridevirtual

The stepper for the Runge Kutta integration. The stepsize is fixed, with the step size given by 'h'. Provides helix starting values y[0 to 6]. Outputs yout[] and ZERO estimated error yerr[]=0.

Parameters
[in]yInputStarting values array of integration variables.
[in]dydxDerivatives array.
[in]hThe given step size.
[out]youtIntegration output.
[out]yerrThe estimated error.

Implements G4MagIntegratorStepper.

Definition at line 46 of file G4ExactHelixStepper.cc.

51{
52 const G4int nvar = 6;
53
54 G4int i;
55 G4ThreeVector Bfld_value;
56
57 MagFieldEvaluate(yInput, Bfld_value);
58 AdvanceHelix(yInput, Bfld_value, hstep, yOut);
59
60 // We are assuming a constant field: helix is exact
61 //
62 for(i=0; i<nvar; ++i)
63 {
64 yErr[i] = 0.0 ;
65 }
66
67 fBfieldValue = Bfld_value;
68}
CLHEP::Hep3Vector G4ThreeVector
int G4int
Definition G4Types.hh:85
void MagFieldEvaluate(const G4double y[], G4ThreeVector &Bfield)

◆ StepperType()

G4StepperType G4ExactHelixStepper::StepperType ( ) const
inlineoverridevirtual

Returns the stepper type-ID, "kExactHelixStepper".

Reimplemented from G4MagIntegratorStepper.

Definition at line 120 of file G4ExactHelixStepper.hh.

120{ return kExactHelixStepper; }
@ kExactHelixStepper
G4ExactHelixStepper.

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