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

#include <G4PiData.hh>

+ Inheritance diagram for G4PiData:

Public Member Functions

 G4PiData (const G4double *aTotal, const G4double *aInelastic, const G4double *anEnergy, G4int nPoints)
 
 ~G4PiData ()=default
 
G4bool AppliesTo (G4double kineticEnergy)
 
G4double ReactionXSection (G4double kineticEnergy)
 
G4double ElasticXSection (G4double kineticEnergy)
 
G4double TotalXSection (G4double kineticEnergy)
 

Detailed Description

Definition at line 35 of file G4PiData.hh.

Constructor & Destructor Documentation

◆ G4PiData()

G4PiData::G4PiData ( const G4double aTotal,
const G4double aInelastic,
const G4double anEnergy,
G4int  nPoints 
)
explicit

Definition at line 35 of file G4PiData.cc.

37{
38 G4int i=0;
39
40 for( i = 0; i < nP; i++ )
41 {
42 std::pair<G4double, G4double> x;
43 x.first=aT[i]*millibarn;
44 x.second=aIn[i]*millibarn;
45 std::pair<G4double, std::pair<G4double, G4double > > aP;
46 aP.first=anE[i]*GeV;
47 aP.second=x;
48 push_back(aP);
49 }
50}
int G4int
Definition: G4Types.hh:85

◆ ~G4PiData()

G4PiData::~G4PiData ( )
default

Member Function Documentation

◆ AppliesTo()

G4bool G4PiData::AppliesTo ( G4double  kineticEnergy)

Definition at line 54 of file G4PiData.cc.

55{
56 return (kineticEnergy<=back().first);
57}

◆ ElasticXSection()

G4double G4PiData::ElasticXSection ( G4double  kineticEnergy)

Definition at line 85 of file G4PiData.cc.

86{
87 G4double result = 0;
88 G4PiData::iterator it=begin();
89 while(it!=end()&&kineticEnergy>(*it).first) {it++;} /* Loop checking, 08.01.2016, W. Pokorski */
90 if(it==end())
91 {
93 ed << "This cross section is applied for E(MeV)= " << kineticEnergy
94 << " outside allowed energy interval" << G4endl;
95 G4Exception("G4PiData::ElasticXSection", "had001", FatalException, ed);
96 }
97 if(it==begin()) it++;
98 G4double x1,x2,e1,e2;
99 e1=(*(it-1)).first;
100 x1=(*(it-1)).second.first - (*(it-1)).second.second;
101 e2=(*(it)).first;
102 x2=(*(it)).second.first - (*(it)).second.second;
103 result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
104 return result;
105}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
double G4double
Definition: G4Types.hh:83
#define G4endl
Definition: G4ios.hh:57

◆ ReactionXSection()

G4double G4PiData::ReactionXSection ( G4double  kineticEnergy)

Definition at line 61 of file G4PiData.cc.

62{
63 G4double result = 0;
64 G4PiData::iterator it=begin();
65 while(it!=end()&&kineticEnergy>(*it).first) {it++;} /* Loop checking, 08.01.2016, W. Pokorski */
66 if(it==end())
67 {
69 ed << "This cross section is applied for E(MeV)= " << kineticEnergy
70 << " outside allowed energy interval" << G4endl;
71 G4Exception("G4PiData::ReactionXSection", "had001", FatalException, ed);
72 }
73 if(it==begin()) it++;
74 G4double x1,x2,e1,e2;
75 e1=(*(it-1)).first;
76 x1=(*(it-1)).second.second;
77 e2=(*(it)).first;
78 x2=(*(it)).second.second;
79 result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
80 return result;
81}

◆ TotalXSection()

G4double G4PiData::TotalXSection ( G4double  kineticEnergy)

Definition at line 109 of file G4PiData.cc.

110{
111 G4double result = 0;
112 G4PiData::iterator it=begin();
113 while(it!=end()&&kineticEnergy>(*it).first) {it++;} /* Loop checking, 08.01.2016, W. Pokorski */
114 if(it==end())
115 {
117 ed << "This cross section is applied for E(MeV)= " << kineticEnergy
118 << " outside allowed energy interval" << G4endl;
119 G4Exception("G4PiData::TotalXSection", "had001", FatalException, ed);
120 }
121 if(it==begin()) it++;
122 G4double x1,x2,e1,e2;
123 e1=(*(it-1)).first;
124 x1=(*(it-1)).second.first;
125 e2=(*(it)).first;
126 x2=(*(it)).second.first;
127 result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
128 return result;
129}

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