Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4InteractionLawPhysical Class Reference

#include <G4InteractionLawPhysical.hh>

Inheritance diagram for G4InteractionLawPhysical:
G4VBiasingInteractionLaw

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.

References G4Exception(), and JustWarning.

Referenced by G4BiasingProcessInterface::PostStepDoIt().

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
G4double G4InteractionLawPhysical::ComputeNonInteractionProbabilityAt ( G4double  length) const
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 62 of file G4InteractionLawPhysical.cc.

References G4Exception(), and JustWarning.

Referenced by G4BiasingProcessInterface::AlongStepDoIt().

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
G4double G4InteractionLawPhysical::GetPhysicalCrossSection ( ) const
inline

Definition at line 53 of file G4InteractionLawPhysical.hh.

Referenced by G4BOptnChangeCrossSection::GetBiasedCrossSection().

53 {return fCrossSection;}
G4double G4InteractionLawPhysical::SampleInteractionLength ( )
virtual

Implements G4VBiasingInteractionLaw.

Definition at line 73 of file G4InteractionLawPhysical.cc.

References DBL_MAX, FatalException, G4Exception(), and G4UniformRand.

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:87
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define DBL_MAX
Definition: templates.hh:83
void G4InteractionLawPhysical::SetPhysicalCrossSection ( G4double  crossSection)

Definition at line 39 of file G4InteractionLawPhysical.cc.

References G4Exception(), and JustWarning.

Referenced by G4BiasingProcessInterface::PostStepGetPhysicalInteractionLength(), and G4BOptnChangeCrossSection::SetBiasedCrossSection().

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
G4double G4InteractionLawPhysical::UpdateInteractionLengthForStep ( G4double  truePathLength)
virtual

Reimplemented from G4VBiasingInteractionLaw.

Definition at line 86 of file G4InteractionLawPhysical.cc.

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

87 {
88  fNumberOfInteractionLength -= truePathLength*fCrossSection;
89  if ( fNumberOfInteractionLength < 0 )
90  {
92  ed << " Negative number of interaction length for `" << GetName() << "' " << fNumberOfInteractionLength << ", set it to zero !" << G4endl;
93  G4Exception("G4InteractionLawPhysical::UpdateInteractionLengthForStep(...)",
94  "BIAS.GEN.13",
96  ed);
97  fNumberOfInteractionLength = 0.;
98  }
99  return fNumberOfInteractionLength;
100 }
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

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