|
|
|||
Warning, file /include/Geant4/G4AtomicFormFactor.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 0026 //--------------------------------------------------------------------------- 0027 // 0028 // ClassName: G4AtomicFormFactor 0029 // 0030 // Description: Contains the function for the evaluation of the atomic form 0031 // factor. The tabulated data are available on IUCr website 0032 // 0033 // Class description: 0034 // 0035 // XXX 0036 // 0037 // 21-04-16, created by E.Bagli 0038 0039 #ifndef G4ATOMICFORMFACTOR_HH 0040 #define G4ATOMICFORMFACTOR_HH 1 0041 0042 #include "G4Exp.hh" 0043 #include <CLHEP/Units/PhysicalConstants.h> 0044 #include "globals.hh" 0045 0046 #include <map> 0047 #include <vector> 0048 0049 class G4AtomicFormFactor 0050 { 0051 public: 0052 static G4AtomicFormFactor* GetManager() 0053 { 0054 if (s_G4AtomicFormFactorManager == nullptr) { 0055 s_G4AtomicFormFactorManager = new G4AtomicFormFactor(); 0056 } 0057 return s_G4AtomicFormFactorManager; 0058 } 0059 0060 G4double Get(G4double kScatteringVector, G4int Z, G4int charge = 0) 0061 { 0062 if (loadedIndex != GetIndex(Z, charge)) { 0063 LoadCoefficiencts(GetIndex(Z, charge)); 0064 } 0065 G4double result = 0.; 0066 // Convert k from mm^-1 to Å^-1 and divide by 4π , then square. 0067 const G4double kVecOn4Pi = (kScatteringVector * 1.0e-7) * (1.0 / (4.0 * CLHEP::pi)); 0068 G4double kVecOn4PiSquared = kVecOn4Pi * kVecOn4Pi; // (k/(4π))^2 in Å^-2 0069 0070 for (unsigned int i0 = 0; i0 < 4; i0++) { 0071 result += theCoefficients[i0 * 2] * G4Exp(-theCoefficients[i0 * 2 + 1] * kVecOn4PiSquared); 0072 } 0073 result += theCoefficients[8]; 0074 return result; 0075 } 0076 0077 protected: 0078 G4AtomicFormFactor(); 0079 ~G4AtomicFormFactor() = default; 0080 0081 private: 0082 void InsertCoefficients(G4int index, const std::vector<G4double>& aDoubleVec) 0083 { 0084 theCoefficientsMap.insert(std::pair<G4int, std::vector<G4double>>(index, aDoubleVec)); 0085 } 0086 0087 // LoadCoefficiencts() method allows the evaluation of the atomic form 0088 // factor coefficients and the storage in theCoefficients. 0089 // If theCoefficients are already correct, no need to get new ones 0090 // Reference: International Tables for Crystallography (2006). 0091 // Vol. C, ch. 6.1, pp. 554-595 0092 // doi: 10.1107/97809553602060000600 0093 // Chapter 6.1. Intensity of diffracted intensities 0094 // IUCr Eq. 6.1.1.15, Coefficients Table 6.1.1.4 0095 void LoadCoefficiencts(G4int index) 0096 { 0097 loadedIndex = index; 0098 for (unsigned int i0 = 0; i0 < 9; i0++) { 0099 theCoefficients[i0] = theCoefficientsMap[index][i0]; 0100 } 0101 } 0102 0103 // Get() function gives back the Atomic Form Factor of the Z material 0104 inline G4int GetIndex(G4int Z, G4int charge = 0) { return Z * 100 + charge; } 0105 0106 private: 0107 inline static G4AtomicFormFactor* s_G4AtomicFormFactorManager = nullptr; 0108 0109 // theCoefficientsMap stores the coefficients for the form factor 0110 // calculations. It can be loaded only by LoadCoefficiencts() 0111 // and accessed by theCoefficients[]. 0112 std::map<G4int, std::vector<G4double>> theCoefficientsMap; 0113 G4double theCoefficients[9]; 0114 G4int loadedIndex; 0115 }; 0116 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|