fisx: fisx_epdl97.h Source File

fisx

fisx_epdl97.h
1 #/*##########################################################################
2 #
3 # The fisx library for X-Ray Fluorescence
4 #
5 # Copyright (c) 2014-2016 European Synchrotron Radiation Facility
6 #
7 # This file is part of the fisx X-ray developed by V.A. Sole
8 #
9 # Permission is hereby granted, free of charge, to any person obtaining a copy
10 # of this software and associated documentation files (the "Software"), to deal
11 # in the Software without restriction, including without limitation the rights
12 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 # copies of the Software, and to permit persons to whom the Software is
14 # furnished to do so, subject to the following conditions:
15 #
16 # The above copyright notice and this permission notice shall be included in
17 # all copies or substantial portions of the Software.
18 #
19 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 # THE SOFTWARE.
26 #
27 #############################################################################*/
28 #ifndef FISX_EPDL97_H
29 #define FISX_EPDL97_H
30 #include <string>
31 #include <ctype.h>
32 #include <vector>
33 #include <map>
34
35 namespace fisx
36 {
37
38 class EPDL97
39 {
40 public:
41 EPDL97();
42 EPDL97(std::string directoryName);
43
44 void setDataDirectory(std::string directoryName);
45 // possibility to change binding energies
46 void loadBindingEnergies(std::string fileName);
47 void setBindingEnergies(const int & z, const std::map<std::string, double> & bindingEnergies);
48 const std::map<std::string, double> & getBindingEnergies(const int & z);
49
50 // the actual mass attenuation related functions
51 std::map<std::string, double> getMassAttenuationCoefficients(const int & z, const double & energy) const;
52 std::map<std::string, std::vector<double> > getMassAttenuationCoefficients(const int & z,\
53 const std::vector<double> & energy) const;
54
55 std::map<std::string, std::vector<double> > getMassAttenuationCoefficients(const int & z) const;
56
57 // the vacancy distribution related functions
58 std::map<std::string, double> getPhotoelectricWeights(const int & z, \
59 const double & energy);
60
61 std::map<std::string, std::vector<double> > getPhotoelectricWeights(const int & z, \
62 const std::vector<double> & energy);
63
64 // utility functions
65 std::string toUpperCaseString(const std::string &) const;
66 std::pair<long, long> getInterpolationIndices(const std::vector<double> &, const double &) const;
67
68 private:
69 // internal function to load the data
70 bool initialized;
71 void loadData(std::string directoryName);
72 void loadCrossSections(std::string fileName);
73
74 // The directory name
75 std::string directoryName;
76
77 // The used file for binding energies
78 std::string bindingEnergiesFile;
79
80 // The used file for cross sections
81 std::string crossSectionsFile;
82
83 // The table containing all binding energies for all elements and shells
84 // bindingEnergy[Z - 1]["K"] gives the binding energy for the K shell of element
85 // with atomic number Z.
86 std::vector<std::map<std::string, double> > bindingEnergy;
87
88 // Mass attenuation data as read from the files
89 // We have a table for each element but all of them share the same
90 // file header structure
91 std::vector<std::string> muInputLabels;
92 std::map<std::string, int> muLabelToIndex;
93 std::vector<std::vector<std::vector <double> > > muInputValues;
94 std::vector<std::vector<double> > muEnergy;
95
96 // Partial photoelectric mass attenuation coefficients
97 // For each shell (= key), there is a vector for the energies
98 // and a vector for the value of the mass attenuation coefficients
99 // Expected map key values are:
100 // K, L1, L2, L3, M1, M2, M3, M4, M5, "all other"
101 void initPartialPhotoelectricCoefficients();
102 };
103
104 } // namespace fisx
105
106 #endif // FISX_EPDL97_H
fisx
Definition: fisx_element.cpp:34
fisx::EPDL97
Definition: fisx_epdl97.h:38