fisx: fisx_beam.h Source File

fisx

fisx_beam.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_BEAM_H
29 #define FISX_BEAM_H
30 #include <cstddef> // needed for NULL definition!!!
31 #include <vector>
32 #include <iostream>
33
34 namespace fisx
35 {
36
37 struct Ray
38 {
39 double energy;
40 double weight;
41 int characteristic;
42 double divergency;
43
44 Ray()
45 {
46 energy = 0.0;
47 weight = 0.0;
48 characteristic = 0;
49 divergency = 0.0;
50 }
51
52 bool operator < (const Ray &b) const
53 {
54 return (energy < b.energy);
55 }
56 };
57
65 class Beam
66 {
67 public:
68 Beam();
77 void setBeam(const std::vector<double> & energy, \
78 const std::vector<double> & weight = std::vector<double>(),\
79 const std::vector<int> & characteristic = std::vector<int>(),\
80 const std::vector<double> & divergency = std::vector<double>());
81
82 friend std::ostream& operator<< (std::ostream& o, Beam const & beam);
83
88 void setBeam(const int & nValues, const double *energy, const double *weight = NULL,
89 const int *characteristic = NULL, const double *divergency = NULL);
90
91 void setBeam(const int & nValues, const double *energy, const double *weight = NULL,
92 const double *characteristic = NULL, const double *divergency = NULL);
93
94 void setBeam(const double & energy, const double divergency = 0.0);
95
99 const std::vector<Ray> & getBeam();
100
110 std::vector<std::vector<double> > getBeamAsDoubleVectors() const;
111
112 private:
113 bool normalized;
114 void normalizeBeam(void);
115 std::vector<Ray> rays;
116 };
117
118 } // namespace fisx
119
120 #endif //FISX_BEAM_H
fisx::Beam
Class describing an X-ray beam.
Definition: fisx_beam.h:65
fisx
Definition: fisx_element.cpp:34
fisx::Ray
Definition: fisx_beam.h:37