Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 36 of file G4CrossSectionBuffer.hh.

Constructor & Destructor Documentation

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

Definition at line 40 of file G4CrossSectionBuffer.hh.

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

Member Function Documentation

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

Definition at line 64 of file G4CrossSectionBuffer.hh.

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

Here is the call graph for this function:

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

Definition at line 43 of file G4CrossSectionBuffer.hh.

44  {
45  G4bool result = false;
46  if(aA == theA)
47  {
48  if(aB == theB) result = true;
49  }
50  else if(aA == theB)
51  {
52  if(aB == theA) result = true;
53  }
54  return result;
55  }
G4double G4ParticleHPJENDLHEData::G4double result
bool G4bool
Definition: G4Types.hh:79
void G4CrossSectionBuffer::Print ( )
inline

Definition at line 108 of file G4CrossSectionBuffer.hh.

109  {
110  for(size_t i=0;i<theData.size(); i++)
111  {
112  G4cerr << "sqrts = "<<theData[i].first<<", X = "<<theData[i].second/CLHEP::millibarn<<G4endl;
113  }
114  }
static constexpr double millibarn
Definition: SystemOfUnits.h:86
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4CrossSectionBuffer::push_back ( G4double  S,
G4double  x 
)
inline

Definition at line 57 of file G4CrossSectionBuffer.hh.

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

Here is the call graph for this function:


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