Import Geant4 10.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 14:11:04 +02:00
parent c9b32a6c0a
commit d4af681f38
4886 changed files with 420149 additions and 1023309 deletions
+90 -3
View File
@@ -1,4 +1,4 @@
$Id: History 85845 2014-11-05 15:43:58Z gcosmo $
$Id: History 93806 2015-11-02 11:21:01Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -16,13 +16,100 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
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
Nov 03, 2014 G.Cosmo - field-V10-00-04
- 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
May 21, 2014 J.Apostolakis - field-V10-00-03
--------------------------
- G4FieldTrack:
* Fixed SetChargeAndMoments() to use the new method
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.hh 68055 2013-03-13 14:43:28Z gcosmo $
// $Id: G4FieldManager.hh 93661 2015-10-28 09:47:47Z gcosmo $
//
//
// class G4FieldManager
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.icc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4FieldManager.icc 93661 2015-10-28 09:47:47Z gcosmo $
//
//
// G4FieldManager inline implementation
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.hh 81175 2014-05-22 07:39:10Z gcosmo $
// $Id: G4FieldTrack.hh 87868 2015-01-16 08:22:22Z gcosmo $
//
//
// class G4FieldTrack
@@ -123,6 +123,7 @@ class G4FieldTrack
inline G4double GetProperTimeOfFlight() const;
inline G4double GetKineticEnergy() const;
inline G4double GetCharge() const;
inline G4double GetRestMass() const { return fRestMass_c2; }
// Accessors.
inline void SetPosition(G4ThreeVector nPos);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.icc 81175 2014-05-22 07:39:10Z gcosmo $
// $Id: G4FieldTrack.icc 90643 2015-06-05 13:18:26Z gcosmo $
//
// -------------------------------------------------------------------
@@ -71,7 +71,8 @@ G4FieldTrack::SetCurvePnt(const G4ThreeVector& pPosition,
SixVector[4] = pMomentum.y();
SixVector[5] = pMomentum.z();
fMomentumDir = pMomentum.unit();
fMomentumDir = (pMomentum.mag2() > 0.0) ?
pMomentum.unit() : G4ThreeVector( 0.0, 0.0, 0.0 );
fDistanceAlongCurve= s_curve;
@@ -186,7 +187,10 @@ void G4FieldTrack::SetMomentum(G4ThreeVector pMomentum)
SixVector[4] = pMomentum.y();
SixVector[5] = pMomentum.z();
fMomentumDir = pMomentum.unit();
if( pMomentum.mag2() > 0.0 )
fMomentumDir = pMomentum.unit();
else
fMomentumDir = G4ThreeVector( 0.0, 0.0, 0.0 );
}
inline
@@ -25,7 +25,7 @@
//
//
//
// $Id: G4MagHelicalStepper.hh 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4MagHelicalStepper.hh 93806 2015-11-02 11:21:01Z gcosmo $
//
//
//
@@ -36,6 +36,11 @@
// Abstract base class for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field
// It is used for a set of steppers which use the helix as a sort of
// 'first order' solution.
// - Most obtain an error by breaking up the step in two
// - G4ExactHelicalStepper does not provide an error estimate
// History:
// - 05.11.98 J.Apostolakis Creation of new ABC
// --------------------------------------------------------------------
@@ -51,7 +51,7 @@ class G4RepleteEofM : public G4EquationOfMotion
{
public: // with description
G4RepleteEofM(G4Field*);
G4RepleteEofM(G4Field*, G4int nvar = 8);
~G4RepleteEofM();
void SetChargeMomentumMass(G4ChargeState particleCharge, // in e+ units
@@ -75,6 +75,8 @@ class G4RepleteEofM : public G4EquationOfMotion
private:
G4int fNvar;
G4bool fBfield, fEfield, fGfield, fgradB, fSpin;
G4double charge, mass, magMoment, spin;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ChordFinder.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4ChordFinder.cc 93806 2015-11-02 11:21:01Z gcosmo $
//
//
// 25.02.97 - John Apostolakis - Design and implementation
@@ -239,15 +239,17 @@ G4ChordFinder::FindNextChord( const G4FieldTrack& yStart,
fIntgrDriver-> GetDerivatives( yCurrent, dydx );
G4int noTrials=0;
unsigned int noTrials=0;
const unsigned int maxTrials= 300; // Avoid endless loop for bad convergence
const G4double safetyFactor= fFirstFraction; // 0.975 or 0.99 ? was 0.999
stepTrial = std::min( stepMax, safetyFactor*fLastStepEstimate_Unconstrained );
G4double newStepEst_Uncons= 0.0;
G4double stepForChord;
do
{
G4double stepForChord;
yCurrent = yStart; // Always start from initial point
// ************
@@ -281,7 +283,21 @@ G4ChordFinder::FindNextChord( const G4FieldTrack& yStart,
}
noTrials++;
}
while( ! validEndPoint ); // End of do-while RKD
while( (! validEndPoint) && (noTrials < maxTrials) ); // End of do-while RKD
if( noTrials >= maxTrials )
{
std::ostringstream message;
message << "Exceeded maximum number of trials= " << maxTrials << G4endl
<< "Current sagita dist= " << dChordStep << G4endl
<< "Step sizes (actual and proposed): " << G4endl
<< "Last trial = " << lastStepLength << G4endl
<< "Next trial = " << stepTrial << G4endl
<< "Proposed for chord = " << stepForChord << G4endl
;
G4Exception("G4ChordFinder::FindNextChord()", "GeomField0003",
JustWarning, message);
}
if( newStepEst_Uncons > 0.0 )
{
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.cc 68055 2013-03-13 14:43:28Z gcosmo $
// $Id: G4FieldManager.cc 93661 2015-10-28 09:47:47Z gcosmo $
//
// -------------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.cc 81175 2014-05-22 07:39:10Z gcosmo $
// $Id: G4FieldTrack.cc 93806 2015-11-02 11:21:01Z gcosmo $
//
// -------------------------------------------------------------------
@@ -33,20 +33,39 @@
std::ostream& operator<<( std::ostream& os, const G4FieldTrack& SixVec)
{
const G4double *SixV = SixVec.SixVector;
const int precPos= 9; // For position
const int precEp= 9; // For Energy / momentum
const int precLen= 12; // For Length along track
const int precSpin= 9; // For polarisation
const int precTime= 6; // For time of flight
const int oldpr= os.precision(precPos);
os << " ( ";
os << " X= " << SixV[0] << " " << SixV[1] << " "
<< SixV[2] << " "; // Position
os.precision(precEp);
os << " P= " << SixV[3] << " " << SixV[4] << " "
<< SixV[5] << " "; // Momentum
os << " Pmag= "
<< G4ThreeVector(SixV[3], SixV[4], SixV[5]).mag(); // mom magnitude
os << " Ekin= " << SixVec.fKineticEnergy ;
os.precision(precLen);
os << " l= " << SixVec.GetCurveLength();
os.precision(6);
os << " m0= " << SixVec.fRestMass_c2;
os << " Pdir= " << SixVec.fMomentumDir.mag();
os << " l= " << SixVec.GetCurveLength();
os << " t_lab= " << SixVec.fLabTimeOfFlight;
os << " t_proper= " << SixVec.fProperTimeOfFlight ;
os << " (Pdir-1)= " << SixVec.fMomentumDir.mag()-1.0;
if( SixVec.fLabTimeOfFlight > 0.0 ) os.precision(precTime);
else os.precision(3);
os << " t_lab= " << SixVec.fLabTimeOfFlight;
os << " t_proper= " << SixVec.fProperTimeOfFlight ;
G4ThreeVector pol= SixVec.GetPolarization();
if( pol.mag2() > 0.0 ){
os.precision(precSpin);
os << " PolV= " << pol; // SixVec.GetPolarization();
}else{
os << " PolV= (0,0,0) ";
}
os << " ) ";
os.precision(oldpr);
return os;
}
@@ -37,12 +37,13 @@
#include "G4Field.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
G4RepleteEofM::G4RepleteEofM( G4Field* field )
: G4EquationOfMotion( field ),
G4RepleteEofM::G4RepleteEofM( G4Field* field, G4int nvar )
: G4EquationOfMotion( field ), fNvar(nvar),
fBfield(false), fEfield(false), fGfield(false),
fgradB(false), fSpin(false),
charge(0.), mass(0.), magMoment(0.), spin(0.),
@@ -240,17 +241,25 @@ G4RepleteEofM::EvaluateRhsGivenB(const G4double y[],
// Lab Time of flight
dydx[7] = inverse_velocity;
if (fNvar == 12) {
dydx[ 8] = 0.; //not used
dydx[ 9] = 0.;
dydx[10] = 0.;
dydx[11] = 0.;
}
if (fSpin) {
// G4cout << "y[9,10,11] " << y[9] << " " << y[10] << " " << y[11] << G4endl;
G4ThreeVector BField(0.,0.,0.);
if (fBfield) {
G4ThreeVector F(Field[0],Field[1],Field[2]);
G4ThreeVector F(field[0],field[1],field[2]);
BField = F;
}
G4ThreeVector EField(0.,0.,0.);
if (fEfield) {
G4ThreeVector F(Field[3],Field[4],Field[5]);
G4ThreeVector F(field[3],field[4],field[5]);
EField = F;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UniformMagField.cc 68055 2013-03-13 14:43:28Z gcosmo $
// $Id: G4UniformMagField.cc 90643 2015-06-05 13:18:26Z gcosmo $
//
//
// Class for creation of uniform Magnetic Field
@@ -64,8 +64,27 @@ G4UniformMagField::G4UniformMagField(G4double vField,
{
if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
{
std::ostringstream msg;
msg << "ERROR in G4UniformMagField::G4UniformMagField(double, double, double) : "
<< "Invalid parameter(s). " << std::endl;
msg << " Expected " << std::endl;
msg << " - Magnitude vField: Value = " << vField
<< " Expected vField > 0 " ;
if ( vField<0) { msg << " <------ Erroneous "; }
msg << std::endl;
msg << " - Theta angle: Value = " << vTheta
<< " Expected between 0 <= theta <= pi = " << pi << " ";
if ( (vTheta<0) || (vTheta>pi) ) { msg << " <------ Erroneous "; }
msg << std::endl;
msg << " - Phi angle: Value = " << vPhi
<< " Expected between 0 <= phi <= 2*pi = " << twopi << std::endl;
if ( (vPhi<0) || (vPhi>twopi) ) { msg << " <------ Erroneous "; }
G4Exception("G4UniformMagField::G4UniformMagField()",
"GeomField0002", FatalException, "Invalid parameters.") ;
"GeomField0002", FatalException, msg ); // "Invalid parameters.") ;
}
fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;