fisx: fisx_xrfconfig.h Source File

fisx

fisx_xrfconfig.h
1 #/*##########################################################################
2 #
3 # The fisx library for X-Ray Fluorescence
4 #
5 # Copyright (c) 2014-2020 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_XRFCONFIG_H
29 #define FISX_XRFCONFIG_H
30 // TODO #include "fisx_version.h"
31 #include "fisx_detector.h"
32 #include "fisx_beam.h"
33 #include "fisx_transmissiontable.h"
34
35 namespace fisx
36 {
37
38 class XRFConfig
39 {
40 public:
41 XRFConfig();
42
43 friend std::ostream& operator<< (std::ostream& o, XRFConfig const & config);
44
45 void readConfigurationFromFile(const std::string & fileName);
46 void saveConfigurationToFile(const std::string & fileName);
47
51 void setBeam(const double & energy, const double & divergency);
52 void setBeam(const std::vector<double> & energies, \
53 const std::vector<double> & weight, \
54 const std::vector<int> & characteristic = std::vector<int>(), \
55 const std::vector<double> & divergency = std::vector<double>());
56 void setBeam(const Beam & beam);
57
61 void setBeamFilters(const std::vector<std::string> & names, \
62 const std::vector<double> & densities, \
63 const std::vector<double> & thicknesses, \
64 const std::vector<std::string> & comments);
65 void setBeamFilters(const std::vector<Layer> & filters);
66
70 void setUserBeamFilters(const std::vector<TransmissionTable> & userBeamFilters);
71
72
77 void setGeometry(const double & alphaIn, const double & alphaOut, const double & scatteringAngle = 90.);
78
84 void setSample(const std::vector<Layer> & layers, const int & referenceLayer = 0);
85 void setSample(const std::vector<std::string> & names, \
86 const std::vector<double> & densities, \
87 const std::vector<double> & thicknesses, \
88 const std::vector<std::string> & comments,
89 const int & referenceLayer = 0);
90
95 void setReferenceLayer(int referenceLayer);
96
97
101 void setAttenuators(const std::vector<Layer> & attenuators);
102 void setAttenuators(const std::vector<std::string> & names, \
103 const std::vector<double> & densities, \
104 const std::vector<double> & thicknesses, \
105 const std::vector<std::string> & comments);
106
110 void setUserAttenuators(const std::vector<TransmissionTable> & userAttenuators);
111
116 void setCollimators();
117 void addCollimator();
118
123 void setDetector(const Detector & detector);
124
128 /*
129 void detectedEmission()
130 void expectedEmission():
131 void expectedFluorescence();
132 void expectedScattering();
133 void peakRatios();
134 */
138 const Beam & getBeam() const;
139 const std::vector<Layer> & getBeamFilters() const {return this->beamFilters;};
140 const std::vector<TransmissionTable> & getUserBeamFilters() const {return this->userBeamFilters;};
141 const std::vector<Layer> & getSample() const {return this->sample;};
142 const std::vector<Layer> & getAttenuators() const {return this->attenuators;};
143 const std::vector<TransmissionTable> & getUserAttenuators() const {return this->userAttenuators;};
144 const Detector & getDetector() const {return this->detector;};
145 const double & getAlphaIn() const {return this->alphaIn;};
146 const double & getAlphaOut() const {return this->alphaOut;};
147 const double & getScatteringAngle() const {return this->scatteringAngle;};
148 const int & getReferenceLayer() const {return this->referenceLayer;};
149
150 private:
151 Beam beam;
152 std::vector<Material> materials;
153 std::vector<Layer> beamFilters;
154 std::vector<Layer> sample; // just other layer with funny factor set to 1.0
155 std::vector<Layer> attenuators;
156 std::vector<TransmissionTable> userBeamFilters;
157 std::vector<TransmissionTable> userAttenuators;
158 int referenceLayer;
159 double alphaIn;
160 double alphaOut;
161 double scatteringAngle;
162 // for the time being the detector is just other layer
163 Detector detector;
164 //collimators Not implemented;
165
166
167 /*
168 WARNING: If materials are not defined in terms of formulas or elemental compositions but in terms of other materials,
169 the methods using a constant reference to an Elements instance can fail if all the materials are not present in the
170 library or have been redefined:
171
172 layer.getTransmission(energy, elementsInstance)
173 layer.getTransmission(energies, elementsInstance)
174 layer.getMassAttenuationCoefficients(energy, elementsInstance)
175 layer.getMassAttenuationCoefficients(energies, elementsInstance)
176 layer.getComposition(elementsInstance)
177 detector.getEscape(energy, elementsInstance, const std::string & label = "", const int & update = 1)
178
179 TODO: Implement those methods as XRF methods taken layers or detector as first argument.
180 */
181 };
182
183 } // namespace fisx
184
185 #endif // FISX_SRF_CONFIG_H
fisx::XRFConfig::setBeam
void setBeam(const double &energy, const double &divergency)
Definition: fisx_xrfconfig.cpp:522
fisx::XRFConfig::setUserBeamFilters
void setUserBeamFilters(const std::vector< TransmissionTable > &userBeamFilters)
Definition: fisx_xrfconfig.cpp:543
fisx::XRFConfig
Definition: fisx_xrfconfig.h:38
fisx::Beam
Class describing an X-ray beam.
Definition: fisx_beam.h:65
fisx
Definition: fisx_element.cpp:34
fisx::XRFConfig::setGeometry
void setGeometry(const double &alphaIn, const double &alphaOut, const double &scatteringAngle=90.)
Definition: fisx_xrfconfig.cpp:42
fisx::XRFConfig::setSample
void setSample(const std::vector< Layer > &layers, const int &referenceLayer=0)
Definition: fisx_xrfconfig.cpp:548
fisx::XRFConfig::getBeam
const Beam & getBeam() const
Definition: fisx_xrfconfig.cpp:532
fisx::XRFConfig::setUserAttenuators
void setUserAttenuators(const std::vector< TransmissionTable > &userAttenuators)
Definition: fisx_xrfconfig.cpp:563
fisx::XRFConfig::setReferenceLayer
void setReferenceLayer(int referenceLayer)
fisx::XRFConfig::setDetector
void setDetector(const Detector &detector)
Definition: fisx_xrfconfig.cpp:568
fisx::Detector
Class describing the detector.
Definition: fisx_detector.h:40
fisx::XRFConfig::setCollimators
void setCollimators()
fisx::XRFConfig::setAttenuators
void setAttenuators(const std::vector< Layer > &attenuators)
Definition: fisx_xrfconfig.cpp:558
fisx::XRFConfig::setBeamFilters
void setBeamFilters(const std::vector< std::string > &names, const std::vector< double > &densities, const std::vector< double > &thicknesses, const std::vector< std::string > &comments)