00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef G4CHORDFINDER_HH
00043 #define G4CHORDFINDER_HH
00044
00045 #include "G4MagIntegratorDriver.hh"
00046 #include "G4FieldTrack.hh"
00047
00048 class G4MagneticField;
00049
00050 class G4ChordFinder
00051 {
00052 public:
00053
00054 G4ChordFinder( G4MagInt_Driver* pIntegrationDriver );
00055
00056 G4ChordFinder( G4MagneticField* itsMagField,
00057 G4double stepMinimum = 1.0e-2,
00058 G4MagIntegratorStepper* pItsStepper = 0 );
00059
00060
00061 virtual ~G4ChordFinder();
00062
00063 G4double AdvanceChordLimited( G4FieldTrack& yCurrent,
00064 G4double stepInitial,
00065 G4double epsStep_Relative,
00066 const G4ThreeVector latestSafetyOrigin,
00067 G4double lasestSafetyRadius);
00068
00069
00070
00071
00072 G4FieldTrack ApproxCurvePointS( const G4FieldTrack& curveAPointVelocity,
00073 const G4FieldTrack& curveBPointVelocity,
00074 const G4FieldTrack& ApproxCurveV,
00075 const G4ThreeVector& currentEPoint,
00076 const G4ThreeVector& currentFPoint,
00077 const G4ThreeVector& PointG,
00078 G4bool first, G4double epsStep);
00079
00080 G4FieldTrack ApproxCurvePointV( const G4FieldTrack& curveAPointVelocity,
00081 const G4FieldTrack& curveBPointVelocity,
00082 const G4ThreeVector& currentEPoint,
00083 G4double epsStep);
00084
00085 inline G4double InvParabolic( const G4double xa, const G4double ya,
00086 const G4double xb, const G4double yb,
00087 const G4double xc, const G4double yc );
00088
00089 inline G4double GetDeltaChord() const;
00090 inline void SetDeltaChord(G4double newval);
00091
00092 inline void SetChargeMomentumMass(G4double pCharge,
00093 G4double pMomentum,
00094 G4double pMass );
00095
00096
00097 inline void SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver);
00098 inline G4MagInt_Driver* GetIntegrationDriver();
00099
00100
00101 inline void ResetStepEstimate();
00102
00103
00104 inline G4int GetNoCalls();
00105 inline G4int GetNoTrials();
00106 inline G4int GetNoMaxTrials();
00107
00108
00109 virtual void PrintStatistics();
00110
00111 inline G4int SetVerbose( G4int newvalue=1);
00112
00113
00114 void SetFractions_Last_Next( G4double fractLast= 0.90,
00115 G4double fractNext= 0.95 );
00116
00117
00118 inline void SetFirstFraction(G4double fractFirst);
00119
00120
00121 public:
00122
00123 void TestChordPrint( G4int noTrials,
00124 G4int lastStepTrial,
00125 G4double dChordStep,
00126 G4double nextStepTrial );
00127
00128
00129
00130 inline G4double GetFirstFraction();
00131 inline G4double GetFractionLast();
00132 inline G4double GetFractionNextEstimate();
00133 inline G4double GetMultipleRadius();
00134
00135
00136 protected:
00137
00138 inline void AccumulateStatistics( G4int noTrials );
00139
00140
00141
00142 inline G4bool AcceptableMissDist(G4double dChordStep) const;
00143
00144 G4double NewStep( G4double stepTrialOld,
00145 G4double dChordStep,
00146 G4double& stepEstimate_Unconstrained ) ;
00147
00148 virtual G4double FindNextChord( const G4FieldTrack& yStart,
00149 G4double stepMax,
00150 G4FieldTrack& yEnd,
00151 G4double& dyErr,
00152 G4double epsStep,
00153 G4double* pNextStepForAccuracy,
00154 const G4ThreeVector latestSafetyOrigin,
00155 G4double latestSafetyRadius
00156 );
00157
00158 void PrintDchordTrial(G4int noTrials,
00159 G4double stepTrial,
00160 G4double oldStepTrial,
00161 G4double dChordStep);
00162
00163 inline G4double GetLastStepEstimateUnc();
00164 inline void SetLastStepEstimateUnc( G4double stepEst );
00165
00166 private:
00167
00168 G4ChordFinder(const G4ChordFinder&);
00169 G4ChordFinder& operator=(const G4ChordFinder&);
00170
00171
00172 private:
00173
00174
00175
00176 const G4double fDefaultDeltaChord;
00177
00178
00179
00180 G4double fDeltaChord;
00181
00182 G4double fFirstFraction, fFractionLast, fFractionNextEstimate;
00183 G4double fMultipleRadius;
00184 G4int fStatsVerbose;
00185
00186
00187
00188 G4MagInt_Driver* fIntgrDriver;
00189 G4MagIntegratorStepper* fDriversStepper;
00190 G4bool fAllocatedStepper;
00191 G4EquationOfMotion* fEquation;
00192
00193
00194
00195 G4double fLastStepEstimate_Unconstrained;
00196
00197
00198
00199
00200 G4int fTotalNoTrials_FNC, fNoCalls_FNC, fmaxTrials_FNC;
00201 };
00202
00203
00204
00205 #include "G4ChordFinder.icc"
00206
00207 #endif // G4CHORDFINDER_HH