38 #ifndef EGS_FOCAL_SPOT_
39 #define EGS_FOCAL_SPOT_
49 #ifdef BUILD_FOCAL_SPOT_DLL
50 #define EGS_FOCAL_SPOT_EXPORT __declspec(dllexport)
52 #define EGS_FOCAL_SPOT_EXPORT __declspec(dllimport)
54 #define EGS_FOCAL_SPOT_LOCAL
58 #ifdef HAVE_VISIBILITY
59 #define EGS_FOCAL_SPOT_EXPORT __attribute__ ((visibility ("default")))
60 #define EGS_FOCAL_SPOT_LOCAL __attribute__ ((visibility ("hidden")))
62 #define EGS_FOCAL_SPOT_EXPORT
63 #define EGS_FOCAL_SPOT_LOCAL
101 bool is_deviating=
false;
102 bool is_rotated=
false;
105 EGS_Float sigma_x_space;
106 EGS_Float sigma_y_space;
107 EGS_Float space_cutoff_x;
108 EGS_Float space_cutoff_y;
109 EGS_Float sigma_x_angle=0;
110 EGS_Float sigma_y_angle=0;
111 EGS_Float x_translation=0;
112 EGS_Float y_translation=0;
113 EGS_Float x_rotation=0;
114 EGS_Float y_rotation=0;
115 EGS_Float z_point_of_rotation;
136 double r = sqrt(-2*log(1-rndm->
getUniform()));
138 x.
x = sigma_x_space * r * cos(phi);
139 x.
y = sigma_y_space * r * sin(phi);
142 while (pow(x.
x/space_cutoff_x,2) + pow(x.
y/space_cutoff_y,2) > 1);
143 x.
x += x_translation;
144 x.
y += y_translation;
148 switch (angle_mode) {
152 u.
z = sqrt(-2*pow((sigma_x_angle*sigma_y_angle), 2)/
153 (pow(sigma_x_angle*sin(phi),2) + pow(sigma_y_angle*cos(phi),2)) * (log(1- rndm->
getUniform())));
158 double r = sqrt((1-u.
z)*(1+u.
z));
167 u.
z = cos(sigma_x_angle * sqrt(-2*log(rndm->
getUniform())));
170 u.
x = sqrt((1-u.
z)*(1+u.
z));
177 u.
z = cos(sigma_y_angle * sqrt(-2*log(rndm->
getUniform())));
180 u.
y = sqrt((1-u.
z)*(1+u.
z));
193 rotation.transform(x);
197 double t = (z_pos - x.
z) / u.
z;
204 EGS_Float getFluence()
const {
208 bool storeFluenceState(ostream &)
const {
212 bool setFluenceState(istream &) {
216 bool isValid()
const {
217 return (valid && s != 0);
221 static constexpr
double PI = 3.141592653589793;
222 static constexpr
double PI2 = 6.283185307179586;
223 static constexpr
double DEGREE_TO_RAD = 0.017453292519943295;
Base class for 'simple' particle sources.
virtual void getPositionDirection(EGS_RandomGenerator *rndm, EGS_Vector &x, EGS_Vector &u, EGS_Float &wt)=0
Sample a particle position and direction.
int angle_mode
rotation about z_point_of_rotation
Base random number generator class. All random number generators should be derived from this class.
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
A class representing 3D vectors.
EGS_BaseSource class header file.
EGS_RandomGenerator class header file.
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.