Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CrossSectionBuffer Class Reference

#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 ()
 

Detailed Description

Definition at line 37 of file G4CrossSectionBuffer.hh.

Constructor & Destructor Documentation

◆ G4CrossSectionBuffer()

G4CrossSectionBuffer::G4CrossSectionBuffer ( const G4ParticleDefinition * aA,
const G4ParticleDefinition * aB )
inline

Definition at line 41 of file G4CrossSectionBuffer.hh.

42 : theA(aA), theB(aB) {}

Member Function Documentation

◆ CrossSection()

G4double G4CrossSectionBuffer::CrossSection ( const G4KineticTrack & trk1,
const G4KineticTrack & trk2 ) const
inline

Definition at line 65 of file G4CrossSectionBuffer.hh.

66 {
67 G4double sqrts = (trk1.Get4Momentum()+trk2.Get4Momentum()).mag();
68 G4double x1(1), y1(0);
69 G4double x2(2), y2(0);
70
71 if(theData.size()==1) return theData[theData.size()-1].second;
72
73 for(size_t i=0; i<theData.size(); i++)
74 {
75 if(theData[i].first>sqrts)
76 {
77 if(0==i)
78 {
79 x1 = theData[i].first;
80 y1 = theData[i].second;
81 x2 = theData[i+1].first;
82 y2 = theData[i+1].second;
83 }
84 else if(theData.size()-1==i)
85 {
86 x1 = theData[theData.size()-2].first;
87 y1 = theData[theData.size()-2].second;
88 x2 = theData[theData.size()-1].first;
89 y2 = theData[theData.size()-1].second;
90 }
91 else
92 {
93 x1 = theData[i-1].first;
94 y1 = theData[i-1].second;
95 x2 = theData[i].first;
96 y2 = theData[i].second;
97 }
98 break;
99 }
100 }
101 // LINLIN interpolation
102 // G4cerr << "!!!!!! "<<sqrts<<" "<<x1<<" "<<x2<<" "<<y1<<" "<<y2<<" "<<i<<G4endl;
103 G4double result = y1 + (sqrts-x1) * (y2-y1)/(x2-x1);
104 if(result<0) result = 0;
105 if(y1<0.01*CLHEP::millibarn) result = 0;
106 return result;
107 }
double G4double
Definition G4Types.hh:83
const G4LorentzVector & Get4Momentum() const

◆ InCharge()

G4bool G4CrossSectionBuffer::InCharge ( const G4ParticleDefinition * aA,
const G4ParticleDefinition * aB ) const
inline

Definition at line 44 of file G4CrossSectionBuffer.hh.

45 {
46 G4bool result = false;
47 if(aA == theA)
48 {
49 if(aB == theB) result = true;
50 }
51 else if(aA == theB)
52 {
53 if(aB == theA) result = true;
54 }
55 return result;
56 }
bool G4bool
Definition G4Types.hh:86

◆ Print()

void G4CrossSectionBuffer::Print ( )
inline

Definition at line 109 of file G4CrossSectionBuffer.hh.

110 {
111 for(size_t i=0;i<theData.size(); i++)
112 {
113 G4cerr << "sqrts = "<<theData[i].first<<", X = "<<theData[i].second/CLHEP::millibarn<<G4endl;
114 }
115 }
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67

◆ push_back()

void G4CrossSectionBuffer::push_back ( G4double S,
G4double x )
inline

Definition at line 58 of file G4CrossSectionBuffer.hh.

59 {
60 std::pair<G4double, G4double> aNew;
61 aNew.first = S;
62 aNew.second = x;
63 theData.push_back(aNew);
64 }
G4double S(G4double temp)

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