Geant4 9.6.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 G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
 
virtual const G4CrossSectionVectorGetComponents () const =0
 
virtual G4String Name () const =0
 
virtual void Print () const
 
virtual void PrintAll (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual G4bool IsValid (G4double e) 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
 
G4ParticleDefinitionFindKeyParticle (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
G4double GetTransversePionMass () const
 
G4double GetMinStringMass () 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{ }

◆ ~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 G4int nComponents = this->GetComponents()->size();
81// G4int nValid = 0;
82
83 G4int i;
84 for (i=0; i<nComponents; i++)
85 {
86 G4CrossSectionSourcePtr componentPtr = (*components)[i];
87 G4VCrossSectionSource* component = componentPtr();
88 if (component->IsValid(ecm))
89 {
90 crossSection = component->CrossSection(trk1,trk2);
91 }
92 else if (i < (nComponents - 1) )
93 {
94 G4CrossSectionSourcePtr nextPtr = (*components)[i+1];
95 G4VCrossSectionSource* next = nextPtr();
96 if (ecm > component->HighLimit() && ecm < next->LowLimit())
97 {
98 // Merge cross-sections in transition region between two validity ranges
99 crossSection = Transition(trk1,trk2,component,next);
100 }
101 }
102 }
103 }
104
105 return crossSection;
106}
std::vector< G4CrossSectionSourcePtr > G4CrossSectionVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
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 109 of file G4CrossSectionPatch.cc.

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

◆ 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 133 of file G4CrossSectionPatch.cc.

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

Referenced by CrossSection().

◆ Transition() [2/2]

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

Definition at line 156 of file G4CrossSectionPatch.cc.

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

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