43 const size_t rdet_nbinsx(40), rdet_nbinsy(30);
44 const double rdet_width(20.0), rdet_height(18.0), rdet_distance(1000.0);
53 0.0 * Units::degree, 2.0 * Units::degree);
54 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
86 0.0 * Units::degree, 2.0 * Units::degree);
87 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
97 0.0 * Units::degree, 1.0 * Units::degree);
98 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
113 pattern1.beginsWith(
"*").add(
"Beam").add(
"Wavelength");
114 result->addParameterDistribution(pattern1.toStdString(), wavelength_distr, 5);
116 pattern2.beginsWith(
"*").add(
"Beam").add(
"InclinationAngle");
117 result->addParameterDistribution(pattern2.toStdString(), alpha_distr, 4);
119 pattern3.beginsWith(
"*").add(
"Beam").add(
"AzimuthalAngle");
120 result->addParameterDistribution(pattern3.toStdString(), phi_distr, 3);
131 0.0 * Units::degree, 2.0 * Units::degree);
132 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
133 result->setBeamIntensity(1e+7);
137 const double deg = Units::degree;
138 result->
addMask(
Ellipse(0.0 * deg, 1.0 * deg, 0.5 * deg, 0.5 * deg),
false);
139 result->
addMask(
Ellipse(0.11 * deg, 1.25 * deg, 0.05 * deg, 0.05 * deg),
true);
141 std::vector<std::vector<double>> points = {{0.0 * deg, 1.0 * deg},
142 {0.5 * deg, 1.2 * deg},
143 {0.5 * deg, 0.8 * deg},
144 {0.0 * deg, 1.0 * deg}};
147 result->
addMask(
Rectangle(0.45 * deg, 0.95 * deg, 0.55 * deg, 1.05 * deg),
false);
148 result->
addMask(
Rectangle(0.61 * deg, 0.95 * deg, 0.71 * deg, 1.05 * deg),
false);
149 result->
addMask(
Rectangle(0.75 * deg, 0.95 * deg, 0.85 * deg, 1.05 * deg),
false);
152 result->
addMask(
Ellipse(-0.5 * deg, 1.5 * deg, 0.3 * deg, 0.1 * deg, 45. * deg),
false);
165 result->setDetectorResolutionFunction(resfunc);
223 0.0 * Units::degree, 2.0 * Units::degree);
224 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
225 result->getOptions().setIncludeSpecular(
true);
235 0.0 * Units::degree, 2.0 * Units::degree);
236 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
258 0.0 * Units::degree, 2.0 * Units::degree);
260 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
271 0.0 * Units::degree, 2.0 * Units::degree);
273 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
282 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
285 detector.setPosition(
kvector_t(rdet_distance, 10.0, 5.0), rdet_width / 2., 1.0,
297 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
300 detector.setPerpendicularToSampleX(rdet_distance, rdet_width / 2., 1.0);
311 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
314 detector.setPerpendicularToDirectBeam(rdet_distance, rdet_width / 2., 1.0);
325 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
328 detector.setPerpendicularToReflectedBeam(rdet_distance, rdet_width / 2., 1.0);
340 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
343 detector.setPerpendicularToReflectedBeam(rdet_distance);
344 detector.setDirectBeamPosition(rdet_width / 2., 1.0);
365 0.0 * Units::degree, 3.0 * Units::degree);
366 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
367 result->
addMask(
Rectangle(-0.5 * Units::degree, 0.3 * Units::degree, -0.2 * Units::degree,
368 0.6 * Units::degree));
369 result->
setRegionOfInterest(-1.5 * Units::degree, 0.25 * Units::degree, 1.5 * Units::degree,
370 1.75 * Units::degree);
388 result->setBackground(bg);
400 simulation->setBeamParameters(13.52 * Units::nm, 0.2 * Units::deg, 0.0 * Units::deg);
401 simulation->setBeamIntensity(1.0e+08);
402 simulation->getOptions().setIncludeSpecular(
true);
408 const double wavelength = 1.54 * Units::angstrom;
409 const int number_of_bins = 2000;
410 const double min_angle = 0 * Units::deg;
411 const double max_angle = 5 * Units::deg;
415 result->setScan(scan);
416 result->getOptions().setUseAvgMaterials(
true);
422 std::vector<double> qs;
424 const double wavelength_0 = 1.54 * Units::angstrom;
425 const int number_of_bins = 2000;
426 const double min_angle = 0 * Units::deg;
427 const double max_angle = 5 * Units::deg;
428 FixedBinAxis angle_axis(
"axis", number_of_bins, min_angle, max_angle);
429 auto angles = angle_axis.getBinCenters();
431 qs.resize(angle_axis.size(), 0.0);
432 for (
size_t i = 0, size = qs.size(); i < size; ++i)
433 qs[i] = 4.0 * M_PI * std::sin(angles[i]) / wavelength_0;
438 result->setScan(q_scan);
439 result->getOptions().setUseAvgMaterials(
true);
445 const double wavelength = 1.54 * Units::angstrom;
446 const int number_of_bins = 2000;
447 const double min_angle = 0 * Units::deg;
448 const double max_angle = 5 * Units::deg;
449 auto gaussian_ff = std::make_unique<FootprintGauss>(1.0);
451 scan.setFootprintFactor(gaussian_ff.get());
454 result->setScan(scan);
460 const double wavelength = 1.54 * Units::angstrom;
461 const int number_of_bins = 2000;
462 const double min_angle = 0 * Units::deg;
463 const double max_angle = 5 * Units::deg;
464 auto square_ff = std::make_unique<FootprintSquare>(1.0);
466 scan.setFootprintFactor(square_ff.get());
469 result->setScan(scan);
475 const double wavelength = 1.54 * Units::angstrom;
476 const int number_of_bins = 20;
477 const size_t n_integration_points = 10;
478 const double min_angle = 0 * Units::deg;
479 const double max_angle = 5 * Units::deg;
480 const double wl_stddev = 0.1 * Units::angstrom;
481 const double ang_stddev = 0.1 * Units::degree;
485 std::unique_ptr<ScanResolution> wl_res(
486 ScanResolution::scanAbsoluteResolution(wl_distr, wl_stddev));
489 std::unique_ptr<ScanResolution> ang_res(
490 ScanResolution::scanAbsoluteResolution(alpha_distr, ang_stddev));
492 scan.setWavelengthResolution(*wl_res);
493 scan.setAngleResolution(*ang_res);
496 result->setScan(scan);
507 result->setScan(q_scan);
508 result->getOptions().setUseAvgMaterials(
true);
517 std::vector<double> resolutions;
518 resolutions.reserve(qs.size());
519 auto qs_vector = qs.getBinCenters();
520 std::for_each(qs_vector.begin(), qs_vector.end(),
521 [&resolutions](
double q_val) { resolutions.push_back(0.03 * q_val); });
525 result->setScan(q_scan);
526 result->getOptions().setUseAvgMaterials(
true);
533 auto* simulation = BasicSpecular();
534 simulation->setBeamPolarization({0.0, 1.0, 0.0});
535 simulation->setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
541 auto* simulation = BasicSpecular();
542 simulation->setBeamPolarization({0.0, 1.0, 0.0});
543 simulation->setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
549 auto* simulation = BasicSpecular();
550 simulation->setBeamPolarization({0.0, -1.0, 0.0});
551 simulation->setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
557 auto* simulation = BasicSpecular();
558 simulation->setBeamPolarization({0.0, -1.0, 0.0});
559 simulation->setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
565 auto* simulation = BasicSpecularQ();
566 simulation->setBeamPolarization({0.0, 1.0, 0.0});
567 simulation->setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
573 auto* simulation = BasicSpecularQ();
574 simulation->setBeamPolarization({0.0, -1.0, 0.0});
575 simulation->setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
581 auto* simulation = BasicSpecularQ();
582 simulation->setBeamPolarization({0.0, 1.0, 0.0});
583 simulation->setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
589 auto* simulation = BasicSpecularQ();
590 simulation->setBeamPolarization({0.0, -1.0, 0.0});
591 simulation->setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
602 const int n_alpha(19);
603 const double alpha_min(0.0 * Units::deg);
604 const double alpha_max(4.0 * Units::deg);
606 const double phi_min(-0.1 * Units::deg);
607 const double phi_max(0.1 * Units::deg);
611 const int n_scan_points(n_alpha);
612 const double alpha_i_min(alpha_min);
613 const double alpha_i_max(alpha_max);
615 FixedBinAxis alpha_i_axis(
"alpha_i", n_scan_points, alpha_i_min, alpha_i_max);
618 result->setBeamIntensity(1e9);
619 result->getOptions().setIncludeSpecular(
true);
628 const double wavelength = 10.0 * Units::angstrom;
629 const size_t n_alpha = 20;
630 const double alpha_min = 0.0 * Units::deg;
631 const double alpha_max = 1.0 * Units::deg;
632 const size_t n_z = n_alpha;
633 const double z_min = -100.0 * Units::nm;
634 const double z_max = 100.0 * Units::nm;
637 result->setZSpan(n_z, z_min, z_max);
648 0.0 * Units::degree, 2.0 * Units::degree);
649 result->
setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
650 result->setBeamIntensity(1e6);
Declares AngularSpecScan class.
Defines class ConstantBackground.
Defines class DepthProbeSimulation.
Defines classes representing one-dimensional distributions.
Defines class GISASSimulation.
Defines class IsGISAXSDetector.
Defines class OffSpecSimulation.
Defines class ParameterPattern.
Declares QSpecScan class.
Defines classes representing ranged one-dimensional distributions.
Defines class RealParameter.
Defines class RectangularDetector.
Defines class ResolutionFunction2DGaussian.
Defines class SampleBuilderFactory.
Defines scan resolution class.
Defines class SpecularSimulation.
Defines namespace and functions for standard simulations.
Defines some unit conversion factors and other constants in namespace Units.
Scan type with inclination angles as coordinate values and a unique wavelength.
Class representing a constant background signal.
Uniform distribution function with half width hwhm.
Gaussian distribution with standard deviation std_dev.
Axis with fixed bin size.
Main class to run a Grazing-Incidence Small-Angle Scattering simulation.
void setBeamParameters(double wavelength, double alpha_i, double phi_i)
Sets beam parameters from here (forwarded to Instrument)
An infinite horizontal line.
void setDetectorParameters(size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max)
Sets detector parameters using angle ranges.
A spherical detector used for validation with IsGISAXS results.
Main class to run an off-specular simulation.
Helper class for constructing parameter patterns.
Scan type with z-components of scattering vector as coordinate values.
Gaussian distribution with standard deviation std_dev.
The rectangle shape having its axis aligned to the (non-rotated) coordinate system.
A flat rectangular detector with axes and resolution function.
Simple gaussian two-dimensional resolution function.
void setDetector(const IDetector2D &detector)
Sets the detector (axes can be overwritten later)
void addMask(const IShape2D &shape, bool mask_value=true)
Adds mask of given shape to the stack of detector masks.
void setDetectorParameters(size_t n_phi, double phi_min, double phi_max, size_t n_alpha, double alpha_min, double alpha_max)
Sets spherical detector parameters using angle ranges.
void maskAll()
Put the mask for all detector channels (i.e. exclude whole detector from the analysis)
void setRegionOfInterest(double xlow, double ylow, double xup, double yup)
Sets rectangular region of interest with lower left and upper right corners defined.
void setMonteCarloIntegration(bool flag=true, size_t mc_points=50)
Enables/disables MonetCarlo integration.
void setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission)
Sets the polarization analyzer characteristics of the detector.
void setBeamPolarization(const kvector_t bloch_vector)
Sets the beam polarization according to the given Bloch vector.
Main class to run a specular simulation.
An infinite vertical line.
GISASSimulation * RectDetectorPerpToReflectedBeam()
GISAS simulation with the rectangular detector perpendicular to the reflected beam.
GISASSimulation * BasicGISAS00()
Basic GISAS for polarization studies.
GISASSimulation * RectDetectorPerpToDirectBeam()
GISAS simulation with the rectangular detector perpendicular to the direct beam.
GISASSimulation * BasicGISAS()
Basic GISAS simulation with the detector phi[0,2], theta[0,2].
GISASSimulation * MiniGISASBeamDivergence()
GISAS simulation with beam divergence applied.
GISASSimulation * GISASWithMasks()
GISAS simulation with multiple masks on the detector plane.
GISASSimulation * MiniGISAS()
GISAS simulation with small detector and phi[-2,2], theta[0,2].
GISASSimulation * IsGISAXSSimulation1()
Typical IsGISAXS simulation with the detector phi[-1,1], theta[0,2].
GISASSimulation * ExtraLongWavelengthGISAS()
GISAS simulation with an extra long wavelength.
GISASSimulation * RectDetectorPerpToSample()
GISAS simulation with the rectangular detector perpendicular to the sample.
GISASSimulation * SphericalDetWithRoi()
GISAS simulation with spherical detector, region of interest and mask.
GISASSimulation * MiniGISASDetectorResolution()
GISAS simulation with detector resolution.
GISASSimulation * MiniGISASMonteCarlo()
GISAS simulation with Monte-Carlo integration switched ON.
GISASSimulation * IsGISAXSSimulation2()
Typical IsGISAXS simulation with the detector phi[0,2], theta[0,2].
GISASSimulation * RectDetectorGeneric()
GISAS simulation with generic rectangular detector.
GISASSimulation * MaxiGISAS()
GISAS simulation with large detector to test performance.
GISASSimulation * MiniGISAS_v2()
GISAS simulation with small detector and phi[-1,1], theta[0,1].
GISASSimulation * RectDetectorPerpToReflectedBeamDpos()
GISAS simulation with the rectangular detector perpendicular to the reflected beam when the coordinat...
GISASSimulation * MiniGISASSpecularPeak()
GISAS simulation with small detector and including specular peak.
GISASSimulation * RectDetWithRoi()
GISAS simulation with rectangular detector, region of interest and mask.
GISASSimulation * MiniGISASFit()
Simulation with fitting.
GISASSimulation * BasicPolarizedGISAS()
Basic GISAS simulation for spin flip channel.
GISASSimulation * MaxiGISAS00()
Basic GISAS for polarization studies.