Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ChordFinder.hh
Go to the documentation of this file.
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// G4ChordFinder
27//
28// Class description:
29//
30// A class that provides RK integration of motion ODE (as does g4magtr)
31// and also has a method that returns an Approximate point on the curve
32// near to a (chord) point.
33
34// Author: J.Apostolakis - Design and implementation - 25.02.1997
35// -------------------------------------------------------------------
36#ifndef G4CHORDFINDER_HH
37#define G4CHORDFINDER_HH
38
41
42#include <memory>
43
45
46class G4MagneticField;
48class G4HelixHeum;
49
51{
52 public: // with description
53
54 explicit G4ChordFinder( G4VIntegrationDriver* pIntegrationDriver );
55 // The most flexible constructor, which allows the user to specify
56 // any type of field, equation, stepper and integration driver.
57
58 G4ChordFinder( G4MagneticField* itsMagField,
59 G4double stepMinimum = 1.0e-2, // * mm
60 G4MagIntegratorStepper* pItsStepper = nullptr,
61 // G4bool useHigherEfficiencyStepper = true,
62 G4int stepperDriverChoice = 2 );
63 // A constructor that creates defaults for all "children" classes.
64 //
65 // The type of equation of motion is fixed.
66 // A default type of stepper (Dormand Prince since release 10.4) is used,
67 // and the corresponding integration driver.
68 // Except if 'useFSAL' is set (true), which provides a FSAL stepper
69 // and its corresponding specialised (templated) driver.
70
71 virtual ~G4ChordFinder();
72
73 G4ChordFinder(const G4ChordFinder&) = delete;
75 // Copy constructor and assignment operator not allowed.
76
78 G4double stepInitial,
79 G4double epsStep_Relative,
80 const G4ThreeVector& latestSafetyOrigin,
81 G4double lasestSafetyRadius);
82 // Uses ODE solver's driver to find the endpoint that satisfies
83 // the chord criterion: that d_chord < delta_chord
84 // -> Returns Length of Step taken.
85
86 G4FieldTrack ApproxCurvePointS( const G4FieldTrack& curveAPointVelocity,
87 const G4FieldTrack& curveBPointVelocity,
88 const G4FieldTrack& ApproxCurveV,
89 const G4ThreeVector& currentEPoint,
90 const G4ThreeVector& currentFPoint,
91 const G4ThreeVector& PointG,
92 G4bool first, G4double epsStep);
93
94 G4FieldTrack ApproxCurvePointV( const G4FieldTrack& curveAPointVelocity,
95 const G4FieldTrack& curveBPointVelocity,
96 const G4ThreeVector& currentEPoint,
97 G4double epsStep);
98
99 inline G4double InvParabolic( const G4double xa, const G4double ya,
100 const G4double xb, const G4double yb,
101 const G4double xc, const G4double yc );
102
103 inline G4double GetDeltaChord() const;
104 inline void SetDeltaChord(G4double newval);
105
106 inline void SetIntegrationDriver(G4VIntegrationDriver* IntegrationDriver);
108 // Access and set Driver.
109
110 inline void ResetStepEstimate();
111 // Clear internal state (last step estimate)
112
113 inline G4int SetVerbose( G4int newvalue=1);
114 // Set verbosity and return old value
115
117
118 friend std::ostream&
119 operator<<( std::ostream& os, const G4ChordFinder& cf);
120
121 protected: // .........................................................
122
123 void PrintDchordTrial(G4int noTrials,
124 G4double stepTrial,
125 G4double oldStepTrial,
126 G4double dChordStep);
127
128 private: // ............................................................
129
130 // Constants
131 // ---------------------
132 const G4double fDefaultDeltaChord; // SET in G4ChordFinder.cc = 0.25 mm
133
134 // PARAMETERS
135 // ---------------------
136 G4double fDeltaChord; // Maximum miss distance
137
138 G4int fStatsVerbose = 0; // if > 0, print Statistics in destructor
139
140 // DEPENDENT Objects
141 // ---------------------
142 G4VIntegrationDriver* fIntgrDriver = nullptr;
143 G4MagIntegratorStepper* fRegularStepperOwned = nullptr;
144 G4MagIntegratorStepper* fNewFSALStepperOwned = nullptr;
145 std::unique_ptr<G4HelixHeum> fLongStepper;
146 G4CachedMagneticField* fCachedField = nullptr;
147 // G4VFSALIntegrationStepper* fOldFSALStepperOwned = nullptr;
148 G4EquationOfMotion* fEquation = nullptr;
149};
150
151// Inline function implementation:
152
153#include "G4ChordFinder.icc"
154
155#endif // G4CHORDFINDER_HH
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void PrintDchordTrial(G4int noTrials, G4double stepTrial, G4double oldStepTrial, G4double dChordStep)
G4double InvParabolic(const G4double xa, const G4double ya, const G4double xb, const G4double yb, const G4double xc, const G4double yc)
void SetIntegrationDriver(G4VIntegrationDriver *IntegrationDriver)
G4FieldTrack ApproxCurvePointV(const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4ThreeVector &currentEPoint, G4double epsStep)
void OnComputeStep()
G4FieldTrack ApproxCurvePointS(const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4FieldTrack &ApproxCurveV, const G4ThreeVector &currentEPoint, const G4ThreeVector &currentFPoint, const G4ThreeVector &PointG, G4bool first, G4double epsStep)
G4ChordFinder(const G4ChordFinder &)=delete
virtual ~G4ChordFinder()
G4double GetDeltaChord() const
G4VIntegrationDriver * GetIntegrationDriver()
G4int SetVerbose(G4int newvalue=1)
void ResetStepEstimate()
void SetDeltaChord(G4double newval)
G4double AdvanceChordLimited(G4FieldTrack &yCurrent, G4double stepInitial, G4double epsStep_Relative, const G4ThreeVector &latestSafetyOrigin, G4double lasestSafetyRadius)
G4ChordFinder & operator=(const G4ChordFinder &)=delete
friend std::ostream & operator<<(std::ostream &os, const G4ChordFinder &cf)