Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
G4CrossSectionComposite Class Referenceabstract

#include <G4CrossSectionComposite.hh>

Inheritance diagram for G4CrossSectionComposite:
G4VCrossSectionSource

Public Member Functions

virtual void Add (G4CrossSectionComposite *component)
 
virtual G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2)
 
virtual G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
 G4CrossSectionComposite ()
 
 G4CrossSectionComposite ()
 
virtual const G4CrossSectionVectorGetComponents () const =0
 
virtual G4double HighLimit () const
 
virtual G4bool IsValid (G4double e) const
 
virtual G4double LowLimit () const
 
virtual G4String Name () const =0
 
G4bool operator!= (const G4CrossSectionComposite &right) const
 
G4bool operator!= (const G4CrossSectionComposite &right) const
 
G4bool operator!= (const G4VCrossSectionSource &right) const
 
G4bool operator== (const G4CrossSectionComposite &right) const
 
G4bool operator== (const G4CrossSectionComposite &right) const
 
G4bool operator== (const G4VCrossSectionSource &right) const
 
virtual void Print () const
 
virtual void PrintAll (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual void Remove (G4CrossSectionComposite *component)
 
virtual ~G4CrossSectionComposite ()
 
virtual ~G4CrossSectionComposite ()
 

Protected Member Functions

G4double FcrossX (G4double e, G4double e0, G4double sigma, G4double eParam, G4double power) const
 
const G4ParticleDefinitionFindKeyParticle (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
const G4ParticleDefinitionFindLightParticle (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
G4bool InLimits (G4double e, G4double eLow, G4double eHigh) const
 

Protected Attributes

G4CrossSectionVector_components
 

Private Member Functions

 G4CrossSectionComposite (const G4CrossSectionComposite &right)
 
G4CrossSectionCompositeoperator= (const G4CrossSectionComposite &right)
 

Detailed Description

Definition at line 50 of file G4CrossSectionComposite.hh.

Constructor & Destructor Documentation

◆ G4CrossSectionComposite() [1/3]

G4CrossSectionComposite::G4CrossSectionComposite ( )

Definition at line 48 of file G4CrossSectionComposite.cc.

49{ }

◆ ~G4CrossSectionComposite() [1/2]

G4CrossSectionComposite::~G4CrossSectionComposite ( )
virtual

Definition at line 52 of file G4CrossSectionComposite.cc.

53{ }

◆ G4CrossSectionComposite() [2/3]

G4CrossSectionComposite::G4CrossSectionComposite ( const G4CrossSectionComposite right)
private

◆ G4CrossSectionComposite() [3/3]

G4CrossSectionComposite::G4CrossSectionComposite ( )

◆ ~G4CrossSectionComposite() [2/2]

virtual G4CrossSectionComposite::~G4CrossSectionComposite ( )
virtual

Member Function Documentation

◆ Add()

virtual void G4CrossSectionComposite::Add ( G4CrossSectionComposite component)
virtual

◆ CrossSection() [1/2]

virtual G4double G4CrossSectionComposite::CrossSection ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
)
virtual

◆ CrossSection() [2/2]

G4double G4CrossSectionComposite::CrossSection ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
virtual

Implements G4VCrossSectionSource.

Definition at line 68 of file G4CrossSectionComposite.cc.

70{
71 // Cross section of composite is the sum of components cross sections
72
73 G4double crossSection = 0.;
74 G4double ecm = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag();
75
76 const G4CrossSectionVector* components = GetComponents();
77 if (components != 0)
78 {
79 G4int nComponents = this->GetComponents()->size();
80// G4int nValid = 0;
81
82 G4int i;
83 for (i=0; i<nComponents; i++)
84 {
85 G4CrossSectionSourcePtr componentPtr = (*components)[i];
86 G4VCrossSectionSource* component = componentPtr();
87 if (component->IsValid(ecm))
88 {
89 crossSection += component->CrossSection(trk1,trk2);
90 }
91 }
92 }
93
94 return crossSection;
95}
std::vector< G4CrossSectionSourcePtr > G4CrossSectionVector
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
virtual const G4CrossSectionVector * GetComponents() const =0
const G4LorentzVector & Get4Momentum() const
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
virtual G4bool IsValid(G4double e) const

References G4VCrossSectionSource::CrossSection(), G4KineticTrack::Get4Momentum(), GetComponents(), and G4VCrossSectionSource::IsValid().

◆ FcrossX()

G4double G4VCrossSectionSource::FcrossX ( G4double  e,
G4double  e0,
G4double  sigma,
G4double  eParam,
G4double  power 
) const
protectedinherited

Definition at line 174 of file G4VCrossSectionSource.cc.

176{
177 G4double result = 0.;
178
179 G4double denom = eParam*eParam + (e-e0)*(e-e0);
180 if (denom > 0.)
181 {
182 G4double value = (2.* eParam * sigma * (e-e0) / denom) * G4Pow::GetInstance()->powA(((e0 + eParam) / e), power);
183 result = std::max(0., value);
184 }
185 return result;
186}
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4double powA(G4double A, G4double y) const
Definition: G4Pow.hh:230
T max(const T t1, const T t2)
brief Return the largest of the two arguments

References G4Pow::GetInstance(), G4INCL::Math::max(), and G4Pow::powA().

◆ FindKeyParticle()

const G4ParticleDefinition * G4VCrossSectionSource::FindKeyParticle ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
protectedinherited

Definition at line 49 of file G4VCrossSectionSource.cc.

51{
52 const G4ParticleDefinition * result;
53
54 const G4ParticleDefinition * p1 = trk1.GetDefinition();
55 const G4ParticleDefinition * p2 = trk2.GetDefinition();
56
57 if( (p1==G4Proton::Proton() && p2==G4Proton::Proton() ) ||
58 (p1==G4Neutron::Neutron() && p2==G4Neutron::Neutron()) )
59 {
60 result = G4Proton::Proton();
61 }
62 else if( (p1==G4Neutron::Neutron() && p2==G4Proton::Proton()) ||
63 (p2==G4Neutron::Neutron() && p1==G4Proton::Proton()) )
64 {
65 result = G4Neutron::Neutron();
66 }
67 else
68 {
69 throw G4HadronicException(__FILE__, __LINE__, "G4VCrossSectionSource: unklnown particles in FindKeyParticle");
70 }
71 return result;
72}
const G4ParticleDefinition * GetDefinition() const
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
static G4Proton * Proton()
Definition: G4Proton.cc:92

References G4KineticTrack::GetDefinition(), G4Neutron::Neutron(), and G4Proton::Proton().

Referenced by G4XNNElasticLowE::CrossSection(), and G4XNNTotalLowE::CrossSection().

◆ FindLightParticle()

const G4ParticleDefinition * G4VCrossSectionSource::FindLightParticle ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
protectedinherited

Definition at line 158 of file G4VCrossSectionSource.cc.

160{
161 G4double mass1 = trk1.GetDefinition()->GetPDGMass();
162 G4double mass2 = trk2.GetDefinition()->GetPDGMass();
163 if (mass1 < mass2)
164 {
165 return trk1.GetDefinition();
166 }
167 else
168 {
169 return trk2.GetDefinition();
170 }
171}

References G4KineticTrack::GetDefinition(), and G4ParticleDefinition::GetPDGMass().

Referenced by G4XMesonBaryonElastic::CrossSection().

◆ GetComponents()

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

Implements G4VCrossSectionSource.

Referenced by CrossSection(), and IsValid().

◆ HighLimit()

G4double G4VCrossSectionSource::HighLimit ( ) const
virtualinherited

◆ InLimits()

G4bool G4VCrossSectionSource::InLimits ( G4double  e,
G4double  eLow,
G4double  eHigh 
) const
protectedinherited

◆ IsValid()

G4bool G4CrossSectionComposite::IsValid ( G4double  e) const
virtual

Reimplemented from G4VCrossSectionSource.

Definition at line 98 of file G4CrossSectionComposite.cc.

99{
100 // The composite is valid if any of its components are valid
101 G4bool answer = false;
102 const G4CrossSectionVector* components = GetComponents();
103 if (components != 0)
104 {
105 G4int n = components->size();
106 G4int i;
107 for (i=0; i<n; i++)
108 {
109 G4CrossSectionSourcePtr componentPtr = (*components)[i];
110 G4VCrossSectionSource* component = componentPtr();
111 if (component->IsValid(e))
112 {
113 answer = true;
114 break;
115 }
116 }
117 }
118 return answer;
119}

References GetComponents(), G4VCrossSectionSource::IsValid(), and CLHEP::detail::n.

◆ LowLimit()

G4double G4VCrossSectionSource::LowLimit ( ) const
virtualinherited

Reimplemented in G4XPDGElastic, and G4XPDGTotal.

Definition at line 140 of file G4VCrossSectionSource.cc.

141{
142 return 0.;
143}

Referenced by G4CrossSectionPatch::CrossSection(), G4VCrossSectionSource::IsValid(), and G4CrossSectionPatch::Transition().

◆ Name()

virtual G4String G4VCrossSectionSource::Name ( ) const
pure virtualinherited

◆ operator!=() [1/3]

G4bool G4CrossSectionComposite::operator!= ( const G4CrossSectionComposite right) const

Definition at line 62 of file G4CrossSectionComposite.cc.

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

◆ operator!=() [2/3]

G4bool G4CrossSectionComposite::operator!= ( const G4CrossSectionComposite right) const

◆ operator!=() [3/3]

G4bool G4VCrossSectionSource::operator!= ( const G4VCrossSectionSource right) const
inherited

Definition at line 80 of file G4VCrossSectionSource.cc.

81{
82 return (this != (G4VCrossSectionSource *) &right);
83}

◆ operator=()

G4CrossSectionComposite & G4CrossSectionComposite::operator= ( const G4CrossSectionComposite right)
private

◆ operator==() [1/3]

G4bool G4CrossSectionComposite::operator== ( const G4CrossSectionComposite right) const

Definition at line 56 of file G4CrossSectionComposite.cc.

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

◆ operator==() [2/3]

G4bool G4CrossSectionComposite::operator== ( const G4CrossSectionComposite right) const

◆ operator==() [3/3]

G4bool G4VCrossSectionSource::operator== ( const G4VCrossSectionSource right) const
inherited

Definition at line 74 of file G4VCrossSectionSource.cc.

75{
76 return (this == (G4VCrossSectionSource *) &right);
77}

◆ Print()

void G4VCrossSectionSource::Print ( ) const
virtualinherited

Reimplemented in G4XNNElasticLowE, G4XnpElasticLowE, and G4XnpTotalLowE.

Definition at line 86 of file G4VCrossSectionSource.cc.

87{
88 G4int nComponents = 0;
89 const G4CrossSectionVector* components = GetComponents();
90 if (components)
91 {
92 nComponents = components->size();
93 }
94 G4cout << "---- " << this->Name() << " ---- has " << nComponents << " components" <<G4endl;
95 G4int i;
96 for (i=0; i<nComponents; i++)
97 {
98 G4cout << "-" << this->Name() << " - Component " << i << ": " <<G4endl;
99
100 G4CrossSectionSourcePtr componentPtr = (*components)[i];
101 G4VCrossSectionSource* component = componentPtr();
102 component->Print();
103 }
104}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
virtual const G4CrossSectionVector * GetComponents() const =0
virtual void Print() const
virtual G4String Name() const =0

References G4cout, G4endl, G4VCrossSectionSource::GetComponents(), G4VCrossSectionSource::Name(), and G4VCrossSectionSource::Print().

Referenced by G4VCollision::Print(), G4VCrossSectionSource::Print(), G4XNNElasticLowE::Print(), G4XnpElasticLowE::Print(), and G4XnpTotalLowE::Print().

◆ PrintAll()

void G4VCrossSectionSource::PrintAll ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
virtualinherited

Definition at line 107 of file G4VCrossSectionSource.cc.

108{
109 G4double sqrtS = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag();
110 G4double sigma = CrossSection(trk1,trk2) / millibarn;
111 G4cout << "---- " << Name() << ": "
112 << "Ecm = " << sqrtS / GeV << " GeV - "
113 << " Cross section = " << sigma << " mb "
114 << G4endl;
115
116 G4int nComponents = 0;
117 const G4CrossSectionVector* components = GetComponents();
118 if (components != 0)
119 {
120 nComponents = components->size();
121 }
122 G4int i;
123 for (i=0; i<nComponents; i++)
124 {
125 G4cout << "* Component " << i << ": ";
126 G4CrossSectionSourcePtr componentPtr = (*components)[i];
127 G4VCrossSectionSource* component = componentPtr();
128 component->PrintAll(trk1,trk2);
129 }
130}
static constexpr double millibarn
Definition: G4SIunits.hh:86
static constexpr double GeV
Definition: G4SIunits.hh:203
virtual void PrintAll(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const

References G4VCrossSectionSource::CrossSection(), G4cout, G4endl, G4KineticTrack::Get4Momentum(), G4VCrossSectionSource::GetComponents(), GeV, millibarn, G4VCrossSectionSource::Name(), and G4VCrossSectionSource::PrintAll().

Referenced by G4VCrossSectionSource::PrintAll().

◆ Remove()

virtual void G4CrossSectionComposite::Remove ( G4CrossSectionComposite component)
virtual

Field Documentation

◆ _components

G4CrossSectionVector* G4CrossSectionComposite::_components
protected

Definition at line 69 of file G4VCrossSectionComposite.hh.


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