Geant4 11.2.2
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
60
61 G4ChordFinder( G4MagneticField* itsMagField,
62 G4double stepMinimum = 1.0e-2, // * mm
63 G4MagIntegratorStepper* pItsStepper = nullptr,
64 // G4bool useHigherEfficiencyStepper = true,
65 G4int stepperDriverChoice = kTemplatedStepperType );
66 // A constructor that creates defaults for all "children" classes.
67 //
68 // The type of equation of motion is fixed.
69 // A default type of stepper (Dormand Prince since release 10.4) is used,
70 // and the corresponding integration driver.
71 // Except if 'useFSAL' is set (true), which provides a FSAL stepper
72 // and its corresponding specialised (templated) driver.
73
74 virtual ~G4ChordFinder();
75
76 G4ChordFinder(const G4ChordFinder&) = delete;
78 // Copy constructor and assignment operator not allowed.
79
81 G4double stepInitial,
82 G4double epsStep_Relative,
83 const G4ThreeVector& latestSafetyOrigin,
84 G4double lasestSafetyRadius);
85 // Uses ODE solver's driver to find the endpoint that satisfies
86 // the chord criterion: that d_chord < delta_chord
87 // -> Returns Length of Step taken.
88
89 G4FieldTrack ApproxCurvePointS( const G4FieldTrack& curveAPointVelocity,
90 const G4FieldTrack& curveBPointVelocity,
91 const G4FieldTrack& ApproxCurveV,
92 const G4ThreeVector& currentEPoint,
93 const G4ThreeVector& currentFPoint,
94 const G4ThreeVector& PointG,
95 G4bool first, G4double epsStep);
96
97 G4FieldTrack ApproxCurvePointV( const G4FieldTrack& curveAPointVelocity,
98 const G4FieldTrack& curveBPointVelocity,
99 const G4ThreeVector& currentEPoint,
100 G4double epsStep);
101
102 inline G4double InvParabolic( const G4double xa, const G4double ya,
103 const G4double xb, const G4double yb,
104 const G4double xc, const G4double yc );
105
106 inline G4double GetDeltaChord() const;
107 inline void SetDeltaChord(G4double newval);
108
109 inline void SetIntegrationDriver(G4VIntegrationDriver* IntegrationDriver);
111 // Access and set Driver.
112
113 inline void ResetStepEstimate();
114 // Clear internal state (last step estimate)
115
116 inline G4int SetVerbose( G4int newvalue=1);
117 // Set verbosity and return old value
118
119 void OnComputeStep(const G4FieldTrack* track);
120
121 friend std::ostream&
122 operator<<( std::ostream& os, const G4ChordFinder& cf);
123
125 // Verbosity for contructor
126 protected: // .........................................................
127
128 void PrintDchordTrial(G4int noTrials,
129 G4double stepTrial,
130 G4double oldStepTrial,
131 G4double dChordStep);
132
133 static G4bool gVerboseCtor; // Verbosity for contructor
134
135 private: // ............................................................
136
137 // Constants
138 // ---------------------
139 const G4double fDefaultDeltaChord; // SET in G4ChordFinder.cc = 0.25 mm
140
141 // PARAMETERS
142 // ---------------------
143 G4double fDeltaChord; // Maximum miss distance
144
145 G4int fStatsVerbose = 0; // if > 0, print Statistics in destructor
146
147 // DEPENDENT Objects
148 // ---------------------
149 G4VIntegrationDriver* fIntgrDriver = nullptr;
150 G4MagIntegratorStepper* fRegularStepperOwned = nullptr;
151 G4MagIntegratorStepper* fNewFSALStepperOwned = nullptr;
152 std::unique_ptr<G4HelixHeum> fLongStepper;
153 G4CachedMagneticField* fCachedField = nullptr;
154 // G4VFSALIntegrationStepper* fOldFSALStepperOwned = nullptr;
155 G4EquationOfMotion* fEquation = nullptr;
156};
157
158// Inline function implementation:
159
160#include "G4ChordFinder.icc"
161
162#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)
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)
static void SetVerboseConstruction(G4bool v=true)
void ResetStepEstimate()
void OnComputeStep(const G4FieldTrack *track)
static G4bool gVerboseCtor
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)
G4ChordFinder(G4VIntegrationDriver *pIntegrationDriver)