#include <G4CrossSectionBuffer.hh>
Public Member Functions | |
G4CrossSectionBuffer (const G4ParticleDefinition *aA, const G4ParticleDefinition *aB) | |
G4bool | InCharge (const G4ParticleDefinition *aA, const G4ParticleDefinition *aB) const |
void | push_back (G4double S, G4double x) |
G4double | CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const |
void | Print () |
Definition at line 36 of file G4CrossSectionBuffer.hh.
G4CrossSectionBuffer::G4CrossSectionBuffer | ( | const G4ParticleDefinition * | aA, | |
const G4ParticleDefinition * | aB | |||
) | [inline] |
G4double G4CrossSectionBuffer::CrossSection | ( | const G4KineticTrack & | trk1, | |
const G4KineticTrack & | trk2 | |||
) | const [inline] |
Definition at line 64 of file G4CrossSectionBuffer.hh.
References G4KineticTrack::Get4Momentum().
00065 { 00066 G4double sqrts = (trk1.Get4Momentum()+trk2.Get4Momentum()).mag(); 00067 G4double x1(1), y1(0); 00068 G4double x2(2), y2(0); 00069 00070 if(theData.size()==1) return theData[theData.size()-1].second; 00071 00072 for(size_t i=0; i<theData.size(); i++) 00073 { 00074 if(theData[i].first>sqrts) 00075 { 00076 if(0==i) 00077 { 00078 x1 = theData[i].first; 00079 y1 = theData[i].second; 00080 x2 = theData[i+1].first; 00081 y2 = theData[i+1].second; 00082 } 00083 else if(theData.size()-1==i) 00084 { 00085 x1 = theData[theData.size()-2].first; 00086 y1 = theData[theData.size()-2].second; 00087 x2 = theData[theData.size()-1].first; 00088 y2 = theData[theData.size()-1].second; 00089 } 00090 else 00091 { 00092 x1 = theData[i-1].first; 00093 y1 = theData[i-1].second; 00094 x2 = theData[i].first; 00095 y2 = theData[i].second; 00096 } 00097 break; 00098 } 00099 } 00100 // LINLIN interpolation 00101 // G4cerr << "!!!!!! "<<sqrts<<" "<<x1<<" "<<x2<<" "<<y1<<" "<<y2<<" "<<i<<G4endl; 00102 G4double result = y1 + (sqrts-x1) * (y2-y1)/(x2-x1); 00103 if(result<0) result = 0; 00104 if(y1<0.01*CLHEP::millibarn) result = 0; 00105 return result; 00106 }
G4bool G4CrossSectionBuffer::InCharge | ( | const G4ParticleDefinition * | aA, | |
const G4ParticleDefinition * | aB | |||
) | const [inline] |
Definition at line 43 of file G4CrossSectionBuffer.hh.
00044 { 00045 G4bool result = false; 00046 if(aA == theA) 00047 { 00048 if(aB == theB) result = true; 00049 } 00050 else if(aA == theB) 00051 { 00052 if(aB == theA) result = true; 00053 } 00054 return result; 00055 }
void G4CrossSectionBuffer::Print | ( | ) | [inline] |
Definition at line 108 of file G4CrossSectionBuffer.hh.
References G4cerr, and G4endl.
00109 { 00110 for(size_t i=0;i<theData.size(); i++) 00111 { 00112 G4cerr << "sqrts = "<<theData[i].first<<", X = "<<theData[i].second/CLHEP::millibarn<<G4endl; 00113 } 00114 }
Definition at line 57 of file G4CrossSectionBuffer.hh.
00058 { 00059 std::pair<G4double, G4double> aNew; 00060 aNew.first = S; 00061 aNew.second = x; 00062 theData.push_back(aNew); 00063 }