Geant4  10.02.p03
G4ILawTruncatedExp Class Reference

#include <G4ILawTruncatedExp.hh>

Inheritance diagram for G4ILawTruncatedExp:
Collaboration diagram for G4ILawTruncatedExp:

Public Member Functions

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

Private Attributes

G4double fMaximumDistance
 
G4double fCrossSection
 
G4double fCrossSectionDefined
 
G4bool fIsSingular
 
G4double fInteractionDistance
 

Additional Inherited Members

Detailed Description

Definition at line 46 of file G4ILawTruncatedExp.hh.

Constructor & Destructor Documentation

◆ G4ILawTruncatedExp()

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

Definition at line 31 of file G4ILawTruncatedExp.cc.

33  fMaximumDistance(0.0),
34  fCrossSection(0.0),
35  fCrossSectionDefined(false),
36  fIsSingular(false)
37 {}

◆ ~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 {
60  if ( !fCrossSectionDefined )
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 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInteractionDistance()

G4double G4ILawTruncatedExp::GetInteractionDistance ( ) const
inline

Definition at line 67 of file G4ILawTruncatedExp.hh.

67 { return fInteractionDistance; }
Here is the caller graph for this function:

◆ GetMaximumDistance()

G4double G4ILawTruncatedExp::GetMaximumDistance ( ) const
inline

Definition at line 66 of file G4ILawTruncatedExp.hh.

66 { return fMaximumDistance;}
Here is the caller graph for this function:

◆ IsSingular()

virtual G4bool G4ILawTruncatedExp::IsSingular ( ) const
inlinevirtual

Reimplemented from G4VBiasingInteractionLaw.

Definition at line 59 of file G4ILawTruncatedExp.hh.

59 {return fIsSingular;}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleInteractionLength()

G4double G4ILawTruncatedExp::SampleInteractionLength ( )
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 89 of file G4ILawTruncatedExp.cc.

90 {
91  if ( !fCrossSectionDefined )
92  {
93  G4Exception("G4ILawTruncatedExp::Sample(..)",
94  "BIAS.GEN.12",
96  "Trying to sample while cross-section is not defined, assuming 0 !");
98  return fInteractionDistance;
99  }
100  fInteractionDistance = -std::log(1.0 - G4UniformRand()* (1.0 - std::exp(-fCrossSection*fMaximumDistance)))/fCrossSection;
101  return fInteractionDistance;
102 }
#define G4UniformRand()
Definition: Randomize.hh:97
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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;
54  fCrossSectionDefined = true;
55  fCrossSection = crossSection;
56 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetMaximumDistance()

void G4ILawTruncatedExp::SetMaximumDistance ( G4double  d)
inline

Definition at line 65 of file G4ILawTruncatedExp.hh.

65 { fMaximumDistance = d;}
Float_t d
Here is the caller graph for this function:

◆ 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",
116  JustWarning,
117  "Trying to sample while cross-section is not defined, assuming 0 !");
119  }
120 
121  return fInteractionDistance;
122 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fCrossSection

G4double G4ILawTruncatedExp::fCrossSection
private

Definition at line 71 of file G4ILawTruncatedExp.hh.

◆ fCrossSectionDefined

G4double G4ILawTruncatedExp::fCrossSectionDefined
private

Definition at line 72 of file G4ILawTruncatedExp.hh.

◆ fInteractionDistance

G4double G4ILawTruncatedExp::fInteractionDistance
private

Definition at line 74 of file G4ILawTruncatedExp.hh.

◆ fIsSingular

G4bool G4ILawTruncatedExp::fIsSingular
private

Definition at line 73 of file G4ILawTruncatedExp.hh.

◆ fMaximumDistance

G4double G4ILawTruncatedExp::fMaximumDistance
private

Definition at line 70 of file G4ILawTruncatedExp.hh.


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