Geant4  10.01.p03
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 // $Id: G4ElementData.hh 72057 2013-07-04 13:07:29Z gcosmo $
27 //
28 //---------------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 // Description: Data structure for cross sections, shell cross sections,
33 // isotope cross sections. Control of vector size should be
34 // performed in user code, no protection in this class
35 //
36 // Author: V.Ivanchenko 10.03.2011
37 //
38 // Modifications:
39 //
40 //----------------------------------------------------------------------------
41 //
42 
43 #ifndef ElementData_h
44 #define ElementData_h 1
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
48 #include "globals.hh"
49 #include "G4NistElementBuilder.hh"
50 #include "G4PhysicsVector.hh"
51 #include "G4Physics2DVector.hh"
52 #include <vector>
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 {
58 public:
59 
60  G4ElementData();
61 
63 
64  // add cross section for the element
66 
67  // add 2D cross section for the element
69 
70  // reserve vector of components
72 
73  // prepare vector of components
74  void AddComponent(G4int Z, G4int id, G4PhysicsVector* v);
75 
76  // set name of the dataset
77  void SetName(const G4String& nam);
78 
79  // get vector for the element
81 
82  // get 2-D vector for the element
84 
85  // get number of components for the element
86  inline size_t GetNumberOfComponents(G4int Z);
87 
88  // get component ID which may be number of nucleons,
89  // or shell number, or any other integer
90  inline G4int GetComponentID(G4int Z, size_t idx);
91 
92  // get vector per shell or per isotope
93  inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, size_t idx);
94 
95  // get vector per shell or per isotope
97 
98  // return cross section per element
99  // if not available return zero
100  inline G4double GetValueForElement(G4int Z, G4double kinEnergy);
101 
102  // return cross section per element
103  // if not available return zero
104  inline G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy);
105 
106 private:
107 
108  // Assignment operator and copy constructor
111 
114  std::vector<G4PhysicsVector*> compData[maxNumElements];
115  std::vector<G4int> compID[maxNumElements];
118 };
119 
120 inline void G4ElementData::SetName(const G4String& nam)
121 {
122  name = nam;
123 }
124 
125 inline
127 {
128  return elmData[Z];
129 }
130 
131 inline
133 {
134  return elm2Data[Z];
135 }
136 
137 inline
139 {
140  return compLength[Z];
141 }
142 
144 {
145  return (compID[Z])[idx];
146 }
147 
148 inline
150 {
151  return (compData[Z])[idx];
152 }
153 
154 inline
156 {
157  G4PhysicsVector* v = 0;
158  for(size_t i=0; i<compLength[Z]; ++i) {
159  if(id == (compID[Z])[i]) {
160  v = (compData[Z])[i];
161  break;
162  }
163  }
164  return v;
165 }
166 
167 inline
169 {
170  return elmData[Z]->Value(kinEnergy);
171 }
172 
173 inline G4double
175 {
176  return ((compData[Z])[idx])->Value(kinEnergy);
177 }
178 
179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
180 
181 #endif
182 
G4PhysicsVector * GetComponentDataByIndex(G4int Z, size_t idx)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id)
std::vector< G4PhysicsVector * > compData[maxNumElements]
G4PhysicsVector * GetElementData(G4int Z)
G4ElementData & operator=(const G4ElementData &right)
G4int nComponents
Definition: TRTMaterials.hh:41
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
G4int GetComponentID(G4int Z, size_t idx)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
size_t compLength[maxNumElements]
G4PhysicsVector * elmData[maxNumElements]
std::vector< G4int > compID[maxNumElements]
size_t GetNumberOfComponents(G4int Z)
G4double Value(G4double theEnergy, size_t &lastidx) const
G4Physics2DVector * elm2Data[maxNumElements]
G4double GetValueForElement(G4int Z, G4double kinEnergy)
G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
void SetName(const G4String &nam)
double G4double
Definition: G4Types.hh:76
G4Physics2DVector * GetElement2DData(G4int Z)
void InitialiseForComponent(G4int Z, G4int nComponents=0)