8 constexpr
double V2W = 3.956034e-07;
43 #define PHASEDIM_INIT \ 46 static const size_t DIM = 3;
47 static const size_t X = 0;
48 static const size_t Y = 1;
49 static const size_t Z = 2;
50 static const size_t PHASEDIM = DIM + 1;
51 static const size_t PHASE = 3;
54 float _position[DIM] = DIM_INIT;
55 float _direction[DIM] = DIM_INIT;
56 float _polarization[DIM] = DIM_INIT;
57 float _sPolarization[PHASEDIM] = PHASEDIM_INIT;
58 float _pPolarization[PHASEDIM] = PHASEDIM_INIT;
59 float _wavelength = 0;
62 unsigned long long int _id = 0;
74 float x()
const {
return _position[X]; };
75 float y()
const {
return _position[Y]; };
76 float z()
const {
return _position[Z]; };
77 void get_position(
float* xx,
float* yy,
float* zz)
const {
82 void get_position(
double* xx,
double* yy,
double* zz)
const {
97 float dx()
const {
return _direction[X]; };
98 float dy()
const {
return _direction[Y]; };
99 float dz()
const {
return _direction[Z]; };
100 void get_direction(
float* x,
float* y,
float* z,
double scale)
const {
105 void get_direction(
double* x,
double* y,
double* z,
double scale)
const {
114 float sx()
const {
return _polarization[X]; };
115 float sy()
const {
return _polarization[Y]; };
116 float sz()
const {
return _polarization[Z]; };
117 void get_polarization(
float* x,
float* y,
float* z)
const {
122 void get_polarization(
double* x,
double* y,
double* z)
const {
131 float sPolAx()
const {
return _sPolarization[X]; };
132 float sPolAy()
const {
return _sPolarization[Y]; };
133 float sPolAz()
const {
return _sPolarization[Z]; };
134 float sPolPh()
const {
return _sPolarization[PHASE]; };
135 void get_sPolarizationAmplitude(
float* x,
float* y,
float* z)
const {
140 void get_sPolarization(
float* x,
float* y,
float* z,
float* phase)
const {
141 get_sPolarizationAmplitude(x,y,z);
147 float pPolAx()
const {
return _pPolarization[X]; };
148 float pPolAy()
const {
return _pPolarization[Y]; };
149 float pPolAz()
const {
return _pPolarization[Z]; };
150 float pPolPh()
const {
return _pPolarization[PHASE]; };
151 void get_pPolarizationAmplitude(
float* x,
float* y,
float* z)
const {
157 void get_pPolarization(
float* x,
float* y,
float* z,
float* phase)
const {
158 get_pPolarizationAmplitude(x,y,z);
167 float get_wavelength()
const {
return _wavelength; };
169 float get_time()
const {
return _time; };
170 float get_weight()
const {
return _weight; };
171 unsigned long long int get_id(
void)
const {
return _id; };
185 _position[X] = x * scale;
186 _position[Y] = y * scale;
187 _position[Z] = z * scale;
192 _direction[X] = x * scale;
193 _direction[Y] = y * scale;
194 _direction[Z] = z * scale;
199 double abs_v = sqrt(x * x + y * y + z * z);
205 _polarization[X] = x * scale;
206 _polarization[Y] = y * scale;
207 _polarization[Z] = z * scale;
211 _sPolarization[X] = x * scale;
212 _sPolarization[Y] = y * scale;
213 _sPolarization[Z] = z * scale;
214 _sPolarization[PHASE] = phase;
218 _pPolarization[X] = x * scale;
219 _pPolarization[Y] = y * scale;
220 _pPolarization[Z] = z * scale;
221 _pPolarization[PHASE] = phase;
229 void set_id(
unsigned long long int idv) { _id = idv; };
234 friend std::ostream& operator<<(std::ostream& os,
const Ray& ray);
242 class photon :
public Ray {};
247 class neutron :
public Ray {};
252 class mcstas_neutron :
public Ray {
257 void set_velocity(
double x,
double y,
double z){
258 double abs_v = sqrt(x * x + y * y + z * z);
262 void get_velocity(
float *x,
float *y,
float* z){
263 double abs_v = V2W/get_wavelength();
264 get_direction(x, y, z, abs_v);
void set_wavelength(double w)
set wavelength
void set_polarization(double x, double y, double z, double scale=1)
scale and set polarization for non-photons
void set_weight(double w)
set weight
Generic ray, containing all the ray information being stored by the API into the openPMD file...
void set_direction(double x, double y, double z, double scale=1)
scale and set the direction
constexpr int kAlive
alive ray
defines the maximum number of rays that can be stored in memory before dumping to file ...
constexpr int kDead
particleStatus_t: dead ray
void get_position(float &xx, float &yy, float &zz) const
void set_sPolarization(double x, double y, double z, double phase, double scale=1)
scale and set s-polarization for photons
void set_pPolarization(double x, double y, double z, double phase, double scale=1)
scale and set p-polarization for photons
void set_velocity(double x, double y, double z)
scale and set the direction from the velocity
void set_time(double t)
set time
void set_position(double x, double y, double z, double scale=1)
scale and set the position
particleStatus_t get_status(void) const
return the particle status