Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CrossSectionPatch Class Referenceabstract

#include <G4CrossSectionPatch.hh>

Inheritance diagram for G4CrossSectionPatch:

Public Member Functions

 G4CrossSectionPatch ()
virtual ~G4CrossSectionPatch ()
G4bool operator== (const G4CrossSectionPatch &right) const
G4bool operator!= (const G4CrossSectionPatch &right) const
virtual G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual const G4CrossSectionVectorGetComponents () const =0
virtual G4bool IsValid (G4double e) const
Public Member Functions inherited from G4VCrossSectionSource
 G4VCrossSectionSource ()
virtual ~G4VCrossSectionSource ()
G4bool operator== (const G4VCrossSectionSource &right) const
G4bool operator!= (const G4VCrossSectionSource &right) const
virtual G4String Name () const =0
virtual void Print () const
virtual void PrintAll (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual G4double HighLimit () const
virtual G4double LowLimit () const

Protected Member Functions

G4double Transition (const G4KineticTrack &trk1, const G4KineticTrack &trk2, const G4VCrossSectionSource *comp1, const G4VCrossSectionSource *comp2) const
G4double Transition (G4double ecm, G4double sigma1, G4double sigma2, G4double e1, G4double e2) const
Protected Member Functions inherited from G4VCrossSectionSource
G4bool InLimits (G4double e, G4double eLow, G4double eHigh) const
const G4ParticleDefinitionFindLightParticle (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
G4double FcrossX (G4double e, G4double e0, G4double sigma, G4double eParam, G4double power) const
const G4ParticleDefinitionFindKeyParticle (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const

Detailed Description

Definition at line 50 of file G4CrossSectionPatch.hh.

Constructor & Destructor Documentation

◆ G4CrossSectionPatch()

G4CrossSectionPatch::G4CrossSectionPatch ( )

Definition at line 48 of file G4CrossSectionPatch.cc.

49{ }

Referenced by GetComponents(), operator!=(), and operator==().

◆ ~G4CrossSectionPatch()

G4CrossSectionPatch::~G4CrossSectionPatch ( )
virtual

Definition at line 52 of file G4CrossSectionPatch.cc.

53{ }

Member Function Documentation

◆ CrossSection()

G4double G4CrossSectionPatch::CrossSection ( const G4KineticTrack & trk1,
const G4KineticTrack & trk2 ) const
virtual

Implements G4VCrossSectionSource.

Definition at line 68 of file G4CrossSectionPatch.cc.

70{
71 // The cross section is provided by one of the components, according to their energy
72 // validity range
73
74 G4double crossSection = 0.;
75 G4double ecm = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag();
76
77 const G4CrossSectionVector* components = GetComponents();
78 if (components != 0)
79 {
80 std::size_t nComponents = this->GetComponents()->size();
81
82 for (std::size_t i=0; i<nComponents; ++i)
83 {
84 G4CrossSectionSourcePtr componentPtr = (*components)[i];
85 G4VCrossSectionSource* component = componentPtr();
86 if (component->IsValid(ecm))
87 {
88 crossSection = component->CrossSection(trk1,trk2);
89 }
90 else if (i < (nComponents - 1) )
91 {
92 G4CrossSectionSourcePtr nextPtr = (*components)[i+1];
93 G4VCrossSectionSource* next = nextPtr();
94 if (ecm > component->HighLimit() && ecm < next->LowLimit())
95 {
96 // Merge cross-sections in transition region between two validity ranges
97 crossSection = Transition(trk1,trk2,component,next);
98 }
99 }
100 }
101 }
102
103 return crossSection;
104}
std::vector< G4CrossSectionSourcePtr > G4CrossSectionVector
double G4double
Definition G4Types.hh:83
G4double Transition(const G4KineticTrack &trk1, const G4KineticTrack &trk2, const G4VCrossSectionSource *comp1, const G4VCrossSectionSource *comp2) const
virtual const G4CrossSectionVector * GetComponents() const =0
const G4LorentzVector & Get4Momentum() const
virtual G4double LowLimit() const
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
virtual G4double HighLimit() const
virtual G4bool IsValid(G4double e) const

◆ GetComponents()

virtual const G4CrossSectionVector * G4CrossSectionPatch::GetComponents ( ) const
pure virtual

Implements G4VCrossSectionSource.

Implemented in G4XNNElastic, G4XNNTotal, G4XnpElastic, and G4XnpTotal.

Referenced by CrossSection(), and IsValid().

◆ IsValid()

G4bool G4CrossSectionPatch::IsValid ( G4double e) const
virtual

Reimplemented from G4VCrossSectionSource.

Definition at line 107 of file G4CrossSectionPatch.cc.

108{
109 // The Patch is valid if any of its components are valid
110 G4bool answer = false;
111 const G4CrossSectionVector* components = GetComponents();
112 if (components != 0)
113 {
114 std::size_t n = components->size();
115 for (std::size_t i=0; i<n; ++i)
116 {
117 G4CrossSectionSourcePtr componentPtr = (*components)[i];
118 G4VCrossSectionSource* component = componentPtr();
119 if (component->IsValid(e))
120 {
121 answer = true;
122 break;
123 }
124 }
125 }
126 return answer;
127}
bool G4bool
Definition G4Types.hh:86

◆ operator!=()

G4bool G4CrossSectionPatch::operator!= ( const G4CrossSectionPatch & right) const

Definition at line 62 of file G4CrossSectionPatch.cc.

63{
64 return (this != (G4CrossSectionPatch*) &right);
65}

◆ operator==()

G4bool G4CrossSectionPatch::operator== ( const G4CrossSectionPatch & right) const

Definition at line 56 of file G4CrossSectionPatch.cc.

57{
58 return (this == (G4CrossSectionPatch*) &right);
59}

◆ Transition() [1/2]

G4double G4CrossSectionPatch::Transition ( const G4KineticTrack & trk1,
const G4KineticTrack & trk2,
const G4VCrossSectionSource * comp1,
const G4VCrossSectionSource * comp2 ) const
protected

Definition at line 130 of file G4CrossSectionPatch.cc.

133{
134 //Merge two cross sections in the transition region between their validity ranges
135
136 G4double crossSection = 0.;
137
138 G4double ecm = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag();
139 G4double sigma1 = comp1->CrossSection(trk1,trk2);
140 G4double sigma2 = comp2->CrossSection(trk1,trk2);
141 G4double denom = comp2->LowLimit() - comp1->HighLimit();
142 G4double diff = ecm - comp1->HighLimit();
143 if (denom > 0. && diff > 0.)
144 {
145 G4double ratio = diff / denom;
146 crossSection = (1.- ratio) * sigma1 + ratio * sigma2;
147 }
148
149 return crossSection;
150}

Referenced by CrossSection().

◆ Transition() [2/2]

G4double G4CrossSectionPatch::Transition ( G4double ecm,
G4double sigma1,
G4double sigma2,
G4double e1,
G4double e2 ) const
protected

Definition at line 153 of file G4CrossSectionPatch.cc.

156{
157 //Merge two cross sections in the transition region between their validity ranges
158
159 G4double crossSection = 0.;
160
161 G4double denom = e2 - e1;
162 G4double diff = ecm - e1;
163 if (denom > 0. && diff > 0.)
164 {
165 G4double ratio = diff / denom;
166 crossSection = (1.- ratio) * sigma1 + ratio * sigma2;
167 }
168
169 return crossSection;
170}

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