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

#include <G4HadronXSDataTable.hh>

Public Member Functions

 G4HadronXSDataTable ()
 
 ~G4HadronXSDataTable ()
 
void Initialise (G4DynamicParticle *, G4CrossSectionDataStore *, G4int bins, G4double emin, G4double emax, G4bool spline)
 
const G4PhysicsVectorHasData (size_t idx) const
 
G4double GetCrossSection (G4double e, size_t idx) const
 
const G4ElementSelectRandomAtom (G4double e, size_t idx) const
 
void Dump ()
 

Detailed Description

Definition at line 95 of file G4HadronXSDataTable.hh.

Constructor & Destructor Documentation

◆ G4HadronXSDataTable()

G4HadronXSDataTable::G4HadronXSDataTable ( )
explicit

Definition at line 103 of file G4HadronXSDataTable.cc.

103 : nMaterials(0)
104{}

◆ ~G4HadronXSDataTable()

G4HadronXSDataTable::~G4HadronXSDataTable ( )

Definition at line 152 of file G4HadronXSDataTable.cc.

153{
154 for(std::size_t i=0; i<nMaterials; ++i) {
155 delete xsData[i];
156 delete elmSelectors[i];
157 }
158}

Member Function Documentation

◆ Dump()

void G4HadronXSDataTable::Dump ( )

Definition at line 162 of file G4HadronXSDataTable.cc.

163{}

◆ GetCrossSection()

G4double G4HadronXSDataTable::GetCrossSection ( G4double  e,
size_t  idx 
) const
inline

Definition at line 113 of file G4HadronXSDataTable.hh.

114 {
115 return xsData[idx]->Value(e);
116 };

◆ HasData()

const G4PhysicsVector * G4HadronXSDataTable::HasData ( size_t  idx) const
inline

Definition at line 108 of file G4HadronXSDataTable.hh.

109 {
110 return xsData[idx];
111 };

◆ Initialise()

void G4HadronXSDataTable::Initialise ( G4DynamicParticle dp,
G4CrossSectionDataStore xs,
G4int  bins,
G4double  emin,
G4double  emax,
G4bool  spline 
)

Definition at line 108 of file G4HadronXSDataTable.cc.

112{
113 std::size_t nn = G4Material::GetNumberOfMaterials();
114 if(nn > nMaterials) {
115 if(0 == nMaterials) {
116 xsData.reserve(nn);
117 elmSelectors.reserve(nn);
118 }
119 G4PhysicsLogVector* first = nullptr;
120 G4int sbins = std::max(10, bins/5);
122 for(std::size_t i=nMaterials; i<nn; ++i) {
123 const G4Material* mat = (*mtable)[i];
124 G4PhysicsVector* v = nullptr;
125 G4HadElementSelector* es = nullptr;
126 // create real vector only for complex materials
127 if(mat->GetNumberOfElements() > 1) {
128 if(nullptr == first) {
129 first = new G4PhysicsLogVector(emin, emax, bins, spline);
130 v = first;
131 } else {
132 v = new G4PhysicsVector(*first);
133 }
134 for(G4int j=0; j<=bins; ++j) {
135 G4double e = first->Energy(j);
136 dp->SetKineticEnergy(e);
137 G4double cros = xs->ComputeCrossSection(dp, mat);
138 v->PutValue(j, cros);
139 }
140 if(spline) v->FillSecondDerivatives();
141 elmSelectors[i] = new G4HadElementSelector(dp, xs, mat, sbins, emin, emax, spline);
142 }
143 xsData.push_back(v);
144 elmSelectors.push_back(es);
145 }
146 nMaterials = nn;
147 }
148}
std::vector< G4Material * > G4MaterialTable
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4double ComputeCrossSection(const G4DynamicParticle *, const G4Material *)
void SetKineticEnergy(G4double aEnergy)
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:684
size_t GetNumberOfElements() const
Definition: G4Material.hh:181
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:677
void PutValue(const std::size_t index, const G4double value)
G4double Energy(const std::size_t index) const
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)

◆ SelectRandomAtom()

const G4Element * G4HadronXSDataTable::SelectRandomAtom ( G4double  e,
size_t  idx 
) const
inline

Definition at line 118 of file G4HadronXSDataTable.hh.

119 {
120 return elmSelectors[idx]->SelectRandomAtom(e);
121 };

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