Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
@@ -27,13 +27,13 @@
//
// Class description:
//
// Data structure bringing together a magnetic track's state.
// (position, momentum direction & modulus, energy, spin, ... )
// Data structure bringing together a magnetic track's state
// (position, momentum direction & modulus, energy, spin, ... ).
// Uses/abilities:
// - does not maintain any relationship between its data (eg energy/momentum).
// - for use in Runge-Kutta solver (in passing it the values right now).
// Author: John Apostolakis, CERN - First version, 14.10.1996
// Author: John Apostolakis (CERN), 14.10.1996 - First version
// -------------------------------------------------------------------
#ifndef G4FIELDTRACK_HH
#define G4FIELDTRACK_HH
@@ -41,140 +41,202 @@
#include "G4ThreeVector.hh"
#include "G4ChargeState.hh"
/**
* @brief G4FieldTrack defines a data structure bringing together a magnetic
* track's state (position, momentum direction & modulus, energy, spin, etc. ).
*/
class G4FieldTrack
{
public: // with description
public:
G4FieldTrack( const G4ThreeVector& pPosition,
G4double LaboratoryTimeOfFlight,
const G4ThreeVector& pMomentumDirection,
G4double kineticEnergy,
G4double restMass_c2,
G4double charge,
const G4ThreeVector& polarization,
G4double magnetic_dipole_moment = 0.0,
G4double curve_length = 0.0,
G4double PDGspin = -1.0 );
/**
* Constructor for G4FieldTrack.
* @param[in] pPosition Position in Cartesian coordinates.
* @param[in] LaboratoryTimeOfFlight Laboratory time of flight value.
* @param[in] pMomentumDirection Direction vector.
* @param[in] kineticEnergy Kinetic energy value.
* @param[in] restMass_c2 Mass at rest.
* @param[in] charge Charge.
* @param[in] polarization Polarisation vector.
* @param[in] magnetic_dipole_moment Magnetic dipole moment.
* @param[in] curve_length Length of curve.
* @param[in] PDGspin Spin.
*/
G4FieldTrack( const G4ThreeVector& pPosition,
G4double LaboratoryTimeOfFlight,
const G4ThreeVector& pMomentumDirection,
G4double kineticEnergy,
G4double restMass_c2,
G4double charge,
const G4ThreeVector& polarization,
G4double magnetic_dipole_moment = 0.0,
G4double curve_length = 0.0,
G4double PDGspin = -1.0 );
G4FieldTrack( char );
// Almost default constructor
/**
* Older constructor for G4FieldTrack, similar to above but missing charge.
* @param[in] pPosition Position in Cartesian coordinates.
* @param[in] pMomentumDirection Direction vector.
* @param[in] curve_length Length of curve.
* @param[in] kineticEnergy Kinetic energy value.
* @param[in] restMass_c2 Mass at rest.
* @param[in] velocity Velocity value - Not used.
* @param[in] LaboratoryTimeOfFlight Laboratory time of flight value.
* @param[in] ProperTimeOfFlight Proper time of flight value.
* @param[in] polarization Polarisation vector.
* @param[in] PDGspin Spin.
*/
G4FieldTrack( const G4ThreeVector& pPosition,
const G4ThreeVector& pMomentumDirection,
G4double curve_length,
G4double kineticEnergy,
const G4double restMass_c2,
G4double velocity,
G4double LaboratoryTimeOfFlight = 0.0,
G4double ProperTimeOfFlight = 0.0,
const G4ThreeVector* pPolarization = nullptr,
G4double PDGspin = -1.0 );
G4FieldTrack( const G4ThreeVector& pPosition,
const G4ThreeVector& pMomentumDirection,
G4double curve_length,
G4double kineticEnergy,
const G4double restMass_c2,
G4double velocity,
G4double LaboratoryTimeOfFlight = 0.0,
G4double ProperTimeOfFlight = 0.0,
const G4ThreeVector* pPolarization = nullptr,
G4double PDGspin = -1.0 );
// Older constructor
// ---> Misses charge !!!
/**
* Empty init constructor.
*/
G4FieldTrack( char );
~G4FieldTrack() = default;
// Destructor
/**
* Default Destructor.
*/
~G4FieldTrack() = default;
inline G4FieldTrack( const G4FieldTrack& pFieldTrack );
inline G4FieldTrack& operator= ( const G4FieldTrack& rStVec );
// Copy constructor & Assignment operator
/**
* Copy constructor and assignment operator.
*/
inline G4FieldTrack( const G4FieldTrack& pFieldTrack );
inline G4FieldTrack& operator= ( const G4FieldTrack& rStVec );
inline G4FieldTrack(G4FieldTrack&& from) noexcept ;
inline G4FieldTrack& operator=(G4FieldTrack&& from) noexcept ;
// Move constructor & operator
/**
* Move constructor and move assignment operator.
*/
inline G4FieldTrack(G4FieldTrack&& from) noexcept ;
inline G4FieldTrack& operator=(G4FieldTrack&& from) noexcept ;
inline void UpdateState( const G4ThreeVector& pPosition,
G4double LaboratoryTimeOfFlight,
const G4ThreeVector& pMomentumDirection,
G4double kineticEnergy);
// Update four-vectors for space/time and momentum/energy
// Also resets curve length.
/**
* Streaming operator.
*/
friend std::ostream& operator<<(std::ostream& os, const G4FieldTrack& SixVec);
inline void UpdateFourMomentum( G4double kineticEnergy,
const G4ThreeVector& momentumDirection );
// Update momentum (and direction), and kinetic energy
/**
* Updates four-vectors for space/time and momentum/energy, also
* resets the curve length.
* @param[in] pPosition Position in Cartesian coordinates.
* @param[in] LaboratoryTimeOfFlight Laboratory time of flight value.
* @param[in] pMomentumDirection Direction vector.
* @param[in] kineticEnergy Kinetic energy value.
*/
inline void UpdateState( const G4ThreeVector& pPosition,
G4double LaboratoryTimeOfFlight,
const G4ThreeVector& pMomentumDirection,
G4double kineticEnergy);
void SetChargeAndMoments(G4double charge,
G4double magnetic_dipole_moment = DBL_MAX,
G4double electric_dipole_moment = DBL_MAX,
G4double magnetic_charge = DBL_MAX );
// Set the charges and moments that are not given as DBL_MAX
/**
* Updates momentum, direction and kinetic energy.
* @param[in] kineticEnergy Kinetic energy value.
* @param[in] pMomentumDirection Direction vector.
*/
inline void UpdateFourMomentum( G4double kineticEnergy,
const G4ThreeVector& momentumDirection );
inline void SetPDGSpin(G4double pdgSpin);
inline G4double GetPDGSpin();
/**
* Sets the charges and moments that are not given as DBL_MAX.
* @param[in] charge Charge value.
* @param[in] magnetic_dipole_moment M agnetic dipole moment.
* @param[in] electric_dipole_moment Electric dipole moment.
* @param[in] magnetic_charge Magnetic charge.
*/
void SetChargeAndMoments(G4double charge,
G4double magnetic_dipole_moment = DBL_MAX,
G4double electric_dipole_moment = DBL_MAX,
G4double magnetic_charge = DBL_MAX );
inline G4ThreeVector GetMomentum() const;
inline G4ThreeVector GetPosition() const;
inline const G4ThreeVector& GetMomentumDir() const;
inline G4ThreeVector GetMomentumDirection() const;
inline G4double GetCurveLength() const;
// Distance along curve of point.
/**
* Setter and getter for PDG spin.
*/
inline void SetPDGSpin(G4double pdgSpin);
inline G4double GetPDGSpin();
inline G4ThreeVector GetPolarization() const;
inline void SetPolarization( const G4ThreeVector& vecPol );
/**
* Accessors.
*/
inline G4ThreeVector GetMomentum() const;
inline G4ThreeVector GetPosition() const;
inline const G4ThreeVector& GetMomentumDir() const;
inline G4ThreeVector GetMomentumDirection() const;
inline G4double GetCurveLength() const;
inline const G4ChargeState* GetChargeState() const;
inline G4double GetLabTimeOfFlight() const;
inline G4double GetProperTimeOfFlight() const;
inline G4double GetKineticEnergy() const;
inline G4double GetCharge() const;
inline G4double GetRestMass() const;
inline const G4ChargeState* GetChargeState() const;
inline G4double GetLabTimeOfFlight() const;
inline G4double GetProperTimeOfFlight() const;
inline G4double GetKineticEnergy() const;
inline G4double GetCharge() const;
inline G4double GetRestMass() const;
// Accessors.
/**
* Getter and setter for polarisation.
*/
inline G4ThreeVector GetPolarization() const;
inline void SetPolarization( const G4ThreeVector& vecPol );
inline void SetPosition(const G4ThreeVector& nPos);
inline void SetMomentum(const G4ThreeVector& nMomDir);
// Does change mom-dir too.
/**
* Setters for momentum. SetMomentumDir() does not change momentum
* or Velocity Vector.
*/
inline void SetMomentum(const G4ThreeVector& nMomDir);
inline void SetMomentumDir(const G4ThreeVector& nMomDir);
inline void SetMomentumDir(const G4ThreeVector& nMomDir);
// Does NOT change Momentum or Velocity Vector.
/**
* Modifiers.
*/
inline void SetPosition(const G4ThreeVector& nPos);
inline void SetRestMass(G4double Mass_c2);
inline void SetCurveLength(G4double nCurve_s); // Distance along curve.
inline void SetKineticEnergy(G4double nEnergy); // Does not modify momentum.
inline void SetLabTimeOfFlight(G4double tofLab);
inline void SetProperTimeOfFlight(G4double tofProper);
inline void SetRestMass(G4double Mass_c2);
inline void SetCurveLength(G4double nCurve_s);
// Distance along curve.
inline void SetKineticEnergy(G4double nEnergy);
// Does not modify momentum.
enum { ncompSVEC = 12 }; // Needed; should be used only for RK integration driver
inline void SetLabTimeOfFlight(G4double tofLab);
inline void SetProperTimeOfFlight(G4double tofProper);
// Modifiers
/**
* Dumps/loads values to/from a provided array 'valArray'.
*/
inline void DumpToArray(G4double valArr[ncompSVEC]) const;
void LoadFromArray(const G4double valArr[ncompSVEC],
G4int noVarsIntegrated);
public: // without description
/**
* More setters/getter foe spin, now obsolete.
*/
inline void InitialiseSpin( const G4ThreeVector& vecPolarization );
inline G4ThreeVector GetSpin() const;
inline void SetSpin(const G4ThreeVector& vSpin);
enum { ncompSVEC = 12 };
// Needed and should be used only for RK integration driver
private:
inline void DumpToArray(G4double valArr[ncompSVEC]) const;
void LoadFromArray(const G4double valArr[ncompSVEC],
G4int noVarsIntegrated);
friend std::ostream&
operator<<( std::ostream& os, const G4FieldTrack& SixVec);
/**
* Implementation method. Obsolete.
*/
inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
const G4ThreeVector& pMomentum,
G4double s_curve );
private:
public: // Obsolete methods -- due to potential confusion with PDG spin
inline void InitialiseSpin( const G4ThreeVector& vecPolarization );
inline G4ThreeVector GetSpin() const;
inline void SetSpin(const G4ThreeVector& vSpin);
private: // Implementation method -- Obsolete
inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
const G4ThreeVector& pMomentum,
G4double s_curve );
private:
G4double SixVector[6];
G4double fDistanceAlongCurve; // distance along curve of point
G4double fKineticEnergy;
G4double fRestMass_c2;
G4double fLabTimeOfFlight;
G4double fProperTimeOfFlight;
G4ThreeVector fPolarization;
G4ThreeVector fMomentumDir;
// G4double fInitialMomentumMag; // At 'track' creation.
// G4double fLastMomentumMag; // From last Update (for checking.)
G4ChargeState fChargeState;
G4double SixVector[6];
G4double fDistanceAlongCurve; // distance along curve of point
G4double fKineticEnergy;
G4double fRestMass_c2;
G4double fLabTimeOfFlight;
G4double fProperTimeOfFlight;
G4ThreeVector fPolarization;
G4ThreeVector fMomentumDir;
G4ChargeState fChargeState;
};
#include "G4FieldTrack.icc"