Import Geant4 3.1.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.cc,v 1.6 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4CashKarpRKF45.cc,v 1.8 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
|
||||
// order method (giving fifth-order accuracy) for the solution
|
||||
@@ -19,12 +19,13 @@
|
||||
//
|
||||
|
||||
#include "G4CashKarpRKF45.hh"
|
||||
#include "G4LineSection.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
|
||||
G4CashKarpRKF45::G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
|
||||
G4CashKarpRKF45::G4CashKarpRKF45(G4EquationOfMotion *EqRhs, G4int numberOfVariables, G4bool primary)
|
||||
: G4MagIntegratorStepper(EqRhs, numberOfVariables)
|
||||
{
|
||||
fNumberOfVariables = numberOfVariables ;
|
||||
@@ -36,6 +37,17 @@ G4CashKarpRKF45::G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
|
||||
ak6 = new G4double[fNumberOfVariables] ;
|
||||
yTemp = new G4double[fNumberOfVariables] ;
|
||||
yIn = new G4double[fNumberOfVariables] ;
|
||||
|
||||
fLastInitialVector = new G4double[fNumberOfVariables] ;
|
||||
fLastFinalVector = new G4double[fNumberOfVariables] ;
|
||||
fLastDyDx = new G4double[fNumberOfVariables];
|
||||
|
||||
fMidVector = new G4double[fNumberOfVariables];
|
||||
fMidError = new G4double[fNumberOfVariables];
|
||||
fAuxStepper = 0;
|
||||
if( primary )
|
||||
fAuxStepper = new G4CashKarpRKF45(EqRhs, numberOfVariables, !primary);
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@@ -52,6 +64,14 @@ G4CashKarpRKF45::~G4CashKarpRKF45()
|
||||
delete[] ak7;
|
||||
delete[] yTemp;
|
||||
delete[] yIn;
|
||||
|
||||
delete[] fLastInitialVector;
|
||||
delete[] fLastFinalVector;
|
||||
delete[] fLastDyDx;
|
||||
delete[] fMidVector;
|
||||
delete[] fMidError;
|
||||
|
||||
delete fAuxStepper;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -145,12 +165,21 @@ G4CashKarpRKF45::Stepper(const G4double yInput[],
|
||||
|
||||
yErr[i] = Step*(dc1*dydx[i] + dc3*ak3[i] + dc4*ak4[i] +
|
||||
dc5*ak5[i] + dc6*ak6[i]) ;
|
||||
|
||||
// Store Input and Final values, for possible use in calculating chord
|
||||
fLastInitialVector[i] = yIn[i] ;
|
||||
fLastFinalVector[i] = yOut[i];
|
||||
fLastDyDx[i] = dydx[i];
|
||||
}
|
||||
// NormaliseTangentVector( yOut ); // Not wanted
|
||||
|
||||
fLastStepLength =Step;
|
||||
|
||||
return ;
|
||||
|
||||
} // end of Stepper .......................................................
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
G4CashKarpRKF45::StepWithEst(const G4double yInput[],
|
||||
@@ -283,5 +312,42 @@ G4CashKarpRKF45::StepWithEst(const G4double yInput[],
|
||||
|
||||
return ;
|
||||
|
||||
} // end of StepWithEst ....................................................
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
G4double G4CashKarpRKF45::DistChord() const
|
||||
{
|
||||
G4double distLine, distChord;
|
||||
G4ThreeVector initialPoint, finalPoint, midPoint;
|
||||
|
||||
// Store last initial and final points (they will be overwritten in self-Stepper call!)
|
||||
initialPoint = G4ThreeVector( fLastInitialVector[0],
|
||||
fLastInitialVector[1], fLastInitialVector[2]);
|
||||
finalPoint = G4ThreeVector( fLastFinalVector[0],
|
||||
fLastFinalVector[1], fLastFinalVector[2]);
|
||||
|
||||
// Do half a step using StepNoErr
|
||||
|
||||
fAuxStepper->Stepper( fLastInitialVector, fLastDyDx, 0.5 * fLastStepLength,
|
||||
fMidVector, fMidError );
|
||||
|
||||
midPoint = G4ThreeVector( fMidVector[0], fMidVector[1], fMidVector[2]);
|
||||
|
||||
// Use stored values of Initial and Endpoint + new Midpoint to evaluate
|
||||
// distance of Chord
|
||||
|
||||
|
||||
if (initialPoint != finalPoint)
|
||||
{
|
||||
distLine = G4LineSection::Distline( midPoint, initialPoint, finalPoint );
|
||||
distChord = distLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
distChord = (midPoint-initialPoint).mag();
|
||||
}
|
||||
return distChord;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ChordFinder.cc,v 1.16 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4ChordFinder.cc,v 1.18 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// 25.02.97 John Apostolakis, design and implimentation
|
||||
@@ -34,16 +34,16 @@ G4ChordFinder::G4ChordFinder( G4MagneticField* theMagField,
|
||||
{
|
||||
// Construct the Chord Finder
|
||||
// by creating in inverse order the Driver, the Stepper and EqRhs ...
|
||||
// G4Mag_EqRhs *
|
||||
fEquation = new G4Mag_UsualEqRhs(theMagField); // Should move q, p to
|
||||
fLastStepEstimate_Unconstrained = DBL_MAX;
|
||||
//G4FieldTrack ??
|
||||
G4Mag_EqRhs *pEquation = new G4Mag_UsualEqRhs(theMagField);
|
||||
fEquation = pEquation;
|
||||
fLastStepEstimate_Unconstrained = DBL_MAX; // Should move q, p to
|
||||
// G4FieldTrack ??
|
||||
// --->> Charge Q = 0
|
||||
// --->> Momentum P = 1 NOMINAL VALUES !!!!!!!!!!!!!!!!!!
|
||||
|
||||
if( pItsStepper == 0 )
|
||||
{
|
||||
pItsStepper = fDriversStepper = new G4ClassicalRK4(fEquation);
|
||||
pItsStepper = fDriversStepper = new G4ClassicalRK4(pEquation);
|
||||
fAllocatedStepper= true;
|
||||
}
|
||||
else
|
||||
@@ -290,8 +290,8 @@ G4FieldTrack G4ChordFinder::ApproxCurvePointV(
|
||||
|
||||
G4FieldTrack Current_PointVelocity= CurveA_PointVelocity;
|
||||
|
||||
G4ThreeVector CurveA_Point= CurveA_PointVelocity.Position();
|
||||
G4ThreeVector CurveB_Point= CurveB_PointVelocity.Position();
|
||||
G4ThreeVector CurveA_Point= CurveA_PointVelocity.GetPosition();
|
||||
G4ThreeVector CurveB_Point= CurveB_PointVelocity.GetPosition();
|
||||
|
||||
G4ThreeVector ChordAB_Vector= CurveB_Point - CurveA_Point;
|
||||
G4ThreeVector ChordAE_Vector= CurrentE_Point - CurveA_Point;
|
||||
@@ -301,7 +301,7 @@ G4FieldTrack G4ChordFinder::ApproxCurvePointV(
|
||||
G4double AE_fraction;
|
||||
|
||||
curve_length=
|
||||
CurveB_PointVelocity.CurveS() - CurveA_PointVelocity.CurveS();
|
||||
CurveB_PointVelocity.GetCurveLength() - CurveA_PointVelocity.GetCurveLength();
|
||||
|
||||
// const
|
||||
G4double integrationInaccuracyLimit= G4std::max( perMillion, 0.5*eps_step );
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ClassicalRK4.cc,v 1.3 2000/11/01 15:15:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4ClassicalRK4.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -14,8 +14,8 @@ G4EqMagElectricField::SetChargeMomentumMass(G4double particleCharge, // e+ units
|
||||
G4double MomentumXc,
|
||||
G4double particleMass)
|
||||
{
|
||||
fElectroMagCof = eplus*c_squared ;
|
||||
fElectroMagCof *= particleCharge/particleMass;
|
||||
fElectroMagCof = eplus*particleCharge*c_light ;
|
||||
fMassCof = particleMass*particleMass ;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,28 +28,27 @@ G4EqMagElectricField::EvaluateRhsGivenB(const G4double y[],
|
||||
|
||||
// Components of y:
|
||||
// 0-2 dr/ds,
|
||||
// 3-5 dv/ds
|
||||
// FCof() = charge/mass
|
||||
// 3-5 dp/ds - momentum derivatives
|
||||
|
||||
G4double vSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
|
||||
G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
|
||||
|
||||
G4double vModule = sqrt(vSquared) ;
|
||||
G4double cof2 = sqrt( pSquared + fMassCof )/c_light ;
|
||||
|
||||
G4double vDotE = y[3]*Field[3] + y[4]*Field[4] + y[5]*Field[5] ;
|
||||
G4double pModuleInverse = 1.0/sqrt(pSquared) ;
|
||||
|
||||
G4double gammaReci = sqrt(1 - vSquared/c_squared) ;
|
||||
G4double cof1 = fElectroMagCof*pModuleInverse ;
|
||||
|
||||
dydx[0] = y[3]/vModule ;
|
||||
dydx[1] = y[4]/vModule ;
|
||||
dydx[2] = y[5]/vModule ;
|
||||
// G4double vDotE = y[3]*Field[3] + y[4]*Field[4] + y[5]*Field[5] ;
|
||||
|
||||
dydx[3] = fElectroMagCof*(Field[3] + (y[4]*Field[2] - y[5]*Field[1])/c_light -
|
||||
y[3]*vDotE/c_light/c_light )*gammaReci/vModule ;
|
||||
|
||||
dydx[0] = y[3]*pModuleInverse ;
|
||||
dydx[1] = y[4]*pModuleInverse ;
|
||||
dydx[2] = y[5]*pModuleInverse ;
|
||||
|
||||
dydx[3] = cof1*(cof2*Field[3] + (y[4]*Field[2] - y[5]*Field[1])) ;
|
||||
|
||||
dydx[4] = fElectroMagCof*(Field[4] + (y[5]*Field[0] - y[3]*Field[2])/c_light -
|
||||
y[4]*vDotE/c_light/c_light )*gammaReci/vModule ;
|
||||
dydx[4] = cof1*(cof2*Field[4] + (y[5]*Field[0] - y[3]*Field[2])) ;
|
||||
|
||||
dydx[5] = fElectroMagCof*(Field[5] + (y[3]*Field[1] - y[4]*Field[0])/c_light -
|
||||
y[5]*vDotE/c_light/c_light)*gammaReci/vModule ;
|
||||
dydx[5] = cof1*(cof2*Field[5] + (y[3]*Field[1] - y[4]*Field[0])) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EquationOfMotion.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4EquationOfMotion.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ExplicitEuler.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Explicit Euler: x_1 = x_0 + h * dx_0
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldManager.cc,v 1.3 2000/11/09 18:06:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4FieldManager.hh"
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldTrack.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4FieldTrack.cc,v 1.3 2001/02/20 18:15:54 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4FieldTrack.hh"
|
||||
|
||||
@@ -15,6 +15,6 @@ G4std::ostream& operator<<( G4std::ostream& os, G4FieldTrack& SixVec)
|
||||
G4double *SixV = SixVec.SixVector;
|
||||
os << " X= " << SixV[0] << " " << SixV[1] << " " << SixV[2] << " ";
|
||||
os << " V= " << SixV[3] << " " << SixV[4] << " " << SixV[5] << " ";
|
||||
os << " l= " << SixVec.CurveS();
|
||||
os << " l= " << SixVec.GetCurveLength();
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixExplicitEuler.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixHeum.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixHeum.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixImplicitEuler.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.cc,v 1.4 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixSimpleRunge.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ImplicitEuler.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Implicit Euler:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LineSection.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// typedef double G4double;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagErrorStepper.cc,v 1.8 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4MagErrorStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.6 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.7 2001/03/22 18:48:03 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4MagHelicalStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
@@ -29,6 +29,9 @@ G4MagHelicalStepper::~G4MagHelicalStepper()
|
||||
{
|
||||
}
|
||||
|
||||
// Constant for determining unit conversion when using normal as integrand.
|
||||
const G4double G4MagHelicalStepper::fUnitConstant = 0.299792458 * (GeV/(tesla*m));
|
||||
|
||||
void
|
||||
G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
G4ThreeVector Bfld,
|
||||
@@ -48,7 +51,13 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
G4double Bmag = Bfld.mag();
|
||||
const G4double *pIn = yIn+3;
|
||||
G4ThreeVector initTangent= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
|
||||
G4ThreeVector initMomentum= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
|
||||
G4double momentumVal = initMomentum.mag();
|
||||
G4ThreeVector initTangent = (1.0/momentumVal) * initMomentum; // .unit();
|
||||
|
||||
// fCof = fUnitConstant*particleCharge/MomentumXc;
|
||||
G4double particleCharge = fPtrMagEqOfMot->FCof() / (eplus*c_light);
|
||||
G4double fCoefficient = (fUnitConstant / momentumVal) * particleCharge;
|
||||
|
||||
// for too small magnetic fields there is no curvature
|
||||
// (include momentum here) FIXME
|
||||
@@ -74,7 +83,8 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
// calculate the radius^-1 of the helix and the stepping angle
|
||||
|
||||
R_1 = - fPtrMagEqOfMot->FCof() * Bmag; // / B_v_P - but this cancels
|
||||
// R_1 = - fPtrMagEqOfMot->FCof() * Bmag; // / B_v_P - but this cancels
|
||||
R_1 = - fCoefficient * Bmag; // / B_v_P - but this cancels
|
||||
|
||||
// again in Theta - so we don't need it.
|
||||
if( fabs(R_1) < 1e-10 ) {
|
||||
@@ -85,7 +95,7 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
// Trigonometrix
|
||||
|
||||
if( Theta < - approc_limit || Theta > approc_limit ) {
|
||||
if( fabs(Theta) > approc_limit ) {
|
||||
SinT2 = sin(0.5 * Theta);
|
||||
CosT2 = cos(0.5 * Theta);
|
||||
// SinT = sin(Theta);
|
||||
@@ -104,8 +114,9 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
// the actual "rotation"
|
||||
|
||||
positionMove = h * ( CosT2 * vperp +
|
||||
SinT2 * B_x_P + vpar );
|
||||
G4double R = 1.0 / R_1;
|
||||
// positionMove = h * ( CosT2 * vperp + SinT2 * B_x_P + vpar );
|
||||
positionMove = R * ( SinT * vperp + (1-CosT) * B_x_P) + h * vpar;
|
||||
endTangent = (CosT * vperp + SinT * B_x_P + vpar);
|
||||
|
||||
// Store the resulting position and tangent
|
||||
@@ -113,9 +124,9 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
yHelix[1] = yIn[1] + positionMove.y();
|
||||
yHelix[2] = yIn[2] + positionMove.z();
|
||||
|
||||
yHelix[3] = endTangent.x();
|
||||
yHelix[4] = endTangent.y();
|
||||
yHelix[5] = endTangent.z();
|
||||
yHelix[3] = momentumVal * endTangent.x();
|
||||
yHelix[4] = momentumVal * endTangent.y();
|
||||
yHelix[5] = momentumVal * endTangent.z();
|
||||
|
||||
// Store and/or calculate parameters for chord distance.
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.cc,v 1.14 2000/11/20 17:29:05 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4MagIntegratorStepper.cc,v 1.5 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
|
||||
// Constructor for stepper abstract base class.
|
||||
//
|
||||
|
||||
G4MagIntegratorStepper::G4MagIntegratorStepper(G4Mag_EqRhs *EqRhs,
|
||||
G4MagIntegratorStepper::G4MagIntegratorStepper(G4EquationOfMotion* Equation,
|
||||
G4int num_var)
|
||||
: fEquation_Rhs(EqRhs),
|
||||
: fEquation_Rhs(Equation),
|
||||
fNumberOfVariables(num_var)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4Mag_EqRhs.cc,v 1.6 2001/03/02 10:48:30 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion
|
||||
// in a pure Magnetic Field .
|
||||
@@ -35,7 +35,8 @@ G4Mag_EqRhs::SetChargeMomentumMass( G4double particleCharge, // e+ units
|
||||
G4double MomentumXc,
|
||||
G4double particleMass)
|
||||
{
|
||||
fCof_val = fUnitConstant*particleCharge/MomentumXc; // B must be in Tesla
|
||||
fCof_val = particleCharge*eplus*c_light ; // B must be in Tesla
|
||||
// fCof_val = fUnitConstant*particleCharge/MomentumXc; // B must be in Tesla
|
||||
// fMass = particleMass;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_UsualEqRhs.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4Mag_UsualEqRhs.cc,v 1.3 2001/02/19 16:52:05 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion.
|
||||
@@ -24,15 +24,21 @@ G4Mag_UsualEqRhs::EvaluateRhsGivenB( const G4double y[],
|
||||
const G4double B[3],
|
||||
G4double dydx[] ) const
|
||||
{
|
||||
G4double velocity_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]);
|
||||
G4double inv_velocity_magnitude = 1.0 / sqrt( velocity_mag_square );
|
||||
G4double momentum_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]);
|
||||
G4double inv_momentum_magnitude = 1.0 / sqrt( momentum_mag_square );
|
||||
|
||||
dydx[0] = y[3] * inv_velocity_magnitude; // (d/ds)x = Vx/V
|
||||
dydx[1] = y[4] * inv_velocity_magnitude; // (d/ds)y = Vy/V
|
||||
dydx[2] = y[5] * inv_velocity_magnitude; // (d/ds)z = Vz/V
|
||||
dydx[3] = FCof()*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
|
||||
dydx[4] = FCof()*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
|
||||
dydx[5] = FCof()*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
|
||||
G4double cof = FCof()*inv_momentum_magnitude;
|
||||
|
||||
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)
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RKG3_Stepper.cc,v 1.5 2000/11/20 17:29:05 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4RKG3_Stepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleHeum.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// Simple Heum:
|
||||
// x_1 = x_0 + h *
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleRunge.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// Simple Runge:
|
||||
//
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformElectricField.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4UniformElectricField.cc,v 1.3 2001/03/27 09:43:22 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
G4UniformElectricField::G4UniformElectricField(const G4ThreeVector FieldVector )
|
||||
{
|
||||
fFieldComponents[0] = 0.0;
|
||||
fFieldComponents[1] = 0.0;
|
||||
fFieldComponents[2] = 0.0;
|
||||
fFieldComponents[3] = FieldVector.x();
|
||||
fFieldComponents[4] = FieldVector.y();
|
||||
fFieldComponents[5] = FieldVector.z();
|
||||
@@ -33,6 +36,9 @@ G4UniformElectricField::G4UniformElectricField(G4double vField,
|
||||
vTheta >= 0 && vTheta <= pi &&
|
||||
vPhi >= 0 && vPhi <= twopi)
|
||||
{
|
||||
fFieldComponents[0] = 0.0;
|
||||
fFieldComponents[1] = 0.0;
|
||||
fFieldComponents[2] = 0.0;
|
||||
fFieldComponents[3] = vField*sin(vTheta)*cos(vPhi) ;
|
||||
fFieldComponents[4] = vField*sin(vTheta)*sin(vPhi) ;
|
||||
fFieldComponents[5] = vField*cos(vTheta) ;
|
||||
@@ -50,13 +56,13 @@ G4UniformElectricField::~G4UniformElectricField()
|
||||
|
||||
G4UniformElectricField::G4UniformElectricField (const G4UniformElectricField &p)
|
||||
{
|
||||
for (G4int i=3; i<6; i++)
|
||||
for (G4int i=0; i<6; i++)
|
||||
fFieldComponents[i] = p.fFieldComponents[i];
|
||||
}
|
||||
|
||||
G4UniformElectricField& G4UniformElectricField::operator = (const G4UniformElectricField &p)
|
||||
{
|
||||
for (G4int i=3; i<6; i++)
|
||||
for (G4int i=0; i<6; i++)
|
||||
fFieldComponents[i] = p.fFieldComponents[i];
|
||||
return *this;
|
||||
}
|
||||
@@ -65,11 +71,14 @@ G4UniformElectricField& G4UniformElectricField::operator = (const G4UniformElect
|
||||
|
||||
|
||||
void G4UniformElectricField::GetFieldValue (const G4double [3],
|
||||
G4double E[3] ) const
|
||||
G4double fieldBandE[6] ) const
|
||||
{
|
||||
E[0]= fFieldComponents[3] ;
|
||||
E[1]= fFieldComponents[4] ;
|
||||
E[2]= fFieldComponents[5] ;
|
||||
fieldBandE[0]= 0.0;
|
||||
fieldBandE[1]= 0.0;
|
||||
fieldBandE[2]= 0.0;
|
||||
fieldBandE[3]= fFieldComponents[3] ;
|
||||
fieldBandE[4]= fFieldComponents[4] ;
|
||||
fieldBandE[5]= fFieldComponents[5] ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformMagField.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user