Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4CashKarpRKF45.cc,v 1.4 1999/12/15 14:49:48 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
// order method (giving fifth-order accuracy) for the solution
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ChordFinder.cc,v 1.9 1999/12/15 14:49:48 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ChordFinder.cc,v 1.14 2000/05/11 17:34:32 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// 25.02.97 John Apostolakis, design and implimentation
@@ -19,6 +19,7 @@
// #include "G4Field.hh"
// #include "G4MagIntegratorStepper.hh"
#include "G4MagIntegratorDriver.hh"
#include "g4std/iomanip"
// For the moment fDeltaChord is a constant!
@@ -35,6 +36,7 @@ G4ChordFinder::G4ChordFinder( G4MagneticField* theMagField,
// by creating in inverse order the Driver, the Stepper and EqRhs ...
// G4Mag_EqRhs *
fEquation = new G4Mag_UsualEqRhs(theMagField); // Should move q, p to
fLastStepEstimate_Unconstrained = DBL_MAX;
//G4FieldTrack ??
// --->> Charge Q = 0
// --->> Momentum P = 1 NOMINAL VALUES !!!!!!!!!!!!!!!!!!
@@ -80,7 +82,7 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
#ifdef G4VERBOSE
if( dbg )
G4cerr << "Entered FindNextChord Limited with:\n yCurrent: " << yCurrent
G4cerr << "Entered AdvanceChordLimited with:\n yCurrent: " << yCurrent
<< " and initial Step=stepMax=" << stepMax << " mm. " << G4endl;
#endif
@@ -114,6 +116,8 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
return stepPossible;
}
// #define TEST_CHORD_PRINT 1
// ..............................................................................
G4double
@@ -127,7 +131,7 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
{
// G4int stepRKnumber=0;
G4FieldTrack yCurrent= yStart;
G4double stepTrial= stepMax;
G4double stepTrial;
G4double dydx[G4FieldTrack::ncompSVEC];
// 1.) Try to "leap" to end of interval
@@ -135,55 +139,115 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
// 2a.) If d_chord is not good enough, find one that is.
G4bool validEndPoint= false, dbg= false;
G4double dChordStep;
G4double dChordStep, oldStepTrial, stepOfLastGoodChord;
fIntgrDriver-> GetDerivatives( yCurrent, dydx ) ;
G4int noTrials=0;
stepTrial = G4std::min( stepMax,
(1-perThousand)*fLastStepEstimate_Unconstrained );
do
{
G4double stepForChord; // , stepForAccuracy;
yCurrent = yStart; // Always start from initial point
fIntgrDriver->QuickAdvance( yCurrent, dydx, stepTrial, dChordStep, dyErr);
#ifdef G4VERBOSE
if( dbg ) {
G4cerr << "Returned from QuickAdvance with: yCur=" << yCurrent << G4endl;
G4cerr << " dChordStep= "<< dChordStep <<" dyErr=" << dyErr << G4endl;
}
#endif
// First debug print
// We check whether the criterion is met here.
validEndPoint = AcceptableMissDist(dChordStep);
// && (dyErr < eps) ;
if( ! validEndPoint ) {
// This is needed to decide new step size until QuickAdvance does it
stepTrial = NewStep(stepTrial, dChordStep );
oldStepTrial = stepTrial;
// Get the driver to calculate the new step size, if it is needed
// stepTrial= fIntgrDriver->ComputeNewStepSize( dyErr/epsStep, stepTrial);
#ifdef G4VERBOSE
if( dbg )
G4cerr << "Dchord too big. Trying new hstep=" << stepTrial << G4endl;
// This method estimates to step size for a good chord.
stepForChord = NewStep(stepTrial, dChordStep, fLastStepEstimate_Unconstrained );
if( ! validEndPoint ) {
stepTrial = stepForChord;
#if 0
// Possible complementary approach:
// Get the driver to calculate the new step size, if it is needed
stepForAccuracy = fIntgrDriver->ComputeNewStepSize( dyErr/(epsStep*oldStepTrial),
stepTrial);
stepTrial = G4std::min(stepForChord, stepForAccuracy);
#endif
// if(dbg) G4cerr<<"Dchord too big. Try new hstep="<<stepTrial<<G4endl;
}
#ifdef TEST_CHORD_PRINT
G4cout.precision(5);
G4cout << " ChF/fnc: notrial " << G4std::setw( 3) << noTrials
<< " this_step= " << G4std::setw(10) << oldStepTrial;
if( fabs( (dChordStep / fDeltaChord) - 1.0 ) < 0.001 ){
G4cout.precision(8);
G4cout << " dChordStep= " << G4std::setw(12) << dChordStep;
}else{
G4cout.precision(6);
G4cout << " dChordStep= " << G4std::setw(12) << dChordStep;
}
if( dChordStep > fDeltaChord )
G4cout << " d+";
else
G4cout << " d-";
G4cout.precision(5);
G4cout << " new_step= " << G4std::setw(10) << fLastStepEstimate_Unconstrained
<< " new_step_constr= " << G4std::setw(10) << stepTrial << endl;
#endif
noTrials++;
}
while( ! validEndPoint ); // End of do-while RKD
stepOfLastGoodChord = stepTrial;
#ifdef TEST_CHORD_PRINT
G4cout << "ChordF/FindNextChord: NoTrials= " << noTrials
<< " StepForGoodChord=" << G4std::setw(10) << stepTrial << endl;
#endif
yEnd= yCurrent;
return stepTrial;
}
// ----------------------------------------------------------------------------
#if 0
// First debug print // older OPTIONAL code
// #ifdef G4VERBOSE
if( dbg ) {
G4cerr << "Returned from QuickAdvance with: yCur=" << yCurrent <<G4endl;
G4cerr << " dChordStep= "<< dChordStep <<" dyErr=" << dyErr << G4endl;
}
#endif
// ----------------------------------------------------------------------------
// ...........................................................................
G4double G4ChordFinder::NewStep(
const G4double stepTrialOld,
const G4double dChordStep ) // Current dchord achieved.
const G4double stepTrialOld,
const G4double dChordStep, // Current dchord achieved.
G4double& stepEstimate_Unconstrained )
{
G4double stepTrial;
static G4double lastStepTrial = 1., lastDchordStep= 1.;
#if 1
const G4double threshold = 1.21, multiplier = 0.9; // 0.9 < 1 / sqrt(1.21)
stepEstimate_Unconstrained = stepTrialOld * sqrt( fDeltaChord / dChordStep );
stepTrial = 0.98 * stepEstimate_Unconstrained;
if ( dChordStep < threshold * fDeltaChord ){
stepTrial= stepTrialOld * multiplier;
}
lastStepTrial = stepTrialOld;
lastDchordStep= dChordStep;
#else
if ( dChordStep > 1000. * fDeltaChord ){
stepTrial= stepTrialOld * 0.03;
}else{
@@ -194,6 +258,7 @@ G4double G4ChordFinder::NewStep(
stepTrial= stepTrialOld * 0.5;
}
}
#endif
// A more sophisticated chord-finder could figure out a better
// stepTrial, from dChordStep and the required d_geometry
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ClassicalRK4.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4ClassicalRK4.hh"
#include "G4ThreeVector.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4EquationOfMotion.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4EquationOfMotion.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ExplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Explicit Euler: x_1 = x_0 + h * dx_0
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4FieldManager.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4FieldManager.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4FieldTrack.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4FieldTrack.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixExplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixExplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixExplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -25,11 +25,11 @@
void
G4HelixExplicitEuler::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
AdvanceHelix(yIn, dydx, h, yOut);
AdvanceHelix(yIn, Bfld, h, yOut);
// NormaliseTangentVector( yOut ); // this could harm more than it helps
return ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixHeum.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixHeum.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixHeum.hh"
#include "G4ThreeVector.hh"
@@ -25,31 +25,32 @@
void
G4HelixHeum::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
const G4int nvar = 6 ;
G4double dydxTemp[6], dydxTemp2[6];
G4ThreeVector Bfield_Temp, Bfield_Temp2;
G4double yTemp[6], yAdd1[6], yAdd2[6] , yTemp2[6];
G4int i;
AdvanceHelix( yIn, dydx, h, yAdd1 );
AdvanceHelix( yIn, Bfld, h, yAdd1 );
AdvanceHelix( yIn, dydx, h/3.0, yTemp );
RightHandSide(yTemp,dydxTemp);
AdvanceHelix( yIn, Bfld, h/3.0, yTemp );
MagFieldEvaluate(yTemp,Bfield_Temp);
AdvanceHelix( yIn, dydxTemp, (2.0 / 3.0) * h, yTemp2 );
AdvanceHelix( yIn, Bfield_Temp, (2.0 / 3.0) * h, yTemp2 );
RightHandSide(yTemp2,dydxTemp2);
MagFieldEvaluate(yTemp2,Bfield_Temp2);
AdvanceHelix( yIn, dydxTemp2, h, yAdd2 );
AdvanceHelix( yIn, Bfield_Temp2, h, yAdd2 );
for( i = 0; i < nvar; i++ ) {
yOut[i] = ( 0.25 * yAdd1[i] + 0.75 * yAdd2[i]);
}
// NormaliseTangentVector( yOut );
return ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixImplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixImplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixImplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -28,24 +28,24 @@
void
G4HelixImplicitEuler::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
const G4int nvar = 6 ;
G4double dydxTemp[6];
G4double yTemp[6], yTemp2[6];
G4ThreeVector Bfld_endpoint;
G4int i;
// Step forward like in the explicit euler case
AdvanceHelix( yIn, dydx, h, yTemp);
AdvanceHelix( yIn, Bfld, h, yTemp);
// now obtain the new field value at the new point
RightHandSide(yTemp,dydxTemp);
MagFieldEvaluate(yTemp, Bfld_endpoint);
// and also advance along a helix for this field value
AdvanceHelix( yIn, dydxTemp, h, yTemp2);
AdvanceHelix( yIn, Bfld_endpoint, h, yTemp2);
// we take the average
for( i = 0; i < nvar; i++ )
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixSimpleRunge.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixSimpleRunge.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixSimpleRunge.hh"
#include "G4ThreeVector.hh"
@@ -26,19 +26,21 @@
void
G4HelixSimpleRunge::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
const G4int nvar = 6 ;
G4double dydxTemp[nvar];
G4double yTemp[nvar]; // , yAdd[nvar];
G4ThreeVector Bfld_midpoint;
AdvanceHelix( yIn, dydx, 0.5 * h, yTemp);
AdvanceHelix( yIn, Bfld, 0.5 * h, yTemp);
RightHandSide(yTemp,dydxTemp);
// now obtain the new field value at the new point
MagFieldEvaluate(yTemp, Bfld_midpoint);
AdvanceHelix( yIn, dydxTemp, h, yOut);
AdvanceHelix( yIn, Bfld_midpoint, h, yOut);
// NormaliseTangentVector( yOut );
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ImplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Implicit Euler:
@@ -5,10 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LineSection.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LineSection.cc,v 1.3 2000/02/25 16:57:15 grichine Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// typedef double G4double;
#include "G4LineSection.hh"
G4LineSection::G4LineSection( const G4ThreeVector& PntA,
@@ -16,8 +17,15 @@ G4LineSection::G4LineSection( const G4ThreeVector& PntA,
{
EndpointA= PntA;
VecAtoB=PntB-PntA;
inverse_square_distAB=1.0 / VecAtoB.mag2();
G4double distABsquared = VecAtoB.mag2() ;
if ( distABsquared == 0.0)
{
G4Exception("Equal points in G4LineSection::G4LineSection: line->point ?") ;
}
else
{
inverse_square_distAB=1.0 / distABsquared ;
}
}
G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
@@ -36,23 +44,31 @@ G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
unit_projection= inner_prod * InvsqDistAB();
if( (0. <= unit_projection ) && (unit_projection <= 1.0 ) )
dist_sq= sq_VecAZ - unit_projection * inner_prod;
else{
{
dist_sq= sq_VecAZ - unit_projection * inner_prod ;
}
else
{
// The perpendicular from the point to the line AB meets the line
// in a point outside the line segment!
//
if( unit_projection < 0. ) {
if( unit_projection < 0. )
{
// A is the closest point
dist_sq= sq_VecAZ;
}else{
}
else
{
// B is the closest point
G4ThreeVector EndpointB = EndpointA + VecAtoB;
G4ThreeVector VecBZ = OtherPnt - EndpointB;
dist_sq = VecBZ.mag2();
}
}
if( dist_sq < 0.0 ) dist_sq = 0.0 ;
return sqrt(dist_sq);
return sqrt(dist_sq) ;
}
G4double G4LineSection::Distline( const G4ThreeVector& OtherPnt,
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagErrorStepper.cc,v 1.6 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagErrorStepper.cc,v 1.7 2000/05/09 11:41:00 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4MagErrorStepper.hh"
#include "G4ThreeVector.hh"
@@ -61,11 +61,26 @@ G4MagErrorStepper::Stepper( const G4double yInput[],
G4double
G4MagErrorStepper::DistChord() const
{
// Soon: must check whether h/R > 2 pi !!
// Method below is good only for < 2 pi
// Estimate the maximum distance from the curve to the chord
//
// We estimate this using the distance of the midpoint to
// chord (the line between
//
// Method below is good only for angle deviations < 2 pi,
// This restriction should not a problem for the Runge cutta methods,
// which generally cannot integrate accurately for large angle deviations.
G4double distLine, distChord;
return G4LineSection::Distline( fMidPoint, fInitialPoint, fFinalPoint );
// This is a class method that gives distance of Mid
// from the Chord between the Initial and Final points.
if (fInitialPoint != fFinalPoint) {
distLine= G4LineSection::Distline( fMidPoint, fInitialPoint, fFinalPoint );
// This is a class method that gives distance of Mid
// from the Chord between the Initial and Final points.
distChord = distLine;
}else{
distChord = (fMidPoint-fInitialPoint).mag();
}
return distChord;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagHelicalStepper.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagHelicalStepper.cc,v 1.4 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4MagHelicalStepper.hh"
#include "G4ThreeVector.hh"
@@ -27,14 +27,14 @@ G4MagHelicalStepper::G4MagHelicalStepper(G4Mag_EqRhs *EqRhs)
void
G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
const G4double Barr[],
const G4double h,
G4double yHelix[])
G4ThreeVector Bfld,
G4double h,
G4double yHelix[])
{
// const G4int nvar = 6;
const G4double approc_limit = 0.05;
G4ThreeVector Bfld, Bnorm, B_x_P, vperp, vpar;
G4ThreeVector Bnorm, B_x_P, vperp, vpar;
// G4double norm;
G4double B_d_P; // B_perp;
G4double Theta; // , Theta_1;
@@ -42,8 +42,7 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
G4double CosT2, SinT2, CosT, SinT;
G4ThreeVector positionMove, endTangent;
Bfld= G4ThreeVector( Barr[0], Barr[1], Barr[2]);
G4double Bmag = Bfld.mag();
G4double Bmag = Bfld.mag();
const G4double *pIn = yIn+3;
G4ThreeVector initTangent= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
@@ -137,7 +136,8 @@ G4MagHelicalStepper::Stepper( const G4double yInput[],
// correction for Richardson Extrapolation.
G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
G4double yTemp[7], dydxTemp[6], yIn[7] ;
G4double yTemp[7], yIn[7] ;
G4ThreeVector Bfld_initial, Bfld_midpoint;
// Saving yInput because yInput and yOut can be aliases for same array
@@ -145,26 +145,35 @@ G4MagHelicalStepper::Stepper( const G4double yInput[],
G4double h = hstep * 0.5;
MagFieldEvaluate(yIn, Bfld_initial) ;
// Do two half steps
DumbStepper(yIn, Bfld_initial, h, yTemp);
MagFieldEvaluate(yTemp, Bfld_midpoint) ;
DumbStepper(yTemp, Bfld_midpoint, h, yOut);
DumbStepper(yIn,dydx,h,yTemp);
MagFieldEvaluate(yTemp,dydxTemp) ; // Was : RightHandSide(,)
DumbStepper(yTemp,dydxTemp,h,yOut);
// Store midpoint, chord calculation
// Store midpoint, to aid distance-from-chord calculation
yMidPoint = G4ThreeVector( yTemp[0], yTemp[1], yTemp[2]);
// Do a full Step
h = hstep ;
DumbStepper(yIn,dydx,h,yTemp);
DumbStepper(yIn, Bfld_initial, h, yTemp);
for(i=0;i<nvar;i++) {
yErr[i] = yOut[i] - yTemp[i] ;
yOut[i] += yErr[i]*correction ; // Provides by 1 increased
// order of accuracy
// Richardson Extrapolation
yErr[i] = yOut[i] - yTemp[i] ;
}
#if G4HELICAL_USE_RICHARDSON_EXTRAPOLATION
if( IntegratorOrder() > 1 ) {
// It is unclear whether it is possible to
// use the Richardson Extrapolation to increase accuracey by 1 order
for(i=0;i<nvar;i++) {
yOut[i] += yErr[i]*correction ;
}
}
#endif
yInitial = G4ThreeVector( yIn[0], yIn[1], yIn[2]);
yFinal = G4ThreeVector( yOut[0], yOut[1], yOut[2]);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorDriver.cc,v 1.10 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagIntegratorDriver.cc,v 1.12 2000/05/09 11:51:47 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
@@ -26,8 +26,6 @@
#include "geomdefs.hh"
// for kCarTolerance
#define G4DEBUG 1
// Stepsize can increase by no more than 5.0
// and decrease by no more than 1/10. = 0.1
//
@@ -52,16 +50,13 @@ G4MagInt_Driver::AccurateAdvance(
// RightHandSide is the right-hand side of ODE system.
// The source is similar to odeint routine from NRC p.721-722 .
// OLD:
// The value h1 should be set as a guessed first stepsize, Hmin is the
// minimum allowed stepsize. On output nOK and nBAD are the numbers of
// good and bad (but retried and fixed) steps taken.
{
// static const G4int maxstp = 5000;
G4int nstp, i;
static G4int dbg=1;
static G4int dbg=0;
G4double x, hnext, hdid, h ;
#ifdef G4DEBUG
dbg=1;
#endif
// G4double yscal[ncompSVEC];
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
@@ -111,20 +106,25 @@ G4MagInt_Driver::AccurateAdvance(
//--------------------------------------
lastStepSucceeded= (hdid == h);
#ifdef G4DEBUG
// #ifdef G4DEBUG
if(lastStepSucceeded) noFullIntegr++ ; else noSmallIntegr++ ;
G4ThreeVector EndPos( y[0], y[1], y[2] );
// Check the endpoint
G4double endPointDist= (EndPos-StartPos).mag();
if( endPointDist >= h*(1.+perMillion) ){
WarnEndPointTooFar ( endPointDist, h, eps, dbg );
// Issue a warning only for gross differences -
// we understand how small difference occur.
if( endPointDist >= h*(1.+perThousand) ){
WarnEndPointTooFar ( endPointDist, h, eps, dbg );
}
noBadSteps ++;
} else { // ie (!dbg)
noGoodSteps ++;
}
#endif
// #endif
// Check the proposed next stepsize
if(fabs(hnext) <= Hmin())
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4MagIntegratorStepper.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4MagIntegratorStepper.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Mag_EqRhs.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// This is the standard right-hand side for equation of motion
// in a pure Magnetic Field .
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Mag_UsualEqRhs.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// This is the standard right-hand side for equation of motion.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RKG3_Stepper.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4RKG3_Stepper.cc,v 1.3 2000/05/09 11:54:23 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4RKG3_Stepper.hh"
#include "G4ThreeVector.hh"
@@ -93,7 +93,7 @@ void G4RKG3_Stepper::StepWithEst( const G4double tIn[7],
{
G4Exception(" G4ClassicalRK4::StepWithEst ERROR: this Method is no longer used.");
G4Exception(" G4RKG3_Stepper::StepWithEst ERROR: this Method is no longer used.");
#if 0
// const G4int nvar = 6 ;
@@ -180,10 +180,9 @@ void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
G4double tTemp[7], yderiv[6] ;
G4int i ;
G4Exception(" G4ClassicalRK4::StepNoErr ERROR: this Method should no longer be used.");
#if 0
#ifdef END_CODE_G3STEPPER
G4Exception(" G4RKG3_Stepper::StepNoErr ERROR: this Method should no longer be used.");
#else
// GetEquationOfMotion()->EvaluateRhsReturnB(tIn,dydx,B1) ;
for(i=0;i<3;i++)
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SimpleHeum.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// Simple Heum:
// x_1 = x_0 + h *
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SimpleRunge.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// Simple Runge:
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4UniformElectricField.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4UniformMagField.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//