Import Geant4 11.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2025-06-26 09:17:29 +02:00
parent 20a218bbe1
commit a499fb82e9
1941 changed files with 203285 additions and 95593 deletions
@@ -23,14 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// class G4SafetyHelper
// G4SafetyHelper
//
// Class description:
//
// This class is a helper for physics processes which require
// knowledge of the safety, and the step size for the 'mass' geometry
// knowledge of the safety, and the step size for the 'mass' geometry.
// First version: J.Apostolakis, July 5th, 2006
// Author: John Apostolakis (CERN), 5 July 2006
// --------------------------------------------------------------------
#ifndef G4SAFETYHELPER_HH
#define G4SAFETYHELPER_HH 1
@@ -43,49 +43,94 @@
class G4PathFinder;
/**
* @brief G4SafetyHelper is a helper class for physics processes which require
* knowledge of the safety, and the step size for the 'mass' geometry.
*/
class G4SafetyHelper
{
public: // with description
public:
/**
* Constructor and default Destructor.
*/
G4SafetyHelper();
~G4SafetyHelper();
// Constructor and destructor
~G4SafetyHelper() = default;
/**
* Computes the distance in the mass geometry.
* @param[in] position Point in global coordinates.
* @param[in] direction Direction.
* @param[in] currentMaxStep Proposed step length to nearest boundary.
* @param[in,out] newSafety New safety.
* @returns The linear step for mass geometry.
*/
G4double CheckNextStep( const G4ThreeVector& position,
const G4ThreeVector& direction,
const G4double currentMaxStep,
G4double& newSafety );
// Return linear step for mass geometry
/**
* Computes the safety distance for all geometries.
* @param[in] pGlobalPoint Point in global coordinates.
* @param[in] maxRadius Radius of interest (e.g. maximum displacement).
* Giving this, one can reduce the average computational
* cost. If not provided, the real isotropic safety is computed.
* @returns The safety distance for all geometries.
*/
G4double ComputeSafety( const G4ThreeVector& pGlobalPoint,
G4double maxRadius = DBL_MAX );
// Return safety for all geometries.
//
// The 2nd argument is the radius of your interest (e.g. maximum
// displacement). Giving this you can reduce the average computational
// cost. If the second argument is not given, this is the real
// isotropic safety
/**
* Locates the point for all geometries.
* @param[in] pGlobalPoint Point in global coordinates.
* @param[in] direction Direction.
*/
void Locate(const G4ThreeVector& pGlobalPoint,
const G4ThreeVector& direction);
// Locate the point for all geometries
/**
* Relocates the point in the volume of interest.
* @param[in] pGlobalPoint Point in global coordinates.
*/
void ReLocateWithinVolume(const G4ThreeVector& pGlobalPoint );
// Relocate the point in the volume of interest
/**
* Enables navigation in parallel geometries.
* @param[in] parallel Flag to have parallel worlds considered.
* Alternative is to use single (mass) navigator directly.
*/
inline void EnableParallelNavigation(G4bool parallel);
// To have parallel worlds considered, must be true.
// Alternative is to use single (mass) Navigator directly
/**
* Checks for new navigator for tracking, and reinitialises pointer.
*/
void InitialiseNavigator();
// Check for new navigator for tracking, and reinitialise pointer
/**
* Verbosity control.
* @param[in] lev The new verbosity level to enable.
* @returns The old verbosity level.
*/
inline G4int SetVerboseLevel( G4int lev );
/**
* Retrieves the world volume of the mass geometry.
* @returns The pointer to the mass geometry world volume.
*/
inline G4VPhysicalVolume* GetWorldVolume();
/**
* Sets the safety value for the given position.
* @param[in] val The safety value.
* @param[in] pos The position.
*/
inline void SetCurrentSafety(G4double val, const G4ThreeVector& pos);
public: // without description
/**
* Initialises all data and navigator.
*/
void InitialiseHelper();
private:
@@ -93,54 +138,28 @@ class G4SafetyHelper
G4PathFinder* fpPathFinder = nullptr;
G4Navigator* fpMassNavigator = nullptr;
/** Flag whether to use PathFinder or single (mass) navigator directly.
By default, one geometry only. */
G4bool fUseParallelGeometries = false;
// Flag whether to use PathFinder or single (mass) Navigator directly
// By default, one geometry only
G4bool fFirstCall = true;
// Flag of first call
G4int fVerbose = 0;
// Whether to print warning in case of move outside safety
// State used during tracking -- for optimisation
/** Flag of first call. */
G4bool fFirstCall = true;
/** Whether to print warning in case of move outside safety. */
G4int fVerbose = 0;
// State used during tracking -- for optimisation -------------------------
G4ThreeVector fLastSafetyPosition;
G4double fLastSafety = 0.0;
// const G4double fRecomputeFactor = 0.0;
// parameter for further optimisation:
// if ( move < fact*safety ) do fast recomputation of safety
// End State (tracking)
// End State (tracking) ---------------------------------------------------
};
// --------------------------------------------------------------------
// Inline definitions
// --------------------------------------------------------------------
inline G4int G4SafetyHelper::SetVerboseLevel( G4int lev )
{
G4int oldlv = fVerbose;
fVerbose = lev;
return oldlv;
}
inline
void G4SafetyHelper::EnableParallelNavigation(G4bool parallel)
{
fUseParallelGeometries = parallel;
}
inline
G4VPhysicalVolume* G4SafetyHelper::GetWorldVolume()
{
return fpMassNavigator->GetWorldVolume();
}
inline
void G4SafetyHelper::SetCurrentSafety(G4double val, const G4ThreeVector& pos)
{
fLastSafety = val;
fLastSafetyPosition = pos;
}
#include "G4SafetyHelper.icc"
#endif