# Category field History

See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!

-------------------------------------------------------------------------------

## 2025-03-11 Gabriele Cosmo (field-V11-02-07)
- Added missing guard in G4TMagFieldEquation header and minor cleanup.
  Fixes [GitHub PR #83](https://github.com/Geant4/geant4/pull/83).

## 2024-11-26 Ivana Hrivnacova (field-V11-02-06)
- Better names for the G4EquationType enum constants

## 2024-11-04 Philippe Canal (field-V11-02-05)
- Improve stability of static initialization for StepperType() and
  StepperDescription() in G4DormandPrince745.

## 2024-09-10 Ivana Hrivnacova (field-V11-02-04)
- Coverity fixes:
  - Use std::move, const auto& instead of auto to avoid copying

## 2024-06-20 Ivana Hrivnacova (field-V11-02-03)
- Fix in G4FieldBuilder for local fields:
  apply the local fields in the order of user setting

## 2024-04-29 Ivana Hrivnacova (field-V11-02-02)
- Added classes for automatic field construction from paremeters:
  - G4FieldBuilder[Messenger], G4FieldParameters[Messenger], G4FieldSetup
  - No changes in other Geant4 classes

## 2024-04-17 Ben Morgan (field-V11-02-01)
- Fix maybe-uninitialized warnings found in ATLAS builds
  - Reported in internal ATLASSIM-6058 ticket.

## 2024-04-02 Gabriele Cosmo (field-V11-02-00)
- Applied trivial clang-tidy fixes to classes, i.e. use of default
  constructor/destructor, auto and using statements.
- Minor cleanup in QSS classes.

## 2023-11-03 Gabriele Cosmo (field-V11-01-06)
- Reinstated default DormandPrince745 stepper.

## 2023-10-27 Lucio Santi (field-V11-01-05)
- Improvements on the QSS Stepper
  The main QSS integration loop is interrupted when the number of substeps
  exceeds a predefined threshold (set to 1000 by default).

## 2023-06-14 Gabriele Cosmo (field-V11-01-04)
- Applied clang-tidy fixes (readability, modernization, performance, ...).

## 2023-06-12 John Apostolakis (field-V11-01-03)
- Inclusion of QSS integration method.
  Most recent changes:
  * Fixes for issue with SetPrecision (used unitialised values of simulator->x)
  * Updated values of parameters in G4PropagatorInField to conservative values.
  * Withdrew interim changes that made QSS the default method for full testing.

## 2023-05-26 Lucio Santi
- Fixes for open issues: 
  * default values for QSS made stricter dQRel=0.001, dQMin=0.0001 (QSSDriver.icc)
    to improve behaviour in full experiment test
  * implemented missing DistChord method -- needed to enable stepping with Chord limit

## 2023-01-31 John Apostolakis
- Initial inclusion of QSS integration method.
  Renamed classes to include 'G4' prefix, and moved them from qss/ subdirectory.
  Added Geant4 disclaimer / license to files.
  Removed QSSmessenger from RunManager and G4PropagatorInField
- Temporarily made QSS the default method for full testing.

## 2023-01-30 Rodrigo Castro, Lucio Santi & Leandro Gomez Vidal
- Included Quantum State Simulation (QSS) integration method
  Alternative method of integration which creates approximation
  functions for each coordinate (x,p) - changing the interpolation
  polynomials when the deviation from exact solution is larger than
  a threshold value.
  Offers built-in interpolation capability - enabling faster finding
  of the intersection of the trajectory with surfaces.
  Currently restricted to using only with a pure magnetic field.
  Created by Rodrigo Castro and Lucio Santi, with contributions
  by Leandro A. Gómez Vidal (and others?)

## 2023-03-16 Ben Morgan (field-V11-01-02)
- Fixed compilation warnings on clang-15 for mismatched bounds declarations
  in input parameters for steppers.

## 2023-01-09 Ben Morgan (field-V11-01-01)
- Use PROJECT_ scoped _SOURCE/BINARY_DIR variables in place of CMAKE_ 
  scope version to ease use of Geant4 as a CMake subproject. 
  - Fixes [GitHub PR #52](https://github.com/Geant4/geant4/pull/52)

## 2022-12-09 Laurie Nevay             (field-V11-01-00)
- Reduced printout for setting any valid value for epsilon_min / _max in
  G4FieldManager.

## 2022-11-28 Gabriele Cosmo           (field-V11-00-05)
- Fixed restore of stream precision in G4FieldManager::ReportBadEpsilonValue().

## 2022-11-14 John Apostolakis         (field-V11-00-04)
- Revised G4FieldManager to ensure that epsilon_min / _max parameters
  are less than a 'maximum accepted' accuracy (now=0.02) to ensure robust
  behaviour of the integration. Improved their Set methods, adding 
   - warnings if min > max, with corrective behaviour,  and
   - a fatal exception in case of values outside the accepted range.
   
  To cope with needs of legacy applications or existing needs for performance,
  the value of the 'ceiling' maximum accepted accuracy can be modified using
  the new static method 
       G4FieldManager::SetMaxAcceptedEpsilon( maxAccept, softFail);
  but must remain under or equal to a final ceiling currently of
       fMaxFinalEpsilon=0.03
  
## 2022-11-10 Gabriele Cosmo (field-V11-00-03)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.

## 2022-11-05 Divyansh Tiwari, John Apostolakis (field-V11-00-02)

- Introduced G4BorisScheme and G4BorisDriver, a 2nd order symplectic
  integration method, created as part of GSoC 2022.

## 2022-10-05 Gabriele Cosmo (field-V11-00-01)
- Fixed compilation warnings on Intel/icx compiler for variables set
  but not used.

## 2021-12-10 Ben Morgan (field-V11-00-00)
- Change to new Markdown History format

---

# History entries prior to 11.0

March 30, 2021 B.Morgan                           - field-V10-07-00
-----------------------
- Migrate sources.cmake to modular build API

November 26, 2020 J.Apostolakis                   - field-V10-06-09
-------------------------------
- Fix to enable G4TDormandPrince45 to be used with G4InterpolationDriver.

  This fix was needed because G4Interpolation driver creates additional
  copies of the stepper class.  Due to this it must obtain the equation
  with the type of the templated stepper.

  For a stepper to be used with 'G4InterpolationDriver', it must
  implement the method
     Equation_type  GetSpecificEquation()
  Templated steppers must ensure that the return type 'Equation_type'
  is the specific equation type of the template.

  This method was added to G4DormandPrince745 and G4TDormandPrince745.

October 12, 2020 J.Apostolakis                    - field-V10-06-08
------------------------------
- Fixes & refinements - mostly in templated classes, tests.
  Compilation fixes, e.g. missing include <cassert>.
  Refinements, e.g. int -> unsigned int in templates

October 9, 2020 J.Apostolakis                     - field-V10-06-07
-----------------------------
- Configure G4ChordFinder to use templated G4TDormandPrince45 as the
  default stepper for magnetic fields (when one is not chosen
  explicitly by the application.)

October 9, 2020 J.Apostolakis & J. Xie           - field-V10-06-06
--------------------------------------
- Adapted classes that avoid virtual calls for field, equation, stepper
  created by Josh Xie (Google Summer of Code 2014), supervised by
  S. Wenzel & J.A.

  The revised design and implementations include:
   * equation of motion templated on the field type;
   * steppers templated on the type of equation and the number of integration
     variables.
  In addition the key methods are marked as 'inline' to enable compilers, where
  they judge possible, to embed them and avoid any function calls.

  These classes can be combined also with the templated drivers
  (G4IntegrationStepper, G4FSALIntegrationStepper and/or G4InterpolationDriver
  to avoid virtual calls in all the levels up to the chord finder's call to
  the integration driver. ]

  The types of stepper currently available are
  i) the originally developed intermediate order stepper:

   - Name (templated) -  original  --   Order/    - Comments
                                           / Embdedded
   ==============================================================================
   G4TClassicalRK4:     G4ClassicalRK4   4th / no   robust, old default
   G4TCashKarpRKF45:    G4CashKarpRKF45  5th / yes  first embedded RK in G4

  ii) the original low order steppers (for specialised uses)
   G4TSimpleHeum:       G4SimpleHeum     3rd / no  lower order alternative
   G4TSimpleRunge:      G4SimpleRunge    2nd / no  very low order
   G4TExplicitEuler:    G4ExplicitEuler  1st / no  lowest order - for checks only

  and
  iii) some newly adapted stepper(s) /  ( J.A. Oct 2020 )
   G4TDormandPrince45  G4DormandPrince745 5th/ yes  default / preferred
   ==============================================================================

  Note: Additional lower-order steppers are not yet available.
        'Vector' steppers (using blaze) are not supported.

  Experimental versions of fields with inline methods:
     G4TUniformMagField,  G4TQuadrupoleMagField
  are included to show how the field evaluation GetFieldValue can also be inlined.

  Note 2:
  Steppers which are not embedded obtain their error estimates by
  breaking the step into two halves, then comparing with the whole step.
  As a result many more field / derivative evaluations are needed than
  embedded steppers of the same order, but the reliability of their error
  estimation has different properties; so it may be more robust in some cases. )

June 15, 2020 G.Cosmo                            - field-V10-06-05
---------------------
- Implemented move constructor and operator for G4FieldTrack.

March 24, 2020 J.Apostolakis                     - field-V10-06-04
----------------------------
- New class G4DriverReporter to print progress of drivers.
   Used for debugging differences between Old & fixed MagIntDriver
- Revisions in testing CMake config file and stepper/driver test
   for magnetic field.

March 13, 2020 J.Apostolakis                     - field-V10-06-03
----------------------------
- G4VIntegrationDriver & dependent driver classes:
    Added new virtual StreamInfo() method,
       & used it to implement operator << for G4VIntegrationDriver
    Made (virtual) DoesReIntegrate() const.
- G4MagInt_Driver: Fixed max iterations & clarified that its
     ComputeNewStepSize does NOT (yet) respect maximum reduction factor (0.1).
  ( Done to enable comparisons with new G4IntegrationDriver<> implementation.)
- G4OldMagIntDriver maintains all old behaviour of G4MagInt_Driver.


January 22, 2020 G.Cosmo                         - field-V10-06-02
------------------------
- Fixed compilation errors and configuration for field07 unit test.

January 13, 2020 G.Cosmo                         - field-V10-06-01
------------------------
- Turn off verbosity flags by default in G4IntegratorDriver,
  G4InterpolationDriver and G4MagIntegratorDriver.

December 10, 2019 B.Morgan                       - field-V10-06-00
--------------------------
- Cleanup CMake build, removing obsolete granular library options and
  explicit include_directories.

November 14, 2019 J.Apostolakis                  - field-V10-05-17
-------------------------------
- Added method / attribute to G4VIntegrationDriver DoesReIntegrate()
   to inform whether the driver recomputes segment when
   AccurateAdvance is called.

October 27, 2019 D.Sorokin                       - field-V10-05-16
----------------------------
- Remove statistics printouts from destructor of G4BFieldIntegrationDriver

October 24, 2019 H.Burkhardt                       - field-V10-05-15
----------------------------
- Standard sextupole magnet first implementation G4SextupoleMagField.cc,.hh

October 18, 2019 D. Sorokin                         - field-V10-05-14
-----------------------------------------
- Fix floating point exception in G4BFieldIntegrationDriver.

October 1, 2019 G. Cosmo                         - field-V10-05-13
-----------------------------------------
- Fixed unitialised data in G4EqMagElectricField and G4EqGravityField,
  reported by Coverity.

September 12, 2019 G. Cosmo                      - field-V10-05-12
-----------------------------------------
- Minor C++11 revision. Code formatting and cleanup.

July 8, 2019 D. Sorokin                          - field-V10-05-11
-----------------------------------------
- G4BFieldIntegrationDriver: an attempt to solve looping particle issue.

July 3, 2019 D. Sorokin                          - field-V10-05-10
-----------------------------------------
- Make G4InterpolationDriver default for performance assessments.

June 25, 2019 D. Sorokin                          - field-V10-05-09
-----------------------------------------
- Fix Dormand-Prince 5th order interpolation method

June 20, 2019 D. Sorokin                          - field-V10-05-08
-----------------------------------------
- New version of G4InterpolationDriver with multiple steppers for each substep.

June 12, 2019 D. Sorokin & J. Apostolakis         - field-V10-05-07
-----------------------------------------
- Revert to use G4IntegrationDriver as default in G4ChordFinder
    ( c-tor for magnetic field. ).
  Change to use concrete type of Stepper as template parameter

June 10, 2019 Dmitry Sorokin                      - field-V10-05-06
-------------------------
- Remove division in G4DormandPrince745::Interpolate4thOrder.

June 7, 2019 Dmitry Sorokin                      - field-V10-05-05
-------------------------
- Switch to original chord finding algorithm in G4InterpolationDriver
- Reset step estimate in G4MagInt_Driver only at the beginning of a track
- Change G4VERBOSE to G4FIELD_DEBUG in G4InterpolationDriver to speed-up

June 4, 2019 Dmitry Sorokin                      - field-V10-05-04
-------------------------
- Use FSAL property of G4DormandPrince745 in G4InterpolationDriver.

June 3, 2019 Dmitry Sorokin                      - field-V10-05-03
-------------------------
- Fix memory churn in G4InterpolationDriver.

May 20, 2019 Dmitry Sorokin                      - field-V10-05-02
-------------------------
- Make interpolation driver default for immediate testing.

April 8, 2019 H.Burkhardt                        - field-V10-05-01
-------------------------
- Correcting transformation to local system in G4QuadrupoleMagField.cc

March 20, 2019 G.Cosmo                           - field-V10-05-00
----------------------
- Corrected 'RegularStepperName' in G4ChordFinder to refer to the actual
  default stepper G4DormandPrince745 rather than G4NystromRK4...

November 9, 2018 J.Apostolakis                   - field-V10-04-17
------------------------------
- Small fixes for warnings in compilation.
- Revisions of descriptions of recent tags (for clarification.)

September 26, 2018 D.Sorokin                   - field-V10-04-15, -16
----------------------------
- Implemented G4InterpolationDriver. This driver uses a Runge-Kutta
  stepper with interpolation property to integrate EoM with error control.
  The field evaluations used to calculate the enpoint of an 'advance' can
  be reused to obtain one or multiple internal points on the curve (x,p).
  So in steps in which an intersection is found, the number of field
  evaluations are expected to be reduced substantially.

September 13, 2018 D.Sorokin                   - field-V10-04-13, -14
----------------------------
- G4NystromRK4 creates G4CachedMagneticField if it was not provided.
- Removed G4MagIntegratorStepper::ComputeRightHandSide() method
  (all calls now use non-virtual RightHandSide() method instead).
- Reversed declaration of final for the class G4UniformMagField.
  Returned to previous status: only GetFieldValue method is final.
  ( This avoid need to change examples/tests and potentially migrate
    users' code. )

September 12, 2018 D.Sorokin                   - field-V10-04-11, -12
----------------------------
- Created new experimental driver G4BFieldIntegrationDriver for pure
  magnetic fields.  In QuickAdvance it uses helix stepper when the
  estimated 'helix' rotation angle is larger than pi/3.
- G4NystromRK4 uses G4CachedMagneticField for caching values.
  NOTE: It now the user's responsibility to create G4CachedMagneticField.
  ( The alternative is to create G4CachedMagneticField inside G4NystromRK4.
    But this would have several disadvantages:
    * It would change the field in the user's equation of motion;
    * G4NystromRK4 is not able to check whether the user calls the method
      that changes the equation using SetEquationOfMotion  method. )

July 10, 2018 D. Sorokin              - field-V10-04-08, -09, -10
------------------------ Tags by J. Apostolakis
- Corrections in calculation of chord distance in G4DormandPrince745
  ( use 4th order interpolation from Shampine 1986 for mid-point. )
- Revised G4FieldUtils: moved copy() method from steppers,
  added 2 new setValue: simple & variadic methods.
- Fixes to copy input time in ModifiedMidpoint, CashKarp, G4RK547FEq1/2/3
  Bogacki-Shampine 4/5 and 2/3  (note: B-S 2/3 largely rewritten )
  Dormand Prince 4/5, 5/6 and 7/8,  and Tsitouras steppers.
- Trial revision in G4BulirschStoer to reduce number of division
  operations (J.A.)
- Fix for unitialised pIntStepper pointer in G4FSALIntegrationDriver
  constructor.  Revision of data member variable names.  ( J.A. )

June 15, 2018 G.Cosmo                   - field-V10-04-07
---------------------
- Fixed minor Coverity defects in G4BurlischStoer and G4ModifiedMidPoint.
  Code cleanup.

June 13, 2018 G.Cosmo                   - field-V10-04-06
---------------------
- Leave override final only for clone() method in G4UniformMagField,
  not in destructor...

June 12, 2018 G.Cosmo                   - field-V10-04-05
---------------------
- Use G4Exception warnings instead of streaming to cerr.
- Added override final for virtual methods in G4UniformMagField (J.Apostolakis).
- Some code cleanup.

Apr 30, 2018 J. Apostolakis             - field-V10-04-04
---------------------------
- G4VIntegrationDriver and derived classes

  Added new virtual method in G4VIntegrationDriver :
      void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper)
  which used to exist in G4MagInt_Driver.
  ( Its absence caused a problem in some existing user code since 10.4. )

  This method must be defined in those derived driver classes which accept
  a Runge Kutta stepper ( i.e. some or any type of G4MagIntegratorStepper )

- G4IntegrationDriver, G4FSALIntegrationDriver
  Defined default implementation (which throws a Fatal G4Exception), and
  implementations in the templated classes G4IntegrationDriver and
  G4FSALIntegrationDriver which check the type (via dynamic cast) and
  change the stepper if it is appropriate.

Feb 13, 2018 J. Apostolakis             - field-V10-04-03
---------------------------
- Change in G4FieldManager::CreateChordFinder to cope
  better with case that field argument is null.

Feb 13, 2018 D. Sorokin                 - field-V10-04-01
-----------------------                 - field-V10-04-02 (comp. fix)
- Introduced Bulirsch-Stoer method of integration, an alternative
  to Runge-Kutta based on the mid-point method.
  Separate driver derived G4VIntegrationDriver and implemented
  using specialisation of G4IntegrationDriver template class.
  Note: this method does not have a RK 'Stepper' !

Jan 31, 2018 J. Apostolakis
---------------------------
- G4MagneticField no longer inherits from G4ElectroMagneticField
  This was incorrect, and allowed a user to provide a full EM
  field, but obtain the force only from the B-field when using
  the equation created in the G4ChordFinder constructor.
   => potential interface change.

  Result: It is no longer possible to use the equation of motion for a
     pure magnetic field for the case of a mixed electromagnetic field.
     This change is desired, and is a *protection* as that inadvertent
     use led to incorrect results.
  Instead the full chain of classes for equation of full EM field,
     steppers and driver must be used for the case of the 'full' EM field.

Feb 9, 2017 G.Cosmo                     - field-V10-04-00
-------------------
- Removed static data from G4FSALIntegrationDriver, G4IntegrationDriver and
  G4MagIntegratorDriver and moved to base class as normal data members.
  Fix required for allowing proper symbol exporting on Windows DLLs.

Nov 17, 2017 J. Apostolakis             - field-V10-03-30
---------------------------
- G4ChordFinder: Reinstated old driver G4MagInt_Drv, for use
    with G4DormandPrince745 (5th order) in G4ChordFinder's
    2nd constructor (with magnetic field.)
  ( Reverses change made in field-V10-03-27 )

Nov 16, 2017 J. Apostolakis             - field-V10-03-29
---------------------------
- Suppressed statistics printing in G4ChordFinder and new drivers
   ( G4IntegrationDriver and G4FSALIntegrationDriver )
   protecting them by verbosity flags.

- Minor fix to initialise scalar data member in new steppers
  G4RK547FEq1, G4RK547FEq2 and G4RK547FEq3.
  Fixes coverity issues 97886, 97888 and 97889.


Nov 14, 2017 J. Apostolakis             - field-V10-03-28
---------------------------
- Suppressed extra verbosity in G4ChordFinder.
- Fix in G4FSALDormandPrince745 for unitialised variables.
  Initialise ak8[], ak9[] in constructor. This avoids repeated
  memory allocation, without deletion - i.e. a memory leak.
- Initialise fLastStepLength and/or fAuxStepper data members in
  in constructors of G4DormandPrince745 and G4FSALDormandPrince745.
  Coverity issues: 67394 (G4FSALDormandPrince745)
                   67391     (G4DormandPrince745)

Nov 14, 2017 J. Apostolakis             - field-V10-03-27 (fixed)
---------------------------             - field-V10-03-26
- G4ChordFinder: changes in default stepper & driver in 2nd constructor.
  in which only a magnetic field is provided (used widely) :

  * Reinstated G4DormandPrince745 (5th order) as default in G4ChordFinder.
   (corrected -23, which missed to initialise driver.)

  * New templated driver G4IntegrationDriver is chosen for the
    the simple constuctors of G4ChordFinder and G4FieldManager
    which only require a (pure) magnetic field. ( Details below.)

  Additional information and details:
  * New optional parameter to constructor of G4ChordFinder which
    allow to create an FSAL stepper and corresponding driver instead.
    This aims to reuse some derivatives, thus reducing computations
    of derivatives and thus field evaluations. )

  * The templated 'driver' classes, available and now chosen in
    G4ChordFinder's 2nd constructor, are used per type of stepper
    class:
     - G4IntegrationDriver      for non-FSAL     steppers
     - G4FSALIntegrationDriver  for FSAL-capable steppers
    These make non-virtual calls to the stepper, as they know its type.

- First fix in G4FSALDormandPrince745 for memory leak, missing
  delete[] fInitialDyDx in destructor. Coverity issue: 96383.

----------------------------------------------------------------------
Multiple tags (below) were to better test stepper/driver combinations:
Date   Tagger         Tag name        Stepper                Driver
======================================================================
Nov 3, D. Sorokin     field-V10-03-25 G4FSALBogackiShampine45 FSAL
Nov 3, J. Apostolakis field-V10-03-24 G4FSALDormandPrince745  FSAL  ok
Nov 2, J. Apostolakis field-V10-03-23 G4DormandPrince745      new
Nov 2, J. Apostolakis field-V10-03-22 G4RK547FEq1             FSAL  ok
----------------------------------------------------------------------
Glossary of drivers:
   the FSAL driver = using G4FSALIntegrationDriver (templated)
   the new  driver = using G4IntegrationDriver     (templated)
===================================================================

Nov  2, 2017 D. Sorokin                 - field-V10-03-21
---------------------------------------
- Added new steppers G4RK547FEq{1,2,3} which implement 7 stage embedded
  Runge-Kutta 4,5 pairs with:
     - FSAL property (return derivative at endpoint for use in next step),
     - stable equilibrium states ( improved handling of difficulties in
         integration: better stability in choosing step size. )
  Each one can be used with all existing Runge-Kutta drivers:
     - G4FSALIntegrationDriver, using its FSAL property;
     - G4IntegrationDriver    without its FSAL property.
     - the original G4MagInt_Driver, also ignoring FSAL.

- Reinstated G4DormandPrince745  ( known widely as DOPRI5 ) as
  the default RK method in G4ChordFinder for pure magnetic fields.
    ( Withdrew G4BogackiShampine45. )  J. Apostolakis

Nov  1, 2017 J. Apostolakis             - field-V10-03-20
---------------------------
- Made G4BogackiShampine45 the default RK method in G4ChordFinder
   for pure magnetic fields.

Oct 30, 2017 D. Sorokin/J.Apostolakis   - field-V10-03-19
---------------------------------------
- add GetStepper method to G4VIntegrationDriver for backward compatibility

Oct 20, 2017 D. Sorokin                 - field-V10-03-18
---------------------------------------
Introduced base class for any driver algorithm (G4VIntegrationDriver)
New concrete classes added:
- G4IntegrationDriver: implementation of templated driver algorithm
  for non-fsal explicit Runge-Kutta steppers
- G4FSALIntegrationDriver: implementation of driver algorithm for
  FSAL explicit Runge-Kutta steppers.
Existing class G4MagInt_Drv remains, deriving from base class.

- Expanded testing in testProElectroMagField (higher precision, new driver)
   ( J. Apostolakis)

Oct 13, 2017 D. Sorokin                 - field-V10-03-17
---------------------------------------
- add G4FieldUtils.hh, G4FieldUtils.icc, G4FieldUtils.cc:
  utilities to extract data from arrays in conventions of the
  magneticfield integration.

Oct 13, 2017 G. Cosmo                   - field-V10-03-16
---------------------------------------
- G4NystromRK4: use consistenly G4 types for double and bool in G4NystromRK4.

Aug 31, 2017 J. Apostolakis             - field-V10-03-15
---------------------------------------
- Made G4DormandPrince457 the default Stepper for magnetic fields in
  G4ChordFinder - when a driver/stepper is not specified.

Aug 31, 2017 J. Apostolakis             - field-V10-03-14
---------------------------------------
- G4NystromRK4: used caching of momentum magnitude ( & its inverse)
  to reduce overhead of fix in field-V10-03-10.

Aug 25, 2017 J. Apostolakis             - field-V10-03-12, 13
---------------------------------------
- G4MagInt_Driver: added GetEquationOfMotion method for enabling common
  code with future develoment.

Aug 24, 2017 D.Sorokin & J. Apostolakis - field-V10-03-11
---------------------------------------
- G4NystromRK4: correction in call to getField: needs p[4], not p[3]
    ( Spotted by D. Sorokin )
  Also small cleanup of testing code into 2 small new methods.
    ( J. Apostolakis )

Aug 23, 2017 J.Apostolakis              - field-V10-03-10
--------------------------
- G4NystromRK4 - Fix the caching of momentum, field location & value.
  Fixes issue reported by ALICE ( problem report #1996 ).
  Thanks to Ruben Shahoyan for identifying and reporting the issue!
- Temporarly made G4NystromRK4 the default Stepper in G4ChordFinder's 2nd
  constructor (to ensure adequate testing).

Jul 04, 2017 J.Apostolakis             - field-V10-03-09
--------------------------
- G4DormandPrinceRK78: initialise fLastStepLength and/or fAuxStepper data
  members in constructor. Coverity issue: 67398,
  Improved description and reference to original 1981 DP paper.
- G4MagIntegratorDriver: initialised fNoCalls in c-tor. Coverity #15158.

Jul 03, 2017 J.Apostolakis             - field-V10-03-08
--------------------------
- G4FSALBogackiShampline45: initialise 'bi[][]' const coefficients only 1 time
  in method PrepareConstants() called by constructor.
    ( Similar to G4BogackiShampine => seek consolidation )
  Small fix: initialise fAuxStepper to nullptr, if not primary.
    ( Part of Coverity issue 67394 )
- G4DormandPrinceRK56: fix for significant memory leak of ak10_low buffer
  space in SetupInterpolate_low(), apparently not seen by Coverity
  because it was initialised in each use, not in constructor!
  Improved initialisation of ak10, 11, 12 (moved to constructor)
  and fixed small memory leak (added deletion in destructor).
- G4MagIntegratorStepper: initialise fNoRHSCalls & fIntegrationOrder in c-tor.
  ( fIntegrationOrder is not yet used widely - future migration )
  Coverity issue 67392.
- G4VFSALIntegrationStepper: initialise counter in c-tor. Coverity issue 67396.
- G4BogackiShampine23: initialised fIsFSAL, fIntegrationOrder in c-tor.
  Suppressed obsolete virtual method isFSAL,
  Deleted duplicate virtual method 'isFSAL()'. Non-virtual method IsFSAL()
  now exists in base class G4MagIntegratorStepper.
  Made copy constructor and equal operator private and not unimplemented.
  Added explanatory comments in source file; can make this method FSAL easily
  (it calculates derivative @ endpoint. )
- Several steppers ( G4DoLoMcPriRK34, G4FSALBogackiShampine45,
  G4DormandPrince745, G4BogackiShampine45 ): initialise fLastStepLength and/or
  fAuxStepper data members in constructor.
  Coverity issues: 67393, 67394, 67391, 67390, 67363

Jul 03, 2017 J.Apostolakis             - field-V10-03-05, -06, -07
--------------------------
- fix for memory leak in Stepper() in two steppers:
     G4FSALBogackiShampline45 ( Coverity issue 67389 )
     G4FSALDormandPrince745   ( Coverity issue 67397 )
- G4BogackiShampline23: fix for memory leak in destructor
    ( Coverity issue 67355 )

May 17, 2017 J.Apostolakis             - field-V10-03-03, -04 (resubmit)
--------------------------
- G4FieldManager::SetDetectorField
  Fixed default of 'fail mode' parameter in
     to 0 (silent) - not 1 which was used for debugging.
  In case of existing G4ChordFinder, use 'max' (1, failMode) not min.


May 11, 2017 J.Apostolakis             - field-V10-03-02
--------------------------
- Reintroduced changes of field-V10-01-05, 06 and 07  to address
  issue recalled by ATLAS.
- New fixes/refinements (since field-V10-01-07)
  o Extra check for missing equation. (Fix)
  o Renamed G4FieldManager::SetFieldChangesEnergy() method to
    InitialiseFieldChangesEnergy() to clarify its utility.
- Original functionality change (copied from field-V10-01-05, & -07) :
  o G4FieldManager.cc : Revised behaviour of SetDetector - it now
    passes the Field to the Equation, as is the natural user expectation
    The previous behaviour is possible, using extra argument 'failMode' flag.
            Values: 0           = silent ;
                    1 (default) = warning;
                    2 or other  = fatal exception.

    This change is to ensure that user expectation is met:
    if the field is changed for an existing, working stepper it must
    be propagated to the equation of motion.
    Note: this causes potential conflict between the type of the equation
          and the field, which will need to be solved in the future.
    Old behaviour (just set our own pointer) is still available in new method:
    ProposeDetectorField(G4Field *detectorField)
    Note: Error reporting behaviour of SetDetector is 'soft'. It does not
          complain by default if ChordFinder is not (yet) set.
          ( The default values of failMode = 0 i.e. quiet. )
    If a chord-finder exists, it will still warn for other errors.
    To obtain have noisy extra checks call SetDetectorField with failMode > 0
    or by using the new method for an existing field:
    ChangeDetectorField(G4Field *detectorField)
  OLD: Co-works and requires new tag in geometry/navigation: geomnav-V10-01-24.

Mar  22, 2017 G.Cosmo                   - field-V10-03-01
---------------------
- Revert change made in previous tag and add simple accessor to return
  singleton pointer.

Mar  17, 2017 G.Cosmo                   - field-V10-03-00
---------------------
- Define G4FieldManagerStore as normal singleton and corrected destructor.

Oct   7, 2016 J.Apostolakis             - field-V10-02-24, 25
---------------------------
- Checked loops for termination for infinite loops and annotated
   them with "Loop checking" comment

Oct   7, 2016 D.Sorokin                 - field-V10-02-23
-----------------------  Commit: J. Apostolakis
- Protection for multiple inclusion of G4ClassicalRK4
   (thanks to Dmitrii Sorokin, GSoC 2016 student. )

Aug  16, 2016 J.Apostolakis             - field-V10-02-22
---------------------------
- Added initialization of fAuxStepper in constructor of
  G4DoLoMcPriRK34, G4DormandPrince745 & G4DormandPrinceRK56.

June 11, 2016 J.Apostolakis             - field-V10-02-21
---------------------------
- Restored G4ClassicalRK4 as default stepper for B-field,
  (due to performance issues reported in benchmarking.)

June 10, 2016 G.Cosmo                   - field-V10-02-20
---------------------
- Fixed code indentation in G4HelixMixedStepper;
  fixes compilation warnings on gcc-6.1.

June 1, 2016 J.Apostolakis              - field-V10-02-19, 18, 17
--------------------------
- Fix in multiple steppers for the size of two C-arrays which hold
  intermediate values;  they must be at least 8 and at least
  'fNumberOfStateVariables' long.
  Changed: G4CashKarp,
           G4BogackiShampine 23 & 34
           G4DormandPrince 745, RK56 & RK78
	   G4DoLoMcPriRK34
           G4FSALBogackiShampine45, G4FSALDormandPrince745
- Made G4CashKarp the default stepper in G4ChordFinder.
- Deleted trial class G4NewChordFinder.

June 1, 2016 J.Apostolakis              - field-V10-02-16
--------------------------
- Deleted test code (RkTestRun) due to cmake issues

June 1, 2016 J.Apostolakis              - field-V10-02-15 (also -14)
--------------------------
- Made G4ClassicalRK4 the default stepper again in G4ChordFinder
- Fixes in test code (RkTestRun) for new names of classes.

May 31, 2016 J.Apostolakis              - field-V10-02-13 (also -12)
--------------------------
- New class G4NewChordFinder, that uses old G4MagIntegratorDriver or
    the newer G4FSALIntegratorDriver -- first try, for testing FSAL.
  Created new test testNewChordFinder.cc to checks this.

- Renamed new Stepper classes to use 'G4' prefix, including
    DormandPrince{745,RK56,RK67} TsitourasRK45 and DoLoMcPriRK34

- Renamed FSAL base classes to use 'G4' prefix & 'Integrat-ion'
     FSALMagIntegratorStepper to G4VFSALIntegrationStepper
     FSALIntegratorDriver     to  G4FSALIntegrationDriver
  and the experimental FSAL versions of steppers,
     FBogackiShampine45.hh  to  G4FSALBogackiShampine45.hh
     FDormandPrince745.hh   to  G4FSALDormandPrince745.hh
( Note: FSAL steppers remain 'behind' the improved non-FSAL versions.)

- Made DormandPrince745 (DP45) the default stepper (in G4ChordFinder).

May 26, 2016 J.Apostolakis & Som. Banerjee   - field-V10-02-11
------------------------------------------
- First version of FSAL classes (as additional classes)
    FSAL Integrator Driver  : New *concrete*, stand-alone driver
    FSAL Integrator Stepper : New base class (separate from G4MagIntegratorStepper)
    FBogackiShampine45:  FSAL-version of BogackiShampine45 stepper
    FDormandPrince745:   FSAL-version of FDormandPrince745 stepper
  Developed by Somnath Banerjee in GSoC 2015

Context:
* FSAL Stepper's key 'Stepper()' method for Stepping has additional
    argument to return the derivative at the end of a step.
    If the step was successful, this estimate has the same order of
    accuracy as the stepper (i.e. 5th order for a 5th order stepper.)

- FSAL Driver method uses the revised Stepper interface, using
    the final (endpoint) derivative for successful steps
    as the start derivative for the next step, in case of
    continuing of integration.

- New test (RkTestRun.cc) covering FSAL methods, integration
   Developed by Somnath Banerjee in GSoC 2015

May 26, 2016 J.Apostolakis                   - field-V10-02-10
--------------------------
Preparation for addition of FSAL steppers (& driver)
- G4MagIntegratorStepper: Added counter for calls to equation RHS,
    with Get/Reset methods.
- Cosmetic fixes in sources.cmake (tabs to spaces)

May 25, 2016 J.Apostolakis & Som. Banerjee   - field-V10-02-09
------------------------------------------
- Added new stepper classes embedded RK method:
  * DoLoMcPriRK34,      6-stage 3/4 RK (interpolation)
  * DormandPrinceRK56,  9-stage 5/6 RK (interpolation, FSAL-able) "6(5)"
  * DormandPrinceRK78, 13-stage 7/8 RK (interpolation)        "8(7) 13M"
  created by Somnath Banerjee as part of GSoC 2015.

May 25, 2016 J.Apostolakis             - field-V10-02-08
--------------------------
- Revised testPropagateMagField, to reduce error severity for over-long
    steps.  An error message is still written if move > (1.+1.0e-9) * step,
    but test does not stop.

- G4HelixMixedStepper: Fixes & added new (5th order) stepper choices.
    Included (G4)Bogacki-Shampine 23/45 ,  DormandPrince745,
    and newest TsitourasRK45.

May 24, 2016 J.Apostolakis             - field-V10-02-06, 07
--------------------------
- Added TsitourasRK45 stepper.
- Made Cash-Karp the default stepper (in G4ChordFinder).

May 23, 2016 J.Apostolakis             - field-V10-02-05
--------------------------
- Made DormandPrince745 (DP45) the default stepper (in G4ChordFinder).

May 20, 2016 J.Apostolakis             - field-V10-02-04
-------------------------
- Added steppers created by Somnath Banerjee as part of GSoC 2015,
    G4BogackiShampine23 (BS23 below), G4BogackiShampine45 (BS45) and
    DormandPrince745 (DP45).
  These implement third order (BS23) and fifth order (BS45, DP45)
    embedded RK tableaus.
- DP45 includes interpolation method, to evaluate the interpolant
    ('y') at intermediate points of a successful step.
  BS45's interpolation method exists, but is not validated (fails).

 References:
  - BS45 is embedded pair from paper by P. Bogacki and L. F. Shampine:
      “An efficient Runge-Kutta (4,5) pair,”
      Comput. Math. with Appl., vol. 32, no. 6, pp. 15–28, Sep. 1996.
  - BS23 is four stage RK method from the paper of P. Bogacki and L. F. Shampine,
      “A 3(2) pair of Runge - Kutta formulas,”
      Appl. Math. Lett., vol 2, no 4, p.321 (1989).
  - DP45 are from Table 2 of  J. R. Dormand and P. J. Prince's
      “A family of embedded Runge-Kutta formulae,”
      Journal of comput. and applied Math., vol. 6, no. 1, pp. 19–26, 1980.

May 4, 2016 G.Cosmo                   - field-V10-02-03
-------------------
- Fixed Clone() signatures in derived Field classes.
  More corrections on implementations of operator=() and copy-ctors.

Apr 29, 2016 G.Cosmo                  - field-V10-02-02
--------------------
- Corrected implementation of operator=() and copy-ctor for G4Field,
  G4ElectroMagneticField, G4ElectricField and G4CachedMagneticField.

Feb 25, 2016 P.Gumplinger             - field-V10-02-01
-------------------------
- address Problem Report: 1831
  change: G4Mag_SpinEqRhs, G4EqEMFieldWithSpin, G4EqEMFieldWithEDM and
          G4RepleteEofM.cc from g_BMT = (magMoment/muB)/spin
                           to   g_BMT = (std::abs(magMoment)/muB)/spin


Dec 11, 2015 A.Dotti		      - field-V10-02-00
--------------------------
Fixing typo in tests/CMakeList.txt file: subdirecotry()
instead of add_subdirectory()

Nov  2, 2015 J.Apostolakis             - field-V10-01-15 (fixed)
Oct 22, 2015 J.Apostolakis             - field-V10-01-14
--------------------------
- Reverted changes in G4FieldManager from  tags field-V10-01-05 to -07
   inadvertently reintroduced in tag field-V10-01-13
    (fixed in tag -15: committed new copy from tag -04 'on top')

- Added explanation comment in G4MagHelicalSteper.

Oct 13, 2015 J.Apostolakis             - field-V10-01-13
--------------------------
- G4ChordFinder::FindNextChord: Added check against number of iterations,
  to identify potential issue of lack of convergence.
- test: fixed testProElectricMagField.cc

- Note: tag-13 inadvertently reintroduced changes from tags field-V10-01-05 to -07

Jun 26, 2015 P.Gumplinger              - field-V10-01-12, 11
-------------------------
- Include 'NumberOfVariables' in G4RepleteEofM constructor argument list.

Jun 22, 2015 G.Cosmo                   - field-V10-01-10
--------------------
- Withdrawn also changes introduced in tag "field-V10-01-08", as
  responsible for memory violation errors in Valgrind.
  Now corresponding to tag "field-V10-01-04".

Jun 18, 2015 G.Cosmo                   - field-V10-01-09
--------------------
- Withdrawn changes introduced from tag "field-V10-01-05" to tag
  "field-V10-01-07" included, responsible for failures on SLC6 and
  run-time errors on Valgrind checks.

Jun 10, 2015 P.Gumplinger              - field-V10-01-08
-------------------------
- initialize all elements of dydx[] in G4RepleteEofM::EvaluateRhsGivenB
  Thanks to Tatsuya Kikawa (Osaka Univ.)

Jun 10, 2015 J.Apostolakis             - field-V10-01-07
--------------------------
- G4FieldManager.cc : Made behaviour of SetDetector 'softer'.  No
   longer complains by default if ChordFinder is not (yet) set.
    ( The default values of failMode = 0 i.e. quiet. )
   If a chord-finder exists, it will still warn for other errors.

   It is still possible to have louder/extra checks done calling
     SetDetectorField with failMode > 0
   or by using a new method, which expects an existing field:
     ChangeDetectorField(G4Field *detectorField)

Jun  8, 2015 J.Apostolakis             - field-V10-01-05, (-06 fixed)
--------------------------
- G4FieldManager.cc : Revised behaviour of SetDetector - it now
   passes the Field to the Equation, as is the natural user expectation
   The previous behaviour is possible, using extra argument 'failMode'
      flag. Values: 0           = silent ;
                    1 (default) = warning;
                    2 or other  = fatal exception.
   Or can use alternative (new) suggestion method ProposeDetectorField();

   This change is to ensure that user expectation is met:
      if the field is changed for an existing, working stepper it must
      be propagated to the equation of motion.
   Note: this causes potential conflict between the type of the equation
         and the field, which will need to be solved in the future.

   Old behaviour (just set our own pointer) is still available in new method:
     ProposeDetectorField(G4Field *detectorField)

   Co-works and requires new tag in geometry/navigation: geomnav-V10-01-24.

Jun 4, 2015 P. Gumplinger              - field-V10-01-04
-------------------------
- change assignment to field instead of Field array in G4RepleteEofM.cc

Jan 28, 2015 J.Apostolakis             - field-V10-01-01 (-02,03 fixed)
--------------------------                               ( History    )
- Revert unintended inclusion of changes in G4MagIntegratorDriver

Jan 15, 2015 J.Apostolakis             - field-V10-01-00
--------------------------
- Small refinements in G4FieldTrack - access rest mass, avoid div by 0
    Avoid division by zero for Unit direction in FieldTrack
    Added method to get Rest Mass.
  Needed for fixes related to Problem report 1696.
  Thanks to Nathan S. Froemming <nfroemm@uw.edu> who reported the issue
   and created dedicated test to demonstrate it.

Nov 03, 2014 G.Cosmo                   - field-V10-00-04
--------------------
- Moved constructors and simple methods to in line in G4ChargeState and
  G4LineSection for CPU speedup (courtesy of S.Wenzel).

May 21, 2014 J.Apostolakis             - field-V10-00-03
--------------------------
- G4FieldTrack:
  * Fixed SetChargeAndMoments() to use the new method
    G4ChargeState::SetChargesAndMoments(); it was changing spin, because of
    erroneous change in G4ChargeState::SetChargesAndMoments(), that method
    is now renamed SetChargeSpinMoments() to show what it does;
  * Added pdg-spin as argument to constructors (needed to track polarization);
  * Renamed 'spin' to 'Polarization' in method, arguments, data member to
    avoid confusion;
  * Revised constructors to add pdg-spin as last argument (with default -1).
- G4ChargeState:
  - Addressed Coverity issue #56281 'Arguments in wrong order'
    G4ChargeState::SetChargeMoments() when used in
    G4FieldTrack::SetChargeMoments() from addition of spin to arguments,
    without revising name of method to reflect it;
  - Changed order of arguments in constructor, making spin 3rd argument
    (was 2nd) and making all arguments mandatory;
  - Renamed SetChargeAndMoments() method with 5 arguments including spin (2nd)
    to SetChargeSpinMoments();
  - Added new methods including SetChargesAndMoments(), SetChargeMdm(),
    SetChargeDipoleMoments() (no spin), and also SetChargeSpin(),
    SetChargeMdmSpin() (which includes spin) to provide most/all potential
    combinations.
- G4MagIntegratorDriver::OneGoodStep():
  * Trial changes to address Valgrind issue, about value used before being set.

Apr 01, 2014 J.Apostolakis                - field-V10-00-02
--------------------------
- Moved G4FieldTrack::LoadFromArray() to .cc and removed non-necessary
  thread-local static data local to the function.

Mar 14, 2014 J.Apostolakis                - field-V10-00-01
--------------------------
- Fix assignment operator for G4FieldTrack. (Copied Rest Mass)
- Improve printing of G4FieldTrack

Jan 17, 2014 P.Gumplinger                 - field-V10-00-00
-------------------------
- add G4Mag_EqRhs::SetChargeMomentumMass( particleCharge, MomentumXc, mass)
  to G4Mag_SpinEqRhs::SetChargeMomentumMass, see bug reported at:
  http://hypernews.slac.stanford.edu/HyperNews/geant4/get/emfields/210.html

Nov 18, 2013 P.Gumplinger                 - field-V09-06-13/12
-------------------------
- fix Coverity warning in G4RepleteEofM

Nov 17, 2013 J.Apostolakis
--------------------------
- Fixed and improved HelixMixed Stepper:
    Corrected the default stepper for small steps to be ClassicalRK4.
    Added Angle-threshold parameter. (Default remains 0.33 radians.)
    Added more Steppers, including G4NystromRK4.
    Revised Id numbers of Steppers, to make the best more visible.
    More comments in Stepper().

Nov 05, 2013 P.Gumplinger                 - field-V09-06-11
-------------------------
- remove writing out-of-bounds dydx[8] = 0. in G4RepleteEofM.cc

Nov 04, 2013 P.Gumplinger                 - field-V09-06-10
-------------------------
- add G4RepleteEofM to sources.cmake
                                            field-V09-06-09 - same as
Nov 01st, 2013 P.Gumplinger               - field-V09-06-08
---------------------------
- add G4RepleteEofM: EofM that includes force due to B, E, and gravity field
  as well as mu*grad(B) and spin tracking.

May 10th, 2013 P.Gumplinger/J.Apostolakis - field-V09-06-07
-----------------------------------------
- Revised number of field components (to allow up to 24).
   18 are required for new applications (B, E, Gravity, B-gradients)
- Fixes for initialisation errors found by Coverity.

May 10th, 2013 P.Gumplinger - field-V09-06-06
---------------------------
- prevent divided by zero and shortcut spin tracking for spin == 0
  particles: G4Mag_SpinEqRhs.cc, G4EqEMFieldWithSpin.cc and
  G4EqEMFieldWithEDM.cc
                                            field-V09-06-05 - same
May 8th,  2013 P.Gumplinger/J.Apostolakis - field-V09-06-04
-----------------------------------------
- Introduced new class G4ChargeState to hold charge, spin, magnetic moment
     (promoted from internal class of G4FieldTrack).
- Changed the signature of EquationOfMotion::SetChargeMomentumMass to
 take G4ChargeState in place of G4double (charge) as first argument.
- Deleted SetChargeMomentumMass from G4ChordFinder, G4PropagatorInField,
   G4MagInt_Driver

- Migrated testPropagateMagField and testPropagateSpin.

March 19th, 2013 G.Cosmo - field-V09-06-03, field-V09-06-02
-------------------------
- Cleanup of MT changes in G4FieldManagerStore.

February 26th, 2013 A.Dotti - field-V09-06-01
---------------------------
- First implementation of Cloning mechanism (needed for MT)

February 22nd, 2013 G.Cosmo - field-V09-06-00
---------------------------
- Cleanup of unnecessary changes for multi-threading in G4QuadrupoleMagField.
- Removed unused private data-members in G4Mag_UsualEqRhs and G4RKG3_Stepper.

November 14th, 2012 P.Mato - field-V09-05-07
--------------------------
- G4QuadrupoleMagField: allow displaced origin and rotation (Björn Riese)
- Added G4SystemOfUnits.hh in unit tests

August 30th, 2012 P.Mato - field-V09-05-06
------------------------
- Adapted CMakeLists.txt files to new unit tests

June 11th, 2012 G.Cosmo - field-V09-05-05
-----------------------
- Explicitly use inclusion of headers for system of units and physical
  constants, in plan to remove implicit inclusion from globals.hh.

May 14th, 2012 G.Cosmo - field-V09-05-04
----------------------
- Fixed spurious case of hidden variable visibility in G4NystromRK4,
  detected with '-Wshadow' compilation option on gcc compiler.

February 3rd,  2012 J.Apostolakis - field-V09-05-03
---------------------------------
- G4FieldTrack:
    Added new (inline) method to set the Rest Mass. Needed in order to
       reset this - and keep reuse the same G4FieldTrack in a client
       (across tracks.)
    Made SetCurvePnt() method private.
    Simplified implementation of constructors.  Gain of 1 square root and
       1 division per call.

February  3rd,  2012 G.Cosmo - field-V09-05-02
----------------------------
- Removed tests in CMakeLists.txt causing catastrophic failure in system
  testing!

February  2nd,  2012 J.Apostolakis - field-V09-05-01
----------------------------------
- G4Mag_UsualEqRhs: in SetChargeMomentumMass() method, fixed problem with
  division by zero; stopped updating 'fInvCurrentMomentumXc' (data member
  is obsolete).
- Added tests in CMakeLists.txt

December 13th,  2011 G.Cosmo - field-V09-05-00
----------------------------
- Fixed Coverity defects in G4SimpleRunge (removed spurious pointer
  data member) and G4FieldTrack (missing G4ChargeState::operator=()).
- Synchronised unit tests to trunk (new test field07 and minor updates).

November 11th,  2011 J.Apostolakis - field-V09-04-06
----------------------------------
- Added G4Field.cc to list of files in sources.cmake

November  4th,  2011 J.Apostolakis - field-V09-04-05
----------------------------------
- G4Field: revised to improve ability to detect gravity field:
  Added new data member to identify gravity field;
  Added new method IsGravityActive() to access this data member;
  Created new source file: moving constructors to it.
- Changed G4UniformGravityField and G4ElectroMagneticField
  to accomodate this refinement.

November 2nd,  2011 P.Gumplinger - field-V09-04-04
--------------------------------
- update list of files in sources.cmake

October 28th,  2011 P.Gumplinger - field-V09-04-03
--------------------------------
- Added (uniform) gravity field capability.
  New classes G4EqGravityField, G4UniformGravityField.

  *Required* for co-working tag in Transportation

October 12th,  2011 P.Gumplinger - field-V09-04-02
--------------------------------
- replaced: omegac = 0.105658387*GeV/mass * 2.837374841e-3*(rad/cm/kilogauss)
  with:     omegac = (eplus/particleMass)*c_light
  in G4EqEMFieldWithEDM.cc, G4Mag_SpinEqRhs.cc, G4EqEMFieldWithSpin.cc
  changed calculation:
     std::sqrt(kineticEnergy*kineticEnergy + 2.0*restMass_c2*kineticEnergy);
  to:
     std::sqrt(kineticEnergy*(kineticEnergy+2.0*restMass_c2))
  in G4FieldTrack.cc

August 11th,  2011 G.Cosmo - field-V09-04-01
--------------------------
- Migrated to new G4Exception scheme for warnings and errors.
- Defined scheme for warnings/errors coding:
  + 1xxx for warnings, 0xxx for errors.
  Code numbering:
  + 0001: not supported or implemented features;
  + 0002: invalid setup/construct;
  + 0003: invalid run condition;
  + 1001: incorrect setup; automatically adapted.
  + 1002: notification.

May 13th, 2011 J.Apostolakis
----------------------------
- Added new class G4TrialsCounter for keeping statistics of trials.
- Avoid printing out pointer in G4CachedMagneticField::ReportStatistics().
- Updated unit tests.

May 12th,  2011 G.Cosmo - field-V09-04-00
-----------------------
- Fixed compilation warnings from gcc-4.6.0 for variables set but not used.

May 5th,  2011 J.Apostolakis
----------------------------
- Reordered data members to group invariants, field parameters, etc...

Sep 10th,  2010 J.Apostolakis - field-V09-03-03
-----------------------------
- Revised constructor of G4MagErrorStepper to add number of State variables
- Corrected MagErrorStepper to copy State Variable to output
- Enable G4ConstRK4 to copy remaining State Variables (must integrate 6)

Sep 10th,  2010 J.Apostolakis - field-V09-03-02
-----------------------------
- New class G4MonopoleEq for rhs of d(pc)/ds propagation in field
  in SI units (V.Grichine).
- Fixed passing of time in G4NystromRK4

Jul 21st,  2010 T.Nikitina - field-V09-03-01
--------------------------
- Fixed cases of memory corruption in G4RKG3_Stepper.
- Fixed case of unused array data member in G4ExactHelixStepper.
- Removed useless code never executed in G4ConstRK4::Stepper().
- Fixed initialization in G4NystromRK4 constructor.

Jul 14th,  2010 G.Cosmo - field-V09-03-00
-----------------------
- Added dummy initialization of members in constructors for G4CashKarpRKF45,
  G4ConstRK4, G4EqEMFieldWithEDM, G4EqEMFieldWithSpin, G4ExactHelixStepper,
  G4FieldTrack, G4MagHelicalStepper, G4MagInt_Driver, G4Mag_EqRhs,
  G4Mag_SpinEqRhs, G4Mag_UsualEqRhs, G4NystromRK4, G4RKG3_Stepper,
  G4UniformElectricField, G4UniformElectricField.

Nov 12th,  2009 J.Apostolakis - field-V09-02-09
-----------------------------
- G4MagIntegratorDriver:  activate check on integration error for spin.

Nov 12th,  2009 J.Apostolakis - field-V09-02-08
-----------------------------  (fix only)
- G4Nystrom:  Corrected interface method getField: array now has explicit dimension[4]
                (Problem found by gcc 4.3 - it checked indices used in inline method! )

Nov 6th,  2009 P.Gumplinger - field-V09-02-07
---------------------------
- bug fix in G4EqEMFieldWithSpin and G4EqEMFieldWithEDM
  thanks to Hiromi Iinuma (KEK) see:
  http://hypernews.slac.stanford.edu/HyperNews/geant4/get/emfields/161.html

Nov 5th,  2009 J.Apostolakis - field-V09-02-06
----------------------------
- G4MagIntegratorDriver.cc : Enabled call to ComputeRightHandSide
- G4NystromRK4.cc          : Disabled auxiliary code in Stepper (needed if
                              ComputeRightHandSide is not called.)

Nov 5th,  2009 J.Apostolakis - field-V09-02-05
----------------------------
- Added new virtual method CalculateRightHandSide to G4MagIntegratorStepper for use
      in caching momentum (and field value) by G4NystromRK4
      Default implementation in G4MagIntegratorStepper calls RightHandSide inline method.
- G4Nystrom:  New Set/Get method for cache distance.
              Changed private data members in G4NystromRK4.
- G4MagIntegratorDriver:  alternative call to ComputeRightHandSide is not used (in comment)
              As a result G4NystromRK4 operates without reusing

Nov 5th,  2009 J.Apostolakis - field-V09-02-04
----------------------------
- G4CachedMagneticField: New Simple class to cache value of Magnetic Field.
     Speeds up code when calculation of field value is complex.
- G4NystromRK4 :         New Stepper with Nystrom for magnetic field
     with analytic estimation of integration error.
     Greatly reduces number of field value per step.
- Revised testPropagateMagField to use Cached Quadrupole field,
     and to cover G4NystromRK4 and G4ConstRK4.

Nov 4th,  2009 P.Gumplinger - field-V09-02-03
---------------------------
- (minor change) remove comment from G4EqEMFieldWithSpin.cc
  add G4EqEMFieldWithEDM class: this is the RHS of EofM in a combined
  electric and magnetic field, with spin tracking for both MDM and EDM terms.
  Thanks to Kevin Lynch, Phys. Dept. at Boston University.

May 18th, 2009 T.Nikitina - field-V09-02-02
-------------------------
- Enhanced algorithm G4ChordFinder::ApproxCurvePointS() in order to speedup
  BrentLocator.

March 25th, 2009 G.Cosmo - field-V09-02-01
------------------------
- Some code cleanup and formatting...

March 6th, 2009 P.Gumplinger - field-V09-02-00
----------------------------
- Added 3rd term of BMT equation (Spin x Beta x Efield) to G4EqEMFieldWithSpin,
  addresses emfields forum posting #155 (bug report). Thanks to Kevin Lynch,
  Phys. Dept. at Boston University.
- Moved renormalization of spin from G4EqEMFieldWithSpin and G4Mag_SpinEqRhs to
  G4ClassicalRK4 and G4SimpleHeum.
- Added Spin propagation errors to the criteria for 'OneGoodStep' in
  G4MagIntegratorDriver but actually don't add it (yet) to the decision logic.

November, 19th, 2008  P.Gumplinger - field-V09-01-05
----------------------------------
- Renormalized the spin to 1 in G4EqEMFieldWithSpin and G4Mag_SpinEqRhs.

November, 7th, 2008   P.Gumplinger - field-V09-01-04
----------------------------------
- Added SetAnomaly() and GetAnomaly() accessors to G4EqEMFieldWithSpin.

October, 28th, 2008   T.Nikitina - field-V09-01-03
--------------------------------
- Added 'ApproxCurveV' to method G4ChordFinder::ApproxCurvePointS() in
  order to better calculate the curve length.
- Some code cleanup.

September, 18th, 2008   T.Nikitina
----------------------------------
- Added new stepper class G4ConstRK4, performing integration of one step
  with error calculation in constant magnetic field; implementation derived
  from G4ClassicalRK4.

July, 15th, 2008   J.Apostolakis - field-V09-01-02
--------------------------------
- Revised signature of G4ChordFinder::FinderNextChord(), making 'FieldTrack'
  argument passed a reference.

May, 28th, 2008   T.Nikitina
----------------------------
- G4ChordFinder: added new method ApproxCurvePointS() using Brent second order
  location mechanism.

April 24th, 2008   T.Nikitina - field-V09-01-01
-----------------------------
- Fix 'unused' non-initialized values of dydx in G4EqMagElectricField
  and G4EqEMFieldWithSpin.

January 17th, 2008   G.Cosmo - field-V09-01-00
----------------------------
- G4CashKarpRKF45: deleted un-needed duplicate (and unused) instance variable
 'fNumberOfVariables', already defined in G4MagIntegratorStepper. (J.Ap.)
- Some code cleanup.

December 7th, 2007   J.Apostolakis & T.Nikitina - field-V09-00-03
-----------------------------------------------
- New class G4FieldManagerStore. It enables resetting of all chord
  finders' state. Needed to address problem reported by user.

September 9th, 2007  G.Cosmo - field-V09-00-02a
----------------------------
- Some code cleanup in G4MagHelicalStepper.cc.

August 30th, 2007    P.Gumplinger - field-V09-00-02
---------------------------------
- Add G4EqEMFieldWithSpin class to allow tracking of spin also in
  G4ElectroMagneticFields

August 21st, 2007    T.Nikitina - field-V09-00-01
-------------------------------
- Fix to DistChord() method for Helical Steppers: adopt 'special' case
  also for Ang<2pi not only for Ang<pi; use cos() in place of tan(), to
  improve CPU performance.
- Improved AdvanceHelix() to be able to make half step and full step
  in one call.
- In G4HelixMixedStepper added possibility to call different steppers for
  small steps and add some statistics how offen different steppers are called.
- G4RKG3_Stepper: improved internal algorithm to use pre-computed values;
  the stepper now gives comparable CPU performance as ClassicalRK4.
- Updated unit tests.

August 17th, 2007    G.Cosmo - field-V09-00-00
----------------------------
- Changed FatalException to EventMustBeAborted in AccurateAdvance()
  if proposed integration step is negative.

June 8th, 2007    T.Nikitina - field-V08-03-03
----------------------------
- Relaxed FatalException to Warning in G4MagIntegratorDriver::AccurateAdvance()
  for case of step zero and return previous value. This fixes problem
  observed by ATLAS in release 8.3 when requiring very accurate propagation
  -- ie using very small values for acceptable integration error.

May 18th, 2007    T.Nikitina - field-V08-03-02
----------------------------
- New class G4HelixMixedStepper, mixing helical stepper and RK
  G4MagHelicalStepper
- Keep values of  inverse Radius, ..
- New calculation of DistChord for SteppingAngle > pi
  G4RKG3Stepper
- New calculation of DistChord for SteppingAngle > pi

May 16th, 2007    G.Cosmo - field-V08-03-01
-------------------------
- Introduced new class G4ErrorMag_UsualEqRhs used to reverse the magnetic
  field when propagation is backwards for error propagation (by P.Arce).
- Coworks with tag "global-V08-03-02".

May 11th, 2007    G.Cosmo - field-V08-03-00
-------------------------
- Use call to G4GeometryTolerance instead of kCarTolerance constant in
  G4MagIntegratorDriver.
- Requires tag "global-V08-03-00" and related tag set.

May 10th, 2007    J.Apostolakis - field-V08-02-01
-------------------------------
- G4MagIntegratorDriver:
    * added protections against zero initial or internal step h=0, (exceptions)
    * revised (re)calculation of h, and quit loop if h/length < smallest-fraction (~ 10^-12)

April 26th, 2007  T.Nikitina - field-V08-02-00
----------------------------
- Corrected integration constants in G4MagHelicalStepper
- Added implementation of G4RKG3_Stepper, stepper derived from Geant3.
- Updated NTST unit test. New unit test "field06" for comparison of steppers.

November 14th, 2006  J.Apostolakis - field-V08-01-02
----------------------------------
- G4MagIntegratorDriver
  * Made first argument of GetDerivatives a reference - avoid copy
- G4MagIntegratorStepper
  * Include the SetEquationOfMotion() method in G4MagIntegratorStepper
    (for Geant4e, as in field-V08-01-00)
  * Update of disclaimers.

November 13th, 2006  G.Cosmo - field-V08-01-01
----------------------------
- G4FieldTrack:
  o Implemented missing definition for GetCharge().
  o Corrected 'const' qualifier for accessors in the subclass.
  o Cleanup ...
- NOTE: this tag is NOT including the change below in G4MagIntegratorStepper.

June 21st, 2006  J.Apostolakis - field-V08-01-00
------------------------------
- Including the SetEquationOfMotion() method in G4MagIntegratorStepper

June 22nd, 2006  J.Apostolakis - field-V08-00-07
-----------------------------
- G4ExactHelixStepper: reintroduced corrected class
    --> testPropagateMagField now tests it also (added)
- G4MagHelicalStepper: made Stepper virtual (for now)
             to enable G4ExactHelixStepper to override it

June 21st, 2006  J.Apostolakis - field-V08-00-06
-----------------------------
- G4ExactHelixStepper: taking out class
   (provisional tag in case of difficulties with class, revisions)

--- The field-V08-00-0x , x > 6, tags do not include the change below

May 27th, 2006  J.Apostolakis - field-V08-00-05
-----------------------------
- G4FieldTrack: Fix for simple compilation error on Sun.

May 23rd, 2006  J.Apostolakis - field-V08-00-04
-----------------------------
- G4FieldTrack: Fix for memory leak for ChargeState
   Made G4ChargeState a data member (has an instance)

May 18th, 2006  J.Apostolakis - field-V08-00-03
-----------------------------
- G4FieldTrack: Fix for issue with gcc 4.0  (mac)

May 16th, 2006  J.Apostolakis - field-V08-00-02
-----------------------------
- G4ExactHelixStepper
   Taken out alpha version - it was included in error

May 11th, 2006  J.Apostolakis - field-V08-00-01
-----------------------------
- G4FieldTrack
   Significant, provisional change:
     * Added charge and moments to FieldTrack
         (SetMethods,  and pointer to embedded class G4ChargeState)
   Technical revisions:
     * New constructor, with charge and without velocity
     * New almost-default constructor (taking a character)
   Also:
     * New constructor to take const reference to Spin
     * New implementation method UpdateFourMomentum
     * Streaming operator takes const reference,
         and outputs momentum magnitude & direction magn.

- G4ExactHelixStepper
   Included in error

Apr 6th, 2006  J.Apostolakis - field-V08-00-00
----------------------------
- In G4FieldManager
 Added missing  const GetChordFinder() method -- Problem report #847
 Corrected description (at top of include file hh):
  - It is possible to set the field manager of a logical volume (since long)


Nov 9th, 2005  G.Cosmo - field-V07-01-00
----------------------
- Archived source code of field01 unit test, now moved to examples/extended.
- Migrated unit test NTST to use <sstream> and std:: namespace. Up-to-date
  with G4VParticleChange new interface.

Dec 2nd, 2004  G.Cosmo - field-V06-02-02
----------------------
- Implemented migration to <cmath> for standard mathematical functions.

Dec 2nd, 2004  J.Apostolakis - field-V06-02-01
----------------------------
- Improvements to comments in key Field classes
- Changes to test/NTST, renaming 'main()' file & modifying input files
- Several improvements to test files
   testProElectroMagField.cc
     * updating for new Electric Field inheritance (& need for
       different ChordFinder creation )
     * adding columns to print-outs in spin case for better diagnosis
   testPropagateMagField.cc
     * Added verbosity level 1 to field Propagator, relabelled old method.
   testPropagateSpin.cc
     * Added more printout of parameters (state) of G4PropagatorInField
       and G4FieldManager before running each test.
   test/NTST
     * Renamed main() file to testNTST.cc and added G4UItcsh terminal.


Oct 20th, 2004  P.Gumplinger - field-V06-02-00
----------------------------
- Added Set/GetAnomaly() methods in G4Mag_SpinEqRhs.

Feb 9th, 2004  G.Cosmo - field-V06-00-00
----------------------
- G4UniformMagField.cc: added missing implementation for
  GetConstantFieldValue(). Fixes bug report #575.

Nov 13th, 2003  J.Apostolakis - field-V05-02-08
-----------------------------
- G4ChordFinder:
  o extended the arguments of AdvanceChordLimited  and  FindNextChord
    adding the current safety sphere (origin, radius), for use in optimising.
  o fixed set functions which had side effect (on first fraction.)
- Added new class G4ChordFinderSaf (using above)
  o which uses safety to create longer chords, so enabling
      propagation in fewer steps --> performance optimisation
- G4FieldManager:
    Changed default accuracy parameters to much better values:
        Epsilon Min Default  to 5.0e-5  from 5.0e-7  (too small)
        Epsilon Max Default  to 0.001   from 0.05    (far too big)

Nov  7th, 2003  J.Apostolakis - field-V05-02-07
-----------------------------
- G4ChordFinder
  o Made this a base class
    * to enable specialised implementations
    * virtual methods: FindNextChord, PrintStatistics)
    * new method AccumulateStatistics to aid in this

  o New default value of                                      Accuracy!!
      Delta Chord        to  0.25 mm    (from 3.00 mm)     <-----

- G4FieldManager
  o Changed default values of
      Delta One Step     to  0.010 mm   (from 0.25 mm)     <-----
      Delta Intersection to  0.001 mm   (from 0.10 mm)     <-----
    for increased default accuracy
  o Use field's DoesFieldChangesEnergy method to set relevant member variable

Nov 7th, 2003  J.Apostolakis - field-V05-02-06
----------------------------
- G4ChordFinder
   Created new class members for parameters used in heuristics:
       fFirstFraction            for first step
       fFractionLast             fraction of last step, if redoing
       fFractionNextEstimate     confidence in step est from chord
       fMultipleRadius           for small radii of curve
   New method to Print Statistics.
   Verbosity to enable optional printing of stats in destructor.

Nov 7th, 2003  J.Apostolakis - field-V05-02-05
----------------------------
- G4ChordFinder
  o Added simple statistics (with access methods)
- test/NTST
  o Added new test, taken from D. Williams' exampleNTST
     modified and maintained by J. Apostolakis

Nov 5th, 2003  J.Apostolakis - field-V05-02-04
----------------------------
- G4FieldManager
  o Added Get/Set Min/Max imumEpsilonStep
  o Added fEpsilonMin fEpsilonMax & default to member variables.
   >> Now these can be tailored for different parts of a detector or setup

- G4Field G4ElectroMagneticField G4MagneticField
  o Adding the virtual method   DoesFieldChangeEnergy()  [to be used later]
  o So that G4ElectroMagneticField derives from G4Field
    and G4MagneticField derives from G4ElectroMagneticField

- G4MagErrorStepper and derived classes
    (G4ClassicalRK4 G4SimpleRunge G4ExplicitEuler G4ImplicitEuler G4SimpleHeum)
  o the constructors take G4EquationOfMotion in place of a G4Mag_EqRhs
    as it these applicable to all types of equations
     (not just ones for Magnetic field)

- G4EqMagElectricField
  o derives from G4EquationOfMotion

- G4ChordFinder
  o Moved simple constructor to .cc file (together with 'complex' one)
  o Changed fDefaultDeltaChord to a constant member variable (from class var.)

Nov 4th, 2003  G.Cosmo - field-V05-02-03
----------------------
Undocumented.

Nov 4th, 2003  G.Cosmo - field-V05-02-02
----------------------
- G4ChordFinder.cc:
  o Fixed compilation problem occuring when G4DEBUG_FIELD was set.

Oct 31st, 2003  G.Cosmo - field-V05-02-01
-----------------------
- Code cleanup and removal of redundant header includes, replaced
  where necessary by forward declarations.

Oct 24th, 2003  G.Cosmo - field-V05-02-00
-----------------------
- Migrated to use new G4Exception scheme.
- Updated outputs of unit tests.

Jun 25th, 2003  J.Apostolakis - field-V05-01-06
-----------------------------
- Suppressed printing of statistics (by default) in MagIntegrationDriver.
- Fix for unused variables warning in ChordFinder.

Jun 24th, 2003  J.Apostolakis - field-V05-01-05
-----------------------------
- Fix for problems introduced in field-V05-01-03:
  o G4ChordFinder:
    - Fixed unitialised variable for next step (now used for optimisation).
    - Protected assignment of 'fLastStepEstimate_Unconstrained' in case of
      unitialised value.

Jun 21st, 2003  J.Apostolakis - field-V05-01-04
-----------------------------
- G4FieldManager:
  o Revised into 'slightly' abstract class with one (new) virtual method:
      ConfigureForTrack( const G4Track *)
    to enable the user to configure it with different accuracy parameters
    depending on energy, particle id, volume, or other track state.
    Currently by default, no such configuration action is undertaken.

Jun 21st, 2003  J.Apostolakis - field-V05-01-03
-----------------------------
- Revised G4ChordFinder:
  * FindNextChord now provides next Step estimate (for accuracy in Integr.)
  * AdvanceChordLimited to use
    - above extra argument to FindNextChord
    - the next Step argument as initial-step suggested to Accurate Advance
- G4MagIntegratorDriver:
  * Added extra argument to Accurate Advance:
    hinitial: suggested initial step size
- Note:
  * Purpose:  performance boost with small/limited changes,
    including minor revisions of interfaces.

Jun 20th, 2003  J.Apostolakis - field-V05-01-02
-----------------------------
- G4MagIntegratorDriver Quick Advance:
  o Took out two unneccessary square roots and two divisions.
- Notes:
  1) Pure magnetic, electric, spin field test are completed.
  2) Purpose:  performance boost with small changes.

Jun 20th, 2003  J.Apostolakis - field-V05-01-01
-----------------------------
- G4MagIntegratorDriver:
  o Corrected neglected conversion to <std> from "G4std".
- Migrated unit tests to <std>.

Jun 19th, 2003  J.Apostolakis - field-V05-01-00
-----------------------------
- G4ChordFinder:
  o Corrected simple constructor to initialise several member variables
    including LastStepEstimate_Unconstrained.
- G4MagIntegratorDriver:
  o Keep simple statistics on number of steps, total error and step size.
  o Took out an unneccessary square root (in loop).
- NOTE:    tests field0X are to be migrated.
  Purpose: fixes, small performance boost, simple statistics.

Apr 2nd, 2003      G. Cosmo - field-V05-00-01
---------------------------
- Created .cc files for G4MagneticField and G4ElecroMagneticField.
- Fixed definition of copy constructors in fields inheritance chain.
- Moved obsolete method StepWithEst() to private in G4RKG3_Stepper,
  G4CashKarpRKF45 and G4ClassicalRK4.
- Cleared strict pedantic warnings.

Feb 5th, 2003      G. Cosmo - field-V05-00-00
---------------------------
- Removed redundant inclusions of PhysicalConstants.h or SystemOfUnits.h.
  Now using directly CLHEP's headers.

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
    o Fix to momentum component of Rhs.

May  31st, 2002   J. Apostolakis - field-V04-00-03
--------------------------------
 - G4MagHelicalStepper.icc
    o Fix to LinearStep (correcting previous fix/cosmetic)
 - G4ChordFinder.cc
    o Corrective behaviour for very small or large changes of 'new step'
       [observed in complex 3-d fields (purging magnet),  or
                    approximate equations of motion ]
 - 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
--------------------------------
 Tag including only two changes below:
  - Putting aside the other fixes/changes (as the one above) to
G4MagIntegratorDriver, tagging only the fix to update the field track
for steps smaller than the chord finder's minstep.

May   7th, 2002   J. Apostolakis
--------------------------------
- G4MagIntegratorDriver  -  **  branch ** on 1.20 **
  * Fix to update the field track for steps smaller than the chord finder's
minstep.

May   7th, 2002   J. Apostolakis
--------------------------------
- G4MagIntegratorStepper
  * Changed RightHandSide from a virtual method to an inline (non-virtual)
      method -- it is not and should not be changed by derived classes.

Mar 28th, 2002  J. Apostolakis - field-V04-00-01
-----------------------
- Fixed LinearStep in G4MagHelicalStepper (expected unit direction),
    that had not been updated for new integration variable (momentum).
    --> found in testing helical steppers in BaBar setup,
         in region of negligible field.

- Changed maximum number of steps in driver,
    halving from 500/order to 250/order.

Mar 28th, 2002  J. Apostolakis
-----------------------
- Committed directory "OtherField" with examples of fields,
    Delphi, Quadropole etc.

- Updated outputs of testPropagateMagField for new version of source,
    that has 3rd test case.

- Added new runs and outputs for testProElectroMagField, with
    several steppers, and modified test script test.sh accordingly.


Feb  2nd, 2002   V. Grichine
------------------------
Update of test/field02 to utilise new features
  - for Electric Field, to signal that a field modifies the energy;
  - updating of time by integration, for time dependent fields.

Jan 10th, 2002  G. Cosmo - field-V04-00-00
------------------------
- Activated G4DEBUG_FIELD in GNUmakefile.

Jan 7th, 2002  J. Apostolakis
-----------------------------
- G4MagHelicalStepper.cc: renamed local variables "*Momentum*" to "*Velocity*".

Dec 4th, 2001  G. Cosmo - field-V03-02-08
-----------------------
- Fixed interface to virtual functions in the inheritance chain.
  Added 'virtual' qualifier to destructor and GetFieldValue() for subclasses
  of G4Field which may act as base class for user-defined fields.
  Modified files: G4MagneticField.hh, G4UniformElectricField[.hh.cc],
                  G4UniformMagField.hh.
- G4ChordFinder.cc: the unphysical curve length exception has been moved to
  inside #ifdef G4DEBUG_FIELD. Other #ifdef renamed to G4DEBUG_FIELD.
- G4LineSection[.hh.cc]: correction for A=B when the distance from P to A
  is returned (V.Grichine).

Nov 28th, 2001  J. Apostolakis - field-V03-02-07
------------------------------
G4FieldManager
- Added fFieldChangesEnergy data member and get/set methods
 ( required to allow transportation to know how to calculate end-time,
   enabling the integration of time only for electric fields. )

Nov 28th, 2001  J. Apostolakis - field-V03-02-06
------------------------------
Small fixes only:

G4CashKarpRKF45
- fixed deletion of unassigned pointer/array in destructor. (-> Volodya Velev)

G4EqMagElectricField
- bug fixed in the formula for inverse velocity             (-> V. Grichine)

Nov 21st, 2001  G. Cosmo - field-V03-02-05
------------------------
- Protected verbose warnings with G4FIELD_DEBUG flag in G4ChordFinder.cc
  (V.Grichine).
- Replaced G4DEBUG with G4DEBUG_FIELD in G4MagIntegratorDriver.cc.
- Updates to unit test field02.

Nov 13th, 2001  G. Cosmo - field-V03-02-04
------------------------
- Removed warnings on gcc-2.95.2.
- Included unit tests field01, field02, field03.

Nov 9th, 2001  J. Apostolakis - field-V03-02-03
-----------------------------
Motivated by the use case of an Electric Field,
 - in order to achieve reasonable accuracy in time integration,
 - and to enable fields that vary with the global time)
we (John Ap. and V. Grichine) changed the following:

- Modified G4Field to allow the time in the GetFieldValue method
     - as 4th component of the "position" array.

- Modified EquationOfMotion to provide the time to the GetFieldValue method
   of G4Field
      * as the 4th component of a position / time  4-array
      * in place of only position as a 3-arry

- Added the global time as variable to be integrated over in the
   case of an Electric Field

Support for these modifications is required in G4Transportation.

(Better support will require either
 - a modification in G4FieldTrack to indicate whether the time has been
    integrated or not.
 - or additionally making the time calculation a property of G4FieldTrack,
    bring in code to do it in from G4Transportation.)


Nov  8th, 2001  J. Apostolakis - field-V03-02-02
------------------------
- Introduced several changes in G4MagIntegratorDriver.

   It now respects its minimum driver step size in AccurateAdvance.
     * whereas before it did not.

   Modified maximum number of steps, lowering by factor of 10.
     -> it should reduce the time spent integrating low energy particles,
	 in some cases where it is unneccessary.

   Protected printing of (nearly?) all warnings with a G4DEBUG_FIELD  #ifdef.


Nov 05th, 2001  G. Cosmo - field-V03-02-01
------------------------
- Fixed trivial warnings on Linux-g++.

Aug 27th, 2001  J. Apostolakis - field-V03-02-00
------------------------------
Tagged last change.
This tag is utilised in transport-V03-02-01 (which requires it).

Aug 16th, 2001  J. Apostolakis
------------------------------
G4ChordFinder:
 Added method to erase/reset the state of the StepEstimate.
 This is unwanted internal state that was carried between tracks and
     events as a side effect.

 Calling this at the start of each track, it is now possible to
 eliminate a non-repeatability that was possible due to this.
    ( It has been observed in particular in vaccuum. )

May 23rd, 2001  J. Apostolakis - field-V03-01-02
------------------------------
- Added Exception to G4RKG3Stepper constructor: the class does not work

May 23rd, 2001  J. Apostolakis - field-V03-01-01
------------------------------
- Fixed G4FieldManager constructors to give default values to delta
  parameters.

- Updated testPropagateSpin (it now compiles),
   and some outputs of testPropagateMagField (1 to 5)


Apr 12th, 2001  P. Gumplinger - field-V03-01-00
-----------------------------
- Updated G4Mag_SpinEqRhs.hh and G4Mag_SpinEqRhs.cc for correction
  to spin tracking.

Apr 04th, 2001  G. Cosmo - field-V03-00-05
------------------------
- G4FieldTrack.icc: fixed pedantic warnings on Linux-g++.

Mar 23rd, 2001  J. Apostolakis - field-V03-00-04
------------------------------
- Electric Field unit test now works: test runs until completion.
   Test outputs saved (on Linux).

- Fixed src/G4UniformElectricField.cc to set correct field components
                                      (compatible with Equation of Motion
                                       G4EqMagElectricField )

- Tidied G4FieldTrack
   * deleted obsolete methods Set/Get MomentumModulus() and its data member.
   * in constructor to set the value of the spin to (0.0, 0.0, 0.0)
          if pSpin is null.  (It was undefined.)

Mar 23rd, 2001  J. Apostolakis - field-V03-00-03
------------------------------
- Fixed (hacked) CashKarp to work using Auxiliary Stepper.

- Modified G4MagIntegratorStepper
     to use pointer to G4EquationOfMotion
            instead of G4Mag_EqRhs

- Design iteration appears neccessary

Mar 23rd, 2001  J. Apostolakis - field-V03-00-02
------------------------------
- Fixed G4MagHelicalStepper::AdvanceHelix for momentum, allowing
    the possibility of (correct) use of all Helical Steppers.

- test/testProElectroMagField.cc updated for momentum.
    (Not yet updated: Spin tests)


Mar 19th, 2001  J. Apostolakis - field-V03-00-01
------------------------------
- Tagging the modification of several classes to integrate in momentum*c_light
    instead of velocity.
  Reason for change:  Velocity integration can result in superluminar
    velocities,  due to arithmetic inaccuracies.
  Classes modified:
    G4FieldTrack,   (Changed components 3,4,5 of SixVector to Momentum,
    G4Mag_EqRhs, G4Mag_UsualEqRhs, G4EqMagElectricField

Feb 20th, 2001  J. Apostolakis

- Modified several classes to integrate in momentum instead of velocity.

 G4FieldTrack:
     Changed components 3,4,5 of SixVector to Momentum,
     Modified constructor
     Added energy calculation to "LoadFromArray" method
     GetEnergy method is now implemented.
     Deleted obsolete (old) method names for Curve and Position. New have "Get"

 G4ChordFinder
     Renamed old-method names of Field Track to new ones.

Jan 29th, 2001  G. Cosmo - field-V03-00-00
-------------------------

- Minor fix to G4MagneticField.hh: added explicit call to G4Field() in
  copy constructor. Fixes report #205.

Nov 20th, 2000  G. Cosmo - field-V02-00-02

- Fixes to remove warnings from "-Wall -ansi -pedantic" g++ compiler options:
  o commented out variables declared and not used.
  o fixed declaration of variables used before being initialised.
  o fixed order of initialisation of member data in constructors.
  o fixed usage of unsigned-int (size_t) for array indeces.

Nov 9th, 2000  G. Cosmo - field-V02-00-01

- G4FieldManager: added check on existence of allocated fChordFinder
  in CreateChordFinder(G4MagneticField*) method.

Nov 1st, 2000  G. Cosmo - field-V02-00-00

- QA code revision and cleanup (+fixes from CodeWizard filtering):
  o Added (private) declarations of copy constructor and assignment operator
    where needed.
  o Added "const" qualifier to accessor methods, wherever needed.
  o Added equality check on operator= where needed.
  o Made destructor "virtual" for classes having virtual methods,
    wherever missing.
  o Changed virtual functions to non-inline wherever's the case.
  o Changed return value to be "const" pointer to functions:
    - G4EquationOfMotion::GetFieldObj()
    - G4FieldManager::GetDetectorField()
    - G4MagIntegratorDriver::GetStepper()
  o Fixed and corrected signature to G4MagIntegratorDriver::SetHmin().
  o Added "inline" qualifier to methods' declarations.
  o General cosmetics

Jun 2nd, 2000  J. Apostolakis
- G4FieldManager[.hh.icc]
  o Added DeltaIntersection and DeltaOneStep to FieldManager: added
    Get/Set methods and SetAccuraciesWithDeltaOneStep().

May 31st, 2000  J. Apostolakis - field-V01-01-03

include/G4FieldManager.hh,icc
  o Moved Delta Intersection and Delta One Step to FieldManager
     (from Propagator in Field),  to allow them to differ over the detector.

May 11th, 2000  J. Apostolakis - field-V01-01-02

- G4ChordFinder[.hh.cc]
  o Modified method for finding new trial step.
    New method assumes a quadratic relationship between step-length and d_chord:
            d_chord  proportional  to  step-lenght ^ 2
  o Added two small refinement in order to avoid unneccesary extra step due to
    small numerical inaccuracies in estimation:
      FindNextChord
          to first step       use  (1-0.001) * last-step-estimate
      New Step:
          to subsequent step  use    trial_step = 0.98 * estimate

May 10th, 2000  G. Cosmo

- G4MagneticField.hh: minor fix to dummy implementation of assignment
  operator.

May    9th, 2000   J. Apostolakis - field-V01-01-01

- G4MagErrorStepper:
    Modified DistChord to check whether the chord endpoint are the same point.

- G4RKG3_Stepper:
    Deleted error message from StepNoErr, as it is used in Stepper.

- G4MagIntegratorDriver:
    Changed the condition for the debug output  (~cosmetic)


April 27th, 2000   G. Cosmo

- Reorganised comments for the Software Reference Manual.
- Moved inlined definition to .icc files, where needed.
  Created: G4ChordFinder.icc and G4FieldManager.icc.

April 13th, 2000   J. Apostolakis - field-V01-01-00

- Modified signature to function DumbStepper() in classes:
  G4HelixExplicitEuler, G4HelixHeum, G4HelixImplicitEuler,
  G4HelixSimpleRunge and G4MagHelicalStepper.
- Modified signature and implementation of function MagFieldEvaluate()
  in G4MagHelicalStepper, to use Field (as ThreeVector) in place of dydx.
- Made Richardson extrapolation optional (it is unclear if
  it offers benefit) in G4MagHelicalStepper.
- Updated unit test testPropagateMagField and reference output.
- G4LineSection: fixes to prevent divisions by 0. and sqrt(<0)
  (V.Grichine).

January  19th, 2000   G. Cosmo - field-V01-00-00

Syncronized versioning of files with HEAD after ISO-C++ migration
(essentially CVS header changes).

December  7th, 1999   J. Apostolakis - field-V00-01-01a

For negative or very small curve lengths (h) we suppress writing an error
(about the distance of endpoints being further than the curve length),
as it is meaningless.

November 23rd, 1999   J. Apostolakis - field-V00-01-01

Tagged this sub-category's state in geometry-V00-01-01


July      6th, 1999   J. Apostolakis - field-01-00-07

These fixes and those in field-01-00-06 and field-01-00-06a all come
from the need to cope with the imprecision of the integration, and its
interaction with paths that are rather straight.

G4MagIntegrationDriver:
 i) AccurateAdvance now that the chord distance is smaller than the curve len-
gth (times 1+epsilon).

ii) OneGoodStep and QuickAdvance considers the error of the velocity as well as
the error of the position - and ensure that both relative errors are within
the "eps" maximum given.

G4ChordFinder:
  Having found that the curve_length vs ABdist disrepancy has its basis in
the imprecision of the integration:
  i) Modified the exception in this case to happen only for very large
   relative disrepancies ( 10 * eps ).
 ii) Undertaken a default corrective action in all other cases
Note that this disrepancy only happens for very straight sections of track -
ie step lengths much smaller than the curvature of the track.

July      1st, 1999   J. Apostolakis - field-01-00-06a

In order to cope with the anomalous condition created by candidate fix
in G4PropagatorInField,  we ensure that the fraction_AE is always between
0 and 1.0.  (giving it a default value of 0.5 whenever it is wrong).
( in G4ChordFinder::ApproxCurvePointV )

June     29th, 1999   J. Apostolakis - field-01-00-06

  I re-instated a check on whether the input distance along the curve between
the two input curve points is truly greater than their linear distance.
( in G4ChordFinder::ApproxCurvePointV )

The condition that prints out a warning message has been altered to
take into account the case of a very small final interval.
( in G4MagInt_Driver::AccurateAdvance )

June     ??th, 1999   J. Apostolakis - field-01-00-05

The condition that prints out a warning message was changed to delete
an incorrect comparison.
( in G4MagInt_Driver::AccurateAdvance )

April    19th, 1999   J. Apostolakis - field-01-00-04

G4MagErrorStepper: Cosmetic changes to name of data members

March     4th, 1999   J. Apostolakis - field-01-00-03

Corrected delete statement of arrays to use 'delete[]' instead of simple delete
in destructors of 2 steppers (G4CashKarpRKF45, G4SimpleHeum)

February 17th, 1999   J. Apostolakis -  field-01-00-02

 Moved G4PropagatorInField files to geometry/volumes.
 Updated GNUmakefile not to depend on geometry/volumes anymore.
   -> the known circular dependency is removed


February 12th, 1999   J. Apostolakis -  field-spin1-works1     (act Feb17)

  A tag that contains the first version that worked with spin (in Peter G.'s
directory).   G4PropagateInSpin is still in this version.  A small change
in a branch of the header file was needed.


February 10th, 1999   J. Apostolakis

All the following changes are needed for energy integration also:

G4ChordFinder now passes to the constructed driver the number of variables.
Because of the need for the stepper to know about it in its Abstract interface

-> Moved theNumberOfVariables  from derived class G4MagErrorStepper
                               to base class G4MagIntegratorStepper

As a consequense the classes that derived from G4MagIntegratorStepper directly
were changed: G4CashKarpRKF45, G4MagHelicalStepper,


February  9th, 1999    J. Apostolakis

Equation of Motion:
G4MagEqRhs.hh  Made SetChargeMomentumMass virtual, so that G4Mag_SpinEqRhs
                 can initialise its constants too.


February  9th, 1999   P. Gumplinger

Added Equation of Motion for Spin in Magnetic Field.


February 17th, 1999   J. Apostolakis  -  field-01-00-01
  --->  date is correct, made sure that tag does not include above fixes!

 Moved G4PropagatorInField files to geometry/volumes.
 Updated GNUmakefile not to depend on geometry/volumes anymore.
   -> the known circular dependency is removed


---------------------------------------------------------------------------
    ------    Geant 4  Production Release   ------------
--------------------------------------------------------------------------
Nov   19th, 1998   J. Apostolakis  -  field-00-04-01head ===> R+D version only

 G4PropagatorInField files modified:

   - to store the last safety computed and its origin.
   - to give them to a requester
------------------------------------------------------------------

Nov   19th, 1998   J. Apostolakis  -  field-00-03-03b

 Subtle fix to interface of G4UniformMagField::GetFieldValue
         ( that tripped Visual C++ )

 G4PropagatorInField:  added printing method for verboseness.

Nov   19th, 1998   J. Apostolakis  -  field-00-03-03a

   Steppers:  Fixed instance variables construction (SimpleRunge)
              and clash of names in CashKarp::StepWithEstimate

   Added post-const to all Field classes for
           void GetFieldValue(const G4double yTrack[] ,
                                 G4double B[]      ) const ;

   Added SetFieldValue methods to UniformMagField

   Added GetConstantFieldValue() methods to Uniform Mag & Electric Fields


Nov   19th, 1998   J. Apostolakis  -  field-00-03-03

   Fixes to Propagate and Steppers

Nov   19th, 1998   J. Apostolakis  -  field-00-03-02

   Minor corrections  (???)

Nov   19th, 1998   J. Apostolakis  -  field-00-03-02

   Major development to allow Electric Field



June  17th, 1998   J. Apostolakis  -  magfield-06-03

 Modified Files:
        include/G4PropagatorInField.hh
            src/G4PropagatorInField.cc
           test/testPropagateInField.cc
----------------------------------------------------------------------

 1)  Added an assertion after each call to LocateGlobalPointAndSetup.
     It checks that the located volume is equal to the current volume.
     If this check fails, the Propagator does not know how to continue.

 2)  Added an argument  to ComputeStep method of G4PropagatorInField.
  The new volume argument is used to check the current volume during the step.

 3)  When G4Navigator's ComputeStep returned  stepLength==stepRequested,  this
used to be treated as a failure to intersect.  This is incorrect.

    stepLength==stepRequested is an intersection,
      so I am now treating it as such in each comparison (of 3).
      Ignoring it causes problems, including volume being skipped.
      --> but treating it as an intersection used to cause problems too ??


May    7th, 1998    J. Apostolakis  -  magfield-06-02-helix01

- Tag includes new version of G4ChordFinder (not used by W.Wander).


May    7th, 1998    W. Wander     (recorded/commited by  J. Apostolakis)

- New "helical" RK steppers that move in helical segments, not linear.
    * Several changes to add steppers

 Modified Files:
        G4MagErrorStepper.hh
        G4MagErrorStepper.cc
           added Helical stepping methods to this general ABC.

        G4MagIntegratorStepper.hh
           made RightHandSide virtual   (this will be reversed very soon)

        testPropagateMagField.cc
           Test of Helical stepping functionality added.

 Added Files for new Helical RK steppers, deriving from G4MagErrorStepper:
        G4HelixExplicitEuler.cc  ( and .hh )
        G4HelixHeum.cc
        G4HelixImplicitEuler.cc
        G4HelixSimpleRunge.cc

 Added File for implementation:
        G4MagErrorStepper.icc


May    7th, 1998    J. Apostolakis   -  magfield-06-01

- added small changes to
    * G4ChordFinder:           methods to get/set IntegratorDriver
    * G4MagIntegratorDriver:   made OneGoodStep method public
- created the file.
