Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -23,21 +23,22 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4FieldTrack implementation
//
//
// Author: John Apostolakis, CERN - First version, 14.10.1996
// -------------------------------------------------------------------
#include "G4FieldTrack.hh"
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);
const G4double* SixV = SixVec.SixVector;
const G4int precPos= 9; // For position
const G4int precEp= 9; // For Energy / momentum
const G4int precLen= 12; // For Length along track
const G4int precSpin= 9; // For polarisation
const G4int precTime= 6; // For time of flight
const G4int oldpr= os.precision(precPos);
os << " ( ";
os << " X= " << SixV[0] << " " << SixV[1] << " "
<< SixV[2] << " "; // Position
@@ -52,15 +53,24 @@ std::ostream& operator<<( std::ostream& os, const G4FieldTrack& SixVec)
os.precision(6);
os << " m0= " << SixVec.fRestMass_c2;
os << " (Pdir-1)= " << SixVec.fMomentumDir.mag()-1.0;
if( SixVec.fLabTimeOfFlight > 0.0 ) os.precision(precTime);
else os.precision(3);
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 ){
if( pol.mag2() > 0.0 )
{
os.precision(precSpin);
os << " PolV= " << pol; // SixVec.GetPolarization();
}else{
}
else
{
os << " PolV= (0,0,0) ";
}
os << " ) ";
@@ -89,10 +99,9 @@ G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
// fPDGSpin( pdgSpin )
{
UpdateFourMomentum( kineticEnergy, pMomentumDirection );
// Sets momentum direction as well.
SetPosition( pPosition );
// Sets momentum direction as well.
SetPosition( pPosition );
SetPolarization( vecPolarization );
}
@@ -114,7 +123,7 @@ G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
fChargeState( DBL_MAX, DBL_MAX, -1.0 ) // charge not set
{
UpdateFourMomentum( kineticEnergy, pMomentumDirection );
// Sets momentum direction as well.
// Sets momentum direction as well.
SetPosition( pPosition );
fChargeState.SetPDGSpin( pdgSpin );
@@ -131,15 +140,15 @@ G4FieldTrack::G4FieldTrack( char ) // Nothing is set !!
G4ThreeVector Zero(0.0, 0.0, 0.0);
SetCurvePnt( Zero, Zero, 0.0 );
SetPolarization( Zero );
// fInitialMomentumMag= 0.00; // Invalid
// fLastMomentumMag= 0.0;
// fInitialMomentumMag = 0.00; // Invalid
// fLastMomentumMag = 0.0;
}
void G4FieldTrack::
SetChargeAndMoments(G4double charge,
G4double magnetic_dipole_moment, // default= DBL_MAX - do not change
G4double electric_dipole_moment, // ditto
G4double magnetic_charge ) // ditto
G4double magnetic_dipole_moment, // default = DBL_MAX
G4double electric_dipole_moment, // ditto
G4double magnetic_charge ) // ditto
{
fChargeState.SetChargesAndMoments( charge,
magnetic_dipole_moment,
@@ -148,7 +157,8 @@ void G4FieldTrack::
// NOTE: Leaves Spin unchanged !
//
// G4double pdgSpin= fChargeState.GetSpin(); // New Property of ChargeState (not well documented! )
// G4double pdgSpin= fChargeState.GetSpin();
// New Property of ChargeState (not well documented! )
// IDEA: Improve the implementation using handles
// -- and handle to the old one (which can be shared by other copies) and
@@ -160,49 +170,49 @@ void G4FieldTrack::
// Load values from array
//
// note that momentum direction must-be/is normalised
// Note that momentum direction must-be/is normalised
//
void G4FieldTrack::LoadFromArray(const G4double valArrIn[ncompSVEC],
G4int noVarsIntegrated)
{
G4int i;
// Fill the variables not integrated with zero -- so it's clear !!
//
G4double valArr[ncompSVEC];
for( i=0; i<noVarsIntegrated; i++){
valArr[i]= valArrIn[i];
for(G4int i=0; i<noVarsIntegrated; ++i)
{
valArr[i] = valArrIn[i];
}
for( i=noVarsIntegrated; i<ncompSVEC; i++) {
valArr[i]= 0.0;
for(G4int i=noVarsIntegrated; i<ncompSVEC; ++i)
{
valArr[i] = 0.0;
}
SixVector[0]=valArr[0];
SixVector[1]=valArr[1];
SixVector[2]=valArr[2];
SixVector[3]=valArr[3];
SixVector[4]=valArr[4];
SixVector[5]=valArr[5];
SixVector[0] = valArr[0];
SixVector[1] = valArr[1];
SixVector[2] = valArr[2];
SixVector[3] = valArr[3];
SixVector[4] = valArr[4];
SixVector[5] = valArr[5];
G4ThreeVector Momentum(valArr[3],valArr[4],valArr[5]);
G4double momentum_square= Momentum.mag2();
fMomentumDir= Momentum.unit();
fKineticEnergy = momentum_square /
(std::sqrt(momentum_square+fRestMass_c2*fRestMass_c2)
+ fRestMass_c2 );
// The above equation is stable for small and large momenta
fKineticEnergy = momentum_square
/ (std::sqrt(momentum_square+fRestMass_c2*fRestMass_c2)
+ fRestMass_c2 );
// The above equation is stable for small and large momenta
// The following components may or may not be
// integrated over -- integration is optional
// fKineticEnergy= valArr[6];
// integrated over -- integration is optional
// fKineticEnergy = valArr[6];
fLabTimeOfFlight=valArr[7];
fProperTimeOfFlight=valArr[8];
G4ThreeVector vecPolarization= G4ThreeVector(valArr[9],valArr[10],valArr[11]);
fLabTimeOfFlight = valArr[7];
fProperTimeOfFlight = valArr[8];
G4ThreeVector vecPolarization= G4ThreeVector(valArr[9],valArr[10],valArr[11]);
SetPolarization( vecPolarization );
// fMomentumDir=G4ThreeVector(valArr[13],valArr[14],valArr[15]);
// fDistanceAlongCurve= valArr[];
}