Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ElementData.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//---------------------------------------------------------------------------
28//
29// GEANT4 Class file
30//
31// Description: Data structure for cross sections, shell cross sections,
32// isotope cross sections. Control of vector size should be
33// performed in user code, no protection in this class
34//
35// Author: V.Ivanchenko 10.03.2011
36//
37// Modifications:
38//
39//----------------------------------------------------------------------------
40//
41
42#ifndef ElementData_h
43#define ElementData_h 1
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
47#include "globals.hh"
48#include "G4PhysicsVector.hh"
49#include "G4Physics2DVector.hh"
50#include <vector>
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
55{
56public:
57
58 explicit G4ElementData();
59
61
62 // add cross section for the element
64
65 // add 2D cross section for the element
67
68 // reserve vector of components
69 void InitialiseForComponent(G4int Z, G4int nComponents=0);
70
71 // prepare vector of components
73
74 // set name of the dataset
75 void SetName(const G4String& nam);
76
77 //--------------------------------------------------------------
78 //
79 // run time methods - no check on validity of input index
80 // it is a responsibility of the consume code to check the input
81 //
82 //--------------------------------------------------------------
83
84 // get vector for the element
86
87 // get 2-D vector for the element
89
90 // get number of components for the element
91 inline size_t GetNumberOfComponents(G4int Z);
92
93 // get component ID which may be number of nucleons,
94 // or shell number, or any other integer
95 inline G4int GetComponentID(G4int Z, G4int idx);
96
97 // get vector per shell or per isotope
99
100 // get vector per shell or per isotope
102
103 // return cross section per element
104 // if not available return zero
105 inline G4double GetValueForElement(G4int Z, G4double kinEnergy);
106
107 // return cross section per element
108 // if not available return zero
110 G4double kinEnergy);
111
112 // Assignment operator and copy constructor
113 G4ElementData & operator=(const G4ElementData &right) = delete;
114 G4ElementData(const G4ElementData&) = delete;
115
116private:
117
118 static const G4int maxNumElm = 99;
119 G4PhysicsVector* elmData[maxNumElm];
120 G4Physics2DVector* elm2Data[maxNumElm];
121 std::vector<G4PhysicsVector*>* compData[maxNumElm];
122 std::vector<G4int>* compID[maxNumElm];
123 G4int compLength[maxNumElm];
124
125 G4String name = "";
126};
127
128inline void G4ElementData::SetName(const G4String& nam)
129{
130 name = nam;
131}
132
133inline
135{
136 return elmData[Z];
137}
138
139inline
141{
142 return elm2Data[Z];
143}
144
145inline
147{
148 return compID[Z]->size();
149}
150
152{
153 return (*(compID[Z]))[idx];
154}
155
156inline G4PhysicsVector*
158{
159 return (*(compData[Z]))[idx];
160}
161
162inline
164{
165 G4PhysicsVector* v = nullptr;
166 for(G4int i=0; i<compLength[Z]; ++i) {
167 if(id == (*(compID[Z]))[i]) {
168 v = (*(compData[Z]))[i];
169 break;
170 }
171 }
172 return v;
173}
174
175inline
177{
178 return elmData[Z]->Value(kinEnergy);
179}
180
181inline G4double
183{
184 return (*(compData[Z]))[idx]->Value(kinEnergy);
185}
186
187//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
188
189#endif
190
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
G4PhysicsVector * GetComponentDataByIndex(G4int Z, G4int idx)
void InitialiseForComponent(G4int Z, G4int nComponents=0)
G4ElementData & operator=(const G4ElementData &right)=delete
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
G4PhysicsVector * GetElementData(G4int Z)
G4double GetValueForComponent(G4int Z, G4int idx, G4double kinEnergy)
G4Physics2DVector * GetElement2DData(G4int Z)
G4double GetValueForElement(G4int Z, G4double kinEnergy)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
void SetName(const G4String &nam)
G4int GetComponentID(G4int Z, G4int idx)
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id)
G4ElementData(const G4ElementData &)=delete
size_t GetNumberOfComponents(G4int Z)
G4double Value(const G4double energy, std::size_t &lastidx) const