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.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /materials/include/G4ElementData.hh (Version 11.3.0) and /materials/include/G4ElementData.hh (Version 9.2.p4)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25                                                   
 26 //--------------------------------------------    
 27 //                                                
 28 // GEANT4 Class file                              
 29 //                                                
 30 // Description: Data structure for cross secti    
 31 //              isotope cross sections. Data a    
 32 //              Z (atomic number in majority o    
 33 //              be in the interval 0 <= Z < le    
 34 //              data a second parameter idx or    
 35 //              In most cases ID = A - atomic     
 36 //              There are run time const metho    
 37 //              assuming responsibility of con    
 38 //              check input and may throwgh a     
 39 //                                                
 40 // Author:      V.Ivanchenko 10.03.2011           
 41 //                                                
 42 // Modifications: 30.09.2023 Extended function    
 43 //                                                
 44 //--------------------------------------------    
 45 //                                                
 46                                                   
 47 #ifndef G4ElementData_h                           
 48 #define G4ElementData_h 1                         
 49                                                   
 50 #include "G4Physics2DVector.hh"                   
 51 #include "G4PhysicsVector.hh"                     
 52 #include "globals.hh"                             
 53                                                   
 54 #include <vector>                                 
 55                                                   
 56 class G4ElementData                               
 57 {                                                 
 58  public:                                          
 59   explicit G4ElementData(G4int length = 99);      
 60                                                   
 61   ~G4ElementData();                               
 62                                                   
 63   // Assignment operator and copy constructor     
 64   G4ElementData& operator=(const G4ElementData    
 65   G4ElementData(const G4ElementData&) = delete    
 66                                                   
 67   // add cross section for the element            
 68   void InitialiseForElement(G4int Z, G4Physics    
 69                                                   
 70   // add 2D cross section for the element         
 71   void InitialiseForElement(G4int Z, G4Physics    
 72                                                   
 73   // reserve vector of components                 
 74   void InitialiseForComponent(G4int Z, G4int n    
 75                                                   
 76   // reserve vector of 2D components              
 77   void InitialiseFor2DComponent(G4int Z, G4int    
 78                                                   
 79   // prepare vector of components                 
 80   void AddComponent(G4int Z, G4int id, G4Physi    
 81                                                   
 82   // prepare vector of 2D components              
 83   void Add2DComponent(G4int Z, G4int id, G4Phy    
 84                                                   
 85   // set name of the dataset (optional)           
 86   inline void SetName(const G4String& nam);       
 87                                                   
 88   //------------------------------------------    
 89   // run time const methods - no check on vali    
 90   // it is a responsibility of the consume cod    
 91   //------------------------------------------    
 92                                                   
 93   // get name of the dataset                      
 94   inline const G4String& GetName() const;         
 95                                                   
 96   // get vector for the element                   
 97   inline G4PhysicsVector* GetElementData(G4int    
 98                                                   
 99   // get 2-D vector for the element               
100   inline G4Physics2DVector* GetElement2DData(G    
101                                                   
102   // get vector per shell or per isotope          
103   inline G4PhysicsVector* GetComponentDataByID    
104                                                   
105   // get vector per shell or per isotope          
106   inline G4Physics2DVector* Get2DComponentData    
107                                                   
108   // return cross section per element             
109   inline G4double GetValueForElement(G4int Z,     
110                                                   
111   //------------------------------------------    
112   // run time const methods with input paramet    
113   //------------------------------------------    
114                                                   
115   // get number of components for the element     
116   inline std::size_t GetNumberOfComponents(G4i    
117                                                   
118   // get number of 2D components for the eleme    
119   inline std::size_t GetNumberOf2DComponents(G    
120                                                   
121   // get component ID which may be number of n    
122   // or shell number, or any other integer        
123   inline G4int GetComponentID(G4int Z, std::si    
124                                                   
125   // get vector per shell or per isotope          
126   inline G4PhysicsVector*                         
127   GetComponentDataByIndex(G4int Z, std::size_t    
128                                                   
129   // get vector per shell or per isotope          
130   inline G4Physics2DVector*                       
131   Get2DComponentDataByIndex(G4int Z, std::size    
132                                                   
133   // return cross section per element             
134   // if not available return zero                 
135   inline G4double                                 
136   GetValueForComponent(G4int Z, std::size_t id    
137                                                   
138  private:                                         
139                                                   
140   void DataError(G4int Z, const G4String&);       
141                                                   
142   const G4int maxNumElm;                          
143                                                   
144   std::vector<G4PhysicsVector*> elmData;          
145   std::vector<G4Physics2DVector*> elm2Data;       
146   std::vector<std::vector<std::pair<G4int, G4P    
147   std::vector<std::vector<std::pair<G4int, G4P    
148                                                   
149   G4String name{""};                              
150 };                                                
151                                                   
152 //--------------------------------------------    
153 // run time const methods without check on val    
154 //--------------------------------------------    
155                                                   
156 inline void G4ElementData::SetName(const G4Str    
157 {                                                 
158   name = nam;                                     
159 }                                                 
160                                                   
161 inline const G4String& G4ElementData::GetName(    
162 {                                                 
163   return name;                                    
164 }                                                 
165                                                   
166 inline G4PhysicsVector* G4ElementData::GetElem    
167 {                                                 
168   return elmData[Z];                              
169 }                                                 
170                                                   
171 inline G4Physics2DVector* G4ElementData::GetEl    
172 {                                                 
173   return elm2Data[Z];                             
174 }                                                 
175                                                   
176 inline G4PhysicsVector*                           
177 G4ElementData::GetComponentDataByID(G4int Z, G    
178 {                                                 
179   G4PhysicsVector* v = nullptr;                   
180   for (auto const & p : *(compData[Z])) {         
181     if (id == p.first) {                          
182       v = p.second;                               
183       break;                                      
184     }                                             
185   }                                               
186   return v;                                       
187 }                                                 
188                                                   
189 inline G4Physics2DVector*                         
190 G4ElementData::Get2DComponentDataByID(G4int Z,    
191 {                                                 
192   G4Physics2DVector* v = nullptr;                 
193   for (auto const & p : *(comp2D[Z])) {           
194     if (id == p.first) {                          
195       v = p.second;                               
196       break;                                      
197     }                                             
198   }                                               
199   return v;                                       
200 }                                                 
201                                                   
202 inline G4double                                   
203 G4ElementData::GetValueForElement(G4int Z, G4d    
204 {                                                 
205   return elmData[Z]->Value(kinEnergy);            
206 }                                                 
207                                                   
208 //--------------------------------------------    
209 // run time const methods with check on validi    
210 //--------------------------------------------    
211                                                   
212 inline std::size_t G4ElementData::GetNumberOfC    
213 {                                                 
214   return (nullptr != compData[Z]) ? compData[Z    
215 }                                                 
216                                                   
217 inline std::size_t G4ElementData::GetNumberOf2    
218 {                                                 
219   return (nullptr != comp2D[Z]) ? comp2D[Z]->s    
220 }                                                 
221                                                   
222 inline G4int G4ElementData::GetComponentID(G4i    
223 {                                                 
224   return (idx < GetNumberOfComponents(Z)) ? (*    
225 }                                                 
226                                                   
227 inline G4PhysicsVector*                           
228 G4ElementData::GetComponentDataByIndex(G4int Z    
229 {                                                 
230   return                                          
231     (idx < GetNumberOfComponents(Z)) ? (*(comp    
232 }                                                 
233                                                   
234 inline G4Physics2DVector*                         
235 G4ElementData::Get2DComponentDataByIndex(G4int    
236 {                                                 
237   return                                          
238     (idx < GetNumberOf2DComponents(Z)) ? (*(co    
239 }                                                 
240                                                   
241 inline G4double                                   
242 G4ElementData::GetValueForComponent(G4int Z, s    
243 {                                                 
244   return (idx < GetNumberOfComponents(Z)) ?       
245     (*(compData[Z]))[idx].second->Value(e) : 0    
246 }                                                 
247                                                   
248 #endif                                            
249