Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
+108 -3
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.37 2001/05/23 18:51:29 japost Exp $
$Id: History,v 1.48 2001/12/04 17:42:29 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,13 +16,118 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
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.
- Added Exception to G4RKG3Stepper constructor: the class does not work
- Updated testPropagateSpin (it now compiles),
and some outputs of testPropagateMagField (1 to 5)
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4CashKarpRKF45.hh,v 1.6.2.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4CashKarpRKF45.hh,v 1.7 2001/07/11 09:59:06 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4CashKarpRKF45
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ChordFinder.hh,v 1.6.2.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ChordFinder.hh,v 1.8 2001/08/16 23:54:15 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ChordFinder
@@ -84,6 +84,9 @@ class G4ChordFinder
inline G4MagInt_Driver* GetIntegrationDriver();
// Access and set Driver.
inline void ResetStepEstimate();
// Clear internal state (last step estimate)
protected: // .........................................................
inline G4bool AcceptableMissDist(G4double dChordStep) const;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ChordFinder.icc,v 1.2.4.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ChordFinder.icc,v 1.4 2001/08/16 23:54:51 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// G4ChordFinder inline implementations
//
@@ -73,3 +73,10 @@ void G4ChordFinder::SetDeltaChord(G4double newval)
{
fDeltaChord=newval;
}
// ......................................................................
inline
void G4ChordFinder::ResetStepEstimate()
{
fLastStepEstimate_Unconstrained = DBL_MAX;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ClassicalRK4.hh,v 1.4.4.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ClassicalRK4.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ClassicalRK4
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Class describing the DELPHI magnetic field. This axial symmetry
// field mainly directed along Z axis. The function MagneticField(yTrack,B)
// calculates the magnetic induction vector B in point corresponding to
// yTrack according to parametrization given in:
// P.Billoir, Precise tracking in a quasi-honogeneous magnetic field, DELPHI
// 87-6 PROG 65, 3 February 1987
//
// 3.2.97 V. Grichine
#ifndef G4DELPHIMAGFIELD_HH
#define G4DELPHIMAGFIELD_HH
#include "globals.hh"
#include "G4MagneticField.hh"
#include "G4Mag_EqRhs.hh"
class G4DELPHIMagField : public G4MagneticField
{
public:
G4DELPHIMagField() ;
~G4DELPHIMagField() ;
void GetFieldValue(const G4double yTrack[] ,
G4double B[] ) const ;
protected:
private:
} ;
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ElectroMagneticField.hh,v 1.4.4.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ElectroMagneticField.hh,v 1.6 2001/11/08 17:31:06 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ElectroMagneticField
@@ -52,7 +52,7 @@ class G4ElectroMagneticField : public G4MagneticField
G4ElectroMagneticField& operator = (const G4ElectroMagneticField &);
// Copy constructor & assignment operators.
virtual void GetFieldValue(const G4double Point[3],
virtual void GetFieldValue(const G4double Point[4],
G4double *Bfield ) const = 0;
};
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EqMagElectricField.hh,v 1.5.2.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EqMagElectricField.hh,v 1.6 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4EqMagElectricField
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EquationOfMotion.hh,v 1.4.4.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EquationOfMotion.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4EquationOfMotion
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EquationOfMotion.icc,v 1.4.4.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EquationOfMotion.icc,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ExplicitEuler.hh,v 1.4.4.1 2001/06/28 19:08:13 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ExplicitEuler.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ExplicitEuler
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Field.hh,v 1.4.4.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Field.hh,v 1.6 2001/11/08 17:31:07 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4Field
@@ -43,7 +43,7 @@ class G4Field
{
public: // with description
virtual void GetFieldValue( const double Point[3],
virtual void GetFieldValue( const double Point[4],
double *Bfield ) const = 0;
G4Field(){;}
virtual ~G4Field(){;}
@@ -55,3 +55,10 @@ class G4Field
#endif /* G4FIELD_HH */
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.hh,v 1.5.4.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4FieldManager.hh,v 1.7 2001/11/28 18:44:43 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4FieldManager
@@ -96,6 +96,10 @@ class G4FieldManager
inline void SetDeltaOneStep(G4double valueD1step);
inline void SetDeltaIntersection(G4double valueDintersection);
inline G4bool DoesFieldChangeEnergy();
inline void SetFieldChangesEnergy(G4bool value);
// For electric field this should be true
// For magnetic field this should be false
private:
G4FieldManager(const G4FieldManager&);
@@ -109,6 +113,7 @@ class G4FieldManager
G4bool fAllocatedChordFinder; // Did we used "new" to
// create fChordFinder ?
G4bool fFieldChangesEnergy;
// Values for the required accuracies
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.icc,v 1.3.4.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4FieldManager.icc,v 1.5 2001/11/28 18:44:43 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// G4FieldManager inline implementation
@@ -90,3 +90,9 @@ void G4FieldManager::SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep)
fDelta_One_Step_Value= valDeltaOneStep;
fDelta_Intersection_Val = 0.4 * fDelta_One_Step_Value;
}
inline G4bool G4FieldManager::DoesFieldChangeEnergy()
{ return fFieldChangesEnergy;}
inline void G4FieldManager::SetFieldChangesEnergy(G4bool value)
{ fFieldChangesEnergy = value; }
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.hh,v 1.6.2.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4FieldTrack.hh,v 1.8 2001/10/25 17:02:16 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4FieldTrack
@@ -113,7 +113,7 @@ class G4FieldTrack
// Needed and should be used only for RK integration driver
enum { ncompSVEC = 12 };
inline void DumpToArray(G4double valArr[ncompSVEC]) const;
inline void LoadFromArray(G4double valArr[ncompSVEC]);
inline void LoadFromArray(const G4double valArr[ncompSVEC]);
friend G4std::ostream&
operator<<( G4std::ostream& os, G4FieldTrack& SixVec);
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.icc,v 1.7.2.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4FieldTrack.icc,v 1.9 2001/10/25 17:02:16 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "PhysicalConstants.h"
@@ -261,7 +261,7 @@ void G4FieldTrack::DumpToArray(G4double valArr[ncompSVEC] ) const
// note that momentum direction must-be/is normalised
inline
void G4FieldTrack::LoadFromArray(G4double valArr[ncompSVEC])
void G4FieldTrack::LoadFromArray(const G4double valArr[ncompSVEC])
{
SixVector[0]=valArr[0];
SixVector[1]=valArr[1];
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Class describing magnetic field parametrised by harmonic polynom up to
// 3rd order. The function MagneticField(yTrack,B) calculates the magnetic field
// induction vector B for the trajectory point yTrack according to formula given
// in: M.Metcalf, Analysis of the SFM Field, OM Development Note AP-10 (revised)
// 09.01.1974
//
// 3.2.97 V.Grichine
#ifndef G4HARMONICPOLMAGFIELD_HH
#define G4HARMONICPOLMAGFIELD_HH
#include "globals.hh"
#include "G4MagneticField.hh"
#include "G4Mag_EqRhs.hh"
class G4HarmonicPolMagField : public G4MagneticField
{
public:
G4HarmonicPolMagField() ;
~G4HarmonicPolMagField() ;
void GetFieldValue(const G4double yTrack[] ,
G4double B[] ) const ;
protected:
private:
} ;
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixExplicitEuler.hh,v 1.5.4.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixExplicitEuler.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4HelixExplicitEuler
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixHeum.hh,v 1.5.4.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixHeum.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4HelixHeum
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixImplicitEuler.hh,v 1.5.4.1 2001/06/28 19:08:14 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixImplicitEuler.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4HelixImplicitEuler
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixSimpleRunge.hh,v 1.4.4.1 2001/06/28 19:08:15 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixSimpleRunge.hh,v 1.5 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// W. Wander <wwc@mit.edu> 03/12/98
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ImplicitEuler.hh,v 1.3.4.1 2001/06/28 19:08:15 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ImplicitEuler.hh,v 1.4 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Class describing line current magnetic field.
// fFieldConstant determines the coefficient in the field law.
// The line current is directed along Z axis and crosses the XY plane in the point
// (0,0) .
//
// 3.2.97 V. Grichine
#ifndef G4LINECURRENTMAGFIELD_HH
#define G4LINECURRENTMAGFIELD_HH
#include "globals.hh"
#include "G4MagneticField.hh"
#include "G4Mag_EqRhs.hh"
class G4LineCurrentMagField : public G4MagneticField
{
public:
G4LineCurrentMagField(G4double pFieldConstant) ;
~G4LineCurrentMagField() ;
void GetFieldValue(const G4double yTrack[] ,
G4double B[] ) const ;
protected:
private:
G4double fFieldConstant ;
} ;
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LineSection.hh,v 1.4.4.1 2001/06/28 19:08:15 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LineSection.hh,v 1.7 2001/12/05 16:40:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4LineSection
@@ -49,22 +49,19 @@ class G4LineSection
G4LineSection( const G4ThreeVector& PntA, const G4ThreeVector& PntB );
G4double Dist( G4ThreeVector OtherPnt ) const;
G4double InvsqDistAB() const;
G4double GetABdistanceSq() const { return fABdistanceSq ; }
static G4double Distline( const G4ThreeVector& OtherPnt,
const G4ThreeVector& LinePntA,
const G4ThreeVector& LinePntB );
private:
G4ThreeVector EndpointA;
G4ThreeVector EndpointA;
G4ThreeVector VecAtoB;
G4double inverse_square_distAB;
G4double fABdistanceSq ;
};
inline
G4double G4LineSection::InvsqDistAB() const
{
return inverse_square_distAB;
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagErrorStepper.hh,v 1.7.4.1 2001/06/28 19:08:15 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagErrorStepper.hh,v 1.8 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4MagErrorStepper
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagErrorStepper.icc,v 1.7.4.1 2001/06/28 19:08:15 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagErrorStepper.icc,v 1.8 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
inline
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagHelicalStepper.hh,v 1.6.2.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagHelicalStepper.hh,v 1.7 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4MagHelicalStepper
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagHelicalStepper.icc,v 1.4.4.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagHelicalStepper.icc,v 1.5 2001/07/11 09:59:08 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// linear Step in regions of no field
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorDriver.hh,v 1.7.4.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagIntegratorDriver.hh,v 1.10 2001/11/09 19:17:20 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4MagInt_Driver
@@ -131,13 +131,17 @@ class G4MagInt_Driver
inline G4int GetMaxNoSteps() const;
inline void SetMaxNoSteps( G4int val);
// Modify and Get the Maximum number of Steps that can be
// taken for the integration of a single segment -
// (ie a single call to AccurateAdvance).
public: // without description
inline void SetHmin(G4double newval);
inline void SetVerboseLevel( int newLevel);
inline G4double GetVerboseLevel() const;
protected:
protected: // without description
void WarnSmallStepSize( G4double hnext, G4double hstep,
G4double h, G4double xDone,
G4int noSteps);
@@ -148,6 +152,31 @@ class G4MagInt_Driver
G4int debugFlag);
// Issue warnings for undesirable situations
void PrintStatus( const G4double* StartArr,
G4double xstart,
const G4double* CurrentArr,
G4double xcurrent,
G4double requestStep,
G4int subStepNo);
void PrintStatus( const G4FieldTrack& StartFT,
const G4FieldTrack& CurrentFT,
G4double requestStep,
G4int subStepNo);
void PrintStat_Aux( const G4FieldTrack& aFieldTrack,
G4double requestStep,
G4double actualStep,
G4int subStepNo);
// Verbose output for debugging
#ifdef QUICK_ADV_TWO
G4bool QuickAdvance( G4double yarrin[], // In
const G4double dydx[],
G4double hstep,
G4double yarrout[], // Out
G4double& dchord_step, // Out
G4double& dyerr ); // in length
#endif
private:
G4MagInt_Driver(const G4MagInt_Driver&);
@@ -174,6 +203,9 @@ class G4MagInt_Driver
static const G4double max_stepping_increase;
static const G4double max_stepping_decrease;
// Maximum stepsize increase/decrease factors.
G4int fVerboseLevel;
// Verbosity level for printing (debug, ..)
};
#include "G4MagIntegratorDriver.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorDriver.icc,v 1.5.4.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagIntegratorDriver.icc,v 1.7 2001/10/25 09:11:09 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
inline
@@ -145,3 +145,16 @@ void G4MagInt_Driver::GetDerivatives(const G4FieldTrack y_curr, // const, INput
y_curr.DumpToArray( tmpValArr );
pIntStepper -> RightHandSide( tmpValArr , dydx );
}
inline
G4double G4MagInt_Driver::GetVerboseLevel() const
{
return fVerboseLevel;
}
inline
void G4MagInt_Driver::SetVerboseLevel( int newLevel)
{
fVerboseLevel= newLevel;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorStepper.hh,v 1.6.2.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagIntegratorStepper.hh,v 1.7 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4MagIntegratorStepper
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorStepper.icc,v 1.4.4.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagIntegratorStepper.icc,v 1.5 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
inline
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_EqRhs.hh,v 1.5.4.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Mag_EqRhs.hh,v 1.6 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4Mag_EqRhs
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_SpinEqRhs.hh,v 1.5.2.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Mag_SpinEqRhs.hh,v 1.7 2001/07/17 02:13:43 gum Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4Mag_SpinEqRhs
@@ -35,7 +35,7 @@
// History:
// - Created: J.Apostolakis, P.Gumplinger - February 8th, 1999.
// - Modified: P.Gumplinger - April 11th, 2001.
// - Modified: D. Cote-Ahern, P.Gumplinger - April 11th, 2001.
#ifndef G4MAG_SPIN_EQRHS
#define G4MAG_SPIN_EQRHS
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_UsualEqRhs.hh,v 1.3.4.1 2001/06/28 19:08:16 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Mag_UsualEqRhs.hh,v 1.4 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4Mag_UsualEqRhs
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagneticField.hh,v 1.6.2.1 2001/06/28 19:08:17 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagneticField.hh,v 1.10 2001/12/04 17:47:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4MagneticField
@@ -39,6 +39,7 @@
#ifndef G4MAGNETIC_FIELD_DEF
#define G4MAGNETIC_FIELD_DEF
#include "G4Types.hh"
#include "G4Field.hh"
class G4MagneticField : public G4Field
@@ -53,8 +54,8 @@ class G4MagneticField : public G4Field
G4MagneticField& operator = (const G4MagneticField &);
// Copy constructor & assignment operator.
virtual void GetFieldValue( const double Point[3],
double *Bfield ) const = 0;
virtual void GetFieldValue( const G4double Point[4],
G4double *Bfield ) const = 0;
};
// Inline implementations
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Class for creation of quadrupole magnetic field
// fGradient - is gardient value for quadrupole magnetic lense. Then the magnetic
// field components are:
// Bx = B[0] = fGradient*X ,
// By = B[1] = fGradient*Y ,
// Bz = B[2] = 0 .
// Here X,Y,Z are the coordinates of a space point of interest.
//
// 3.2.97 V.Grichine
#ifndef G4QUADRUPOLEMAGFIELD_HH
#define G4QUADRUPOLEMAGFIELD_HH
#include "globals.hh"
#include "G4MagneticField.hh"
#include "G4Mag_EqRhs.hh"
class G4QuadrupoleMagField : public G4MagneticField
{
public:
G4QuadrupoleMagField(G4double pGradient) ;
~G4QuadrupoleMagField() ;
void GetFieldValue(const G4double yTrack[] ,
G4double B[] ) const ;
protected:
private:
G4double fGradient ;
} ;
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4RKG3_Stepper.hh,v 1.7.2.1 2001/06/28 19:08:17 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4RKG3_Stepper.hh,v 1.8 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4RKG3_Stepper
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SimpleHeum.hh,v 1.4.4.1 2001/06/28 19:08:17 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4SimpleHeum.hh,v 1.5 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4SimpleHeum
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SimpleRunge.hh,v 1.4.4.1 2001/06/28 19:08:17 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4SimpleRunge.hh,v 1.5 2001/07/11 09:59:09 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4SimpleRunge
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UniformElectricField.hh,v 1.4.4.1 2001/06/28 19:08:17 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UniformElectricField.hh,v 1.6 2001/12/04 17:35:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4UniformElectricField
@@ -56,14 +56,13 @@ class G4UniformElectricField : public G4ElectroMagneticField
G4double vTheta,
G4double vPhi ) ;
~G4UniformElectricField() ;
virtual ~G4UniformElectricField() ;
G4UniformElectricField(const G4UniformElectricField &p);
G4UniformElectricField& operator = (const G4UniformElectricField &p);
// Copy constructor and assignment operator
void GetFieldValue(const G4double position[] ,
G4double B[] ) const ;
virtual void GetFieldValue(const G4double pos[4], G4double *field) const;
private:
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UniformMagField.hh,v 1.4.4.1 2001/06/28 19:08:17 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UniformMagField.hh,v 1.7 2001/12/04 17:35:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4UniformMagField
@@ -56,14 +56,14 @@ class G4UniformMagField : public G4MagneticField
G4double vTheta,
G4double vPhi ) ;
~G4UniformMagField() ;
virtual ~G4UniformMagField() ;
G4UniformMagField(const G4UniformMagField &p);
G4UniformMagField& operator = (const G4UniformMagField &p);
// Copy constructor and assignment operator.
void GetFieldValue(const G4double yTrack[3] ,
G4double *MagField) const ;
virtual void GetFieldValue(const G4double yTrack[4],
G4double *MagField) const ;
void SetFieldValue(const G4ThreeVector& newFieldValue);
@@ -76,3 +76,5 @@ class G4UniformMagField : public G4MagneticField
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4CashKarpRKF45.cc,v 1.8.2.1 2001/06/28 19:08:18 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4CashKarpRKF45.cc,v 1.10 2001/11/21 17:56:18 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
// order method (giving fifth-order accuracy) for the solution
@@ -51,6 +51,7 @@ G4CashKarpRKF45::G4CashKarpRKF45(G4EquationOfMotion *EqRhs, G4int numberOfVariab
ak4 = new G4double[fNumberOfVariables] ;
ak5 = new G4double[fNumberOfVariables] ;
ak6 = new G4double[fNumberOfVariables] ;
ak7 = 0;
yTemp = new G4double[fNumberOfVariables] ;
yIn = new G4double[fNumberOfVariables] ;
@@ -77,7 +78,7 @@ G4CashKarpRKF45::~G4CashKarpRKF45()
delete[] ak4;
delete[] ak5;
delete[] ak6;
delete[] ak7;
// delete[] ak7;
delete[] yTemp;
delete[] yIn;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ChordFinder.cc,v 1.18.2.1 2001/06/28 19:08:18 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ChordFinder.cc,v 1.24 2001/11/30 17:36:18 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// 25.02.97 John Apostolakis, design and implimentation
@@ -94,9 +94,9 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
G4double dyErr;
G4FieldTrack yEnd( yCurrent);
G4double startCurveLen= yCurrent.GetCurveLength();
G4bool dbg= false;
#ifdef G4VERBOSE
#ifdef G4DEBUG_FIELD
static G4bool dbg= false;
if( dbg )
G4cerr << "Entered AdvanceChordLimited with:\n yCurrent: " << yCurrent
<< " and initial Step=stepMax=" << stepMax << " mm. " << G4endl;
@@ -114,7 +114,7 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
{
// Advance more accurately to "end of chord"
good_advance = fIntgrDriver->AccurateAdvance(yCurrent, stepPossible, epsStep);
#ifdef G4VERBOSE
#ifdef G4DEBUG_FIELD
if (dbg) G4cerr << "Accurate advance to end of chord attemped"
<< "with result " << good_advance << G4endl ;
#endif
@@ -124,7 +124,7 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
}
}
#ifdef G4VERBOSE
#ifdef G4DEBUG_FIELD
if( dbg ) G4cerr << "Exiting FindNextChord Limited with:\n yCurrent: "
<< yCurrent<< G4endl;
#endif
@@ -212,7 +212,7 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
G4cout << " d-";
G4cout.precision(5);
G4cout << " new_step= " << G4std::setw(10) << fLastStepEstimate_Unconstrained
<< " new_step_constr= " << G4std::setw(10) << stepTrial << endl;
<< " new_step_constr= " << G4std::setw(10) << stepTrial << G4endl;
#endif
noTrials++;
}
@@ -220,8 +220,9 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
stepOfLastGoodChord = stepTrial;
#ifdef TEST_CHORD_PRINT
G4cout << "ChordF/FindNextChord: NoTrials= " << noTrials
<< " StepForGoodChord=" << G4std::setw(10) << stepTrial << endl;
if( dbg )
G4cout << "ChordF/FindNextChord: NoTrials= " << noTrials
<< " StepForGoodChord=" << G4std::setw(10) << stepTrial << G4endl;
#endif
yEnd= yCurrent;
@@ -230,12 +231,11 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
// ----------------------------------------------------------------------------
#if 0
// First debug print // older OPTIONAL code
// #ifdef G4VERBOSE
if( dbg ) {
G4cerr << "Returned from QuickAdvance with: yCur=" << yCurrent <<G4endl;
G4cerr << " dChordStep= "<< dChordStep <<" dyErr=" << dyErr << G4endl;
}
if( dbg ) {
G4cerr << "Returned from QuickAdvance with: yCur=" << yCurrent <<G4endl;
G4cerr << " dChordStep= "<< dChordStep <<" dyErr=" << dyErr << G4endl;
}
#endif
// ----------------------------------------------------------------------------
@@ -322,21 +322,19 @@ G4FieldTrack G4ChordFinder::ApproxCurvePointV(
// const
G4double integrationInaccuracyLimit= G4std::max( perMillion, 0.5*eps_step );
if( curve_length < ABdist * (1. - integrationInaccuracyLimit) ){
// #ifdef G4DEBUG
#ifdef G4DEBUG_FIELD
G4cerr << " Warning in G4ChordFinder::ApproxCurvePoint: " << G4endl <<
" The two points are further apart than the curve length " << G4endl <<
" Dist = " << ABdist <<
" curve length = " << curve_length
<< " relativeDiff = " << (curve_length-ABdist)/ABdist
<< G4endl;
// #endif
if( curve_length < ABdist * (1. - 10*eps_step) ) {
// #ifdef G4DEBUG
G4cerr << " ERROR: the size of the above difference exceeds allowed limits. Aborting."
<< G4endl;
// #endif
G4Exception("G4ChordFinder::ApproxCurvePoint> Unphysical curve length.");
}
#endif
// Take default corrective action:
// --> adjust the maximum curve length.
// NOTE: this case only happens for relatively straight paths.
@@ -348,18 +346,22 @@ G4FieldTrack G4ChordFinder::ApproxCurvePointV(
if ( ABdist > 0.0 ){
AE_fraction = ChordAE_Vector.mag() / ABdist;
}else{
G4cerr << " Error in G4ChordFinder::ApproxCurvePoint: A and B are the same point\n" <<
" Chord AB length = " << ChordAE_Vector.mag() << G4endl << G4endl;
AE_fraction = 0.5; // Guess .. ?;
#ifdef G4DEBUG_FIELD
G4cout << "Warning in G4ChordFinder::ApproxCurvePoint: A and B are the same point\n" <<
" Chord AB length = " << ChordAE_Vector.mag() << G4endl << G4endl;
#endif
}
if( (AE_fraction> 1.0 + perMillion) || (AE_fraction< 0.) ){
#ifdef G4DEBUG_FIELD
G4cerr << " G4ChordFinder::ApproxCurvePointV: Warning: Anomalous condition:AE > AB or AE/AB <= 0 " << G4endl <<
" AE_fraction = " << AE_fraction << G4endl <<
" Chord AE length = " << ChordAE_Vector.mag() << G4endl <<
" Chord AB length = " << ABdist << G4endl << G4endl;
G4cerr << " OK if this condition occurs after a recalculation of 'B'" << G4endl
<< " Otherwise it is an error. " << G4endl ;
#endif
// This course can now result if B has been re-evaluated,
// without E being recomputed (1 July 99)
// In this case this is not a "real error" - but it undesired
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ClassicalRK4.cc,v 1.3.4.1 2001/06/28 19:08:18 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ClassicalRK4.cc,v 1.4 2001/07/11 09:59:10 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4ClassicalRK4.hh"
#include "G4ThreeVector.hh"
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4DELPHIMagField.hh"
#include "globals.hh"
#include "geomdefs.hh"
G4DELPHIMagField::G4DELPHIMagField()
{
;
}
////////////////////////////////////////////////////////////////////////
G4DELPHIMagField::~G4DELPHIMagField()
{
;
}
///////////////////////////////////////////////////////////////////////
void
G4DELPHIMagField::GetFieldValue( const G4double yTrack[7],
G4double B[3] ) const
{
G4int i, n = 8 ;
G4double a = 0.001 ; // mm -> m
G4double x = a*yTrack[0], y = a*yTrack[1], z = a*yTrack[2] ;
G4double x2 = x*x, y2 = y*y, z2 = z*z, r2 = x2 + y2 ;
G4double r4 = r2*r2, z4 = z2*z2, r6 = r4*r2, z6 = z4*z2 ;
G4double r8 = r4*r4, z8 = z4*z4, r10 = r8*r2, z10 = z8*z2 ;
G4double rz = z*sqrt(r2), r = sqrt(r2+a*a) ;
G4double Br ;
G4double P[8], Q[8] ;
static G4double c[8] = {
-9.26e-5, -3.51e-5, 2.94e-6, -1.10e-6,
6.25e-8, -1.77e-8, -6.88e-10, -7.52e-11
} ;
P[0] = 2*rz ;
P[1] = 4*rz*(r2 - 4.0*z2/3.0) ;
P[2] = 6*rz*(r4 - 4*r2*z2 + 1.6*z4) ;
P[3] = 8*rz*(r6 - 8*r4*z2 + 9.6*r2*z4 - 64.0*z6/35.0) ;
P[4] = 10*rz*(r8 - 40.0*r6*z2/3.0 + 32*r4*z4 - 128.0*r2*z6/7.0 + 128.0*z8/63.0);
P[5] = 0 ;
P[6] = 0 ;
P[7] = 0 ;
Q[0] = r2 - 2*z2 ;
Q[1] = r4 - 8*r2*z2 + 8.0*z4/3.0 ;
Q[2] = r6 - 18*r4*z2 + 24*r2*z4 - 3.2*z6 ;
Q[3] = r8 - 32*r6*z2 + 96*r4*z4 - 51.2*r2*z6 +128.0*z8/35.0 ;
Q[4] = r10 - 50*r8*z2 + 800.0*r6*z4/3.0 - 320*r4*z6
+ 640.0*r2*z8/7.0 - 256.0*z10/63.0 ;
Q[5] = 0 ;
Q[6] = 0 ;
Q[7] = 0 ;
Br = 0 ;
B[2] = 1.2*tesla ; // the principal Bz value of DELPHI detector
for(i=0;i<n;i++)
{
Br += c[i]*P[i] ;
B[2] += c[i]*Q[i] ;
}
B[0] = Br*x/r ;
B[1] = Br*y/r ;
return ;
}
// -----------------------------------------------------------------
@@ -54,10 +54,14 @@ G4EqMagElectricField::EvaluateRhsGivenB(const G4double y[],
G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
G4double cof2 = sqrt( pSquared + fMassCof )/c_light ;
G4double Energy = sqrt( pSquared + fMassCof );
G4double cof2 = Energy/c_light ;
G4double pModuleInverse = 1.0/sqrt(pSquared) ;
// G4double inverse_velocity = Energy * c_light * pModuleInverse;
G4double inverse_velocity = Energy * pModuleInverse / c_light;
G4double cof1 = fElectroMagCof*pModuleInverse ;
// G4double vDotE = y[3]*Field[3] + y[4]*Field[4] + y[5]*Field[5] ;
@@ -72,5 +76,11 @@ G4EqMagElectricField::EvaluateRhsGivenB(const G4double y[],
dydx[4] = cof1*(cof2*Field[4] + (y[5]*Field[0] - y[3]*Field[2])) ;
dydx[5] = cof1*(cof2*Field[5] + (y[3]*Field[1] - y[4]*Field[0])) ;
// Lab Time of flight
dydx[7] = inverse_velocity;
return ;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EquationOfMotion.cc,v 1.3.4.1 2001/06/28 19:08:18 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EquationOfMotion.cc,v 1.5 2001/11/09 20:39:07 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4EquationOfMotion.hh"
@@ -36,8 +36,16 @@ G4EquationOfMotion::RightHandSide( const G4double y[],
G4double dydx[] ) const
{
G4double Field[G4maximum_number_of_field_components];
G4double PositionAndTime[4];
GetFieldValue(y, Field) ;
// Position
PositionAndTime[0] = y[0];
PositionAndTime[1] = y[1];
PositionAndTime[2] = y[2];
// Global Time
PositionAndTime[3] = y[7]; // See G4FieldTrack::LoadFromArray
GetFieldValue(PositionAndTime, Field) ;
EvaluateRhsGivenB( y, Field, dydx );
}
@@ -46,7 +54,16 @@ G4EquationOfMotion::EvaluateRhsReturnB( const G4double y[],
G4double dydx[],
G4double Field[] ) const
{
GetFieldValue(y, Field) ;
G4double PositionAndTime[4];
// Position
PositionAndTime[0] = y[0];
PositionAndTime[1] = y[1];
PositionAndTime[2] = y[2];
// Global Time
PositionAndTime[3] = y[7]; // See G4FieldTrack::LoadFromArray
GetFieldValue(PositionAndTime, Field) ;
EvaluateRhsGivenB( y, Field, dydx );
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ExplicitEuler.cc,v 1.3.4.1 2001/06/28 19:08:18 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ExplicitEuler.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Explicit Euler: x_1 = x_0 + h * dx_0
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.cc,v 1.4.2.1 2001/06/28 19:08:18 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4FieldManager.cc,v 1.6 2001/11/28 18:44:43 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4FieldManager.hh"
@@ -33,6 +33,8 @@ G4FieldManager::G4FieldManager()
fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
fFieldChangesEnergy= false;
}
G4FieldManager::G4FieldManager(G4MagneticField *detectorField)
@@ -43,6 +45,8 @@ G4FieldManager::G4FieldManager(G4MagneticField *detectorField)
fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
fFieldChangesEnergy= false;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.cc,v 1.3.2.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4FieldTrack.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4FieldTrack.hh"
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4HarmonicPolMagField.hh"
#include "globals.hh"
#include "geomdefs.hh"
G4HarmonicPolMagField::G4HarmonicPolMagField()
{
;
}
/////////////////////////////////////////////////////////////////////////
G4HarmonicPolMagField::~G4HarmonicPolMagField()
{
;
}
/////////////////////////////////////////////////////////////////////////
void
G4HarmonicPolMagField::GetFieldValue(const G4double yTrack[7],
G4double B[3] ) const
{
G4int i ;
G4double a = 1.00 ; // mm -> m
G4double x = a*yTrack[0], y = a*yTrack[1], z = a*yTrack[2] ;
G4double x2 = x*x, y2 = y*y, z2 = z*z ;
G4double x3 = x2*x, y3 = y2*y, z3 = z2*z ;
G4double xy = x*y, xz = x*z, yz = y*z, xyz = x*y*z ;
static G4double
c[24] = {
0.010, 0.010, 0.010, // 3(0)
0.0001, 0.0001, 0.0001, 0.0001, 0.0001, // 5(1)
0.00001, 0.00001, 0.00001, 0.00001, 0.00001, 0.00001, 0.00001, // 7(2)
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.0000001, 0.0000001, 0.0000001 // 9(3)
} ; // total : 24
// for(i=0;i<24;i++)
// {
// c[i] = 1.0*c[i] ;
// }
B[0] = c[1]
-2*c[3]*x + c[4]*z +c[6]*y -2*c[7]*x
-6*c[8]*xz + c[9]*(z2-x2) -2*c[10]*xy + c[11]*yz - 2*c[12]*xz
+c[13]*(y2-x2) - 6*c[14]*xy
-4*c[15]*(3*x*z2-x3) +c[16]*(z3-3*x2*z) - 6*c[17]*xyz +c[18]*y*(z2-x2)
-2*c[19]*(x*z2+x*y2-2*x3/3) + c[20]*z*(y2-x2) - 6*c[21]*xyz
+c[22]*(y3-3*x2*y) - 4*c[23]*(3*x*y2-x3) ;
B[1] = c[2]
+c[5]*z + c[6]*x + 2*c[7]*y
+c[10]*(z2-x2) + c[11]*xz +2*c[12]*yz +2*c[13]*xy + 3*c[14]*(y2-x2)
+c[17]*(z3-3*x2*z) + c[18]*(x*z2-x3/3) +2*c[19]*y*(z2-x2)
+2*c[20]*xyz
+3*c[21]*z*(y2-x2) + c[22]*(3*x*y2-x3) + 4*c[23]*(y3-3*x2*y) ;
B[2] = c[0]
+c[3]*z + c[4]*x + c[5]*y
+3*c[8]*(z2-x2) + 2*c[9]*xz + 2*c[10]*yz + c[11]*xy + c[12]*(y2-x2)
+4*c[15]*(z3-3*x2*z) + c[16]*(3*x*z2-x3) + 3*c[17]*(y*z2-x2*y)
+2*c[18]*xyz
+2*c[19]*z*(y2-x2) + c[20]*(x*y2-x3/3) + c[21]*(y3-3*x2*y) ;
for(i=0;i<3;i++)
{
B[i] = 0.1*B[i] ;
}
return ;
}
// -----------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixExplicitEuler.cc,v 1.3.4.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixExplicitEuler.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4HelixExplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixHeum.cc,v 1.3.4.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixHeum.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4HelixHeum.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixImplicitEuler.cc,v 1.3.4.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixImplicitEuler.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4HelixImplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HelixSimpleRunge.cc,v 1.4.4.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HelixSimpleRunge.cc,v 1.5 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4HelixSimpleRunge.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ImplicitEuler.cc,v 1.3.4.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ImplicitEuler.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Implicit Euler:
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4LineCurrentMagField.hh"
#include "globals.hh"
#include "geomdefs.hh"
G4LineCurrentMagField::G4LineCurrentMagField(G4double pFieldConstant)
{
fFieldConstant = pFieldConstant ;
}
////////////////////////////////////////////////////////////////////////
G4LineCurrentMagField::~G4LineCurrentMagField()
{
;
}
///////////////////////////////////////////////////////////////////////////
void
G4LineCurrentMagField::GetFieldValue( const G4double yTrack[7],
G4double B[3] ) const
{
// G4double fFieldConstant = 100 ;
G4double a = 1.00*mm ; // mm -> m
G4double x = a*yTrack[0], y = a*yTrack[1] ;
G4double x2 = x*x, y2 = y*y, r2 = x2 + y2 ;
G4double r = sqrt(r2+a*a) ;
G4double Br = fFieldConstant/r;
B[0] = -Br*y/r ;
B[1] = Br*x/r ;
B[2] = 0 ;
return ;
}
// -----------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LineSection.cc,v 1.4.4.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LineSection.cc,v 1.6 2001/12/04 15:10:01 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// typedef double G4double;
@@ -33,6 +33,8 @@ G4LineSection::G4LineSection( const G4ThreeVector& PntA,
: EndpointA(PntA),
VecAtoB(PntB-PntA)
{
fABdistanceSq = VecAtoB.mag2() ;
/*
G4double distABsquared = VecAtoB.mag2() ;
if ( distABsquared == 0.0)
{
@@ -42,6 +44,7 @@ G4LineSection::G4LineSection( const G4ThreeVector& PntA,
{
inverse_square_distAB=1.0 / distABsquared ;
}
*/
}
G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
@@ -57,31 +60,36 @@ G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
// Determine Projection(AZ on AB) / Length(AB)
//
unit_projection= inner_prod * InvsqDistAB();
if( (0. <= unit_projection ) && (unit_projection <= 1.0 ) )
if( fABdistanceSq != 0.0 )
{
dist_sq= sq_VecAZ - unit_projection * inner_prod ;
}
else
{
// unit_projection= inner_prod * InvsqDistAB();
unit_projection = inner_prod/fABdistanceSq;
if( (0. <= unit_projection ) && (unit_projection <= 1.0 ) )
{
dist_sq= sq_VecAZ - unit_projection * inner_prod ;
}
else
{
// The perpendicular from the point to the line AB meets the line
// in a point outside the line segment!
if( unit_projection < 0. )
{
// A is the closest point
if( unit_projection < 0. ) // A is the closest point
{
dist_sq= sq_VecAZ;
}
else
{
// B is the closest point
}
else // B is the closest point
{
G4ThreeVector EndpointB = EndpointA + VecAtoB;
G4ThreeVector VecBZ = OtherPnt - EndpointB;
dist_sq = VecBZ.mag2();
}
}
}
}
else
{
dist_sq = (OtherPnt - EndpointA).mag2() ;
}
if( dist_sq < 0.0 ) dist_sq = 0.0 ;
return sqrt(dist_sq) ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagErrorStepper.cc,v 1.8.4.1 2001/06/28 19:08:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagErrorStepper.cc,v 1.9 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4MagErrorStepper.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagHelicalStepper.cc,v 1.7.2.1 2001/06/28 19:08:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagHelicalStepper.cc,v 1.8 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4MagHelicalStepper.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorDriver.cc,v 1.14.4.1 2001/06/28 19:08:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagIntegratorDriver.cc,v 1.20 2001/11/21 16:43:16 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//
@@ -49,14 +49,15 @@ const G4double G4MagInt_Driver::max_stepping_decrease = 0.1;
// The (default) maximum number of steps is Base divided by the order of Stepper
//
const G4int G4MagInt_Driver::fMaxStepBase = 5000;
const G4int G4MagInt_Driver::fMaxStepBase = 500; // Was 5000
// Constructor
//
G4MagInt_Driver::G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4int numComponents)
: nvar(numComponents)
: nvar(numComponents),
fVerboseLevel(0)
{
RenewStepperAndAdjust( pItsStepper );
hminimum_val= hminimum;
@@ -69,6 +70,9 @@ G4MagInt_Driver::~G4MagInt_Driver()
{
}
// To add much printing for debugging purposes, uncomment this:
// #define G4DEBUG_FIELD 1
G4bool
G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
G4double hstep,
@@ -84,18 +88,23 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
{
G4int nstp, i;
static G4int dbg=0;
G4double x, hnext, hdid, h ;
#ifdef G4DEBUG
G4int no_warnings=0;
#ifdef G4DEBUG_FIELD
static G4int dbg=0;
dbg=1;
fVerboseLevel=2;
#endif
// G4double yscal[ncompSVEC];
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
G4double ystart[G4FieldTrack::ncompSVEC];
G4double ystart[G4FieldTrack::ncompSVEC], yEnd[G4FieldTrack::ncompSVEC];
G4double x1, x2;
G4bool succeeded = true, lastStepSucceeded;
G4FieldTrack yStartFT(y_current);
// Assume that hstep > 0
// ystart = y_current.PosVelVec();
@@ -132,68 +141,133 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
// could otherwise force lots of small last steps.
}
// static G4int nStpPr=50; // For debug printing of integrations with many steps
// Perform the Integration
//
OneGoodStep(y,dydx,x,h,eps,hdid,hnext) ;
//--------------------------------------
//
lastStepSucceeded= (hdid == h);
// #ifdef G4DEBUG
if( h > Hmin() ){
OneGoodStep(y,dydx,x,h,eps,hdid,hnext) ;
//--------------------------------------
lastStepSucceeded= (hdid == h);
}else{
#if 0
OneGoodStep(y,dydx,x,h,2*eps,hdid,hnext) ;
//--------------------------------------
lastStepSucceeded= (hdid == h);
#else
G4FieldTrack yFldTrk( G4ThreeVector(0,0,0),
G4ThreeVector(0,0,0), 0., 0., 0., 0. );
G4double dchord_step, dyerr, dyerr_len; // Must figure what to do with these
yFldTrk.LoadFromArray(y);
yFldTrk.SetCurveLength( x );
// G4double s_start = yFldTrk.GetCurveLength();
QuickAdvance( yFldTrk, dydx, h, dchord_step, dyerr_len );
# ifdef G4DEBUG_FIELD
if(dbg>1) OneGoodStep(y,dydx,x,h,2*eps,hdid,hnext) ;
if(dbg>1) PrintStatus( ystart, x1, y, x, h, -nstp);
yFldTrk.DumpToArray(y);
if(dbg>1) PrintStatus( ystart, x1, y, x, h, nstp); // Only this
# endif
dyerr = dyerr_len / hstep;
hdid= h;
x += hdid;
// Compute suggested new step
hnext= ComputeNewStepSize( dyerr/eps, h);
lastStepSucceeded= (dyerr<= eps);
#endif
}
// #ifdef G4DEBUG_FIELD
if(lastStepSucceeded) noFullIntegr++ ; else noSmallIntegr++ ;
G4ThreeVector EndPos( y[0], y[1], y[2] );
#ifdef G4DEBUG_FIELD
if(nstp>nStpPr) {
G4cout << "hdid=" << hdid << "hnext =" << hnext << " " << endl;
PrintStatus( ystart, x1, y, x, h, nstp==nStpPr ? -nstp: nstp);
}
#endif
// Check the endpoint
G4double endPointDist= (EndPos-StartPos).mag();
if( endPointDist >= h*(1.+perMillion) ){
if( endPointDist >= hdid*(1.+perMillion) ){
noBadSteps ++;
// Issue a warning only for gross differences -
// we understand how small difference occur.
if( endPointDist >= h*(1.+perThousand) ){
WarnEndPointTooFar ( endPointDist, h, eps, dbg );
if( endPointDist >= hdid*(1.+perThousand) ){
#ifdef G4DEBUG_FIELD
WarnEndPointTooFar ( endPointDist, hdid, eps, dbg );
G4cerr << " Total steps: bad" << noBadSteps << " good " << noGoodSteps << endl;
// G4cerr << "Mid:EndPtFar> ";
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
// Potentially add as arguments: <dydx> - as Initial Force
#endif
no_warnings++;
}
noBadSteps ++;
} else { // ie (!dbg)
noGoodSteps ++;
}
// #endif
// Check the proposed next stepsize
if(fabs(hnext) <= Hmin())
{
#ifdef G4DEBUG_FIELD
// If simply a very small interval is being integrated, do not warn
if( (x < x2 * (1-eps) ) && // The last step can be small: it's OK
(fabs(hstep) > Hmin()) // and if we are asked, it's OK
// && (hnext < hstep * PerThousand )
)
// Issue WARNING
WarnSmallStepSize( hnext, hstep, h, x-x1, nstp );
else
succeeded = false; // Meaningful only if we break out of the loop.
){
// Issue WARNING
WarnSmallStepSize( hnext, hstep, h, x-x1, nstp );
// G4cerr << "Mid:SmallStep> ";
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
no_warnings++;
}
#endif
// else
// succeeded = false; // Meaningful only if we break out of the loop.
//
// lastStep = true; // Make this the last step ... Dubious now
lastStep = true; // ensure that this was the last step
// Make sure that the next step is at least Hmin.
h = Hmin();
}else{
h = hnext ;
}
h = hnext ;
}while (((nstp++)<=fMaxNoSteps) &&
(x < x2) // Have we reached the end ?
// --> a better test might be x-x2 > an_epsilon
}while ( ((nstp++)<=fMaxNoSteps)
&& (x < x2) // Have we reached the end ?
// --> a better test might be x-x2 > an_epsilon
&& (!lastStep)
);
succeeded= (x>=x2); // If it was a "forced" last step
for(i=0;i<nvar;i++) ystart[i] = y[i] ;
if(nstp > fMaxNoSteps){
WarnTooManyStep( x1, x2, x ); // Issue WARNING
succeeded = false;
}
for(i=0;i<nvar;i++) yEnd[i] = y[i] ;
// Put back the values.
y_current.LoadFromArray( ystart );
y_current.LoadFromArray( yEnd );
y_current.SetCurveLength( x );
if(nstp > fMaxNoSteps){
no_warnings++;
succeeded = false;
#ifdef G4DEBUG_FIELD
WarnTooManyStep( x1, x2, x ); // Issue WARNING
PrintStatus( yEnd, x1, y, x, hstep, -nstp);
#endif
}
#ifdef G4DEBUG_FIELD
if( no_warnings ){
G4cerr << " Exiting status: "
<< " no-steps " << nstp
<<endl;
PrintStatus( yEnd, x1, y, x, hstep, nstp);
}
#endif
return succeeded;
} // end of AccurateAdvance ...........................
@@ -204,15 +278,23 @@ G4MagInt_Driver::WarnSmallStepSize( G4double hnext, G4double hstep,
G4int nstp)
{
static G4int noWarningsIssued =0;
const G4int maxNoWarnings = 100;
if( noWarningsIssued < maxNoWarnings ){
G4cerr<< " Warning (G4MagIntegratorDriver): The stepsize for the "
<< " next iteration=" << hnext << " is too small - in Step number "
<< nstp << "." << G4endl;
G4cerr << " Requested step size was " << hstep << " ." << G4endl ;
G4cerr << " Previous step size was " << h << " ." << G4endl ;
const G4int maxNoWarnings = 10; // Number of verbose warnings
if( (noWarningsIssued < maxNoWarnings) || fVerboseLevel > 10 ){
G4cerr<< " Warning (G4MagIntegratorDriver::AccurateAdvance): The stepsize for the "
<< " next iteration=" << hnext << " is too small "
<< "- in Step number " << nstp << "." << G4endl;
G4cerr << " The minimum for the driver is " << Hmin() << G4endl ;
G4cerr << " Requested integr. length was " << hstep << " ." << G4endl ;
G4cerr << " The size of this sub-step was " << h << " ." << G4endl ;
G4cerr << " The integrations has already gone " << xDone << G4endl ;
}else{
G4cerr<< " G4MagInt_Driver: Too small 'next' step " << hnext
<< " step-no " << nstp ; // << G4setw(4)
G4cerr << " this sub-step " << h
<< " req_tot_len " << hstep
<< " done " << xDone
<< " min " << Hmin()
<< G4endl ;
}
noWarningsIssued++;
}
@@ -236,20 +318,22 @@ G4MagInt_Driver::WarnEndPointTooFar (G4double endPointDist,
G4double eps,
G4int dbg)
{
static G4double maxRelError= 0.0;
static G4double maxRelError= 0.0, maxRelError_last_printed=0.0;
G4bool isNewMax, prNewMax;
isNewMax = endPointDist > (1.0 + maxRelError) * h;
prNewMax = endPointDist > (1.0 + 1.05 * maxRelError) * h;
if( isNewMax )
maxRelError= endPointDist / h - 1.0;
if( prNewMax )
maxRelError_last_printed = maxRelError;
if( dbg
&& (h > kCarTolerance)
&& ( prNewMax || (endPointDist >= h*(1.+eps) ) )
&& ( (dbg>1) || prNewMax || (endPointDist >= h*(1.+eps) ) )
){
static G4int noWarnings = 0;
if( (noWarnings ++ < 10) || (dbg>1) ){
if( (noWarnings ++ < 10) || (dbg>2) ){
G4cerr << " Warning (G4MagIntegratorDriver): "
<< " The integration produced an endpoint which " << G4endl
<< " is further from the startpoint than the curve length." << G4endl;
@@ -258,26 +342,29 @@ G4MagInt_Driver::WarnEndPointTooFar (G4double endPointDist,
<< " curve length = " << h
<< " Difference (curveLen-endpDist)= " << (h - endPointDist)
<< " relative = " << (h-endPointDist) / h
<< " epsilon = " << eps
<< G4endl;
}else{
G4cerr << " EndpointDist = " << endPointDist
<< " curve length = " << h
<< " Diff (cl-ed)= " << (h - endPointDist)
G4cerr << " Warning:"
<< " dist_e= " << endPointDist
<< " h_step = " << h
<< " Diff (hs-ed)= " << (h - endPointDist)
<< " rel = " << (h-endPointDist) / h
<< " (from G4MagIntegratorDriver)" << G4endl;
<< " eps = " << eps
<< " (from G4MagInt_Driver)" << G4endl;
}
}
}
// ---------------------------------------------------------
void
G4MagInt_Driver::OneGoodStep( G4double y[],
G4MagInt_Driver::OneGoodStep( G4double y[], // InOut
const G4double dydx[],
G4double& x,
G4double& x, // InOut
G4double htry,
G4double eps_rel_max,
G4double& hdid,
G4double& hnext )
G4double& hdid, // Out
G4double& hnext ) // Out
// Driver for one Runge-Kutta Step with monitoring of local truncation error
// to ensure accuracy and adjust stepsize. Input are dependent variable
@@ -411,6 +498,22 @@ G4bool G4MagInt_Driver::QuickAdvance(
return true;
}
#ifdef QUICK_ADV_TWO
G4bool G4MagInt_Driver::QuickAdvance(
G4double yarrin[], // IN
const G4double dydx[],
G4double hstep, // In
G4double yarrout[],
G4double& dchord_step,
G4double& dyerr ) // in length
{
G4Exception("Not implemented in current version");
dyerr = dchord_step = hstep * yarrin[0] * dydx[0];
yarrout[0]= yarrin[0];
}
#endif
// --------------------------------------------------------------------------
// This method computes new step sizes - but does not limit changes to
// within certain factors
@@ -436,12 +539,11 @@ G4MagInt_Driver::ComputeNewStepSize(
return hnew;
}
// --------------------------------------------------------------------------
// This method computes new step sizes - but does not limit changes to
// within certain factors
// -----------------------------------------------------------------------------
// This method computes new step sizes limiting changes within certain factors
//
// It shares its logic with AccurateAdvance, so they should eventually
// be merged ??
// It shares its logic with AccurateAdvance.
// They are kept separate currently for optimisation.
G4double
G4MagInt_Driver::ComputeNewStepSize_WithinLimits(
@@ -469,3 +571,126 @@ G4MagInt_Driver::ComputeNewStepSize_WithinLimits(
return hnew;
}
void G4MagInt_Driver::PrintStatus( const G4double* StartArr,
G4double xstart,
const G4double* CurrentArr,
G4double xcurrent,
G4double requestStep,
G4int subStepNo)
// Potentially add as arguments:
// <dydx> - as Initial Force
// stepTaken(hdid) - last step taken
// nextStep (hnext) - proposal for size
{
G4FieldTrack StartFT(G4ThreeVector(0,0,0), G4ThreeVector(0,0,0), 0., 0., 0., 0. );
G4FieldTrack CurrentFT (StartFT);
StartFT.LoadFromArray( StartArr);
StartFT.SetCurveLength( xstart);
CurrentFT.LoadFromArray( CurrentArr);
CurrentFT.SetCurveLength( xcurrent );
PrintStatus(StartFT, CurrentFT, requestStep, subStepNo );
}
#include "g4std/iomanip"
void G4MagInt_Driver::PrintStatus(
const G4FieldTrack& StartFT,
const G4FieldTrack& CurrentFT,
G4double requestStep,
// G4double safety,
G4int subStepNo)
{
G4int verboseLevel= fVerboseLevel;
static G4int noPrecision= 5;
G4int oldPrec= G4cout.precision(noPrecision);
// G4cout.setf(ios_base::fixed,ios_base::floatfield);
const G4ThreeVector StartPosition= StartFT.GetPosition();
const G4ThreeVector StartUnitVelocity= StartFT.GetMomentumDir();
const G4ThreeVector CurrentPosition= CurrentFT.GetPosition();
const G4ThreeVector CurrentUnitVelocity= CurrentFT.GetMomentumDir();
G4double step_len= CurrentFT.GetCurveLength()
- StartFT.GetCurveLength();
if( (subStepNo <= 0) && (verboseLevel <= 3) )
{
subStepNo = - subStepNo; // To allow printing banner
G4cout << G4std::setw( 6) << " "
<< G4std::setw( 25) << " G4MagInt_Driver: Current Position and Direction" << " "
<< G4endl;
G4cout << G4std::setw( 5) << "Step#" << " "
<< G4std::setw( 7) << "s-curve" << " "
<< G4std::setw( 9) << "X(mm)" << " "
<< G4std::setw( 9) << "Y(mm)" << " "
<< G4std::setw( 9) << "Z(mm)" << " "
<< G4std::setw( 7) << " N_x " << " "
<< G4std::setw( 7) << " N_y " << " "
<< G4std::setw( 7) << " N_z " << " "
<< G4std::setw( 7) << "KinEner " << " "
<< G4std::setw( 9) << "StepLen" << " " // Add the Sub-step ??
<< G4std::setw( 9) << "ReqStep" << " "
<< G4endl;
PrintStat_Aux( StartFT, requestStep, 0., 0);
//*************
}
if( verboseLevel <= 3 )
{
G4cout.precision(noPrecision);
PrintStat_Aux( CurrentFT, requestStep, step_len, subStepNo);
//*************
}
else // if( verboseLevel > 3 )
{
// Multi-line output
// G4cout << "Current Position is " << CurrentPosition << G4endl
// << " and UnitVelocity is " << CurrentUnitVelocity << G4endl;
// G4cout << "Step taken was " << step_len
// << " out of PhysicalStep= " << requestStep << G4endl;
// G4cout << "Final safety is: " << safety << G4endl;
// G4cout << "Chord length = " << (CurrentPosition-StartPosition).mag() << G4endl;
// G4cout << G4endl;
}
G4cout.precision(oldPrec);
}
void G4MagInt_Driver::PrintStat_Aux(
const G4FieldTrack& aFieldTrack,
G4double requestStep,
G4double step_len,
G4int subStepNo)
{
const G4ThreeVector Position= aFieldTrack.GetPosition();
const G4ThreeVector UnitVelocity= aFieldTrack.GetMomentumDir();
if( subStepNo >= 0)
G4cout << G4std::setw( 5) << subStepNo << " ";
else
G4cout << G4std::setw( 5) << "Start" << " ";
G4cout << G4std::setw( 7) << aFieldTrack.GetCurveLength();
G4cout << G4std::setw( 9) << Position.x() << " "
<< G4std::setw( 9) << Position.y() << " "
<< G4std::setw( 9) << Position.z() << " "
<< G4std::setw( 7) << UnitVelocity.x() << " "
<< G4std::setw( 7) << UnitVelocity.y() << " "
<< G4std::setw( 7) << UnitVelocity.z() << " ";
G4cout << G4std::setw( 7) << aFieldTrack.GetKineticEnergy();
G4cout << G4std::setw( 9) << step_len << " ";
if( requestStep != -1.0 )
G4cout << G4std::setw( 9) << requestStep << " ";
else
G4cout << G4std::setw( 9) << " InitialStep " << " ";
// G4cout << G4std::setw(12) << safety << " ";
G4cout << G4endl;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorStepper.cc,v 1.5.2.1 2001/06/28 19:08:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MagIntegratorStepper.cc,v 1.6 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4MagIntegratorStepper.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_EqRhs.cc,v 1.6.2.1 2001/06/28 19:08:21 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Mag_EqRhs.cc,v 1.7 2001/07/11 09:59:12 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// This is the standard right-hand side for equation of motion
// in a pure Magnetic Field .
@@ -28,7 +28,7 @@
//
// J. Apostolakis, February 8th, 1999
// P. Gumplinger, February 8th, 1999
// P. Gumplinger, April 11th, 2001
// D. Cote-Ahern, P. Gumplinger, April 11th, 2001
//
#include "G4Mag_SpinEqRhs.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_UsualEqRhs.cc,v 1.3.2.1 2001/06/28 19:08:21 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Mag_UsualEqRhs.cc,v 1.4 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// This is the standard right-hand side for equation of motion.
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4QuadrupoleMagField.hh"
#include "globals.hh"
#include "geomdefs.hh"
G4QuadrupoleMagField::G4QuadrupoleMagField(G4double pGradient)
{
fGradient = pGradient ;
}
/////////////////////////////////////////////////////////////////////////
G4QuadrupoleMagField::~G4QuadrupoleMagField()
{
;
}
////////////////////////////////////////////////////////////////////////
void
G4QuadrupoleMagField::GetFieldValue( const G4double y[7],
G4double B[3] ) const
{
// G4double fGradient = 0.001 ; // Tesla/mm
B[0] = fGradient*y[1] ;
B[1] = fGradient*y[0] ;
B[2] = 0 ;
return ;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4RKG3_Stepper.cc,v 1.5.4.1 2001/06/28 19:08:21 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4RKG3_Stepper.cc,v 1.6 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4RKG3_Stepper.hh"
#include "G4ThreeVector.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SimpleHeum.cc,v 1.4.4.1 2001/06/28 19:08:21 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4SimpleHeum.cc,v 1.5 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// Simple Heum:
// x_1 = x_0 + h *
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SimpleRunge.cc,v 1.3.4.1 2001/06/28 19:08:21 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4SimpleRunge.cc,v 1.4 2001/07/11 09:59:13 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// Simple Runge:
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UniformElectricField.cc,v 1.3.2.1 2001/06/28 19:08:21 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UniformElectricField.cc,v 1.6 2001/12/04 17:35:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//
@@ -86,8 +86,8 @@ G4UniformElectricField& G4UniformElectricField::operator = (const G4UniformElect
// ------------------------------------------------------------------------
void G4UniformElectricField::GetFieldValue (const G4double [3],
G4double fieldBandE[6] ) const
void G4UniformElectricField::GetFieldValue (const G4double[4],
G4double *fieldBandE ) const
{
fieldBandE[0]= 0.0;
fieldBandE[1]= 0.0;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UniformMagField.cc,v 1.3.4.1 2001/06/28 19:08:22 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UniformMagField.cc,v 1.5 2001/11/08 17:32:21 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//
@@ -89,7 +89,7 @@ G4UniformMagField& G4UniformMagField::operator = (const G4UniformMagField &p)
// ------------------------------------------------------------------------
void G4UniformMagField::GetFieldValue (const G4double [3],
void G4UniformMagField::GetFieldValue (const G4double [4],
G4double *B ) const
{
B[0]= fFieldComponents[0] ;