ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4RKIntegrationDriver.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4RKIntegrationDriver.hh
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
// G4RKIntegrationDriver
27
//
28
// Class description:
29
//
30
// Driver class which controls the integration error of a
31
// Runge-Kutta stepper
32
33
// Created: D.Sorokin, 2017
34
// --------------------------------------------------------------------
35
#ifndef G4RKINTEGRATIONDRIVER_HH
36
#define G4RKINTEGRATIONDRIVER_HH
37
38
#include "
G4VIntegrationDriver.hh
"
39
40
template
<
class
T>
41
class
G4RKIntegrationDriver
:
public
G4VIntegrationDriver
42
{
43
public
:
44
45
G4RKIntegrationDriver
(
T
*
stepper
);
46
47
G4RKIntegrationDriver
(
const
G4RKIntegrationDriver
&) =
delete
;
48
G4RKIntegrationDriver
&
operator=
(
const
G4RKIntegrationDriver
&) =
delete
;
49
50
virtual
void
GetDerivatives
(
const
G4FieldTrack
&
track
,
51
G4double
dydx[])
const override
;
52
53
virtual
void
GetDerivatives
(
const
G4FieldTrack
& track,
54
G4double
dydx[],
55
G4double
field[])
const override
;
56
57
virtual
G4double
ComputeNewStepSize
(
G4double
errMaxNorm,
// normalised error
58
G4double
hstepCurrent)
override
;
59
// Taking the last step's normalised error, calculate
60
// a step size for the next step.
61
// Do not limit the next step's size within a factor of the current one.
62
63
virtual
G4EquationOfMotion
*
GetEquationOfMotion
()
override
;
64
virtual
void
SetEquationOfMotion
(
G4EquationOfMotion
* equation)
override
;
65
66
virtual
const
T
*
GetStepper
()
const override
;
67
virtual
T
*
GetStepper
()
override
;
68
69
// Accessors.
70
G4double
GetSafety
()
const
;
71
G4double
GetPshrnk
()
const
;
72
G4double
GetPgrow
()
const
;
73
74
virtual
void
RenewStepperAndAdjust
(
G4MagIntegratorStepper
* stepper)
override
;
75
76
void
ReSetParameters
(
G4double
safety
= 0.9);
77
void
SetSafety
(
G4double
valS);
78
// i) sets the exponents (pgrow & pshrnk),
79
// using the current Stepper's order,
80
// ii) sets the safety
81
82
G4int
GetMaxNoSteps
()
const
;
83
void
SetMaxNoSteps
(
G4int
val);
84
// Modify and Get the Maximum number of Steps that can be
85
// taken for the integration of a single segment -
86
// (ie a single call to AccurateAdvance).
87
88
G4double
GetSmallestFraction
()
const
;
89
void
SetSmallestFraction
(
G4double
val);
90
91
protected
:
92
93
G4double
ShrinkStepSize
(
G4double
h
,
G4double
error
)
const
;
94
G4double
GrowStepSize
(
G4double
h,
G4double
error)
const
;
95
96
G4double
ShrinkStepSize2
(
G4double
h,
G4double
error2)
const
;
97
G4double
GrowStepSize2
(
G4double
h,
G4double
error2)
const
;
98
99
void
UpdateErrorConstraints
();
100
101
private
:
102
103
inline
void
RenewStepperAndAdjustImpl
(
T
* stepper);
104
105
G4int
fMaxNoSteps
;
106
107
G4int
fMaxStepBase
;
108
// The (default) maximum number of steps is Base
109
// divided by the order of Stepper
110
111
// Parameters used to grow and shrink trial stepsize.
112
//
113
G4double
safety
;
114
G4double
pshrnk
;
// exponent for shrinking
115
G4double
pgrow
;
// exponent for growth
116
117
// muximum error values for shrinking / growing (optimisation).
118
//
119
G4double
errorConstraintShrink
;
120
G4double
errorConstraintGrow
;
121
122
T
*
pIntStepper
=
nullptr
;
123
};
124
125
#include "G4RKIntegrationDriver.icc"
126
127
#endif
geant4
tree
geant4-10.6-release
source
geometry
magneticfield
include
G4RKIntegrationDriver.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:16
using
1.8.2 with
ECCE GitHub integration