Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldTrack.cc 66356 2012-12-18 09:02:32Z gcosmo $
|
||||
// $Id: G4FieldTrack.cc 81175 2014-05-22 07:39:10Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -36,12 +36,16 @@ std::ostream& operator<<( std::ostream& os, const G4FieldTrack& SixVec)
|
||||
os << " ( ";
|
||||
os << " X= " << SixV[0] << " " << SixV[1] << " "
|
||||
<< SixV[2] << " "; // Position
|
||||
os << " V= " << SixV[3] << " " << SixV[4] << " "
|
||||
os << " P= " << SixV[3] << " " << SixV[4] << " "
|
||||
<< SixV[5] << " "; // Momentum
|
||||
os << " v2= "
|
||||
os << " Pmag= "
|
||||
<< G4ThreeVector(SixV[3], SixV[4], SixV[5]).mag(); // mom magnitude
|
||||
os << " mdm= " << SixVec.fMomentumDir.mag();
|
||||
os << " l= " << SixVec.GetCurveLength();
|
||||
os << " Ekin= " << SixVec.fKineticEnergy ;
|
||||
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 << " ) ";
|
||||
return os;
|
||||
}
|
||||
@@ -52,23 +56,26 @@ G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
|
||||
G4double kineticEnergy,
|
||||
G4double restMass_c2,
|
||||
G4double charge,
|
||||
const G4ThreeVector& Spin,
|
||||
const G4ThreeVector& vecPolarization,
|
||||
G4double magnetic_dipole_moment,
|
||||
G4double curve_length )
|
||||
G4double curve_length,
|
||||
G4double pdgSpin )
|
||||
: fDistanceAlongCurve(curve_length),
|
||||
fKineticEnergy(kineticEnergy),
|
||||
fRestMass_c2(restMass_c2),
|
||||
fLabTimeOfFlight(LaboratoryTimeOfFlight),
|
||||
fProperTimeOfFlight(0.),
|
||||
// fMomentumDir(pMomentumDirection),
|
||||
fChargeState( charge, magnetic_dipole_moment )
|
||||
fChargeState( charge, magnetic_dipole_moment, pdgSpin )
|
||||
// fChargeState( charge, magnetic_dipole_moment ) ,
|
||||
// fPDGSpin( pdgSpin )
|
||||
{
|
||||
UpdateFourMomentum( kineticEnergy, pMomentumDirection );
|
||||
// Sets momentum direction as well.
|
||||
|
||||
SetPosition( pPosition );
|
||||
|
||||
InitialiseSpin( Spin );
|
||||
SetPolarization( vecPolarization );
|
||||
}
|
||||
|
||||
G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
|
||||
@@ -79,32 +86,33 @@ G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
|
||||
G4double, // velocity
|
||||
G4double pLaboratoryTimeOfFlight,
|
||||
G4double pProperTimeOfFlight,
|
||||
const G4ThreeVector* pSpin)
|
||||
const G4ThreeVector* pPolarization,
|
||||
G4double pdgSpin )
|
||||
: fDistanceAlongCurve(curve_length),
|
||||
fKineticEnergy(kineticEnergy),
|
||||
fRestMass_c2(restMass_c2),
|
||||
fLabTimeOfFlight(pLaboratoryTimeOfFlight),
|
||||
fProperTimeOfFlight(pProperTimeOfFlight),
|
||||
// fMomentumDir(pMomentumDirection),
|
||||
fChargeState( DBL_MAX ) // charge not set
|
||||
fChargeState( DBL_MAX, DBL_MAX, -1.0 ) // charge not set
|
||||
{
|
||||
UpdateFourMomentum( kineticEnergy, pMomentumDirection );
|
||||
// Sets momentum direction as well.
|
||||
|
||||
SetPosition( pPosition );
|
||||
|
||||
G4ThreeVector Spin(0.0, 0.0, 0.0);
|
||||
if( pSpin ) Spin= *pSpin;
|
||||
InitialiseSpin( Spin );
|
||||
fChargeState.SetPDGSpin( pdgSpin );
|
||||
|
||||
G4ThreeVector PolarVec(0.0, 0.0, 0.0);
|
||||
if( pPolarization ) { PolarVec= *pPolarization; }
|
||||
SetPolarization( PolarVec );
|
||||
}
|
||||
|
||||
G4FieldTrack::G4FieldTrack( char ) // Nothing is set !!
|
||||
: fKineticEnergy(0.), fRestMass_c2(0.), fLabTimeOfFlight(0.),
|
||||
fProperTimeOfFlight(0.), fChargeState( DBL_MAX )
|
||||
fProperTimeOfFlight(0.), fChargeState( DBL_MAX , DBL_MAX, -1 )
|
||||
{
|
||||
G4ThreeVector Zero(0.0, 0.0, 0.0);
|
||||
SetCurvePnt( Zero, Zero, 0.0 );
|
||||
InitialiseSpin( Zero );
|
||||
SetPolarization( Zero );
|
||||
// fInitialMomentumMag= 0.00; // Invalid
|
||||
// fLastMomentumMag= 0.0;
|
||||
}
|
||||
@@ -115,16 +123,68 @@ void G4FieldTrack::
|
||||
G4double electric_dipole_moment, // ditto
|
||||
G4double magnetic_charge ) // ditto
|
||||
{
|
||||
fChargeState.SetChargeAndMoments( charge, magnetic_dipole_moment,
|
||||
electric_dipole_moment, magnetic_charge );
|
||||
fChargeState.SetChargesAndMoments( charge,
|
||||
magnetic_dipole_moment,
|
||||
electric_dipole_moment,
|
||||
magnetic_charge );
|
||||
|
||||
// fpChargeState->SetChargeAndMoments( charge, magnetic_dipole_moment,
|
||||
// electric_dipole_moment, magnetic_charge );
|
||||
// NOTE: Leaves Spin unchanged !
|
||||
//
|
||||
// G4double pdgSpin= fChargeState.GetSpin(); // New Property of ChargeState (not well documented! )
|
||||
|
||||
// TO-DO: Improve the implementation using handles
|
||||
// IDEA: Improve the implementation using handles
|
||||
// -- and handle to the old one (which can be shared by other copies) and
|
||||
// must not be left to hang loose
|
||||
//
|
||||
// fpChargeState= new G4ChargeState( charge, magnetic_dipole_moment,
|
||||
// electric_dipole_moment, magnetic_charge );
|
||||
}
|
||||
|
||||
// Load values from array
|
||||
//
|
||||
// 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( 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];
|
||||
|
||||
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
|
||||
|
||||
// The following components may or may not be
|
||||
// integrated over -- integration is optional
|
||||
// fKineticEnergy= valArr[6];
|
||||
|
||||
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[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user