Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 // $Id: G4ElementData.hh 67044 2013-01-30 08:50:06Z 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 <vector>
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 {
57 public:
58 
59  G4ElementData();
60 
62 
63  // add cross section for the element
65 
66  // reserve vector of components
68 
69  // prepare vector of components
70  void AddComponent(G4int Z, G4int id, G4PhysicsVector* v);
71 
72  // set name of the dataset
73  void SetName(const G4String& nam);
74 
75  // get vector for the element
77 
78  // get number of components for the element
79  inline size_t GetNumberOfComponents(G4int Z);
80 
81  // get component ID which may be number of nucleons,
82  // or shell number, or any other integer
83  inline G4int GetComponentID(G4int Z, size_t idx);
84 
85  // get vector per shell or per isotope
86  inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, size_t idx);
87 
88  // get vector per shell or per isotope
90 
91  // return cross section per element
92  // if not available return zero
93  inline G4double GetValueForElement(G4int Z, G4double kinEnergy);
94 
95  // return cross section per element
96  // if not available return zero
97  inline G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy);
98 
99 private:
100 
101  // Assignment operator and copy constructor
102  G4ElementData & operator=(const G4ElementData &right);
104 
106  std::vector<G4PhysicsVector*> compData[maxNumElements];
107  std::vector<G4int> compID[maxNumElements];
108  size_t compLength[maxNumElements];
109  G4String name;
110 };
111 
112 inline void G4ElementData::SetName(const G4String& nam)
113 {
114  name = nam;
115 }
116 
117 inline
119 {
120  return elmData[Z];
121 }
122 
123 inline
125 {
126  return compLength[Z];
127 }
128 
130 {
131  return (compID[Z])[idx];
132 }
133 
134 inline
136 {
137  return (compData[Z])[idx];
138 }
139 
140 inline
142 {
143  G4PhysicsVector* v = 0;
144  for(size_t i=0; i<compLength[Z]; ++i) {
145  if(id == (compID[Z])[i]) {
146  v = (compData[Z])[i];
147  break;
148  }
149  }
150  return v;
151 }
152 
153 inline
155 {
156  return elmData[Z]->Value(kinEnergy);
157 }
158 
159 inline G4double
161 {
162  return ((compData[Z])[idx])->Value(kinEnergy);
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
167 #endif
168