Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
@@ -45,40 +45,69 @@ class G4ChargeState // Charge & moments
{
public: // without description
G4ChargeState(G4double charge,
G4double spin = 0,
G4double magnetic_dipole_moment = 0.0,
G4double electric_dipole_moment = 0.0,
G4double magnetic_charge = 0.0);
inline G4ChargeState(G4double charge,
G4double magnetic_dipole_moment,
G4double pdgSpin,
G4double electric_dipole_moment = 0.0,
G4double magnetic_charge = 0.0);
G4ChargeState( const G4ChargeState& right );
G4ChargeState& operator = ( const G4ChargeState& right );
inline G4ChargeState( const G4ChargeState& right );
inline G4ChargeState& operator = ( const G4ChargeState& right );
// Revise the charge (in units of the positron charge)
// do not change moments
void SetChargeAndMoments(G4double charge,
G4double spin,
G4double magnetic_dipole_moment = DBL_MAX,
G4double electric_dipole_moment = DBL_MAX,
G4double magnetic_charge = DBL_MAX );
// Revise the charge, spin and all moments
void SetChargeSpinMoments(G4double charge,
G4double pdgSpin,
G4double magnetic_dipole_moment= DBL_MAX,
G4double electric_dipole_moment= DBL_MAX,
G4double magnetic_charge= DBL_MAX );
// Revise the charge, pdgSpin, and optionally both moments and magnetic charge
void SetCharge(G4double charge){ fCharge = charge; }
G4double GetCharge() const { return fCharge; }
// Revise the charge (in units of the positron charge)
void SetSpin(G4double spin){ fSpin = spin; }
G4double GetSpin() const { return fSpin; }
void SetMagneticDipoleMoment(G4double moment){ fMagn_dipole = moment; }
// Basic Get / Set methods
void SetPDGSpin(G4double spin){ fSpin = spin; }
G4double GetPDGSpin() const { return fSpin; }
void SetMagneticDipoleMoment(G4double moment){ fMagn_dipole = moment; }
G4double GetMagneticDipoleMoment() const { return fMagn_dipole; }
void SetElectricDipoleMoment(G4double moment){ fElec_dipole = moment; }
void SetElectricDipoleMoment(G4double moment){ fElec_dipole = moment; }
G4double ElectricDipoleMoment() const { return fElec_dipole; }
void SetMagneticCharge(G4double charge){ fMagneticCharge=charge; }
void SetMagneticCharge(G4double charge){ fMagneticCharge=charge; }
G4double MagneticCharge() const { return fMagneticCharge; }
// Auxiliary methods to set several properties at once
inline void SetChargeMdm(G4double charge, G4double mag_dipole_moment);
// SetCharge and Magnetic Dipole Moment
inline void SetChargeMdmSpin(G4double charge,
G4double magnetic_dipole_moment,
G4double pdgSpin);
inline void SetChargeSpin(G4double charge,
G4double pdgSpin);
// Revise the charge, spin and all both moments
inline void SetChargeDipoleMoments(G4double charge,
G4double magnetic_dipole_moment,
G4double electric_dipole_moment);
inline void SetChargesAndMoments(G4double charge,
G4double magnetic_dipole_moment,
G4double electric_dipole_moment,
G4double magnetic_charge );
public: // Obsolete
inline void SetSpin(G4double spin){ SetPDGSpin( spin); }
inline G4double GetSpin() const { return GetPDGSpin(); }
private:
G4double fCharge;
@@ -87,4 +116,81 @@ class G4ChargeState // Charge & moments
G4double fElec_dipole;
G4double fMagneticCharge; // for magnetic monopole
};
// Inline methods implementation
inline G4ChargeState::G4ChargeState(G4double charge,
G4double magnetic_dipole_moment,
G4double spin,
G4double electric_dipole_moment,
G4double magnetic_charge)
{
fCharge = charge;
fSpin = spin;
fMagn_dipole = magnetic_dipole_moment;
fElec_dipole = electric_dipole_moment;
fMagneticCharge = magnetic_charge;
}
inline G4ChargeState::G4ChargeState( const G4ChargeState& right )
{
fCharge = right.fCharge;
fSpin = right.fSpin;
fMagn_dipole = right.fMagn_dipole;
fElec_dipole = right.fElec_dipole;
fMagneticCharge = right.fMagneticCharge;
}
inline G4ChargeState& G4ChargeState::operator = ( const G4ChargeState& right )
{
if (&right == this) return *this;
fCharge = right.fCharge;
fSpin = right.fSpin;
fMagn_dipole = right.fMagn_dipole;
fElec_dipole = right.fElec_dipole;
fMagneticCharge = right.fMagneticCharge;
return *this;
}
inline void G4ChargeState::SetChargeMdm(G4double charge, G4double mag_dipole_moment)
{
SetCharge( charge );
SetMagneticDipoleMoment( mag_dipole_moment);
}
inline void G4ChargeState::SetChargeMdmSpin(G4double charge,
G4double magDipoleMoment,
G4double pdgSpin)
{
SetChargeMdm( charge, magDipoleMoment );
SetPDGSpin( pdgSpin );
}
inline void G4ChargeState::SetChargeSpin(G4double charge,
G4double pdgSpin)
{
SetCharge( charge );
SetPDGSpin( pdgSpin );
}
inline void
G4ChargeState::SetChargeDipoleMoments(G4double charge,
G4double magneticDM,
G4double electricDM)
{
SetChargeMdm( charge, magneticDM );
SetElectricDipoleMoment( electricDM );
}
inline void
G4ChargeState::SetChargesAndMoments(G4double charge,
G4double magneticDM,
G4double electricDM,
G4double magnetic_charge )
{
SetChargeDipoleMoments( charge, magneticDM, electricDM);
SetMagneticCharge( magnetic_charge );
}
#endif /* End of ifndef G4ChargeState_HH */
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.hh 69699 2013-05-13 08:50:30Z gcosmo $
// $Id: G4FieldTrack.hh 81175 2014-05-22 07:39:10Z gcosmo $
//
//
// class G4FieldTrack
@@ -61,10 +61,11 @@ class G4FieldTrack
G4double kineticEnergy,
G4double restMass_c2,
G4double charge,
const G4ThreeVector& pSpin,
const G4ThreeVector& polarization,
G4double magnetic_dipole_moment= 0.0,
G4double curve_length= 0.0
);
G4double curve_length= 0.0,
G4double PDGspin = -1.0 );
G4FieldTrack( const G4FieldTrack& pFieldTrack );
G4FieldTrack( char ); // Almost default constructor
@@ -87,7 +88,10 @@ class G4FieldTrack
G4double magnetic_dipole_moment= DBL_MAX,
G4double electric_dipole_moment= DBL_MAX,
G4double magnetic_charge=DBL_MAX );
// Sets all charges and moments
// Sets the charges and moments that are not given as DBL_MAX
inline void SetPDGSpin(G4double pdgSpin){ fChargeState.SetPDGSpin(pdgSpin); }
inline G4double GetPDGSpin(){ return fChargeState.GetPDGSpin(); }
G4FieldTrack( const G4ThreeVector& pPosition,
const G4ThreeVector& pMomentumDirection,
@@ -97,7 +101,8 @@ class G4FieldTrack
G4double velocity,
G4double LaboratoryTimeOfFlight=0.0,
G4double ProperTimeOfFlight=0.0,
const G4ThreeVector* pSpin=0);
const G4ThreeVector* pPolarization=0,
G4double PDGspin = -1.0 );
// Older constructor
// ---> Misses charge !!!
@@ -111,7 +116,9 @@ class G4FieldTrack
inline G4double GetCurveLength() const;
// Distance along curve of point.
inline G4ThreeVector GetSpin() const;
inline G4ThreeVector GetPolarization() const;
inline void SetPolarization( const G4ThreeVector& vecPol );
inline G4double GetLabTimeOfFlight() const;
inline G4double GetProperTimeOfFlight() const;
inline G4double GetKineticEnergy() const;
@@ -132,24 +139,27 @@ class G4FieldTrack
inline void SetKineticEnergy(G4double nEnergy);
// Does not modify momentum.
inline void SetSpin(G4ThreeVector nSpin);
inline void SetLabTimeOfFlight(G4double nTOF);
inline void SetProperTimeOfFlight(G4double nTOF);
inline void SetLabTimeOfFlight(G4double tofLab);
inline void SetProperTimeOfFlight(G4double tofProper);
// Modifiers
public: // without description
inline void InitialiseSpin( const G4ThreeVector& Spin );
// Used to update / initialise the state
enum { ncompSVEC = 12 };
// Needed and should be used only for RK integration driver
inline void DumpToArray(G4double valArr[ncompSVEC]) const;
inline void LoadFromArray(const G4double valArr[ncompSVEC],
G4int noVarsIntegrated);
void LoadFromArray(const G4double valArr[ncompSVEC],
G4int noVarsIntegrated);
friend std::ostream&
operator<<( std::ostream& os, const G4FieldTrack& SixVec);
public: // Obsolete methods -- due to potential confusion with PDG spin
inline void InitialiseSpin( const G4ThreeVector& vecPolarization )
{ SetPolarization( vecPolarization ); }
inline G4ThreeVector GetSpin() const { return GetPolarization(); }
inline void SetSpin(G4ThreeVector vSpin){ SetPolarization(vSpin); }
private: // Implementation method -- Obsolete
inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
const G4ThreeVector& pMomentum,
@@ -162,7 +172,7 @@ class G4FieldTrack
G4double fRestMass_c2;
G4double fLabTimeOfFlight;
G4double fProperTimeOfFlight;
G4ThreeVector fSpin;
G4ThreeVector fPolarization;
G4ThreeVector fMomentumDir;
// G4double fInitialMomentumMag; // At 'track' creation.
// G4double fLastMomentumMag; // From last Update (for checking.)
@@ -24,20 +24,10 @@
// ********************************************************************
//
//
// $Id: G4FieldTrack.icc 69699 2013-05-13 08:50:30Z gcosmo $
// $Id: G4FieldTrack.icc 81175 2014-05-22 07:39:10Z gcosmo $
//
// -------------------------------------------------------------------
inline void
G4FieldTrack::InitialiseSpin( const G4ThreeVector& Spin )
{
// static G4ThreeVector ZeroVec(0.0, 0.0, 0.0);
fSpin = Spin;
// New Member ?? G4bool fHasSpin;
// fHasSpin = (fSpin != ZeroVec);
}
inline
G4FieldTrack::G4FieldTrack( const G4FieldTrack& rStVec )
: fDistanceAlongCurve( rStVec.fDistanceAlongCurve),
@@ -46,7 +36,7 @@ G4FieldTrack::G4FieldTrack( const G4FieldTrack& rStVec )
fLabTimeOfFlight( rStVec.fLabTimeOfFlight ),
fProperTimeOfFlight( rStVec.fProperTimeOfFlight ),
// fMomentumModulus( rStVec.fMomentumModulus ),
fSpin( rStVec.fSpin ),
fPolarization( rStVec.fPolarization ),
fMomentumDir( rStVec.fMomentumDir ),
fChargeState( rStVec.fChargeState )
{
@@ -142,15 +132,15 @@ void G4FieldTrack::SetKineticEnergy(G4double newKinEnergy)
}
inline
G4ThreeVector G4FieldTrack::GetSpin() const
G4ThreeVector G4FieldTrack::GetPolarization() const
{
return fSpin;
return fPolarization;
}
inline
void G4FieldTrack::SetSpin(G4ThreeVector nSpin)
void G4FieldTrack::SetPolarization(const G4ThreeVector& vecPlz)
{
fSpin=nSpin;
fPolarization= vecPlz;
}
inline
@@ -231,61 +221,15 @@ void G4FieldTrack::DumpToArray(G4double valArr[ncompSVEC] ) const
// valArr[6]=fEnergy; // When it is integrated over, do this ...
valArr[7]=fLabTimeOfFlight;
valArr[8]=fProperTimeOfFlight;
valArr[9]=fSpin.x();
valArr[10]=fSpin.y();
valArr[11]=fSpin.z();
valArr[9]=fPolarization.x();
valArr[10]=fPolarization.y();
valArr[11]=fPolarization.z();
// valArr[13]=fMomentumDir.x();
// valArr[14]=fMomentumDir.y();
// valArr[15]=fMomentumDir.z();
// valArr[]=fDistanceAlongCurve;
}
// Load values from array
//
// note that momentum direction must-be/is normalised
inline
void G4FieldTrack::LoadFromArray(const G4double valArrIn[ncompSVEC], G4int noVarsIntegrated)
{
G4int i;
// Fill the variables not integrated with zero -- so it's clear !!
static G4ThreadLocal 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];
fSpin=G4ThreeVector(valArr[9],valArr[10],valArr[11]);
// fMomentumDir=G4ThreeVector(valArr[13],valArr[14],valArr[15]);
// fDistanceAlongCurve= valArr[];
}
inline
G4FieldTrack & G4FieldTrack::operator = ( const G4FieldTrack& rStVec )
{
@@ -300,9 +244,10 @@ G4FieldTrack & G4FieldTrack::operator = ( const G4FieldTrack& rStVec )
SetCurveLength( rStVec.GetCurveLength() );
fKineticEnergy= rStVec.fKineticEnergy;
fRestMass_c2= rStVec.fRestMass_c2;
SetLabTimeOfFlight( rStVec.GetLabTimeOfFlight() );
SetProperTimeOfFlight( rStVec.GetProperTimeOfFlight() );
SetSpin( rStVec.GetSpin() );
SetPolarization( rStVec.GetPolarization() );
fMomentumDir= rStVec.fMomentumDir;
fChargeState= rStVec.fChargeState;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LineSection.hh 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4LineSection.hh 85845 2014-11-05 15:43:58Z gcosmo $
//
//
// class G4LineSection
@@ -48,22 +48,45 @@ class G4LineSection
{
public: // with description
G4LineSection( const G4ThreeVector& PntA, const G4ThreeVector& PntB );
inline G4LineSection( const G4ThreeVector& PntA, const G4ThreeVector& PntB );
G4double Dist( G4ThreeVector OtherPnt ) const;
G4double GetABdistanceSq() const { return fABdistanceSq ; }
inline G4double GetABdistanceSq() const;
static G4double Distline( const G4ThreeVector& OtherPnt,
const G4ThreeVector& LinePntA,
const G4ThreeVector& LinePntB );
inline static G4double Distline( const G4ThreeVector& OtherPnt,
const G4ThreeVector& LinePntA,
const G4ThreeVector& LinePntB );
private:
G4ThreeVector EndpointA;
G4ThreeVector VecAtoB;
G4double fABdistanceSq ;
};
// Inline methods implementations
inline
G4LineSection::G4LineSection( const G4ThreeVector& PntA,
const G4ThreeVector& PntB )
: EndpointA(PntA), VecAtoB(PntB-PntA)
{
fABdistanceSq = VecAtoB.mag2();
}
inline
G4double G4LineSection::GetABdistanceSq() const
{
return fABdistanceSq;
}
inline
G4double G4LineSection::Distline( const G4ThreeVector& OtherPnt,
const G4ThreeVector& LinePntA,
const G4ThreeVector& LinePntB )
{
G4LineSection LineAB( LinePntA, LinePntB ); // Line from A to B
return LineAB.Dist( OtherPnt );
}
#endif