Import Geant4 9.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:46:55 +02:00
parent 89a9605df1
commit b1eb5424d2
10957 changed files with 888481 additions and 160139 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4CachedMagneticField.cc,v 1.1 2009/11/05 11:06:13 japost Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4CachedMagneticField.cc,v 1.1 2009-11-05 11:06:13 japost Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
@@ -52,7 +52,7 @@ G4CachedMagneticField::~G4CachedMagneticField()
void
G4CachedMagneticField::ReportStatistics()
{
G4cout << " Cached field: " << this << G4endl
G4cout << " Cached field: " << G4endl
<< " Number of calls: " << fCountCalls << G4endl
<< " Number of evaluations : " << fCountEvaluations << G4endl;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4CashKarpRKF45.cc,v 1.16 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4CashKarpRKF45.cc,v 1.16 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
// order method (giving fifth-order accuracy) for the solution of an ODE.
@@ -221,7 +221,7 @@ G4CashKarpRKF45::StepWithEst( const G4double*,
const G4double*,
G4double* )
{
G4Exception("G4CashKarpRKF45::StepWithEst()", "ObsoleteMethod",
G4Exception("G4CashKarpRKF45::StepWithEst()", "GeomField0001",
FatalException, "Method no longer used.");
return ;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ChordFinder.cc,v 1.53 2009/05/18 14:22:43 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4ChordFinder.cc,v 1.53 2009-05-18 14:22:43 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// 25.02.97 - John Apostolakis - Design and implementation
@@ -42,20 +42,20 @@
// ..........................................................................
G4ChordFinder::G4ChordFinder(G4MagInt_Driver* pIntegrationDriver)
: fDefaultDeltaChord( 0.25 * mm ),
fDeltaChord( fDefaultDeltaChord ),
fAllocatedStepper(false),
fEquation(0),
fDriversStepper(0),
: fDefaultDeltaChord( 0.25 * mm ), // Parameters
fDeltaChord( fDefaultDeltaChord ), // Internal parameters
fFirstFraction(0.999), fFractionLast(1.00), fFractionNextEstimate(0.98),
fMultipleRadius(15.0),
fTotalNoTrials_FNC(0), fNoCalls_FNC(0), fmaxTrials_FNC(0),
fStatsVerbose(0)
fStatsVerbose(0),
fDriversStepper(0), // Dependent objects
fAllocatedStepper(false),
fEquation(0),
fTotalNoTrials_FNC(0), fNoCalls_FNC(0), fmaxTrials_FNC(0)
{
// Simple constructor which does not create equation, ..
// Simple constructor -- it does not create equation
fIntgrDriver= pIntegrationDriver;
fAllocatedStepper= false;
fLastStepEstimate_Unconstrained = DBL_MAX; // Should move q, p to
SetFractions_Last_Next( fFractionLast, fFractionNextEstimate);
@@ -68,15 +68,15 @@ G4ChordFinder::G4ChordFinder(G4MagInt_Driver* pIntegrationDriver)
G4ChordFinder::G4ChordFinder( G4MagneticField* theMagField,
G4double stepMinimum,
G4MagIntegratorStepper* pItsStepper )
: fDefaultDeltaChord( 0.25 * mm ),
fDeltaChord( fDefaultDeltaChord ),
fAllocatedStepper(false),
fEquation(0),
fDriversStepper(0),
: fDefaultDeltaChord( 0.25 * mm ), // Constants
fDeltaChord( fDefaultDeltaChord ), // Parameters
fFirstFraction(0.999), fFractionLast(1.00), fFractionNextEstimate(0.98),
fMultipleRadius(15.0),
fTotalNoTrials_FNC(0), fNoCalls_FNC(0), fmaxTrials_FNC(0),
fStatsVerbose(0)
fStatsVerbose(0),
fDriversStepper(0), // Dependent objects
fAllocatedStepper(false),
fEquation(0),
fTotalNoTrials_FNC(0), fNoCalls_FNC(0), fmaxTrials_FNC(0) // State - stats
{
// Construct the Chord Finder
// by creating in inverse order the Driver, the Stepper and EqRhs ...
@@ -331,7 +331,6 @@ G4double G4ChordFinder::NewStep(G4double stepTrialOld,
// which is likely to assist in more performant 'stepping'.
G4double stepTrial;
static G4double lastStepTrial = 1., lastDchordStep= 1.;
#if 1
@@ -375,9 +374,6 @@ G4double G4ChordFinder::NewStep(G4double stepTrialOld,
stepTrial= 0.000001;
}
lastStepTrial = stepTrialOld;
lastDchordStep= dChordStep;
#else
if ( dChordStep > 1000. * fDeltaChord )
@@ -500,8 +496,7 @@ G4ChordFinder::ApproxCurvePointS( const G4FieldTrack& CurveA_PointVelocity,
test_step=0.5*curve;
}
G4bool goodAdvance;
goodAdvance = fIntgrDriver->AccurateAdvance(EndPoint,test_step, eps_step);
fIntgrDriver->AccurateAdvance(EndPoint,test_step, eps_step);
#ifdef G4DEBUG_FIELD
// Printing Brent and Linear Approximation
@@ -564,10 +559,13 @@ ApproxCurvePointV( const G4FieldTrack& CurveA_PointVelocity,
<< G4endl;
if( curve_length < ABdist * (1. - 10*eps_step) )
{
G4cerr << " ERROR: the size of the above difference"
<< " exceeds allowed limits. Aborting." << G4endl;
G4Exception("G4ChordFinder::ApproxCurvePointV()", "PrecisionError",
FatalException, "Unphysical curve length.");
std::ostringstream message;
message << "Unphysical curve length." << G4endl
<< "The size of the above difference exceeds allowed limits."
<< G4endl
<< "Aborting.";
G4Exception("G4ChordFinder::ApproxCurvePointV()", "GeomField0003",
FatalException, message);
}
#endif
// Take default corrective action: adjust the maximum curve length.
@@ -613,11 +611,10 @@ ApproxCurvePointV( const G4FieldTrack& CurveA_PointVelocity,
new_st_length= AE_fraction * curve_length;
G4bool good_advance;
if ( AE_fraction > 0.0 )
{
good_advance = fIntgrDriver->AccurateAdvance(Current_PointVelocity,
new_st_length, eps_step );
fIntgrDriver->AccurateAdvance(Current_PointVelocity,
new_st_length, eps_step );
//
// In this case it does not matter if it cannot advance the full distance
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ClassicalRK4.cc,v 1.14 2009/03/25 15:29:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4ClassicalRK4.cc,v 1.14 2009-03-25 15:29:02 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -------------------------------------------------------------------
@@ -125,7 +125,7 @@ G4ClassicalRK4::StepWithEst( const G4double*,
const G4double*,
G4double* )
{
G4Exception("G4ClassicalRK4::StepWithEst()", "ObsoleteMethod",
G4Exception("G4ClassicalRK4::StepWithEst()", "GeomField0001",
FatalException, "Method no longer used.");
} // end of StepWithEst ......................................................
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ConstRK4.cc,v 1.5 2010/09/10 15:51:10 japost Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4ConstRK4.cc,v 1.5 2010-09-10 15:51:10 japost Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// - 18.09.2008 - J.Apostolakis, T.Nikitina - Created
@@ -46,11 +46,11 @@ G4ConstRK4::G4ConstRK4(G4Mag_EqRhs* EqRhs, G4int numStateVariables)
// const G4int numberOfVariables= 6;
if( numStateVariables < 8 )
{
G4cerr << "ERROR in G4ConstRK4::G4ConstRK4 "
<< " The number of State variables at least 8 " << G4endl;
G4cerr << " Instead it is numStateVariables= " << numStateVariables << G4endl;
G4Exception("G4ConstRK4::G4ConstRK4()", "InvalidSetup", FatalException,
"Valid only for number of state variables of 8 or more. Use another Stepper!");
std::ostringstream message;
message << "The number of State variables at least 8 " << G4endl
<< "Instead it is - numStateVariables= " << numStateVariables;
G4Exception("G4ConstRK4::G4ConstRK4()", "GeomField0002",
FatalException, message, "Use another Stepper!");
}
fEq = EqRhs;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4DELPHIMagField.cc,v 1.6 2006/06/29 18:23:39 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4DELPHIMagField.cc,v 1.6 2006-06-29 18:23:39 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// -------------------------------------------------------------------
#include "G4DELPHIMagField.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ElectricField.cc,v 1.2 2006/06/29 18:23:42 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ElectricField.cc,v 1.2 2006-06-29 18:23:42 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
@@ -24,14 +24,15 @@
// ********************************************************************
//
//
// $Id: G4ElectroMagneticField.cc,v 1.3 2006/06/29 18:23:44 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ElectroMagneticField.cc,v 1.3 2006-06-29 18:23:44 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
#include "G4ElectroMagneticField.hh"
G4ElectroMagneticField::G4ElectroMagneticField()
: G4Field( false ) // No gravitational field (default)
{
}
@@ -40,7 +41,7 @@ G4ElectroMagneticField::~G4ElectroMagneticField()
}
G4ElectroMagneticField::G4ElectroMagneticField(const G4ElectroMagneticField &r)
: G4Field(r)
: G4Field( r.IsGravityActive() ) // To allow extension to joint EM & g field
{
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4EqEMFieldWithEDM.cc,v 1.3 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4EqEMFieldWithEDM.cc,v 1.3 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// This is the standard right-hand side for equation of motion.
@@ -60,7 +60,7 @@ G4EqEMFieldWithEDM::SetChargeMomentumMass(G4double particleCharge, // e+ units
fElectroMagCof = eplus*particleCharge*c_light ;
fMassCof = particleMass*particleMass ;
omegac = 0.105658387*GeV/particleMass * 2.837374841e-3*(rad/cm/kilogauss);
omegac = (eplus/particleMass)*c_light;
pcharge = particleCharge;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4EqEMFieldWithSpin.cc,v 1.9 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4EqEMFieldWithSpin.cc,v 1.9 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// This is the standard right-hand side for equation of motion.
@@ -59,7 +59,7 @@ G4EqEMFieldWithSpin::SetChargeMomentumMass(G4double particleCharge, // e+ units
fElectroMagCof = eplus*particleCharge*c_light ;
fMassCof = particleMass*particleMass ;
omegac = 0.105658387*GeV/particleMass * 2.837374841e-3*(rad/cm/kilogauss);
omegac = (eplus/particleMass)*c_light;
pcharge = particleCharge;
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// This is the right-hand side for equation of motion for a
// massive particle in a gravitational field.
//
// History:
// - 14.06.11 P.Gumplinger, Created.
// -------------------------------------------------------------------
// Adopted from G4EqMagElectricField.hh
//
// Thanks to Peter Fierlinger (PSI) and
// A. Capra and A. Fontana (INFN Pavia)
// -------------------------------------------------------------------
#include "G4EqGravityField.hh"
#include "globals.hh"
void
G4EqGravityField::SetChargeMomentumMass(G4double,
G4double,
G4double particleMass )
{
fMass = particleMass;
}
void
G4EqGravityField::EvaluateRhsGivenB(const G4double y[],
const G4double G[],
G4double dydx[] ) const
{
// Components of y:
// 0-2 dr/ds,
// 3-5 dp/ds - momentum derivatives
G4double momentum_mag_square = y[3]*y[3] + y[4]*y[4] + y[5]*y[5];
G4double inv_momentum_magnitude = 1.0 / std::sqrt( momentum_mag_square );
G4double Energy = std::sqrt(momentum_mag_square + fMass*fMass);
G4double cof2 = Energy/c_light;
G4double cof1 = inv_momentum_magnitude*fMass;
G4double inverse_velocity = Energy*inv_momentum_magnitude/c_light;
dydx[0] = y[3]*inv_momentum_magnitude; // (d/ds)x = Vx/V
dydx[1] = y[4]*inv_momentum_magnitude; // (d/ds)y = Vy/V
dydx[2] = y[5]*inv_momentum_magnitude; // (d/ds)z = Vz/V
dydx[3] = G[0]*cof1*cof2;
dydx[4] = G[1]*cof1*cof2; // m*g
dydx[5] = G[2]*cof1*cof2;
// Lab Time of flight
dydx[7] = inverse_velocity;
return;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4EqMagElectricField.cc,v 1.14 2008/04/24 12:33:35 tnikitin Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EqMagElectricField.cc,v 1.14 2008-04-24 12:33:35 tnikitin Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// This is the standard right-hand side for equation of motion.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4EquationOfMotion.cc,v 1.9 2006/06/29 18:23:48 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EquationOfMotion.cc,v 1.9 2006-06-29 18:23:48 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ErrorMag_UsualEqRhs.cc,v 1.1 2007/05/16 12:54:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ErrorMag_UsualEqRhs.cc,v 1.1 2007-05-16 12:54:02 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// --------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ExactHelixStepper.cc,v 1.11 2010/07/21 13:46:01 tnikitin Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4ExactHelixStepper.cc,v 1.11 2010-07-21 13:46:01 tnikitin Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Helix a-la-Explicity Euler: x_1 = x_0 + helix(h)
// with helix(h) being a helix piece of length h
@@ -88,7 +88,7 @@ G4ExactHelixStepper::DumbStepper( const G4double yIn[],
AdvanceHelix(yIn, Bfld, h, yOut);
G4Exception("G4ExactHelixStepper::DumbStepper",
"EHS:NoDumbStepper", FatalException,
"GeomField0002", FatalException,
"Should not be called. Stepper must do all the work." );
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ExplicitEuler.cc,v 1.8 2006/06/29 18:23:53 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ExplicitEuler.cc,v 1.8 2006-06-29 18:23:53 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Explicit Euler: x_1 = x_0 + h * dx_0
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// First implementation class for G4Field
// J. Apostolakis, 4 Nov 2011 - to add fGravityActive data member
// -------------------------------------------------------------------
#include "G4Field.hh"
G4Field::G4Field( G4bool gravityOn):
fGravityActive( gravityOn )
{
}
G4Field::~G4Field()
{
}
G4Field& G4Field::operator = (const G4Field &p)
{
if (&p == this) return *this;
fGravityActive= p.fGravityActive;
return *this;
}
G4Field::G4Field (const G4Field &p)
: fGravityActive(p.fGravityActive)
{
}
// ------------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.cc,v 1.15 2007/12/07 15:34:10 japost Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FieldManager.cc,v 1.15 2007-12-07 15:34:10 japost Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -------------------------------------------------------------------
@@ -42,10 +42,10 @@ G4FieldManager::G4FieldManager(G4Field *detectorField,
: fDetectorField(detectorField),
fChordFinder(pChordFinder),
fAllocatedChordFinder(false),
fDefault_Delta_One_Step_Value(0.01*mm),
fDefault_Delta_Intersection_Val(0.001*mm),
fEpsilonMinDefault(5.0e-5),
fEpsilonMaxDefault(0.001),
fDefault_Delta_One_Step_Value(0.01*mm),
fDefault_Delta_Intersection_Val(0.001*mm),
fEpsilonMin( fEpsilonMinDefault ),
fEpsilonMax( fEpsilonMaxDefault)
{
@@ -58,16 +58,15 @@ G4FieldManager::G4FieldManager(G4Field *detectorField,
// Add to store
G4FieldManagerStore::Register(this);
}
G4FieldManager::G4FieldManager(G4MagneticField *detectorField)
: fDetectorField(detectorField), fAllocatedChordFinder(true),
fEpsilonMinDefault(5.0e-5),
fEpsilonMaxDefault(0.001),
fFieldChangesEnergy(false),
fDefault_Delta_One_Step_Value(0.01*mm),
fDefault_Delta_Intersection_Val(0.001*mm),
fEpsilonMinDefault(5.0e-5),
fEpsilonMaxDefault(0.001),
fEpsilonMin( fEpsilonMinDefault ),
fEpsilonMax( fEpsilonMaxDefault)
{
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FieldManagerStore.cc,v 1.4 2008/01/17 10:56:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FieldManagerStore.cc,v 1.4 2008-01-17 10:56:23 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// G4FieldManagerStore
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.cc,v 1.15 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4FieldTrack.cc,v 1.15 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -------------------------------------------------------------------
@@ -63,8 +63,7 @@ G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
// fMomentumDir(pMomentumDirection),
fChargeState( charge, magnetic_dipole_moment )
{
G4double momentum = std::sqrt(kineticEnergy*kineticEnergy
+2.0*restMass_c2*kineticEnergy);
G4double momentum = std::sqrt(kineticEnergy*(kineticEnergy+2.0*restMass_c2));
G4ThreeVector pMomentum= momentum * pMomentumDirection;
SetCurvePnt( pPosition, pMomentum, curve_length );
// Sets momentum direction as well.
@@ -91,8 +90,7 @@ G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
// fMomentumDir(pMomentumDirection),
fChargeState( DBL_MAX ) // charge not set
{
G4double momentum = std::sqrt(kineticEnergy*kineticEnergy
+2.0*restMass_c2*kineticEnergy);
G4double momentum = std::sqrt(kineticEnergy*(kineticEnergy+2.0*restMass_c2));
G4ThreeVector pMomentum= momentum * pMomentumDirection;
SetCurvePnt( pPosition, pMomentum, curve_length );
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HarmonicPolMagField.cc,v 1.6 2006/06/29 18:24:00 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4HarmonicPolMagField.cc,v 1.6 2006-06-29 18:24:00 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HelixExplicitEuler.cc,v 1.8 2007/12/10 16:29:49 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4HelixExplicitEuler.cc,v 1.8 2007-12-10 16:29:49 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Helix Explicit Euler: x_1 = x_0 + helix(h)
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HelixHeum.cc,v 1.6 2006/06/29 18:24:04 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4HelixHeum.cc,v 1.6 2006-06-29 18:24:04 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Simple Heum:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HelixImplicitEuler.cc,v 1.6 2006/06/29 18:24:06 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4HelixImplicitEuler.cc,v 1.6 2006-06-29 18:24:06 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Helix Implicit Euler:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HelixSimpleRunge.cc,v 1.7 2006/06/29 18:24:08 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4HelixSimpleRunge.cc,v 1.7 2006-06-29 18:24:08 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Simple Runge:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ImplicitEuler.cc,v 1.9 2006/06/29 18:24:11 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ImplicitEuler.cc,v 1.9 2006-06-29 18:24:11 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Implicit Euler:
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LineCurrentMagField.cc,v 1.6 2006/06/29 18:24:13 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4LineCurrentMagField.cc,v 1.6 2006-06-29 18:24:13 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// -------------------------------------------------------------------
#include "G4LineCurrentMagField.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4LineSection.cc,v 1.10 2006/06/29 18:24:16 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4LineSection.cc,v 1.10 2006-06-29 18:24:16 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
@@ -41,7 +41,7 @@ G4LineSection::G4LineSection( const G4ThreeVector& PntA,
G4double distABsquared = VecAtoB.mag2() ;
if ( distABsquared == 0.0)
{
G4Exception("G4LineSection::G4LineSection()", "WrongArgumentValue",
G4Exception("G4LineSection::G4LineSection()", "GeomField0002",
FatalException, "Equal points in input (line->point) ?") ;
}
else
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4MagErrorStepper.cc,v 1.13 2006/06/29 18:24:18 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4MagErrorStepper.cc,v 1.13 2006-06-29 18:24:18 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4MagHelicalStepper.cc,v 1.24 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4MagHelicalStepper.cc,v 1.24 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorDriver.cc,v 1.57 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4MagIntegratorDriver.cc,v 1.57 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
//
@@ -66,24 +66,25 @@ const G4int G4MagInt_Driver::fMaxStepBase = 250; // Was 5000
// Constructor
//
G4MagInt_Driver::G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4MagIntegratorStepper *pStepper,
G4int numComponents,
G4int statisticsVerbose)
: fSmallestFraction( 1.0e-12 ),
fNoIntegrationVariables(numComponents),
fMinNoVars(12),
fNoVars( std::max( fNoIntegrationVariables, fMinNoVars )),
fVerboseLevel(0),
fStatisticsVerboseLevel(statisticsVerbose),
fNoTotalSteps(0), fNoBadSteps(0), fNoSmallSteps(0),
fNoInitialSmallSteps(0), fDyerr_max(0.0), fDyerr_mx2(0.0),
fNoInitialSmallSteps(0),
fDyerr_max(0.0), fDyerr_mx2(0.0),
fDyerrPos_smTot(0.0), fDyerrPos_lgTot(0.0), fDyerrVel_lgTot(0.0),
fSumH_sm(0.0), fSumH_lg(0.0),
fStatisticsVerboseLevel(statisticsVerbose)
fVerboseLevel(0)
{
// In order to accomodate "Laboratory Time", which is [7], fMinNoVars=8
// is required. For proper time of flight and spin, fMinNoVars must be 12
RenewStepperAndAdjust( pItsStepper );
RenewStepperAndAdjust( pStepper );
fMinimumStep= hminimum;
fMaxNoSteps = fMaxStepBase / pIntStepper->IntegratorOrder();
#ifdef G4DEBUG_FIELD
@@ -162,19 +163,20 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
{
if(hstep==0.0)
{
G4cerr << "WARNING - G4MagIntegratorDriver::AccurateAdvance()" << G4endl
<< " Proposed step is zero; hstep = " << hstep
<< " !" << G4endl;
std::ostringstream message;
message << "Proposed step is zero; hstep = " << hstep << " !";
G4Exception("G4MagInt_Driver::AccurateAdvance()",
"GeomField1001", JustWarning, message);
return succeeded;
}
else
{
G4cerr << "ERROR - G4MagIntegratorDriver::AccurateAdvance()" << G4endl
<< " Proposed step is negative; hstep = " << hstep
<< " !" << G4endl;
std::ostringstream message;
message << "Invalid run condition." << G4endl
<< "Proposed step is negative; hstep = " << hstep << "." << G4endl
<< "Requested step cannot be negative! Aborting event.";
G4Exception("G4MagInt_Driver::AccurateAdvance()",
"InvalidCall", EventMustBeAborted,
"Requested step cannot be negative! Aborting event.");
"GeomField0003", EventMustBeAborted, message);
return false;
}
}
@@ -267,8 +269,8 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
if( h == 0.0 )
{
G4Exception("G4MagInt_Driver::AccurateAdvance()",
"Integration Step became Zero",
FatalException, "IntegrationStepUnderflow.");
"GeomField0003", FatalException,
"Integration Step became Zero!");
}
dyerr = dyerr_len / h;
hdid= h;
@@ -430,26 +432,26 @@ G4MagInt_Driver::WarnSmallStepSize( G4double hnext, G4double hstep,
{
static G4int noWarningsIssued =0;
const G4int maxNoWarnings = 10; // Number of verbose warnings
std::ostringstream message;
if( (noWarningsIssued < maxNoWarnings) || fVerboseLevel > 10 )
{
G4cerr << " Warning (G4MagIntegratorDriver::AccurateAdvance):" << G4endl
<< " 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;
message << "The stepsize for the next iteration, " << hnext
<< ", is too small - in Step number " << nstp << "." << G4endl
<< "The minimum for the driver is " << Hmin() << G4endl
<< "Requested integr. length was " << hstep << " ." << G4endl
<< "The size of this sub-step was " << h << " ." << G4endl
<< "The integrations has already gone " << xDone;
}
else
{
G4cerr << " G4MagInt_Driver: Too small 'next' step " << hnext
<< " step-no " << nstp << G4endl;
G4cerr << " this sub-step " << h
<< " req_tot_len " << hstep
<< " done " << xDone
<< " min " << Hmin()
<< G4endl;
message << "Too small 'next' step " << hnext
<< ", step-no: " << nstp << G4endl
<< ", this sub-step: " << h
<< ", req_tot_len: " << hstep
<< ", done: " << xDone << ", min: " << Hmin();
}
G4Exception("G4MagInt_Driver::WarnSmallStepSize()", "GeomField1001",
JustWarning, message);
noWarningsIssued++;
}
@@ -460,12 +462,14 @@ G4MagInt_Driver::WarnTooManyStep( G4double x1start,
G4double x2end,
G4double xCurrent)
{
G4cerr << " Warning (G4MagIntegratorDriver):" << G4endl
<< " The number of steps used in the Integration driver"
<< " (Runge-Kutta) is too many." << G4endl;
G4cerr << " Integration of the interval was not completed !" << G4endl
<< " Only a " << (xCurrent-x1start)*100/(x2end-x1start)
<<" % fraction of it was done." << G4endl;
std::ostringstream message;
message << "The number of steps used in the Integration driver"
<< " (Runge-Kutta) is too many." << G4endl
<< "Integration of the interval was not completed !" << G4endl
<< "Only a " << (xCurrent-x1start)*100/(x2end-x1start)
<< " % fraction of it was done.";
G4Exception("G4MagInt_Driver::WarnTooManyStep()", "GeomField1001",
JustWarning, message);
}
// ---------------------------------------------------------
@@ -476,42 +480,31 @@ G4MagInt_Driver::WarnEndPointTooFar (G4double endPointDist,
G4double eps,
G4int dbg)
{
static G4double maxRelError=0.0, maxRelError_last_printed=0.0;
static G4double maxRelError=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 > G4GeometryTolerance::GetInstance()->GetSurfaceTolerance())
&& ( (dbg>1) || prNewMax || (endPointDist >= h*(1.+eps) ) ) )
{
static G4int noWarnings = 0;
std::ostringstream message;
if( (noWarnings ++ < 10) || (dbg>2) )
{
G4cerr << " Warning (G4MagIntegratorDriver): " << G4endl
<< " The integration produced an endpoint which " << G4endl
<< " is further from the startpoint than the curve length."
<< G4endl;
G4cerr << " Distance of endpoints = " << endPointDist
<< " curve length = " << h
<< " Difference (curveLen-endpDist)= " << (h - endPointDist)
<< " relative = " << (h-endPointDist) / h
<< " epsilon = " << eps
<< G4endl;
}
else
{
G4cerr << " Warning:"
<< " dist_e= " << endPointDist
<< " h_step = " << h
<< " Diff (hs-ed)= " << (h - endPointDist)
<< " rel = " << (h-endPointDist) / h
<< " eps = " << eps
<< " (from G4MagInt_Driver)" << G4endl;
message << "The integration produced an end-point which " << G4endl
<< "is further from the start-point than the curve length."
<< G4endl;
}
message << " Distance of endpoints = " << endPointDist
<< ", curve length = " << h << G4endl
<< " Difference (curveLen-endpDist)= " << (h - endPointDist)
<< ", relative = " << (h-endPointDist) / h
<< ", epsilon = " << eps;
G4Exception("G4MagInt_Driver::WarnEndPointTooFar()", "GeomField1001",
JustWarning, message);
}
}
@@ -645,7 +638,7 @@ G4bool G4MagInt_Driver::QuickAdvance(
G4double& dyerr_pos_sq,
G4double& dyerr_mom_rel_sq )
{
G4Exception("G4MagInt_Driver::QuickAdvance()", "NotImplemented",
G4Exception("G4MagInt_Driver::QuickAdvance()", "GeomField0001",
FatalException, "Not yet implemented.");
// Use the parameters of this method, to please compiler
@@ -744,7 +737,7 @@ G4bool G4MagInt_Driver::QuickAdvance(
G4double& dchord_step,
G4double& dyerr ) // In length
{
G4Exception("G4MagInt_Driver::QuickAdvance()", "NotImplemented",
G4Exception("G4MagInt_Driver::QuickAdvance()", "GeomField0001",
FatalException, "Not yet implemented.");
dyerr = dchord_step = hstep * yarrin[0] * dydx[0];
yarrout[0]= yarrin[0];
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4MagIntegratorStepper.cc,v 1.12 2009/11/05 18:31:15 japost Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4MagIntegratorStepper.cc,v 1.12 2009-11-05 18:31:15 japost Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_EqRhs.cc,v 1.12 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4Mag_EqRhs.cc,v 1.12 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// This is the standard right-hand side for equation of motion
// in a pure Magnetic Field .
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_SpinEqRhs.cc,v 1.16 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4Mag_SpinEqRhs.cc,v 1.16 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// This is the standard right-hand side for equation of motion.
// This version of the right-hand side includes the three components
@@ -59,7 +59,7 @@ G4Mag_SpinEqRhs::SetChargeMomentumMass(G4double particleCharge, // in e+ units
// To set fCof_val
G4Mag_EqRhs::SetChargeMomentumMass(particleCharge, MomentumXc, particleMass);
omegac = 0.105658387*GeV/particleMass * 2.837374841e-3*(rad/cm/kilogauss);
omegac = (eplus/particleMass)*c_light;
pcharge = particleCharge;
@@ -67,6 +67,8 @@ G4Mag_SpinEqRhs::SetChargeMomentumMass(G4double particleCharge, // in e+ units
beta = MomentumXc/E;
gamma = E/particleMass;
G4double neutronAnomaly = -2.913042725;
if (pcharge==0.) SetAnomaly(neutronAnomaly);
}
void
@@ -81,9 +83,16 @@ G4Mag_SpinEqRhs::EvaluateRhsGivenB( const G4double y[],
dydx[0] = y[3] * inv_momentum_magnitude; // (d/ds)x = Vx/V
dydx[1] = y[4] * inv_momentum_magnitude; // (d/ds)y = Vy/V
dydx[2] = y[5] * inv_momentum_magnitude; // (d/ds)z = Vz/V
dydx[3] = cof*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
dydx[4] = cof*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
dydx[5] = cof*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
if (pcharge == 0.) {
dydx[3] = 0.;
dydx[4] = 0.;
dydx[5] = 0.;
} else {
dydx[3] = cof*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
dydx[4] = cof*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
dydx[5] = cof*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
}
G4ThreeVector u(y[3], y[4], y[5]);
u *= inv_momentum_magnitude;
@@ -100,7 +109,12 @@ G4Mag_SpinEqRhs::EvaluateRhsGivenB( const G4double y[],
G4ThreeVector dSpin;
dSpin = pcharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u)));
if (pcharge == 0.) {
// dSpin = (3.8260837/2.)*omegac*(Spin.cross(BField));
dSpin = omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u)));
} else {
dSpin = pcharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u)));
}
dydx[ 9] = dSpin.x();
dydx[10] = dSpin.y();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Mag_UsualEqRhs.cc,v 1.13 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4Mag_UsualEqRhs.cc,v 1.13 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// This is the 'standard' right-hand side for the equation of motion
@@ -24,14 +24,15 @@
// ********************************************************************
//
//
// $Id: G4MagneticField.cc,v 1.3 2006/06/29 18:24:44 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4MagneticField.cc,v 1.3 2006-06-29 18:24:44 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
#include "G4MagneticField.hh"
G4MagneticField::G4MagneticField()
: G4ElectroMagneticField()
{
}
@@ -39,12 +40,14 @@ G4MagneticField::~G4MagneticField()
{
}
G4MagneticField::G4MagneticField(const G4MagneticField &)
: G4ElectroMagneticField()
G4MagneticField::G4MagneticField(const G4MagneticField &MagField)
: G4ElectroMagneticField( MagField )
{
}
G4MagneticField& G4MagneticField::operator = (const G4MagneticField &p)
{
if (&p == this) return *this; *this = p; return *this;
if (&p == this) return *this;
*this = p;
return *this;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4MonopoleEq.cc,v 1.2 2010/03/18 10:23:29 japost Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4MonopoleEq.cc,v 1.2 2010-03-18 10:23:29 japost Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// This is the right-hand side for equation of motion for a
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4NystromRK4.cc,v 1.9 2010/09/10 15:42:09 japost Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4NystromRK4.cc,v 1.9 2010-09-10 15:42:09 japost Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// History:
// - Created: I.Gavrilenko 15.05.2009 (as G4AtlasRK4)
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4QuadrupoleMagField.cc,v 1.4 2006/06/29 18:24:46 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4QuadrupoleMagField.cc,v 1.4 2006-06-29 18:24:46 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RKG3_Stepper.cc,v 1.17 2010/07/23 14:13:49 tnikitin Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4RKG3_Stepper.cc,v 1.17 2010-07-23 14:13:49 tnikitin Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -------------------------------------------------------------------
@@ -112,7 +112,7 @@ void G4RKG3_Stepper::StepWithEst( const G4double*,
G4double* )
{
G4Exception("G4RKG3_Stepper::StepWithEst()", "ObsoleteMethod",
G4Exception("G4RKG3_Stepper::StepWithEst()", "GeomField0001",
FatalException, "Method no longer used.");
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4SimpleHeum.cc,v 1.10 2009/03/25 15:29:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4SimpleHeum.cc,v 1.10 2009-03-25 15:29:02 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Simple Heum:
// x_1 = x_0 + h *
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4SimpleRunge.cc,v 1.10 2006/06/29 18:24:53 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4SimpleRunge.cc,v 1.10 2006-06-29 18:24:53 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Simple Runge:
//
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: $
// GEANT4 tag $Name: $
//
// class G4TrialsCounter
//
// Class inline implementation
//
// Author: Dec 8, 2006 John Apostolakis
// -------------------------------------------------------------------
#include "G4TrialsCounter.hh"
#include "G4ios.hh"
G4TrialsCounter::G4TrialsCounter( const G4String& nameStats,
const G4String& description,
G4bool printOnExit )
: fName(nameStats), fDescription(description),
fStatsVerbose(printOnExit), fPrinted(false)
{
ClearCounts();
}
G4TrialsCounter::~G4TrialsCounter()
{
if( (fStatsVerbose) && (!fPrinted) ) { PrintStatistics(); }
}
void
G4TrialsCounter::PrintStatistics()
{
// Print Statistics
G4cout << "G4TrialsCounter::PrintStatistics()" << G4endl
<< "Report of counts for " << fDescription << " : " << G4endl;
G4cout << "Stats for '" << fName << "' > "
<< " No-trials= " << fTotalNoTrials
<< " No-calls= " << fNumberCalls
<< " Max-trial= " << fmaxTrials
<< " no-max= " << fNoTimesMaxTrials
<< G4endl;
fPrinted= true;
}
void G4TrialsCounter::ClearCounts()
{
fTotalNoTrials= 0;
fNumberCalls = 0;
fmaxTrials = 0; // Maximum --> so only unsigned ints expected
fNoTimesMaxTrials=0;
}
G4int
G4TrialsCounter::ReturnTotals( G4int& calls, G4int& maxTrials, G4int& numMaxT )
{
calls = fNumberCalls;
maxTrials= fmaxTrials;
numMaxT = fNoTimesMaxTrials;
return fTotalNoTrials;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4UniformElectricField.cc,v 1.13 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4UniformElectricField.cc,v 1.13 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
//
@@ -54,7 +54,7 @@ G4UniformElectricField::G4UniformElectricField(G4double vField,
if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
{
G4Exception("G4UniformElectricField::G4UniformElectricField()",
"WrongArgumentValue", FatalException, "Invalid parameters.");
"GeomField0002", FatalException, "Invalid parameters.");
}
fFieldComponents[0] = 0.0;
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Class for creation of Uniform Gravitation Field.
//
// History:
// - 14.06.11 P.Gumplinger, Created.
// -------------------------------------------------------------------
// Adopted from G4UniformElectricField.hh
//
// Thanks to Peter Fierlinger (PSI) and
// A. Capra and A. Fontana (INFN Pavia)
// -------------------------------------------------------------------
//
#include "G4UniformGravityField.hh"
// Construct from a 3-vector
G4UniformGravityField::G4UniformGravityField(const G4ThreeVector FieldVector)
: G4Field ( true ) // Gravity flag *on*
{
fFieldComponents[0] = FieldVector.x();
fFieldComponents[1] = FieldVector.y();
fFieldComponents[2] = FieldVector.z();
}
// Construct from a double > default = -9.81 m*s^-2
G4UniformGravityField::G4UniformGravityField(const G4double gy )
: G4Field ( true )
{
fFieldComponents[0] = 0.0;
fFieldComponents[1] = gy;
fFieldComponents[2] = 0.0;
}
G4UniformGravityField::~G4UniformGravityField()
{
}
G4UniformGravityField::G4UniformGravityField (const G4UniformGravityField &p)
: G4Field(p)
{
for (G4int i=0; i<3; i++)
fFieldComponents[i] = p.fFieldComponents[i];
}
G4UniformGravityField&
G4UniformGravityField::operator = (const G4UniformGravityField &p)
{
// G4Field::SetGravityActive( p.IsGravityActive );
for (G4int i=0; i<3; i++)
fFieldComponents[i] = p.fFieldComponents[i];
return *this;
}
// -------------------------------------------------------------------
void G4UniformGravityField::GetFieldValue (const G4double [4],
G4double *G ) const
{
G[0]= fFieldComponents[0] ;
G[1]= fFieldComponents[1] ;
G[2]= fFieldComponents[2] ;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4UniformMagField.cc,v 1.12 2010/07/14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4UniformMagField.cc,v 1.12 2010-07-14 10:00:36 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Class for creation of uniform Magnetic Field
@@ -58,7 +58,7 @@ G4UniformMagField::G4UniformMagField(G4double vField,
if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
{
G4Exception("G4UniformMagField::G4UniformMagField()",
"WrongArgumentValue", FatalException, "Invalid parameters.") ;
"GeomField0002", FatalException, "Invalid parameters.") ;
}
fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;