Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
+118 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.60 2002/06/07 18:30:29 japost Exp $
$Id: History,v 1.69 2002/12/12 08:21:38 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,111 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Dec 12th, 2002 G. Cosmo - field-V04-01-06
---------------------------
- Moved unused variable 'nStpPr' to debug section in G4MagIntegratorDriver.cc,
method AccurateAdvance().
Dec 06th, 2002 G. Cosmo - field-V04-01-05
---------------------------
- Merged changes by Makoto for migration to new G4ApplicationState in
messengers of unit tests.
Nov 29th, 2002 J. Apostolakis - field-V04-01-04
---------------------------------
Further fixes for unitialised variable - in other steppers:
G4ExplicitEuler, G4ImplicitEuler, G4ImplicitEuler
Large memory leak fix for G4ImplicitEuler, small for ExplicitEuler.
Test accuracy requirements for spin adjusted.
Nov 20th, 2002 J. Apostolakis - field-V04-01-03
---------------------------------
Further fixes for unitialised variables:
* G4MagIntegratorStepper
- Created instance variables for number of Integration, State variables
* G4MagErrorStepper
- Utilise number of State variables to initialise full state of Output.
* G4Mag_SpinEqRhs
- Initialise the values of dydx that we do not update.
Note: Undoing these changes and the ones below would enable the user to see
if undefined values are used in variables that he/she expects to
have integrated.
BUT the fix assists us to find truly undefined values elsewhere
-- if they exist -- using valgrind.
Nov 9th, 2002 J. Apostolakis - field-V04-01-02
---------------------------------
Fixes to address use of uninitialised variable in seting values of FieldTrack
(this was done by design, but was neither ideal or always well-behaved.)
Changed:
* G4MagIntegratorDriver
- Added instance variables for number of Integration, State variables
- Initialise all State variables of Output with values from initial variables.
- Only the Integration variables will be integrated
* G4ClassicalRK4 and G4MagErrorStepper
- Copy the initial time to intermediate and output C-vectors,
in order to provide a zero-eth estimate value.
Note1: Should clean-up this fix, making it similar to Driver (above)
Note2: Should *not* be used for time varying field unless created
with at least 8 integration variables
---------------------------------
G4ChordFinder.cc
- Correction from zero dChord
which is does not update the Unconstrained step estimate (state)
- Added instance variables to store number of calls and chord-trials
and new print method for 'debugging'
G4Mag_UsualEqRhs.cc
- Attempted approximations for speedup *overwritten* by full inverse sqrt.
Oct 29th, 2002 J. Apostolakis - test-V04-01-02
--------------------------------
- Changed output of tests for small output change (GeV->MeV)
Oct 29th, 2002 J. Apostolakis - test-V04-01-02
--------------------------------
- (Only changed and tagged test subdirectory)
Changed tests to use the new method SetChargeMomentumMass of
PropagatorInField in order to be ready for its full use in
G4PropagatorInField.
(A key problem at end-July was this non-preparedness of the unit tests.)
Jul 24th, 2002 G. Cosmo - field-V04-01-01
--------------------------
- G4FieldManager[.hh.cc]: made fDefault_Delta_One_Step_Value and
fDefault_Delta_Intersection_Val normal constants (not static) to
resolve initialisation problems. Coworks with tag "geomvol-V04-01-01".
Fixes problem report #383.
Jul 23rd, 2002 G. Cosmo - field-V04-01-00
--------------------------
- G4MagIntegratorDriver.cc: cleared warning of unused variable.
Protected variable 'nStpPr' with G4DEBUG_FIELD.
- Updated reference outputs and some other updates to unit tests.
Jun 25th, 2002 J. Apostolakis - field-V04-00-05
--------------------------------
- G4ChordFinder.cc
In NewStep: fixed case of stepTrial >> stepTrialOld, to take large multiple - not small;
(it was treated the same as stepTrial << old)
Added guard for stepTrial==0.0 in FindNextChord
- G4MagIntegratorDriver.cc
Added protection against error of 0.0 in ComputeNewStepSize.
- G4EquationOfMotion
Made RightHandSide an inline method
In GetFieldValue signature of Point is double[4], instead of double[3]
Defined G4maximum_number_of_field_components as enum
Jun 7th, 2002 J. Apostolakis - field-V04-00-04
--------------------------------
- G4Mag_SpinEqRhs.cc
@@ -32,6 +137,18 @@ May 31st, 2002 J. Apostolakis - field-V04-00-03
- G4MagIntegratorDriver
o More information in debug printing (tangent cosine, norm)
May 7th, 2002 J. Apostolakis
--------------------------------
- G4MagIntegratorDriver - ( on trunk )
* Fix to update the field track for steps smaller than the chord finder's
minstep.
April 19th, 2002 J. Apostolakis (not included in tag field-V04-00-02)
--------------------------------
- G4MagIntegratorDriver.hh,cc (on trunk)
* Bug fix: last step can now only be triggerred if x+h > x2.
* Debugging methods improved.
May 7th, 2002 J. Apostolakis - field-V04-00-02
--------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4CashKarpRKF45.hh,v 1.7 2001/07/11 09:59:06 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4CashKarpRKF45
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ChordFinder.hh,v 1.8 2001/08/16 23:54:15 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ChordFinder.hh,v 1.9 2002/11/09 03:05:13 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4ChordFinder
@@ -101,6 +101,10 @@ class G4ChordFinder
G4double& dyErr, // Error of endpoint
G4double epsStep );
void PrintDchordTrial(G4int noTrials,
G4double stepTrial,
G4double oldStepTrial,
G4double dChordStep);
private: // ............................................................
G4ChordFinder(const G4ChordFinder&);
@@ -121,6 +125,7 @@ class G4ChordFinder
G4bool fAllocatedStepper;
G4EquationOfMotion* fEquation;
G4MagIntegratorStepper* fDriversStepper;
G4int fNoTrials, fNoCalls;
};
// Inline function implementation:
@@ -22,7 +22,7 @@
//
//
// $Id: G4ChordFinder.icc,v 1.4 2001/08/16 23:54:51 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// G4ChordFinder inline implementations
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ClassicalRK4.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ClassicalRK4.hh,v 1.6 2002/11/20 17:56:35 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4ClassicalRK4
@@ -85,7 +85,7 @@ class G4ClassicalRK4 : public G4MagErrorStepper
private:
G4int fNumberOfVariables ; // is set default to 6 in constructor
// G4int fNumberOfVariables ; // is set default to 6 in constructor
G4double *dydxm, *dydxt, *yt; // scratch space - not state
};
@@ -22,7 +22,7 @@
//
//
// $Id: G4ElectroMagneticField.hh,v 1.6 2001/11/08 17:31:06 grichine Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4ElectroMagneticField
@@ -22,7 +22,7 @@
//
//
// $Id: G4EqMagElectricField.hh,v 1.6 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4EqMagElectricField
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EquationOfMotion.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4EquationOfMotion.hh,v 1.7 2002/06/11 08:38:56 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4EquationOfMotion
@@ -64,6 +64,7 @@ class G4EquationOfMotion
// Set the charge, momentum and mass of the current particle
// --> used to set the equation's coefficients ...
inline
void RightHandSide( const G4double y[],
G4double dydx[] ) const;
// This calculates the value of the derivative dydx at y.
@@ -77,7 +78,7 @@ class G4EquationOfMotion
// Same as RHS above, but also returns the value of B.
// Should be made the new default ? after putting dydx & B in a class.
void GetFieldValue( const G4double Point[3],
void GetFieldValue( const G4double Point[4],
G4double Field[] ) const;
// Obtain only the field - the stepper assumes it is pure Magnetic.
// Not protected, because G4RKG3_Stepper uses it directly.
@@ -86,6 +87,8 @@ class G4EquationOfMotion
void SetFieldObj(G4Field* pField);
private:
// static const int G4maximum_number_of_field_components = 16;
enum { G4maximum_number_of_field_components = 16 } ;
G4Field *itsField;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EquationOfMotion.icc,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4EquationOfMotion.icc,v 1.7 2002/06/11 08:39:14 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Inline implementation
@@ -46,8 +46,28 @@ void G4EquationOfMotion::SetFieldObj(G4Field* pField)
}
inline
void G4EquationOfMotion::GetFieldValue( const G4double Point[3],
void G4EquationOfMotion::GetFieldValue( const G4double Point[4],
G4double Field[] ) const
{
itsField-> GetFieldValue( Point, Field );
}
inline
void
G4EquationOfMotion::RightHandSide( const G4double y[],
G4double dydx[] ) const
{
G4double Field[G4maximum_number_of_field_components];
G4double PositionAndTime[4];
// Position
PositionAndTime[0] = y[0];
PositionAndTime[1] = y[1];
PositionAndTime[2] = y[2];
// Global Time
PositionAndTime[3] = y[7]; // See G4FieldTrack::LoadFromArray
GetFieldValue(PositionAndTime, Field) ;
EvaluateRhsGivenB( y, Field, dydx );
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ExplicitEuler.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ExplicitEuler.hh,v 1.6 2002/11/29 13:47:49 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4ExplicitEuler
@@ -58,9 +58,6 @@ class G4ExplicitEuler : public G4MagErrorStepper
G4int IntegratorOrder() const { return 1; }
private:
G4int fNumberOfVariables ;
};
#endif /* G4EXPLICITEULER_HH */
@@ -22,7 +22,7 @@
//
//
// $Id: G4Field.hh,v 1.6 2001/11/08 17:31:07 grichine Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4Field
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.hh,v 1.7 2001/11/28 18:44:43 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FieldManager.hh,v 1.8 2002/07/24 10:43:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4FieldManager
@@ -120,10 +120,8 @@ class G4FieldManager
G4double fDelta_One_Step_Value; // for one tracking/physics step
G4double fDelta_Intersection_Val; // for boundary intersection
// Their default values ... (set in G4PropagatemagField.cc)
//
static const G4double fDefault_Delta_One_Step_Value; // = 0.25 * mm;
static const G4double fDefault_Delta_Intersection_Val; // = 0.1 * mm;
G4double fDefault_Delta_One_Step_Value; // = 0.25 * mm;
G4double fDefault_Delta_Intersection_Val; // = 0.1 * mm;
};
// Our current design envisions that one Field manager is valid for a region of the detector.
@@ -22,7 +22,7 @@
//
//
// $Id: G4FieldManager.icc,v 1.5 2001/11/28 18:44:43 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// G4FieldManager inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4FieldTrack.hh,v 1.8 2001/10/25 17:02:16 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4FieldTrack
@@ -22,7 +22,7 @@
//
//
// $Id: G4FieldTrack.icc,v 1.9 2001/10/25 17:02:16 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "PhysicalConstants.h"
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixExplicitEuler.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4HelixExplicitEuler
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixHeum.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4HelixHeum
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixImplicitEuler.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4HelixImplicitEuler
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixSimpleRunge.hh,v 1.5 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// W. Wander <wwc@mit.edu> 03/12/98
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ImplicitEuler.hh,v 1.4 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ImplicitEuler.hh,v 1.5 2002/11/29 13:48:47 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
@@ -45,9 +45,11 @@ class G4ImplicitEuler : public G4MagErrorStepper
G4int IntegratorOrder() const { return 2 ; } ;
private:
private: // No description
G4int fNumberOfVariables ;
G4double* dydxTemp;
G4double* yTemp;
// Temporaries, created to avoid new/delete on every call
};
#endif /* G4IMPLICITEULER_HH */
@@ -22,7 +22,7 @@
//
//
// $Id: G4LineSection.hh,v 1.7 2001/12/05 16:40:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4LineSection
@@ -22,7 +22,7 @@
//
//
// $Id: G4MagErrorStepper.hh,v 1.8 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4MagErrorStepper
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagErrorStepper.icc,v 1.8 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MagErrorStepper.icc,v 1.9 2002/11/09 03:06:15 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
inline
@@ -30,7 +30,7 @@ G4MagErrorStepper::G4MagErrorStepper(G4Mag_EqRhs *EqRhs,
G4int numberOfVariables)
: G4MagIntegratorStepper(EqRhs,numberOfVariables)
{
G4int nvar = this->GetNumberOfVariables() ;
G4int nvar = G4std::max(this->GetNumberOfVariables(), 8);
yMiddle= new G4double[nvar];
dydxMid= new G4double[nvar];
yInitial= new G4double[nvar];
@@ -22,7 +22,7 @@
//
//
// $Id: G4MagHelicalStepper.hh,v 1.7 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4MagHelicalStepper
@@ -22,7 +22,7 @@
//
//
// $Id: G4MagHelicalStepper.icc,v 1.7 2002/05/31 16:22:54 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// linear Step in regions of no field
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorDriver.hh,v 1.11 2002/04/19 17:31:41 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MagIntegratorDriver.hh,v 1.12 2002/11/09 02:32:15 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4MagInt_Driver
@@ -190,7 +190,9 @@ class G4MagInt_Driver
G4double hminimum_val;
// Minimum Step allowed in a Step.
G4int nvar;
const G4int fNoIntegrationVariables; // Number of Variables in integration
const G4int fMinNoVars; // Minimum number for FieldTrack
const G4int fNoVars; // Full number of variable
G4MagIntegratorStepper *pIntStepper;
G4int fMaxNoSteps;
@@ -22,7 +22,7 @@
//
//
// $Id: G4MagIntegratorDriver.icc,v 1.7 2001/10/25 09:11:09 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
inline
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorStepper.hh,v 1.8 2002/05/07 16:11:59 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MagIntegratorStepper.hh,v 1.9 2002/11/20 18:09:22 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4MagIntegratorStepper
@@ -31,9 +31,16 @@
//
// Abstract base class for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field
//
// A Stepper must integrate over NumberOfVariables elements,
// and also copy (from input to output) any of NoStateVariables
// not included in the NumberOfVariables.
//
// So it is expected that NoStateVariables >= NumberOfVariables
// History:
// - 15.01.97 J.Apostolakis (J.Apostolakis@cern.ch)
// - 15.01.97 J. Apostolakis (J.Apostolakis@cern.ch)
// - 20.11.02 J. Apostolakis: Added new "State" elements
#ifndef G4MAGIntegratorSTEPPER
#define G4MAGIntegratorSTEPPER
@@ -45,7 +52,9 @@ class G4MagIntegratorStepper
{
public: // with description
G4MagIntegratorStepper(G4EquationOfMotion *Equation, G4int num_variables);
G4MagIntegratorStepper(G4EquationOfMotion *Equation,
G4int numIntegrationVariables,
G4int numStateVariables=12);
virtual ~G4MagIntegratorStepper();
// Constructor and destructor. No actions.
@@ -71,8 +80,12 @@ class G4MagIntegratorStepper
// Right Hand side of the associated equation.
inline G4int GetNumberOfVariables() const;
inline void SetNumberOfVariables(G4int newNo);
// Get/Set the number of variables that the stepper will compile over.
// Get the number of variables that the stepper will integrate over.
// void SetNumberOfVariables(G4int newNo); // Dangerous & obsolete ...
inline G4int GetNumberOfStateVariables() const;
// Get the number of variables of state variables (>= above, integration)
virtual G4int IntegratorOrder() const = 0;
// Returns the order of the integrator
@@ -102,8 +115,9 @@ class G4MagIntegratorStepper
private:
G4EquationOfMotion *fEquation_Rhs;
G4int fNumberOfVariables;
const G4int fNoIntegrationVariables; // Number of Variables in integration
const G4int fNoStateVariables; // Number required for FieldTrack
// const G4int fNumberOfVariables;
};
#include "G4MagIntegratorStepper.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorStepper.icc,v 1.6 2002/05/07 16:11:59 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MagIntegratorStepper.icc,v 1.7 2002/11/20 18:10:44 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
inline
@@ -34,15 +34,22 @@ G4EquationOfMotion* G4MagIntegratorStepper::GetEquationOfMotion()
inline
G4int G4MagIntegratorStepper::GetNumberOfVariables() const
{
return fNumberOfVariables;
return fNoIntegrationVariables;
}
inline
void G4MagIntegratorStepper::SetNumberOfVariables(G4int newNo)
G4int G4MagIntegratorStepper::GetNumberOfStateVariables() const
{
fNumberOfVariables = newNo;
return fNoStateVariables;
}
// inline
// void G4MagIntegratorStepper::SetNumberOfVariables(G4int newNo)
// {
// fNumberOfVariables = newNo;
// }
inline
void G4MagIntegratorStepper::RightHandSide( const double y[], double dydx[] )
{
@@ -22,7 +22,7 @@
//
//
// $Id: G4Mag_EqRhs.hh,v 1.6 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4Mag_EqRhs
@@ -22,7 +22,7 @@
//
//
// $Id: G4Mag_SpinEqRhs.hh,v 1.8 2002/06/07 18:25:09 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4Mag_SpinEqRhs
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_UsualEqRhs.hh,v 1.4 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Mag_UsualEqRhs.hh,v 1.5 2002/04/29 16:54:02 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4Mag_UsualEqRhs
@@ -57,6 +57,15 @@ class G4Mag_UsualEqRhs : public G4Mag_EqRhs
G4double dydx[] ) const;
// Given the value of the magnetic field B, this function
// calculates the value of the derivative dydx.
virtual void SetChargeMomentumMass( G4double particleCharge, // in e+ units
G4double MomentumXc,
G4double mass);
private: // without description
G4double fInvCurrentMomentumXc; // This extra state enables us
// to save a square root in a
// critical method.
};
#endif /* G4MAG_USUAL_EQRHS */
@@ -22,7 +22,7 @@
//
//
// $Id: G4MagneticField.hh,v 1.10 2001/12/04 17:47:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4MagneticField
@@ -22,7 +22,7 @@
//
//
// $Id: G4RKG3_Stepper.hh,v 1.8 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4RKG3_Stepper
@@ -22,7 +22,7 @@
//
//
// $Id: G4SimpleHeum.hh,v 1.5 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4SimpleHeum
@@ -22,7 +22,7 @@
//
//
// $Id: G4SimpleRunge.hh,v 1.5 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4SimpleRunge
@@ -22,7 +22,7 @@
//
//
// $Id: G4UniformElectricField.hh,v 1.6 2001/12/04 17:35:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4UniformElectricField
@@ -22,7 +22,7 @@
//
//
// $Id: G4UniformMagField.hh,v 1.7 2001/12/04 17:35:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// class G4UniformMagField
@@ -22,7 +22,7 @@
//
//
// $Id: G4CashKarpRKF45.cc,v 1.10 2001/11/21 17:56:18 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
// order method (giving fifth-order accuracy) for the solution
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ChordFinder.cc,v 1.27 2002/06/01 02:37:14 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ChordFinder.cc,v 1.31 2002/11/09 02:50:48 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// 25.02.97 John Apostolakis, design and implimentation
@@ -184,7 +184,7 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
stepForChord = NewStep(stepTrial, dChordStep, fLastStepEstimate_Unconstrained );
if( ! validEndPoint ) {
if( stepForChord <= oldStepTrial )
if( (stepForChord <= oldStepTrial) || (stepTrial<=0.0) )
stepTrial = stepForChord;
else
stepTrial *= 0.1;
@@ -223,6 +223,7 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
stepOfLastGoodChord = stepTrial;
#ifdef TEST_CHORD_PRINT
static int dbg=0;
if( dbg )
G4cout << "ChordF/FindNextChord: NoTrials= " << noTrials
<< " StepForGoodChord=" << G4std::setw(10) << stepTrial << G4endl;
@@ -247,6 +248,11 @@ if( dbg ) {
G4double G4ChordFinder::NewStep(G4double stepTrialOld,
G4double dChordStep, // Current dchord achieved.
G4double& stepEstimate_Unconstrained )
//
// Is called to estimate the next step size, even for successful steps,
// in order to predict an accurate 'chord-sensitive' first step
// which is likely to assist in more performant 'stepping'.
//
{
G4double stepTrial;
@@ -255,15 +261,22 @@ G4double G4ChordFinder::NewStep(G4double stepTrialOld,
#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 > 0.0)
{
stepEstimate_Unconstrained = stepTrialOld * sqrt( fDeltaChord / dChordStep );
stepTrial = 0.98 * stepEstimate_Unconstrained;
}
else
{
// Should not update the Unconstrained Step estimate: incorrect!
stepTrial = stepTrialOld * 2.;
}
// if ( dChordStep < threshold * fDeltaChord ){
// stepTrial= stepTrialOld * multiplier;
// }
if( (stepTrial < 0.001 * stepTrialOld)
|| (stepTrial > 1000.0 * stepTrialOld)
){
if( stepTrial <= 0.001 * stepTrialOld)
{
if ( dChordStep > 1000.0 * fDeltaChord ){
stepTrial= stepTrialOld * 0.03;
}else{
@@ -274,6 +287,13 @@ G4double G4ChordFinder::NewStep(G4double stepTrialOld,
stepTrial= stepTrialOld * 0.5;
}
}
}else if (stepTrial > 1000.0 * stepTrialOld)
{
stepTrial= 1000.0 * stepTrialOld;
}
if( stepTrial == 0.0 ){
stepTrial= 0.000001;
}
lastStepTrial = stepTrialOld;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ClassicalRK4.cc,v 1.4 2001/07/11 09:59:10 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ClassicalRK4.cc,v 1.6 2002/11/20 17:56:35 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4ClassicalRK4.hh"
#include "G4ThreeVector.hh"
@@ -33,12 +33,14 @@
// Constructor sets the number of variables (default = 6)
G4ClassicalRK4::G4ClassicalRK4(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables)
// fNumberOfVariables(numberOfVariables)
{
dydxm = new G4double[fNumberOfVariables];
dydxt = new G4double[fNumberOfVariables];
yt = new G4double[fNumberOfVariables];
unsigned int noVariables= G4std::max(numberOfVariables,8); // For Time .. 7+1
dydxm = new G4double[noVariables];
dydxt = new G4double[noVariables];
yt = new G4double[noVariables];
}
////////////////////////////////////////////////////////////////
@@ -68,10 +70,15 @@ G4ClassicalRK4::DumbStepper( const G4double yIn[],
G4double h,
G4double yOut[])
{
const G4int nvar = fNumberOfVariables; // GetNumberOfVariables();
const G4int nvar = this->GetNumberOfVariables(); // fNumberOfVariables();
G4int i;
G4double hh = h*0.5 , h6 = h/6.0 ;
// Initialise time to t0, needed when it is not updated by the integration.
// [ Note: Only for time dependent fields (usually electric)
// is it neccessary to integrate the time.]
yt[7] = yIn[7];
yOut[7] = yIn[7];
for(i=0;i<nvar;i++)
{
@@ -21,34 +21,14 @@
// ********************************************************************
//
//
// $Id: G4EquationOfMotion.cc,v 1.5 2001/11/09 20:39:07 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4EquationOfMotion.cc,v 1.7 2002/06/11 08:34:27 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4EquationOfMotion.hh"
static const int G4maximum_number_of_field_components = 16;
G4EquationOfMotion::~G4EquationOfMotion()
{}
void
G4EquationOfMotion::RightHandSide( const G4double y[],
G4double dydx[] ) const
{
G4double Field[G4maximum_number_of_field_components];
G4double PositionAndTime[4];
// Position
PositionAndTime[0] = y[0];
PositionAndTime[1] = y[1];
PositionAndTime[2] = y[2];
// Global Time
PositionAndTime[3] = y[7]; // See G4FieldTrack::LoadFromArray
GetFieldValue(PositionAndTime, Field) ;
EvaluateRhsGivenB( y, Field, dydx );
}
void
G4EquationOfMotion::EvaluateRhsReturnB( const G4double y[],
G4double dydx[],
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ExplicitEuler.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ExplicitEuler.cc,v 1.5 2002/11/29 13:50:18 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Explicit Euler: x_1 = x_0 + h * dx_0
@@ -41,8 +41,7 @@
G4ExplicitEuler::G4ExplicitEuler(G4Mag_EqRhs *EqRhs,
G4int numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables)
{
}
@@ -66,17 +65,17 @@ G4ExplicitEuler::DumbStepper( const G4double yIn[],
G4double h,
G4double yOut[] )
{
// const G4int nvar = 6 ;
const G4int numberOfVariables= GetNumberOfVariables();
// Initialise time to t0, needed when it is not updated by the integration.
// yOut[7] = yIn[7]; // Better to set it to NaN; // TODO
G4int i;
for(i=0;i<fNumberOfVariables;i++)
for(i=0;i< numberOfVariables;i++)
{
yOut[i] = yIn[i] + h*dydx[i] ; // 1st and only Step
}
// NormaliseTangentVector( yOut ); // this could harm more than
// it helps - FIXME ???
return ;
}
@@ -21,32 +21,28 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.cc,v 1.6 2001/11/28 18:44:43 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FieldManager.cc,v 1.7 2002/07/24 10:43:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4FieldManager.hh"
G4FieldManager::G4FieldManager()
: fDetectorField(0), fChordFinder(0), fAllocatedChordFinder(false),
fFieldChangesEnergy(false), fDefault_Delta_One_Step_Value(0.25*mm),
fDefault_Delta_Intersection_Val(0.1*mm)
{
fDetectorField= 0;
fAllocatedChordFinder= false;
fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
fFieldChangesEnergy= false;
}
G4FieldManager::G4FieldManager(G4MagneticField *detectorField)
: fDetectorField(detectorField), fAllocatedChordFinder(true),
fFieldChangesEnergy(false), fDefault_Delta_One_Step_Value(0.25*mm),
fDefault_Delta_Intersection_Val(0.1*mm)
{
fDetectorField= detectorField;
this->CreateChordFinder(detectorField);
fChordFinder= new G4ChordFinder( detectorField );
fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
fFieldChangesEnergy= false;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4FieldTrack.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4FieldTrack.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixExplicitEuler.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4HelixExplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixHeum.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4HelixHeum.hh"
#include "G4ThreeVector.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixImplicitEuler.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4HelixImplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4HelixSimpleRunge.cc,v 1.5 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4HelixSimpleRunge.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ImplicitEuler.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ImplicitEuler.cc,v 1.5 2002/11/29 13:45:21 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Implicit Euler:
@@ -47,9 +47,11 @@
G4ImplicitEuler::G4ImplicitEuler(G4Mag_EqRhs *EqRhs,
G4int numberOfVariables):
G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
G4MagErrorStepper(EqRhs, numberOfVariables)
{
unsigned int noVariables= G4std::max(numberOfVariables,8); // For Time .. 7+1
dydxTemp = new G4double[noVariables] ;
yTemp = new G4double[noVariables] ;
}
@@ -59,6 +61,8 @@ G4MagErrorStepper(EqRhs, numberOfVariables),
G4ImplicitEuler::~G4ImplicitEuler()
{
delete[] dydxTemp;
delete[] yTemp;
}
//////////////////////////////////////////////////////////////////////
@@ -71,25 +75,23 @@ G4ImplicitEuler::DumbStepper( const G4double yIn[],
G4double h,
G4double yOut[])
{
// const G4int nvar = 6 ;
G4double* dydxTemp = new G4double[fNumberOfVariables] ;
G4double* yTemp = new G4double[fNumberOfVariables] ;
G4int i;
const G4int numberOfVariables= GetNumberOfVariables();
for( i = 0; i < fNumberOfVariables; i++ )
// Initialise time to t0, needed when it is not updated by the integration.
yTemp[7] = yOut[7] = yIn[7]; // Better to set it to NaN; // TODO
for( i = 0; i < numberOfVariables; i++ )
{
yTemp[i] = yIn[i] + h*dydx[i] ;
}
RightHandSide(yTemp,dydxTemp);
for( i = 0; i < fNumberOfVariables; i++ )
for( i = 0; i < numberOfVariables; i++ )
{
yOut[i] = yIn[i] + 0.5 * h * ( dydx[i] + dydxTemp[i] );
}
// NormaliseTangentVector( yOut );
return ;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4LineSection.cc,v 1.6 2001/12/04 15:10:01 grichine Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// typedef double G4double;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagErrorStepper.cc,v 1.9 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MagErrorStepper.cc,v 1.11 2002/11/20 18:14:00 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4MagErrorStepper.hh"
#include "G4ThreeVector.hh"
@@ -44,6 +44,7 @@ G4MagErrorStepper::Stepper( const G4double yInput[],
G4double yError [] )
{
const G4int nvar = this->GetNumberOfVariables() ;
const G4int maxvar= GetNumberOfStateVariables();
G4int i;
// correction for Richardson Extrapolation.
@@ -52,6 +53,12 @@ G4MagErrorStepper::Stepper( const G4double yInput[],
// Saving yInput because yInput and yOutput can be aliases for same array
for(i=0;i<nvar;i++) yInitial[i]=yInput[i];
yInitial[7]= yInput[7]; // Copy the time in case ... even if not really needed
yMiddle[7] = yInput[7]; // Copy the time from initial value
yOneStep[7] = yInput[7]; // As it contributes to final value of yOutput ?
// yOutput[7] = yInput[7]; // -> dumb stepper does it too for RK4
for(i=nvar;i<maxvar;i++) yOutput[i]=yInput[i];
// yError[7] = 0.0;
G4double halfStep = hstep * 0.5;
@@ -22,7 +22,7 @@
//
//
// $Id: G4MagHelicalStepper.cc,v 1.11 2002/01/17 08:12:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4MagHelicalStepper.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorDriver.cc,v 1.25 2002/05/07 17:18:49 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MagIntegratorDriver.cc,v 1.31 2002/12/12 08:19:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
//
@@ -57,9 +57,15 @@ const G4int G4MagInt_Driver::fMaxStepBase = 250; // Was 5000
G4MagInt_Driver::G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4int numComponents)
: nvar(numComponents),
: fNoIntegrationVariables(numComponents),
fMinNoVars(12),
fNoVars( G4std::max( fNoIntegrationVariables, fMinNoVars )),
fVerboseLevel(0)
{
// In order to accomodate "Laboratory Time", which is [7], fMinNoVars=8 is required.
// For proper time of flight and spin, fMinNoVars must be 12
// fNoVars= G4std::max( fNoVars, fMinNoVars );
RenewStepperAndAdjust( pItsStepper );
hminimum_val= hminimum;
fMaxNoSteps = fMaxStepBase / pIntStepper->IntegratorOrder();
@@ -101,7 +107,6 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
G4FieldTrack yFldTrkStart(y_current);
#endif
// G4double yscal[ncompSVEC];
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
G4double ystart[G4FieldTrack::ncompSVEC], yEnd[G4FieldTrack::ncompSVEC];
G4double x1, x2;
@@ -111,19 +116,17 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
// Assume that hstep > 0
// ystart = y_current.PosVelVec();
y_current.DumpToArray( ystart );
x1= y_current.GetCurveLength();
x2= x1 + hstep;
// // Initial Step size "h" is half the interval
// h = 0.5 * hstep;
// Initial Step size "h" is the full interval
h = hstep;
x = x1;
G4int noFullIntegr=0, noSmallIntegr = 0 ;
static G4int noGoodSteps =0, noBadSteps = 0 ; // Bad = chord > curve-len
const int nvar= fNoVars;
for(i=0;i<nvar;i++) y[i] = ystart[i] ;
@@ -150,7 +153,9 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
}
}
static G4int nStpPr=50; // For debug printing of integrations with many steps
#ifdef G4DEBUG_FIELD
static G4int nStpPr=50; // For debug printing of long integrations
#endif
// Perform the Integration
//
@@ -159,9 +164,9 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
OneGoodStep(y,dydx,x,h,eps,hdid,hnext) ;
//--------------------------------------
lastStepSucceeded= (hdid == h);
# ifdef G4DEBUG_FIELD
#ifdef G4DEBUG_FIELD
if(dbg>2) PrintStatus( ySubStepStart, x1, y, x, h, nstp); // Only
# endif
#endif
}else{
G4FieldTrack yFldTrk( G4ThreeVector(0,0,0),
G4ThreeVector(0,0,0), 0., 0., 0., 0. );
@@ -172,15 +177,15 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
QuickAdvance( yFldTrk, dydx, h, dchord_step, dyerr_len );
//-----------------------------------------------------
# ifdef G4DEBUG_FIELD
// #ifdef G4DEBUG_FIELD
// if(dbg>1) OneGoodStep(y,dydx,x,h,2*eps,hdid,hnext) ;
// if(dbg>1) PrintStatus( ystart, x1, y, x, h, -nstp);
# endif
yFldTrk.DumpToArray(y);
# ifdef G4DEBUG_FIELD
#ifdef G4DEBUG_FIELD
if(dbg>1) PrintStatus( ySubStepStart, x1, y, x, h, nstp); // Only this
# endif
dyerr = dyerr_len / h; // was dyerr_len / hstep;
#endif
dyerr = dyerr_len / h;
hdid= h;
x += hdid;
// Compute suggested new step
@@ -193,9 +198,9 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
G4ThreeVector EndPos( y[0], y[1], y[2] );
#ifdef G4DEBUG_FIELD
if(nstp>nStpPr) {
if(dbg && (nstp>nStpPr)) {
G4cout << "hdid=" << G4std::setw(12) << hdid << " "
<< "hnext=" << G4std::setw(12) << hnext << " " << endl;
<< "hnext=" << G4std::setw(12) << hnext << " " << G4endl;
PrintStatus( ystart, x1, y, x, h, (nstp==nStpPr) ? -nstp: nstp);
}
#endif
@@ -208,11 +213,13 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
// we understand how small difference occur.
if( endPointDist >= hdid*(1.+perThousand) ){
#ifdef G4DEBUG_FIELD
WarnEndPointTooFar ( endPointDist, hdid, eps, dbg );
G4cerr << " Total steps: bad" << noBadSteps << " good " << noGoodSteps << endl;
// G4cerr << "Mid:EndPtFar> ";
if(dbg>1) PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
if(dbg){
WarnEndPointTooFar ( endPointDist, hdid, eps, dbg );
G4cerr << " Total steps: bad" << noBadSteps << " good " << noGoodSteps << G4endl;
// G4cerr << "Mid:EndPtFar> ";
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
// Potentially add as arguments: <dydx> - as Initial Force
}
#endif
no_warnings++;
}
@@ -230,10 +237,12 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
(fabs(hstep) > Hmin()) // and if we are asked, it's OK
// && (hnext < hstep * PerThousand )
){
// Issue WARNING
WarnSmallStepSize( hnext, hstep, h, x-x1, nstp );
// G4cerr << "Mid:SmallStep> ";
if(dbg>1) PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
if(dbg>0){
// Issue WARNING
WarnSmallStepSize( hnext, hstep, h, x-x1, nstp );
// G4cerr << "Mid:SmallStep> ";
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
}
no_warnings++;
}
#endif
@@ -266,16 +275,16 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
no_warnings++;
succeeded = false;
#ifdef G4DEBUG_FIELD
WarnTooManyStep( x1, x2, x ); // Issue WARNING
if( dbg>1) PrintStatus( yEnd, x1, y, x, hstep, -nstp);
if(dbg){
WarnTooManyStep( x1, x2, x ); // Issue WARNING
PrintStatus( yEnd, x1, y, x, hstep, -nstp);
}
#endif
}
#ifdef G4DEBUG_FIELD
if( no_warnings ){
G4cerr << " Exiting status: "
<< " no-steps " << nstp
<<endl;
if( dbg && no_warnings ){
G4cerr << "G4MagIntegratorDriver exit status: no-steps " << nstp <<G4endl;
PrintStatus( yEnd, x1, y, x, hstep, nstp);
}
#endif
@@ -394,7 +403,6 @@ G4MagInt_Driver::OneGoodStep( G4double y[], // InOut
{
G4double errpos_sq, errvel_sq, errmax_sq;
G4double errmax, h, htemp, xnew ;
G4int i;
G4double yerr[G4FieldTrack::ncompSVEC], ytemp[G4FieldTrack::ncompSVEC];
@@ -411,7 +419,7 @@ G4MagInt_Driver::OneGoodStep( G4double y[], // InOut
errpos_sq = sqr(yerr[0]) + sqr(yerr[1]) + sqr(yerr[2]) ;
errpos_sq /= eps_pos*eps_pos; // Scale relative to required tolerance
// Accuracy for velocity
// Accuracy for momentum
errvel_sq = (sqr(yerr[3]) + sqr(yerr[4]) + sqr(yerr[5]) )
/ (sqr(y[3]) + sqr(y[4]) + sqr(y[5]) );
errvel_sq /= eps_rel_max*eps_rel_max;
@@ -444,10 +452,10 @@ G4MagInt_Driver::OneGoodStep( G4double y[], // InOut
x += (hdid = h) ;
int i;
const int nvar= fNoIntegrationVariables;
for(i=0;i<nvar;i++) y[i] = ytemp[i] ;
// delete[] ytemp ;
// delete[] yerr ;
return ;
} // end of OneGoodStep .............................
@@ -543,9 +551,12 @@ G4MagInt_Driver::ComputeNewStepSize(
// Step failed; compute the size of retrial Step.
hnew = GetSafety()*hstepCurrent*pow(errMaxNorm,GetPshrnk()) ;
}else{
}else if(errMaxNorm > 0.0 ){
// Compute size of next Step for a successful step
hnew = GetSafety()*hstepCurrent*pow(errMaxNorm,GetPgrow()) ;
}else {
// if error estimate is zero (possible) or negative (dubious)
hnew = max_stepping_increase * hstepCurrent;
}
return hnew;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorStepper.cc,v 1.7 2002/05/07 16:11:59 japost Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4MagIntegratorStepper.cc,v 1.8 2002/11/20 18:12:56 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4MagIntegratorStepper.hh"
@@ -30,9 +30,12 @@
//
G4MagIntegratorStepper::G4MagIntegratorStepper(G4EquationOfMotion* Equation,
G4int num_var)
G4int num_integration_vars,
G4int num_state_vars)
: fEquation_Rhs(Equation),
fNumberOfVariables(num_var)
fNoIntegrationVariables(num_integration_vars),
fNoStateVariables(num_state_vars)
// fNumberOfVariables( G4std::max(num_var,fNoStateVariables) )
{
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4Mag_EqRhs.cc,v 1.7 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// This is the standard right-hand side for equation of motion
// in a pure Magnetic Field .
@@ -76,8 +76,10 @@ G4Mag_SpinEqRhs::EvaluateRhsGivenB( const G4double y[],
G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u);
G4double ucb = (anomaly+1./gamma)/beta;
G4ThreeVector Spin(y[9],y[10],y[11]);
// Initialise the values of dydx that we do not update.
dydx[6] = dydx[7] = dydx[8] = 0.0;
G4ThreeVector Spin(y[9],y[10],y[11]);
G4ThreeVector dSpin;
dSpin = ParticleCharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u)));
@@ -21,17 +21,15 @@
// ********************************************************************
//
//
// $Id: G4Mag_UsualEqRhs.cc,v 1.4 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Mag_UsualEqRhs.cc,v 1.8 2002/11/09 02:58:14 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// This is the standard right-hand side for equation of motion.
// This is the 'standard' right-hand side for the equation of motion
// of a charged particle in a magnetic field.
//
// The only case another is required is when using a moving reference
// frame ... or extending the class to include additional Forces,
// eg an electric field
//
// J. Apostolakis, January 13th, 1997
// Initial version: J. Apostolakis, January 13th, 1997
// Modified: J. Apostolakis, November 9th, 2002
//
#include "G4Mag_UsualEqRhs.hh"
@@ -56,5 +54,13 @@ G4Mag_UsualEqRhs::EvaluateRhsGivenB( const G4double y[],
return ;
}
void
G4Mag_UsualEqRhs::
SetChargeMomentumMass( G4double particleCharge, // in e+ units
G4double MomentumXc,
G4double mass)
{
fInvCurrentMomentumXc= 1.0 / MomentumXc;
G4Mag_EqRhs::SetChargeMomentumMass( particleCharge, MomentumXc, mass);
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4RKG3_Stepper.cc,v 1.6 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4RKG3_Stepper.hh"
#include "G4ThreeVector.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4SimpleHeum.cc,v 1.5 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Simple Heum:
// x_1 = x_0 + h *
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SimpleRunge.cc,v 1.4 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4SimpleRunge.cc,v 1.6 2002/11/29 23:17:16 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Simple Runge:
//
@@ -49,8 +49,12 @@ G4SimpleRunge::G4SimpleRunge(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
{
dydxTemp = new G4double[fNumberOfVariables] ;
yTemp = new G4double[fNumberOfVariables] ;
unsigned int noVariables= G4std::max(numberOfVariables,
GetNumberOfStateVariables());
// To deal with Time >= 7+1
dydxTemp = new G4double[noVariables] ;
yTemp = new G4double[noVariables] ;
}
@@ -60,10 +64,10 @@ G4SimpleRunge::G4SimpleRunge(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
G4SimpleRunge::~G4SimpleRunge()
{
;
delete[] dydxTemp;
delete[] yTemp;
}
//////////////////////////////////////////////////////////////////
//
//
@@ -74,7 +78,9 @@ G4SimpleRunge::DumbStepper( const G4double yIn[],
G4double h,
G4double yOut[])
{
// const G4int nvar = 6 ;
// Initialise time to t0, needed when it is not updated by the integration.
yTemp[7] = yOut[7] = yIn[7]; // Better to set it to NaN; // TODO
G4int i;
for( i = 0; i < fNumberOfVariables; i++ )
@@ -89,7 +95,5 @@ G4SimpleRunge::DumbStepper( const G4double yIn[],
yOut[i] = yIn[i] + h * ( dydxTemp[i] );
}
// NormaliseTangentVector( yOut );
return ;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4UniformElectricField.cc,v 1.6 2001/12/04 17:35:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4UniformMagField.cc,v 1.5 2001/11/08 17:32:21 grichine Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
//