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 #ifndef G4MagInt_Driver_Def
00042 #define G4MagInt_Driver_Def
00043
00044 #include "G4Types.hh"
00045 #include "G4FieldTrack.hh"
00046 #include "G4MagIntegratorStepper.hh"
00047
00048 class G4MagInt_Driver
00049 {
00050 public:
00051
00052 G4bool AccurateAdvance(G4FieldTrack& y_current,
00053 G4double hstep,
00054 G4double eps,
00055 G4double hinitial=0.0);
00056
00057
00058
00059
00060
00061
00062 G4bool QuickAdvance( G4FieldTrack& y_val,
00063 const G4double dydx[],
00064 G4double hstep,
00065 G4double& dchord_step,
00066 G4double& dyerr ) ;
00067
00068
00069 G4bool QuickAdvance( G4FieldTrack& y_posvel,
00070 const G4double dydx[],
00071 G4double hstep,
00072 G4double& dchord_step,
00073 G4double& dyerr_pos_sq,
00074 G4double& dyerr_mom_rel_sq ) ;
00075
00076
00077
00078
00079
00080 G4MagInt_Driver( G4double hminimum,
00081 G4MagIntegratorStepper *pItsStepper,
00082 G4int numberOfComponents=6,
00083 G4int statisticsVerbosity=1);
00084 ~G4MagInt_Driver();
00085
00086
00087 inline G4double GetHmin() const;
00088 inline G4double Hmin() const;
00089 inline G4double GetSafety() const;
00090 inline G4double GetPshrnk() const;
00091 inline G4double GetPgrow() const;
00092 inline G4double GetErrcon() const;
00093 inline void GetDerivatives( const G4FieldTrack &y_curr,
00094 G4double dydx[] );
00095
00096
00097 inline void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper);
00098
00099
00100
00101 inline void ReSetParameters(G4double new_safety= 0.9 );
00102
00103
00104
00105
00106
00107 inline void SetSafety(G4double valS);
00108 inline void SetPshrnk(G4double valPs);
00109 inline void SetPgrow (G4double valPg);
00110 inline void SetErrcon(G4double valEc);
00111
00112
00113
00114 inline G4double ComputeAndSetErrcon();
00115
00116 inline void SetChargeMomentumMass( G4double particleCharge,
00117 G4double MomentumXc,
00118 G4double Mass );
00119
00120
00121 inline const G4MagIntegratorStepper* GetStepper() const;
00122
00123 void OneGoodStep( G4double ystart[],
00124 const G4double dydx[],
00125 G4double& x,
00126 G4double htry,
00127 G4double eps,
00128 G4double& hdid,
00129 G4double& hnext ) ;
00130
00131
00132
00133
00134 G4double ComputeNewStepSize( G4double errMaxNorm,
00135 G4double hstepCurrent);
00136
00137
00138
00139
00140
00141 G4double ComputeNewStepSize_WithinLimits(
00142 G4double errMaxNorm,
00143 G4double hstepCurrent);
00144
00145
00146
00147
00148 inline G4int GetMaxNoSteps() const;
00149 inline void SetMaxNoSteps( G4int val);
00150
00151
00152
00153
00154 public:
00155
00156 inline void SetHmin(G4double newval);
00157 inline void SetVerboseLevel(G4int newLevel);
00158 inline G4double GetVerboseLevel() const;
00159
00160 inline G4double GetSmallestFraction() const;
00161 void SetSmallestFraction( G4double val );
00162
00163 protected:
00164 void WarnSmallStepSize( G4double hnext, G4double hstep,
00165 G4double h, G4double xDone,
00166 G4int noSteps);
00167 void WarnTooManyStep( G4double x1start, G4double x2end, G4double xCurrent);
00168 void WarnEndPointTooFar (G4double endPointDist,
00169 G4double hStepSize ,
00170 G4double epsilonRelative,
00171 G4int debugFlag);
00172
00173
00174 void PrintStatus( const G4double* StartArr,
00175 G4double xstart,
00176 const G4double* CurrentArr,
00177 G4double xcurrent,
00178 G4double requestStep,
00179 G4int subStepNo );
00180 void PrintStatus( const G4FieldTrack& StartFT,
00181 const G4FieldTrack& CurrentFT,
00182 G4double requestStep,
00183 G4int subStepNo );
00184 void PrintStat_Aux( const G4FieldTrack& aFieldTrack,
00185 G4double requestStep,
00186 G4double actualStep,
00187 G4int subStepNo,
00188 G4double subStepSize,
00189 G4double dotVelocities );
00190
00191
00192 void PrintStatisticsReport() ;
00193
00194
00195 #ifdef QUICK_ADV_TWO
00196 G4bool QuickAdvance( G4double yarrin[],
00197 const G4double dydx[],
00198 G4double hstep,
00199 G4double yarrout[],
00200 G4double& dchord_step,
00201 G4double& dyerr );
00202 #endif
00203
00204 private:
00205
00206 G4MagInt_Driver(const G4MagInt_Driver&);
00207 G4MagInt_Driver& operator=(const G4MagInt_Driver&);
00208
00209
00210 private:
00211
00212
00213
00214
00215 G4double fMinimumStep;
00216
00217 G4double fSmallestFraction;
00218
00219
00220
00221 const G4int fNoIntegrationVariables;
00222 const G4int fMinNoVars;
00223 const G4int fNoVars;
00224
00225 G4int fMaxNoSteps;
00226 static const G4int fMaxStepBase;
00227
00228 G4double safety;
00229 G4double pshrnk;
00230 G4double pgrow;
00231 G4double errcon;
00232
00233
00234 static const G4double max_stepping_increase;
00235 static const G4double max_stepping_decrease;
00236
00237
00238 G4int fStatisticsVerboseLevel;
00239
00240
00241
00242 G4MagIntegratorStepper *pIntStepper;
00243
00244
00245
00246
00247 G4int fNoTotalSteps, fNoBadSteps, fNoSmallSteps, fNoInitialSmallSteps;
00248 G4double fDyerr_max, fDyerr_mx2;
00249 G4double fDyerrPos_smTot, fDyerrPos_lgTot, fDyerrVel_lgTot;
00250 G4double fSumH_sm, fSumH_lg;
00251
00252
00253 G4int fVerboseLevel;
00254
00255
00256 };
00257
00258 #include "G4MagIntegratorDriver.icc"
00259
00260 #endif