Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4InteractionLawPhysical Class Reference

#include <G4InteractionLawPhysical.hh>

Inheritance diagram for G4InteractionLawPhysical:
Collaboration diagram for G4InteractionLawPhysical:

Public Member Functions

 G4InteractionLawPhysical (G4String name="exponentialLaw")
 
virtual ~G4InteractionLawPhysical ()
 
void SetPhysicalCrossSection (G4double crossSection)
 
G4double GetPhysicalCrossSection () const
 
virtual G4double ComputeEffectiveCrossSectionAt (G4double length) const
 
virtual G4double ComputeNonInteractionProbabilityAt (G4double length) const
 
virtual G4double SampleInteractionLength ()
 
virtual G4double UpdateInteractionLengthForStep (G4double truePathLength)
 
- Public Member Functions inherited from G4VBiasingInteractionLaw
 G4VBiasingInteractionLaw (G4String name)
 
virtual ~G4VBiasingInteractionLaw ()
 
const G4StringGetName () const
 
virtual G4bool IsSingular () const
 
virtual G4bool IsEffectiveCrossSectionInfinite () const
 
G4double Sample ()
 
G4double UpdateForStep (G4double truePathLength)
 
G4double GetSampledInteractionLength () const
 

Additional Inherited Members

Detailed Description

Definition at line 45 of file G4InteractionLawPhysical.hh.

Constructor & Destructor Documentation

G4InteractionLawPhysical::G4InteractionLawPhysical ( G4String  name = "exponentialLaw")

Definition at line 29 of file G4InteractionLawPhysical.cc.

31  fCrossSection(0.0),
32  fCrossSectionDefined(false),
33  fNumberOfInteractionLength(-1.0)
34 {}
G4InteractionLawPhysical::~G4InteractionLawPhysical ( )
virtual

Definition at line 36 of file G4InteractionLawPhysical.cc.

37 {}

Member Function Documentation

G4double G4InteractionLawPhysical::ComputeEffectiveCrossSectionAt ( G4double  length) const
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 53 of file G4InteractionLawPhysical.cc.

54 {
55  if (!fCrossSectionDefined) G4Exception("G4InteractionLawPhysical::ComputeEffectiveCrossSection(..)",
56  "BIAS.GEN.15",
58  "Cross-section value requested, but has not been defined yet. Assumes 0 !");
59  return fCrossSection;
60 }
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:

G4double G4InteractionLawPhysical::ComputeNonInteractionProbabilityAt ( G4double  length) const
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 62 of file G4InteractionLawPhysical.cc.

63 {
64  if (!fCrossSectionDefined) G4Exception("G4InteractionLawPhysical::ComputeNonInteractionProbability(..)",
65  "BIAS.GEN.16",
67  "Non interaction probabitlity value requested, but cross section has not been defined yet. Assumes it to be 0 !");
68  // -- allows zero cross-section case, by convention:
69  if ( fCrossSection == 0.0 ) return 1.0;
70  else return std::exp(-fCrossSection*stepLength);
71 }
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:

G4double G4InteractionLawPhysical::GetPhysicalCrossSection ( ) const
inline

Definition at line 53 of file G4InteractionLawPhysical.hh.

53 {return fCrossSection;}

Here is the caller graph for this function:

G4double G4InteractionLawPhysical::SampleInteractionLength ( )
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 73 of file G4InteractionLawPhysical.cc.

74 {
75  if ( !fCrossSectionDefined || fCrossSection < 0.0 ) G4Exception("G4InteractionLawPhysical::Sample(..)",
76  "BIAS.GEN.17",
78  "Trying to sample while cross-section is not defined or < 0 !");
79  if ( fCrossSection == 0.0 ) return DBL_MAX;
80 
81  fNumberOfInteractionLength = -std::log( G4UniformRand() );
82  return fNumberOfInteractionLength/fCrossSection;
83 }
#define G4UniformRand()
Definition: Randomize.hh:97
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define DBL_MAX
Definition: templates.hh:83

Here is the call graph for this function:

void G4InteractionLawPhysical::SetPhysicalCrossSection ( G4double  crossSection)

Definition at line 39 of file G4InteractionLawPhysical.cc.

40 {
41  if (crossSection < 0.0)
42  {
43  G4Exception("G4InteractionLawPhysical::SetPhysicalCrossSection(..)",
44  "BIAS.GEN.14",
46  "Cross-section value passed is negative. It is set to zero !");
47  crossSection = 0.0;
48  }
49  fCrossSectionDefined = true;
50  fCrossSection = crossSection;
51 }
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:

G4double G4InteractionLawPhysical::UpdateInteractionLengthForStep ( G4double  truePathLength)
virtual

Reimplemented from G4VBiasingInteractionLaw.

Definition at line 86 of file G4InteractionLawPhysical.cc.

87 {
88  fNumberOfInteractionLength -= truePathLength*fCrossSection;
89 
90  if ( fNumberOfInteractionLength < 0 )
91  {
93  ed << " Negative number of interaction length for `" << GetName() << "' " << fNumberOfInteractionLength << ", set it to zero !" << G4endl;
94  G4Exception("G4InteractionLawPhysical::UpdateInteractionLengthForStep(...)",
95  "BIAS.GEN.13",
97  ed);
98  fNumberOfInteractionLength = 0.;
99  }
100  return fNumberOfInteractionLength/fCrossSection;
101 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const

Here is the call graph for this function:


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