File indexing completed on 2025-01-18 09:58:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifndef G4CHORDFINDER_HH
0037 #define G4CHORDFINDER_HH
0038
0039 #include "G4VIntegrationDriver.hh"
0040 #include "G4MagIntegratorStepper.hh"
0041
0042 #include <memory>
0043
0044 class G4VFSALIntegrationStepper;
0045
0046 class G4MagneticField;
0047 class G4CachedMagneticField;
0048 class G4HelixHeum;
0049
0050 class G4ChordFinder
0051 {
0052 public:
0053
0054 explicit G4ChordFinder( G4VIntegrationDriver* pIntegrationDriver );
0055
0056
0057
0058 enum kIntegrationType { kDefaultDriverType=0, kFSALStepperType=1,
0059 kTemplatedStepperType, kRegularStepperType, kBfieldDriverType, kQss2DriverType, kQss3DriverType };
0060
0061 G4ChordFinder( G4MagneticField* itsMagField,
0062 G4double stepMinimum = 1.0e-2,
0063 G4MagIntegratorStepper* pItsStepper = nullptr,
0064
0065 G4int stepperDriverChoice = kTemplatedStepperType );
0066
0067
0068
0069
0070
0071
0072
0073
0074 virtual ~G4ChordFinder();
0075
0076 G4ChordFinder(const G4ChordFinder&) = delete;
0077 G4ChordFinder& operator=(const G4ChordFinder&) = delete;
0078
0079
0080 inline G4double AdvanceChordLimited( G4FieldTrack& yCurrent,
0081 G4double stepInitial,
0082 G4double epsStep_Relative,
0083 const G4ThreeVector& latestSafetyOrigin,
0084 G4double lasestSafetyRadius);
0085
0086
0087
0088
0089 G4FieldTrack ApproxCurvePointS( const G4FieldTrack& curveAPointVelocity,
0090 const G4FieldTrack& curveBPointVelocity,
0091 const G4FieldTrack& ApproxCurveV,
0092 const G4ThreeVector& currentEPoint,
0093 const G4ThreeVector& currentFPoint,
0094 const G4ThreeVector& PointG,
0095 G4bool first, G4double epsStep);
0096
0097 G4FieldTrack ApproxCurvePointV( const G4FieldTrack& curveAPointVelocity,
0098 const G4FieldTrack& curveBPointVelocity,
0099 const G4ThreeVector& currentEPoint,
0100 G4double epsStep);
0101
0102 inline G4double InvParabolic( const G4double xa, const G4double ya,
0103 const G4double xb, const G4double yb,
0104 const G4double xc, const G4double yc );
0105
0106 inline G4double GetDeltaChord() const;
0107 inline void SetDeltaChord(G4double newval);
0108
0109 inline void SetIntegrationDriver(G4VIntegrationDriver* IntegrationDriver);
0110 inline G4VIntegrationDriver* GetIntegrationDriver();
0111
0112
0113 inline void ResetStepEstimate();
0114
0115
0116 inline G4int SetVerbose( G4int newvalue=1);
0117
0118
0119 void OnComputeStep(const G4FieldTrack* track);
0120
0121 friend std::ostream&
0122 operator<<( std::ostream& os, const G4ChordFinder& cf);
0123
0124 static void SetVerboseConstruction(G4bool v=true) { gVerboseCtor=v;}
0125
0126 protected:
0127
0128 void PrintDchordTrial(G4int noTrials,
0129 G4double stepTrial,
0130 G4double oldStepTrial,
0131 G4double dChordStep);
0132
0133 static G4bool gVerboseCtor;
0134
0135 private:
0136
0137
0138
0139 const G4double fDefaultDeltaChord;
0140
0141
0142
0143 G4double fDeltaChord;
0144
0145 G4int fStatsVerbose = 0;
0146
0147
0148
0149 G4VIntegrationDriver* fIntgrDriver = nullptr;
0150 G4MagIntegratorStepper* fRegularStepperOwned = nullptr;
0151 G4MagIntegratorStepper* fNewFSALStepperOwned = nullptr;
0152 std::unique_ptr<G4HelixHeum> fLongStepper;
0153 G4CachedMagneticField* fCachedField = nullptr;
0154
0155 G4EquationOfMotion* fEquation = nullptr;
0156 };
0157
0158
0159
0160 #include "G4ChordFinder.icc"
0161
0162 #endif