#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 G4CrossSectionVector * | GetComponents () const =0 |
virtual G4bool | IsValid (G4double e) 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 |
Definition at line 50 of file G4CrossSectionPatch.hh.
G4CrossSectionPatch::G4CrossSectionPatch | ( | ) |
G4CrossSectionPatch::~G4CrossSectionPatch | ( | ) | [virtual] |
G4double G4CrossSectionPatch::CrossSection | ( | const G4KineticTrack & | trk1, | |
const G4KineticTrack & | trk2 | |||
) | const [virtual] |
Implements G4VCrossSectionSource.
Definition at line 68 of file G4CrossSectionPatch.cc.
References G4VCrossSectionSource::CrossSection(), G4KineticTrack::Get4Momentum(), GetComponents(), G4VCrossSectionSource::HighLimit(), G4VCrossSectionSource::IsValid(), G4VCrossSectionSource::LowLimit(), and Transition().
00070 { 00071 // The cross section is provided by one of the components, according to their energy 00072 // validity range 00073 00074 G4double crossSection = 0.; 00075 G4double ecm = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag(); 00076 00077 const G4CrossSectionVector* components = GetComponents(); 00078 if (components != 0) 00079 { 00080 G4int nComponents = this->GetComponents()->size(); 00081 // G4int nValid = 0; 00082 00083 G4int i; 00084 for (i=0; i<nComponents; i++) 00085 { 00086 G4CrossSectionSourcePtr componentPtr = (*components)[i]; 00087 G4VCrossSectionSource* component = componentPtr(); 00088 if (component->IsValid(ecm)) 00089 { 00090 crossSection = component->CrossSection(trk1,trk2); 00091 } 00092 else if (i < (nComponents - 1) ) 00093 { 00094 G4CrossSectionSourcePtr nextPtr = (*components)[i+1]; 00095 G4VCrossSectionSource* next = nextPtr(); 00096 if (ecm > component->HighLimit() && ecm < next->LowLimit()) 00097 { 00098 // Merge cross-sections in transition region between two validity ranges 00099 crossSection = Transition(trk1,trk2,component,next); 00100 } 00101 } 00102 } 00103 } 00104 00105 return crossSection; 00106 }
virtual const G4CrossSectionVector* G4CrossSectionPatch::GetComponents | ( | ) | const [pure virtual] |
Implements G4VCrossSectionSource.
Implemented in G4XNNElastic, G4XNNTotal, G4XnpElastic, and G4XnpTotal.
Referenced by CrossSection(), and IsValid().
Reimplemented from G4VCrossSectionSource.
Definition at line 109 of file G4CrossSectionPatch.cc.
References GetComponents(), G4VCrossSectionSource::IsValid(), and CLHEP::detail::n.
00110 { 00111 // The Patch is valid if any of its components are valid 00112 G4bool answer = false; 00113 const G4CrossSectionVector* components = GetComponents(); 00114 if (components != 0) 00115 { 00116 G4int n = components->size(); 00117 G4int i; 00118 for (i=0; i<n; i++) 00119 { 00120 G4CrossSectionSourcePtr componentPtr = (*components)[i]; 00121 G4VCrossSectionSource* component = componentPtr(); 00122 if (component->IsValid(e)) 00123 { 00124 answer = true; 00125 break; 00126 } 00127 } 00128 } 00129 return answer; 00130 }
G4bool G4CrossSectionPatch::operator!= | ( | const G4CrossSectionPatch & | right | ) | const |
Definition at line 62 of file G4CrossSectionPatch.cc.
00063 { 00064 return (this != (G4CrossSectionPatch*) &right); 00065 }
G4bool G4CrossSectionPatch::operator== | ( | const G4CrossSectionPatch & | right | ) | const |
Definition at line 56 of file G4CrossSectionPatch.cc.
00057 { 00058 return (this == (G4CrossSectionPatch*) &right); 00059 }
G4double G4CrossSectionPatch::Transition | ( | G4double | ecm, | |
G4double | sigma1, | |||
G4double | sigma2, | |||
G4double | e1, | |||
G4double | e2 | |||
) | const [protected] |
Definition at line 156 of file G4CrossSectionPatch.cc.
00159 { 00160 //Merge two cross sections in the transition region between their validity ranges 00161 00162 G4double crossSection = 0.; 00163 00164 G4double denom = e2 - e1; 00165 G4double diff = ecm - e1; 00166 if (denom > 0. && diff > 0.) 00167 { 00168 G4double ratio = diff / denom; 00169 crossSection = (1.- ratio) * sigma1 + ratio * sigma2; 00170 } 00171 00172 return crossSection; 00173 }
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.
References G4VCrossSectionSource::CrossSection(), G4KineticTrack::Get4Momentum(), G4VCrossSectionSource::HighLimit(), and G4VCrossSectionSource::LowLimit().
Referenced by CrossSection().
00136 { 00137 //Merge two cross sections in the transition region between their validity ranges 00138 00139 G4double crossSection = 0.; 00140 00141 G4double ecm = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag(); 00142 G4double sigma1 = comp1->CrossSection(trk1,trk2); 00143 G4double sigma2 = comp2->CrossSection(trk1,trk2); 00144 G4double denom = comp2->LowLimit() - comp1->HighLimit(); 00145 G4double diff = ecm - comp1->HighLimit(); 00146 if (denom > 0. && diff > 0.) 00147 { 00148 G4double ratio = diff / denom; 00149 crossSection = (1.- ratio) * sigma1 + ratio * sigma2; 00150 } 00151 00152 return crossSection; 00153 }