BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
StandardSimulations.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Simulation/StandardSimulations.cpp
6 //! @brief Implements functions for standard simulations.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
16 #include "Base/Const/Units.h"
26 #include "Device/Mask/Ellipse.h"
27 #include "Device/Mask/Line.h"
28 #include "Device/Mask/Polygon.h"
29 #include "Device/Mask/Rectangle.h"
33 #include "Core/Scan/QSpecScan.h"
39 #include <memory>
40 
41 namespace
42 {
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);
45 } // namespace
46 
47 //! Basic GISAS simulation with the detector phi[0,2], theta[0,2].
48 
50 {
51  GISASSimulation* result = new GISASSimulation();
52  result->setDetectorParameters(100, 0.0 * Units::degree, 2.0 * Units::degree, 100,
53  0.0 * Units::degree, 2.0 * Units::degree);
54  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
55  return result;
56 }
57 
58 //! Basic GISAS for polarization studies.
59 
61 {
62  GISASSimulation* result = BasicGISAS();
63  kvector_t zplus(0.0, 0.0, 1.0);
64  result->setBeamPolarization(zplus);
65  result->setAnalyzerProperties(zplus, 1.0, 0.5);
66  return result;
67 }
68 
69 //! Basic GISAS simulation for spin flip channel.
70 
72 {
73  GISASSimulation* result = BasicGISAS();
74  kvector_t zplus(0.0, 0.0, 1.0);
75  result->setBeamPolarization(zplus);
76  result->setAnalyzerProperties(zplus, -1.0, 0.5);
77  return result;
78 }
79 
80 //! GISAS simulation with small detector and phi[-2,2], theta[0,2].
81 
83 {
84  GISASSimulation* result = new GISASSimulation();
85  result->setDetectorParameters(25, -2.0 * Units::degree, 2.0 * Units::degree, 25,
86  0.0 * Units::degree, 2.0 * Units::degree);
87  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
88  return result;
89 }
90 
91 //! GISAS simulation with small detector and phi[-1,1], theta[0,1].
92 
94 {
95  GISASSimulation* result = new GISASSimulation();
96  result->setDetectorParameters(25, -1.0 * Units::degree, 1.0 * Units::degree, 25,
97  0.0 * Units::degree, 1.0 * Units::degree);
98  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
99  return result;
100 }
101 
102 //! GISAS simulation with beam divergence applied.
103 
105 {
106  GISASSimulation* result = MiniGISAS();
107 
108  DistributionLogNormal wavelength_distr(1.0 * Units::angstrom, 0.1);
109  DistributionGaussian alpha_distr(0.2 * Units::degree, 0.1 * Units::degree);
110  DistributionGate phi_distr(-0.1 * Units::degree, 0.1 * Units::degree);
111 
112  ParameterPattern pattern1;
113  pattern1.beginsWith("*").add("Beam").add("Wavelength");
114  result->addParameterDistribution(pattern1.toStdString(), wavelength_distr, 5);
115  ParameterPattern pattern2;
116  pattern2.beginsWith("*").add("Beam").add("InclinationAngle");
117  result->addParameterDistribution(pattern2.toStdString(), alpha_distr, 4);
118  ParameterPattern pattern3;
119  pattern3.beginsWith("*").add("Beam").add("AzimuthalAngle");
120  result->addParameterDistribution(pattern3.toStdString(), phi_distr, 3);
121 
122  return result;
123 }
124 
125 //! GISAS simulation with multiple masks on the detector plane.
126 
128 {
129  GISASSimulation* result = new GISASSimulation();
130  result->setDetectorParameters(50, -1.0 * Units::degree, 1.0 * Units::degree, 50,
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);
134 
135  result->maskAll();
136  // pacman
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);
140 
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}};
145  result->addMask(Polygon(points), true);
146 
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);
150 
151  // more masks
152  result->addMask(Ellipse(-0.5 * deg, 1.5 * deg, 0.3 * deg, 0.1 * deg, 45. * deg), false);
153  result->addMask(VerticalLine(-0.6 * deg), true);
154  result->addMask(HorizontalLine(0.3 * deg), false);
155 
156  return result;
157 }
158 
159 //! GISAS simulation with detector resolution.
160 
162 {
163  GISASSimulation* result = MiniGISAS();
164  ResolutionFunction2DGaussian resfunc(0.0025, 0.0025);
165  result->setDetectorResolutionFunction(resfunc);
166  return result;
167 }
168 
170 {
171  GISASSimulation* result = MiniGISAS();
172 
173  kvector_t analyzer_dir(0.0, 0.0, 1.0);
174  kvector_t beampol(0.0, 0.0, 1.0);
175 
176  result->setBeamPolarization(beampol);
177  result->setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
178  return result;
179 }
180 
182 {
183  GISASSimulation* result = MiniGISAS();
184 
185  kvector_t analyzer_dir(0.0, 0.0, -1.0);
186  kvector_t beampol(0.0, 0.0, 1.0);
187 
188  result->setBeamPolarization(beampol);
189  result->setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
190  return result;
191 }
192 
194 {
195  GISASSimulation* result = MiniGISAS();
196 
197  kvector_t analyzer_dir(0.0, 0.0, 1.0);
198  kvector_t beampol(0.0, 0.0, -1.0);
199 
200  result->setBeamPolarization(beampol);
201  result->setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
202  return result;
203 }
204 
206 {
207  GISASSimulation* result = MiniGISAS();
208 
209  kvector_t analyzer_dir(0.0, 0.0, -1.0);
210  kvector_t beampol(0.0, 0.0, -1.0);
211 
212  result->setBeamPolarization(beampol);
213  result->setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
214  return result;
215 }
216 
217 //! GISAS simulation with small detector and including specular peak.
218 
220 {
221  GISASSimulation* result = new GISASSimulation();
222  result->setDetectorParameters(25, -2.0 * Units::degree, 2.0 * Units::degree, 25,
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);
226  return result;
227 }
228 
229 //! GISAS simulation with large detector to test performance.
230 
232 {
233  GISASSimulation* result = new GISASSimulation();
234  result->setDetectorParameters(256, -2.0 * Units::degree, 2.0 * Units::degree, 256,
235  0.0 * Units::degree, 2.0 * Units::degree);
236  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
237  return result;
238 }
239 
240 //! Basic GISAS for polarization studies.
241 
243 {
244  GISASSimulation* result = MaxiGISAS();
245  kvector_t zplus(0.0, 0.0, 1.0);
246  result->setBeamPolarization(zplus);
247  result->setAnalyzerProperties(zplus, 1.0, 0.5);
248  return result;
249 }
250 
251 //! Typical IsGISAXS simulation with the detector phi[-1,1], theta[0,2].
252 
254 {
255  GISASSimulation* result = new GISASSimulation();
256  IsGISAXSDetector detector;
257  detector.setDetectorParameters(100, -1.0 * Units::degree, 1.0 * Units::degree, 100,
258  0.0 * Units::degree, 2.0 * Units::degree);
259  result->setDetector(detector);
260  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
261  return result;
262 }
263 
264 //! Typical IsGISAXS simulation with the detector phi[0,2], theta[0,2].
265 
267 {
268  GISASSimulation* result = new GISASSimulation();
269  IsGISAXSDetector detector;
270  detector.setDetectorParameters(100, 0.0 * Units::degree, 2.0 * Units::degree, 100,
271  0.0 * Units::degree, 2.0 * Units::degree);
272  result->setDetector(detector);
273  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
274  return result;
275 }
276 
277 //! GISAS simulation with generic rectangular detector.
278 
280 {
281  GISASSimulation* result = new GISASSimulation();
282  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
283 
285  detector.setPosition(kvector_t(rdet_distance, 10.0, 5.0), rdet_width / 2., 1.0,
286  kvector_t(0.1, -1.0, 0.2));
287 
288  result->setDetector(detector);
289  return result;
290 }
291 
292 //! GISAS simulation with the rectangular detector perpendicular to the sample.
293 
295 {
296  GISASSimulation* result = new GISASSimulation();
297  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
298 
301 
302  result->setDetector(detector);
303  return result;
304 }
305 
306 //! GISAS simulation with the rectangular detector perpendicular to the direct beam.
307 
309 {
310  GISASSimulation* result = new GISASSimulation();
311  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
312 
315 
316  result->setDetector(detector);
317  return result;
318 }
319 
320 //! GISAS simulation with the rectangular detector perpendicular to the reflected beam.
321 
323 {
324  GISASSimulation* result = new GISASSimulation();
325  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
326 
329 
330  result->setDetector(detector);
331  return result;
332 }
333 
334 //! GISAS simulation with the rectangular detector perpendicular to the reflected beam when
335 //! the coordinates of direct beam are known.
336 
338 {
339  GISASSimulation* result = new GISASSimulation();
340  result->setBeamParameters(1.0 * Units::angstrom, 0.2 * Units::degree, 0.0 * Units::degree);
341 
344  detector.setDirectBeamPosition(rdet_width / 2., 1.0);
345 
346  result->setDetector(detector);
347  return result;
348 }
349 
350 //! GISAS simulation with Monte-Carlo integration switched ON.
351 
353 {
354  GISASSimulation* result = MiniGISAS();
355  result->getOptions().setMonteCarloIntegration(true, 100);
356  return result;
357 }
358 
359 //! GISAS simulation with spherical detector, region of interest and mask.
360 
362 {
363  GISASSimulation* result = new GISASSimulation();
364  result->setDetectorParameters(40, -2.0 * Units::degree, 2.0 * Units::degree, 30,
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);
371  return result;
372 }
373 
374 //! GISAS simulation with rectangular detector, region of interest and mask.
375 
377 {
379  result->addMask(Rectangle(3.0, 4.0, 5.0, 7.0));
380  result->setRegionOfInterest(2.0, 3.0, 18.0, 15.0);
381  return result;
382 }
383 
385 {
386  GISASSimulation* result = MiniGISAS();
387  ConstantBackground bg(1e3);
388  result->setBackground(bg);
389  return result;
390 }
391 
392 //! GISAS simulation with an extra long wavelength
393 
395 {
396  auto* simulation = new GISASSimulation;
397  simulation->setDetectorParameters(100, -1.0 * Units::deg, 1.0 * Units::deg, 100, 0.0,
398  2.0 * Units::deg);
399 
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);
403  return simulation;
404 }
405 
407 {
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;
412  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
413 
414  auto* result = new SpecularSimulation();
415  result->setScan(scan);
416  result->getOptions().setUseAvgMaterials(true);
417  return result;
418 }
419 
421 {
422  std::vector<double> qs;
423  {
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();
430 
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;
434  }
435  QSpecScan q_scan(qs);
436 
437  auto* result = new SpecularSimulation;
438  result->setScan(q_scan);
439  result->getOptions().setUseAvgMaterials(true);
440  return result;
441 }
442 
444 {
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);
450  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
451  scan.setFootprintFactor(gaussian_ff.get());
452 
453  auto* result = new SpecularSimulation;
454  result->setScan(scan);
455  return result;
456 }
457 
459 {
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);
465  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
466  scan.setFootprintFactor(square_ff.get());
467 
468  auto* result = new SpecularSimulation;
469  result->setScan(scan);
470  return result;
471 }
472 
474 {
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;
482  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
483 
484  RangedDistributionGaussian wl_distr(n_integration_points, /*sigma_factor = */ 2.0);
485  std::unique_ptr<ScanResolution> wl_res(
486  ScanResolution::scanAbsoluteResolution(wl_distr, wl_stddev));
487 
488  RangedDistributionGaussian alpha_distr(n_integration_points, /*sigma_factor = */ 2.0);
489  std::unique_ptr<ScanResolution> ang_res(
490  ScanResolution::scanAbsoluteResolution(alpha_distr, ang_stddev));
491 
492  scan.setWavelengthResolution(*wl_res);
493  scan.setAngleResolution(*ang_res);
494 
495  auto* result = new SpecularSimulation;
496  result->setScan(scan);
497  return result;
498 }
499 
501 {
502  FixedBinAxis qs("axis", 500, 0.0, 1.0);
503  QSpecScan q_scan(qs);
504  q_scan.setRelativeQResolution(RangedDistributionGaussian(20, 2.0), 0.03);
505 
506  auto* result = new SpecularSimulation;
507  result->setScan(q_scan);
508  result->getOptions().setUseAvgMaterials(true);
509  return result;
510 }
511 
513 {
514  FixedBinAxis qs("axis", 500, 0.0, 1.0);
515  QSpecScan q_scan(qs);
516 
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); });
522  q_scan.setAbsoluteQResolution(RangedDistributionGaussian(20, 2.0), resolutions);
523 
524  auto* result = new SpecularSimulation;
525  result->setScan(q_scan);
526  result->getOptions().setUseAvgMaterials(true);
527  return result;
528 }
529 
530 // ------------ polarized specular ----------------
532 {
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);
536  return simulation;
537 }
538 
540 {
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);
544  return simulation;
545 }
546 
548 {
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);
552  return simulation;
553 }
554 
556 {
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);
560  return simulation;
561 }
562 
564 {
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);
568  return simulation;
569 }
570 
572 {
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);
576  return simulation;
577 }
578 
580 {
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);
584  return simulation;
585 }
586 
588 {
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);
592  return simulation;
593 }
594 
595 // ----------------------- off-spec simulations ------------------
596 
597 // OffSpec simulation used in ResonatorOffSpecSetup.py
599 {
600  auto* result = new OffSpecSimulation;
601 
602  const int n_alpha(19);
603  const double alpha_min(0.0 * Units::deg);
604  const double alpha_max(4.0 * Units::deg);
605  const int n_phi(9);
606  const double phi_min(-0.1 * Units::deg);
607  const double phi_max(0.1 * Units::deg);
608 
609  result->setDetectorParameters(n_phi, phi_min, phi_max, n_alpha, alpha_min, alpha_max);
610 
611  const int n_scan_points(n_alpha);
612  const double alpha_i_min(alpha_min);
613  const double alpha_i_max(alpha_max);
614 
615  FixedBinAxis alpha_i_axis("alpha_i", n_scan_points, alpha_i_min, alpha_i_max);
616  result->setBeamParameters(5.0 * Units::angstrom, alpha_i_axis, 0.0);
617 
618  result->setBeamIntensity(1e9);
619  result->getOptions().setIncludeSpecular(true);
620 
621  return result;
622 }
623 
625 {
626  auto* result = new DepthProbeSimulation;
627 
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;
635 
636  result->setBeamParameters(wavelength, n_alpha, alpha_min, alpha_max);
637  result->setZSpan(n_z, z_min, z_max);
638 
639  return result;
640 }
641 
642 //! Simulation with fitting.
643 //! Beam intensity set to provide reasonably large values in detector channels.
645 {
646  auto* result = new GISASSimulation;
647  result->setDetectorParameters(25, -2.0 * Units::degree, 2.0 * Units::degree, 25,
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);
651  return result;
652 }
Declares AngularSpecScan class.
Defines class ConstantBackground.
Defines class DepthProbeSimulation.
Defines classes representing one-dimensional distributions.
Defines class Rectangle.
Defines class FootprintGauss.
Defines class FootprintSquare.
Defines class GISASSimulation.
Defines class IsGISAXSDetector.
Defines class Line.
#define M_PI
Definition: MathConstants.h:39
Defines class OffSpecSimulation.
Defines class ParameterPattern.
Defines class Polygon.
Declares QSpecScan class.
Defines classes representing ranged one-dimensional distributions.
Defines class RealParameter.
Defines class Rectangle.
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.
BasicVector3D< double > kvector_t
Definition: Vectors3D.h:21
Scan type with inclination angles as coordinate values and a unique wavelength.
void setAngleResolution(const ScanResolution &resolution)
Sets angle resolution values via ScanResolution object.
void setFootprintFactor(const IFootprintFactor *f_factor)
Sets footprint correction factor.
void setWavelengthResolution(const ScanResolution &resolution)
Sets wavelength resolution values via ScanResolution object.
Class representing a constant background signal.
Uniform distribution function with half width hwhm.
Definition: Distributions.h:86
Gaussian distribution with standard deviation std_dev.
Log-normal distribution.
Ellipse shape.
Definition: Ellipse.h:24
Axis with fixed bin size.
Definition: FixedBinAxis.h:24
std::vector< double > getBinCenters() const
size_t size() const
retrieve the number of bins
Definition: FixedBinAxis.h:36
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.
Definition: Line.h:58
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.
Definition: IDetector2D.cpp:35
A spherical detector used for validation with IsGISAXS results.
Main class to run an off-specular simulation.
Helper class for constructing parameter patterns.
ParameterPattern & beginsWith(std::string start_type)
std::string toStdString() const
ParameterPattern & add(std::string object_type)
A polygon in 2D space.
Definition: Polygon.h:31
Scan type with z-components of scattering vector as coordinate values.
Definition: QSpecScan.h:29
void setRelativeQResolution(const RangedDistribution &distr, double rel_dev)
Definition: QSpecScan.cpp:120
void setAbsoluteQResolution(const RangedDistribution &distr, double std_dev)
Definition: QSpecScan.cpp:135
Gaussian distribution with standard deviation std_dev.
The rectangle shape having its axis aligned to the (non-rotated) coordinate system.
Definition: Rectangle.h:24
A flat rectangular detector with axes and resolution function.
void setDirectBeamPosition(double u0, double v0)
void setPerpendicularToSampleX(double distance, double u0, double v0)
void setPerpendicularToDirectBeam(double distance, double u0, double v0)
void setPerpendicularToReflectedBeam(double distance, double u0=0.0, double v0=0.0)
void setPosition(const kvector_t normal_to_detector, double u0, double v0, const kvector_t direction=kvector_t(0.0, -1.0, 0.0))
Simple gaussian two-dimensional resolution function.
static ScanResolution * scanAbsoluteResolution(const RangedDistribution &distr, double stddev)
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 setIncludeSpecular(bool include_specular)
void setMonteCarloIntegration(bool flag=true, size_t mc_points=50)
Enables/disables MonetCarlo integration.
const SimulationOptions & getOptions() const
Definition: Simulation.h:92
void setBackground(const IBackground &bg)
Definition: Simulation.cpp:257
void setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission)
Sets the polarization analyzer characteristics of the detector.
Definition: Simulation.cpp:167
void setBeamIntensity(double intensity)
Definition: Simulation.cpp:173
void addParameterDistribution(const std::string &param_name, const IDistribution1D &distribution, size_t nbr_samples, double sigma_factor=0.0, const RealLimits &limits=RealLimits())
Definition: Simulation.cpp:273
void setBeamPolarization(const kvector_t bloch_vector)
Sets the beam polarization according to the given Bloch vector.
Definition: Simulation.cpp:184
void setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function)
Definition: Simulation.cpp:156
Main class to run a specular simulation.
void setScan(const ISpecularScan &scan)
Sets chosen specular scan to the simulation.
An infinite vertical line.
Definition: Line.h:40
SpecularSimulation * BasicSpecularQPP()
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.
SpecularSimulation * BasicSpecularMP()
GISASSimulation * BasicGISAS()
Basic GISAS simulation with the detector phi[0,2], theta[0,2].
GISASSimulation * MiniGISASBeamDivergence()
GISAS simulation with beam divergence applied.
SpecularSimulation * SpecularWithSquareBeam()
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].
SpecularSimulation * BasicSpecularPM()
GISASSimulation * IsGISAXSSimulation1()
Typical IsGISAXS simulation with the detector phi[-1,1], theta[0,2].
OffSpecSimulation * MiniOffSpec()
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 * MiniGISASPolarizationPM()
SpecularSimulation * TOFRWithRelativeResolution()
GISASSimulation * MiniGISASDetectorResolution()
GISAS simulation with detector resolution.
SpecularSimulation * BasicSpecularQMP()
GISASSimulation * MiniGISASMonteCarlo()
GISAS simulation with Monte-Carlo integration switched ON.
SpecularSimulation * SpecularWithGaussianBeam()
GISASSimulation * MiniGISASPolarizationMM()
GISASSimulation * MiniGISASPolarizationMP()
DepthProbeSimulation * BasicDepthProbe()
GISASSimulation * IsGISAXSSimulation2()
Typical IsGISAXS simulation with the detector phi[0,2], theta[0,2].
GISASSimulation * ConstantBackgroundGISAS()
SpecularSimulation * BasicSpecularQPM()
GISASSimulation * RectDetectorGeneric()
GISAS simulation with generic rectangular detector.
SpecularSimulation * BasicSpecularMM()
GISASSimulation * MiniGISASPolarizationPP()
SpecularSimulation * BasicSpecularPP()
SpecularSimulation * BasicSpecularQ()
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...
SpecularSimulation * TOFRWithPointwiseResolution()
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.
SpecularSimulation * SpecularDivergentBeam()
SpecularSimulation * BasicSpecularQMM()
GISASSimulation * MaxiGISAS00()
Basic GISAS for polarization studies.
SpecularSimulation * BasicSpecular()
static constexpr double deg
Definition: Units.h:56
static constexpr double nm
Definition: Units.h:31
static constexpr double angstrom
Definition: Units.h:25
static constexpr double degree
Definition: Units.h:40