Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
@@ -23,39 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4BOptnForceFreeFlight
// --------------------------------------------------------------------
#include "G4BOptnForceFreeFlight.hh"
#include "G4ILawForceFreeFlight.hh"
#include "G4BiasingProcessInterface.hh"
#include "G4Step.hh"
G4BOptnForceFreeFlight::G4BOptnForceFreeFlight(G4String name)
: G4VBiasingOperation ( name ),
fCumulatedWeightChange ( -1.0 ),
fInitialTrackWeight ( -1.0 ),
fOperationComplete ( true )
G4BOptnForceFreeFlight::G4BOptnForceFreeFlight(const G4String& name)
: G4VBiasingOperation( name )
{
fForceFreeFlightInteractionLaw = new G4ILawForceFreeFlight("LawForOperation"+name);
}
G4BOptnForceFreeFlight::~G4BOptnForceFreeFlight()
{
if ( fForceFreeFlightInteractionLaw ) delete fForceFreeFlightInteractionLaw;
delete fForceFreeFlightInteractionLaw;
}
const G4VBiasingInteractionLaw* G4BOptnForceFreeFlight::ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface*, G4ForceCondition& proposeForceCondition )
const G4VBiasingInteractionLaw* G4BOptnForceFreeFlight::
ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface*,
G4ForceCondition& proposeForceCondition )
{
fOperationComplete = false;
proposeForceCondition = Forced;
return fForceFreeFlightInteractionLaw;
}
G4VParticleChange* G4BOptnForceFreeFlight::ApplyFinalStateBiasing( const G4BiasingProcessInterface* callingProcess,
const G4Track* track,
const G4Step* step,
G4bool& forceFinalState)
G4VParticleChange* G4BOptnForceFreeFlight::
ApplyFinalStateBiasing( const G4BiasingProcessInterface* callingProcess,
const G4Track* track, const G4Step* step,
G4bool& forceFinalState)
{
// -- If the track is reaching the volume boundary, its free flight ends. In this case, its zero
// -- weight is brought back to non-zero value: its initial weight is restored by the first
@@ -64,41 +62,39 @@ G4VParticleChange* G4BOptnForceFreeFlight::ApplyFinalStateBiasing( const G4Biasi
// -- If the track is not reaching the volume boundary, it zero weight flight continues.
fParticleChange.Initialize( *track );
forceFinalState = true;
forceFinalState = true;
if ( step->GetPostStepPoint()->GetStepStatus() == fGeomBoundary )
{
// -- Sanity checks:
if ( fInitialTrackWeight <= DBL_MIN )
{
// -- Sanity checks:
if ( fInitialTrackWeight <= DBL_MIN )
{
G4ExceptionDescription ed;
ed << " Initial track weight is null ! " << G4endl;
G4Exception(" G4BOptnForceFreeFlight::ApplyFinalStateBiasing(...)",
"BIAS.GEN.05",
JustWarning,
ed);
}
if ( fCumulatedWeightChange <= DBL_MIN )
{
G4ExceptionDescription ed;
ed << " Cumulated weight is null ! " << G4endl;
G4Exception(" G4BOptnForceFreeFlight::ApplyFinalStateBiasing(...)",
"BIAS.GEN.06",
JustWarning,
ed);
}
G4double proposedWeight = track->GetWeight();
if ( callingProcess->GetIsFirstPostStepDoItInterface() ) proposedWeight = fCumulatedWeightChange * fInitialTrackWeight;
else proposedWeight *= fCumulatedWeightChange;
fParticleChange.ProposeWeight(proposedWeight);
fOperationComplete = true;
G4ExceptionDescription ed;
ed << " Initial track weight is null ! " << G4endl;
G4Exception(" G4BOptnForceFreeFlight::ApplyFinalStateBiasing(...)",
"BIAS.GEN.05", JustWarning, ed);
}
if ( fCumulatedWeightChange <= DBL_MIN )
{
G4ExceptionDescription ed;
ed << " Cumulated weight is null ! " << G4endl;
G4Exception(" G4BOptnForceFreeFlight::ApplyFinalStateBiasing(...)",
"BIAS.GEN.06", JustWarning, ed);
}
G4double proposedWeight = track->GetWeight();
if ( callingProcess->GetIsFirstPostStepDoItInterface() )
proposedWeight = fCumulatedWeightChange * fInitialTrackWeight;
else
proposedWeight *= fCumulatedWeightChange;
fParticleChange.ProposeWeight(proposedWeight);
fOperationComplete = true;
}
return &fParticleChange;
}
void G4BOptnForceFreeFlight::AlongMoveBy( const G4BiasingProcessInterface*, const G4Step*, G4double weightChange )
void G4BOptnForceFreeFlight::
AlongMoveBy( const G4BiasingProcessInterface*,
const G4Step*, G4double weightChange )
{
fCumulatedWeightChange *= weightChange;
}