ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ElementData.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ElementData.hh
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 "G4NistElementBuilder.hh"
49 #include "G4PhysicsVector.hh"
50 #include "G4Physics2DVector.hh"
51 #include <vector>
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 {
57 public:
58 
59  explicit G4ElementData();
60 
62 
63  // add cross section for the element
65 
66  // add 2D cross section for the element
68 
69  // reserve vector of components
70  void InitialiseForComponent(G4int Z, G4int nComponents=0);
71 
72  // prepare vector of components
73  void AddComponent(G4int Z, G4int id, G4PhysicsVector* v);
74 
75  // set name of the dataset
76  void SetName(const G4String& nam);
77 
78  // get vector for the element
80 
81  // get 2-D vector for the element
83 
84  // get number of components for the element
85  inline size_t GetNumberOfComponents(G4int Z);
86 
87  // get component ID which may be number of nucleons,
88  // or shell number, or any other integer
89  inline G4int GetComponentID(G4int Z, size_t idx);
90 
91  // get vector per shell or per isotope
92  inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, size_t idx);
93 
94  // get vector per shell or per isotope
96 
97  // return cross section per element
98  // if not available return zero
99  inline G4double GetValueForElement(G4int Z, G4double kinEnergy);
100 
101  // return cross section per element
102  // if not available return zero
103  inline G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy);
104 
105 private:
106 
107  // Assignment operator and copy constructor
108  G4ElementData & operator=(const G4ElementData &right) = delete;
109  G4ElementData(const G4ElementData&) = delete;
110 
113  std::vector<G4PhysicsVector*> compData[maxNumElements];
114  std::vector<G4int> compID[maxNumElements];
117 };
118 
119 inline void G4ElementData::SetName(const G4String& nam)
120 {
121  name = nam;
122 }
123 
124 inline
126 {
127  return elmData[Z];
128 }
129 
130 inline
132 {
133  return elm2Data[Z];
134 }
135 
136 inline
138 {
139  return compLength[Z];
140 }
141 
143 {
144  return (compID[Z])[idx];
145 }
146 
147 inline
149 {
150  return (compData[Z])[idx];
151 }
152 
153 inline
155 {
156  G4PhysicsVector* v = 0;
157  for(size_t i=0; i<compLength[Z]; ++i) {
158  if(id == (compID[Z])[i]) {
159  v = (compData[Z])[i];
160  break;
161  }
162  }
163  return v;
164 }
165 
166 inline
168 {
169  return elmData[Z]->Value(kinEnergy);
170 }
171 
172 inline G4double
174 {
175  return ((compData[Z])[idx])->Value(kinEnergy);
176 }
177 
178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
179 
180 #endif
181