Geant4-11
Public Member Functions | Private Attributes
G4ILawTruncatedExp Class Reference

#include <G4ILawTruncatedExp.hh>

Inheritance diagram for G4ILawTruncatedExp:
G4VBiasingInteractionLaw

Public Member Functions

virtual G4double ComputeEffectiveCrossSectionAt (G4double length) const
 
virtual G4double ComputeNonInteractionProbabilityAt (G4double length) const
 
 G4ILawTruncatedExp (G4String name="expForceInteractionLaw")
 
G4double GetInteractionDistance () const
 
G4double GetMaximumDistance () const
 
const G4StringGetName () const
 
G4double GetSampledInteractionLength () const
 
virtual G4bool IsEffectiveCrossSectionInfinite () const
 
virtual G4bool IsSingular () const
 
G4double Sample ()
 
virtual G4double SampleInteractionLength ()
 
void SetForceCrossSection (G4double xs)
 
void SetMaximumDistance (G4double d)
 
G4double UpdateForStep (G4double truePathLength)
 
virtual G4double UpdateInteractionLengthForStep (G4double truePathLength)
 
virtual ~G4ILawTruncatedExp ()
 

Private Attributes

G4double fCrossSection
 
G4double fCrossSectionDefined
 
G4double fInteractionDistance
 
G4bool fIsSingular
 
G4double fMaximumDistance
 
G4String fName
 
G4double fSampledInteractionLength
 

Detailed Description

Definition at line 45 of file G4ILawTruncatedExp.hh.

Constructor & Destructor Documentation

◆ G4ILawTruncatedExp()

G4ILawTruncatedExp::G4ILawTruncatedExp ( G4String  name = "expForceInteractionLaw")

Definition at line 31 of file G4ILawTruncatedExp.cc.

◆ ~G4ILawTruncatedExp()

G4ILawTruncatedExp::~G4ILawTruncatedExp ( )
virtual

Definition at line 39 of file G4ILawTruncatedExp.cc.

40{}

Member Function Documentation

◆ ComputeEffectiveCrossSectionAt()

G4double G4ILawTruncatedExp::ComputeEffectiveCrossSectionAt ( G4double  length) const
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 58 of file G4ILawTruncatedExp.cc.

59{
61 {
62 G4Exception("G4ILawTruncatedExp::ComputeEffectiveCrossSection(..)",
63 "BIAS.GEN.10",
65 "Cross-section value requested, but has not been defined yet. Assumes 0 !");
66 // -- zero cross-section, returns the limit form of the effective cross-section:
67 return 1.0 / ( fMaximumDistance - distance );
68 }
69 G4double denum = 1.0 - std::exp( -fCrossSection * ( fMaximumDistance - distance) );
70 return fCrossSection / denum;
71}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
double G4double
Definition: G4Types.hh:83

References fCrossSection, fCrossSectionDefined, fMaximumDistance, G4Exception(), and JustWarning.

Referenced by G4ILawCommonTruncatedExp::ComputeEffectiveCrossSectionAt().

◆ ComputeNonInteractionProbabilityAt()

G4double G4ILawTruncatedExp::ComputeNonInteractionProbabilityAt ( G4double  length) const
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 73 of file G4ILawTruncatedExp.cc.

74{
76 {
77 G4Exception("G4ILawTruncatedExp::ComputeNonInteractionProbability(..)",
78 "BIAS.GEN.11",
80 "Non interaction probability value requested, but cross section has not been defined yet. Assumes it to be 0 !");
81 // -- return limit case of null cross-section:
82 return 1.0 - distance / fMaximumDistance;
83 }
84 G4double num = 1.0 - std::exp( -fCrossSection*distance );
85 G4double denum = 1.0 - std::exp( -fCrossSection*fMaximumDistance );
86 return 1.0 - num/denum;
87}

References fCrossSection, fCrossSectionDefined, fMaximumDistance, G4Exception(), and JustWarning.

Referenced by G4ILawCommonTruncatedExp::ComputeNonInteractionProbabilityAt().

◆ GetInteractionDistance()

G4double G4ILawTruncatedExp::GetInteractionDistance ( ) const
inline

◆ GetMaximumDistance()

G4double G4ILawTruncatedExp::GetMaximumDistance ( ) const
inline

Definition at line 65 of file G4ILawTruncatedExp.hh.

65{ return fMaximumDistance;}

References fMaximumDistance.

Referenced by G4ILawCommonTruncatedExp::GetMaximumDistance().

◆ GetName()

const G4String & G4VBiasingInteractionLaw::GetName ( ) const
inlineinherited

◆ GetSampledInteractionLength()

G4double G4VBiasingInteractionLaw::GetSampledInteractionLength ( ) const
inlineinherited

◆ IsEffectiveCrossSectionInfinite()

virtual G4bool G4VBiasingInteractionLaw::IsEffectiveCrossSectionInfinite ( ) const
inlinevirtualinherited

◆ IsSingular()

virtual G4bool G4ILawTruncatedExp::IsSingular ( ) const
inlinevirtual

Reimplemented from G4VBiasingInteractionLaw.

Definition at line 58 of file G4ILawTruncatedExp.hh.

58{return fIsSingular;}

References fIsSingular.

Referenced by G4ILawCommonTruncatedExp::IsSingular().

◆ Sample()

G4double G4VBiasingInteractionLaw::Sample ( )
inlineinherited

◆ SampleInteractionLength()

G4double G4ILawTruncatedExp::SampleInteractionLength ( )
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 89 of file G4ILawTruncatedExp.cc.

90{
92 {
93 G4Exception("G4ILawTruncatedExp::Sample(..)",
94 "BIAS.GEN.12",
96 "Trying to sample while cross-section is not defined, assuming 0 !");
99 }
100 fInteractionDistance = -std::log(1.0 - G4UniformRand()* (1.0 - std::exp(-fCrossSection*fMaximumDistance)))/fCrossSection;
102}
#define G4UniformRand()
Definition: Randomize.hh:52

References fCrossSection, fCrossSectionDefined, fInteractionDistance, fMaximumDistance, G4Exception(), G4UniformRand, and JustWarning.

Referenced by G4ILawCommonTruncatedExp::SampleInteractionLength().

◆ SetForceCrossSection()

void G4ILawTruncatedExp::SetForceCrossSection ( G4double  xs)

Definition at line 42 of file G4ILawTruncatedExp.cc.

43{
44 if (crossSection < 0.0)
45 {
46 G4Exception("G4ILawTruncatedExp::SetForceCrossSection(..)",
47 "BIAS.GEN.09",
49 "Cross-section value passed is negative. It is set to zero !");
50 fIsSingular = true;
51 crossSection = 0.0;
52 }
53 fIsSingular = false;
55 fCrossSection = crossSection;
56}

References fCrossSection, fCrossSectionDefined, fIsSingular, G4Exception(), and JustWarning.

Referenced by G4ILawCommonTruncatedExp::SetForceCrossSection().

◆ SetMaximumDistance()

void G4ILawTruncatedExp::SetMaximumDistance ( G4double  d)
inline

Definition at line 64 of file G4ILawTruncatedExp.hh.

64{ fMaximumDistance = d;}

References fMaximumDistance.

Referenced by G4ILawCommonTruncatedExp::SetMaximumDistance().

◆ UpdateForStep()

G4double G4VBiasingInteractionLaw::UpdateForStep ( G4double  truePathLength)
inlineinherited

◆ UpdateInteractionLengthForStep()

G4double G4ILawTruncatedExp::UpdateInteractionLengthForStep ( G4double  truePathLength)
virtual

Reimplemented from G4VBiasingInteractionLaw.

Definition at line 105 of file G4ILawTruncatedExp.cc.

106{
107 fInteractionDistance -= truePathLength;
108 fMaximumDistance -= truePathLength;
109
110 if ( fInteractionDistance < 0 )
111 {
113 ed << " Negative number of interaction length for `" << GetName() << "' " << fInteractionDistance << ", set it to zero !" << G4endl;
114 G4Exception("G4ILawTruncatedExp::UpdateInteractionLengthForStep(...)",
115 "BIAS.GEN.13",
117 "Trying to sample while cross-section is not defined, assuming 0 !");
119 }
120
122}
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4endl
Definition: G4ios.hh:57
const G4String & GetName() const

References fInteractionDistance, fMaximumDistance, G4endl, G4Exception(), G4VBiasingInteractionLaw::GetName(), and JustWarning.

Referenced by G4ILawCommonTruncatedExp::UpdateInteractionLengthForStep().

Field Documentation

◆ fCrossSection

G4double G4ILawTruncatedExp::fCrossSection
private

◆ fCrossSectionDefined

G4double G4ILawTruncatedExp::fCrossSectionDefined
private

◆ fInteractionDistance

G4double G4ILawTruncatedExp::fInteractionDistance
private

◆ fIsSingular

G4bool G4ILawTruncatedExp::fIsSingular
private

Definition at line 72 of file G4ILawTruncatedExp.hh.

Referenced by IsSingular(), and SetForceCrossSection().

◆ fMaximumDistance

G4double G4ILawTruncatedExp::fMaximumDistance
private

◆ fName

G4String G4VBiasingInteractionLaw::fName
privateinherited

Definition at line 111 of file G4VBiasingInteractionLaw.hh.

Referenced by G4VBiasingInteractionLaw::GetName().

◆ fSampledInteractionLength

G4double G4VBiasingInteractionLaw::fSampledInteractionLength
privateinherited

The documentation for this class was generated from the following files: