fisx
fisx_xrf.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_XRF_H
29 #define FISX_XRF_H
30 #include "fisx_xrfconfig.h"
31 #include "fisx_elements.h"
32 #include <iostream>
33 
34 namespace fisx
35 {
36 
37 class XRF
38 {
39 
40 typedef std::map<std::string, std::map<int, std::map<std::string, std::map<std::string, double> > > > \
41  expectedLayerEmissionType;
42 typedef std::map<std::string, std::map<int, std::map<std::string, std::map<std::string, double> > > >::const_iterator \
43  iteratorExpectedLayerEmissionType;
44 
45 public:
49  XRF();
50 
54  XRF(const std::string & configurationFile);
55 
59  void readConfigurationFromFile(const std::string & fileName);
60 
64  void setBeam(const Beam & beam);
65 
74  void setBeam(const std::vector<double> & energies, \
75  const std::vector<double> & weight, \
76  const std::vector<int> & characteristic = std::vector<int>(), \
77  const std::vector<double> & divergency = std::vector<double>());
78 
83  void setBeam(const double & energy, const double & divergency = 0.0);
84 
85 
89  void setBeamFilters(const std::vector<Layer> & filters);
90 
94  void setUserBeamFilters(const std::vector<TransmissionTable> & userFilters);
95 
96 
102  void setSample(const std::vector<Layer> & layers, const int & referenceLayer = 0);
103 
104 
108  void setSample(const std::string & name, \
109  const double & density = 1.0, \
110  const double & thickness = 1.0);
111 
115  void setSample(const Layer & layer);
116 
117 
118 
123  void setAttenuators(const std::vector<Layer> & attenuators);
124 
125 
129  void setUserAttenuators(const std::vector<TransmissionTable> & userAttenuators);
130 
131 
136  void setDetector(const Detector & detector);
137 
144  void setGeometry(const double & alphaIn, const double & alphaOut,\
145  const double & scatteringAngle = -90.);
146 
151  void setReferenceLayer(const int & index);
152  void setRefenceLayer(const std::string & name);
153 
157  //void setElementsReference(const Elements & elements);
158 
163  void setCollimators();
164  void addCollimator();
165 
169  const XRFConfig & getConfiguration() const;
170 
174  void setConfiguration(const XRFConfig & configuration);
175 
186  std::map< std::string, std::map< std::string, std::map<std::string, std::map<std::string, double> > > >\
187  getExpectedPrimaryEmission(const std::vector<std::string> & elementList,
188  const Elements & elements);
189 
193  double getGeometricEfficiency(const int & layerIndex = 0) const;
194 
195 
206  std::map<std::string, std::map<int, std::map<std::string, std::map<std::string, double> > > > \
207  getMultilayerFluorescence(const std::string & element, \
208  const Elements & elementsLibrary, const int & sampleLayerIndex = 0, \
209  const std::string & lineFamily = "", const int & secondary = 0, \
210  const int & useGeometricEfficiency = 1, const int & useMassFractions = 0, \
211  const double & secondaryCalculationLimit = 0.0);
240  std::map<std::string, std::map<int, std::map<std::string, std::map<std::string, double> > > > \
241  getMultilayerFluorescence(const std::vector<std::string> & elementFamilyLayer, \
242  const Elements & elementsLibrary, const int & secondary = 0, \
243  const int & useGeometricEfficiency = 1, \
244  const int & useMassFractions = 0, \
245  const double & secondaryCalculationLimit = 0.0);
246 
247  std::map<std::string, std::map<int, std::map<std::string, std::map<std::string, double> > > > \
248  getMultilayerFluorescence(const std::vector<std::string> & elementList,
249  const Elements & elementsLibrary, \
250  const std::vector<int> & layerList, \
251  const std::vector<std::string> & familyList, \
252  const int & secondary = 0, \
253  const int & useGeometricEfficiency = 1, \
254  const int & useMassFractions = 0, \
255  const double & secondaryCalculationLimit = 0.0);
256 
257 
258  double getEnergyThreshold(const std::string & elementName, const std::string & family, \
259  const Elements & elementsLibrary) const;
260 
264  const Beam & getBeam() const {return this->configuration.getBeam();};
265 
269  const std::vector<Layer> & getBeamFilters() const {return this->configuration.getBeamFilters();};
270 
274  const std::vector<TransmissionTable> & getUserBeamFilters() const {return this->configuration.getUserBeamFilters();};
275 
279  const std::vector<Layer> & getSample() const {return this->configuration.getSample();};
280 
284  const std::vector<Layer> & getAttenuators() const {return this->configuration.getAttenuators();};
285 
289  const std::vector<TransmissionTable> & getUserAttenuators() const {return this->configuration.getUserAttenuators();};
290 
294  const Detector & getDetector() const {return this->configuration.getDetector();};
295 
296 
297  const double & getAlphaIn() const {return this->configuration.getAlphaIn();};
298  const double & getAlphaOut() const {return this->configuration.getAlphaOut();};
299  const double & getScatteringAngle() const {return this->configuration.getScatteringAngle();};
300  const int & getReferenceLayer() const {return this->configuration.getReferenceLayer();};
301 
302 private:
309  XRFConfig configuration;
310 
314  bool recentBeam;
315 
316  expectedLayerEmissionType lastMultilayerFluorescence;
317 };
318 
319 } // namespace fisx
320 
321 #endif // FISX_XRF_H
void setBeamFilters(const std::vector< Layer > &filters)
Definition: fisx_xrf.cpp:93
const std::vector< TransmissionTable > & getUserBeamFilters() const
Definition: fisx_xrf.h:274
const std::vector< Layer > & getSample() const
Definition: fisx_xrf.h:279
void setUserAttenuators(const std::vector< TransmissionTable > &userAttenuators)
Definition: fisx_xrf.cpp:131
Definition: fisx_xrfconfig.h:38
Class describing an X-ray beam.
Definition: fisx_beam.h:65
void setDetector(const Detector &detector)
Definition: fisx_xrf.cpp:136
const std::vector< Layer > & getAttenuators() const
Definition: fisx_xrf.h:284
double getGeometricEfficiency(const int &layerIndex=0) const
Definition: fisx_xrf.cpp:141
Definition: fisx_element.cpp:34
void setUserBeamFilters(const std::vector< TransmissionTable > &userFilters)
Definition: fisx_xrf.cpp:99
Class containing the composition of a layer.
Definition: fisx_layer.h:43
Class handling the physical properties.
Definition: fisx_elements.h:60
void setCollimators()
const std::vector< Layer > & getBeamFilters() const
Definition: fisx_xrf.h:269
void setReferenceLayer(const int &index)
const Detector & getDetector() const
Definition: fisx_xrf.h:294
const Beam & getBeam() const
Definition: fisx_xrfconfig.cpp:532
void setConfiguration(const XRFConfig &configuration)
Definition: fisx_xrf.h:37
XRF()
Definition: fisx_xrf.cpp:40
const XRFConfig & getConfiguration() const
Definition: fisx_xrf.cpp:257
void setGeometry(const double &alphaIn, const double &alphaOut, const double &scatteringAngle=-90.)
Definition: fisx_xrf.cpp:60
void setBeam(const Beam &beam)
Definition: fisx_xrf.cpp:73
Class describing the detector.
Definition: fisx_detector.h:40
const std::vector< TransmissionTable > & getUserAttenuators() const
Definition: fisx_xrf.h:289
void setAttenuators(const std::vector< Layer > &attenuators)
Definition: fisx_xrf.cpp:126
const Beam & getBeam() const
Definition: fisx_xrf.h:264
void readConfigurationFromFile(const std::string &fileName)
Definition: fisx_xrf.cpp:54
Elements properties.
void setSample(const std::vector< Layer > &layers, const int &referenceLayer=0)
Definition: fisx_xrf.cpp:105