BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
StandardSimulations Namespace Reference

Standard pre-defined simulations. More...

Functions

DepthProbeSimulationBasicDepthProbe ()
 
GISASSimulationBasicGISAS ()
 Basic GISAS simulation with the detector phi[0,2], theta[0,2]. More...
 
GISASSimulationBasicGISAS00 ()
 Basic GISAS for polarization studies. More...
 
GISASSimulationBasicPolarizedGISAS ()
 Basic GISAS simulation for spin flip channel. More...
 
SpecularSimulationBasicSpecular ()
 
SpecularSimulationBasicSpecularMM ()
 
SpecularSimulationBasicSpecularMP ()
 
SpecularSimulationBasicSpecularPM ()
 
SpecularSimulationBasicSpecularPP ()
 
SpecularSimulationBasicSpecularQ ()
 
SpecularSimulationBasicSpecularQMM ()
 
SpecularSimulationBasicSpecularQMP ()
 
SpecularSimulationBasicSpecularQPM ()
 
SpecularSimulationBasicSpecularQPP ()
 
GISASSimulationConstantBackgroundGISAS ()
 
GISASSimulationExtraLongWavelengthGISAS ()
 GISAS simulation with an extra long wavelength. More...
 
GISASSimulationGISASWithMasks ()
 GISAS simulation with multiple masks on the detector plane. More...
 
GISASSimulationIsGISAXSSimulation1 ()
 Typical IsGISAXS simulation with the detector phi[-1,1], theta[0,2]. More...
 
GISASSimulationIsGISAXSSimulation2 ()
 Typical IsGISAXS simulation with the detector phi[0,2], theta[0,2]. More...
 
GISASSimulationMaxiGISAS ()
 GISAS simulation with large detector to test performance. More...
 
GISASSimulationMaxiGISAS00 ()
 Basic GISAS for polarization studies. More...
 
GISASSimulationMiniGISAS ()
 GISAS simulation with small detector and phi[-2,2], theta[0,2]. More...
 
GISASSimulationMiniGISAS_v2 ()
 GISAS simulation with small detector and phi[-1,1], theta[0,1]. More...
 
GISASSimulationMiniGISASBeamDivergence ()
 GISAS simulation with beam divergence applied. More...
 
GISASSimulationMiniGISASDetectorResolution ()
 GISAS simulation with detector resolution. More...
 
GISASSimulationMiniGISASFit ()
 ISimulation with fitting. More...
 
GISASSimulationMiniGISASMonteCarlo ()
 GISAS simulation with Monte-Carlo integration switched ON. More...
 
GISASSimulationMiniGISASPolarizationMM ()
 
GISASSimulationMiniGISASPolarizationMP ()
 
GISASSimulationMiniGISASPolarizationPM ()
 
GISASSimulationMiniGISASPolarizationPP ()
 
GISASSimulationMiniGISASSpecularPeak ()
 GISAS simulation with small detector and including specular peak. More...
 
OffSpecularSimulationMiniOffSpecular ()
 
GISASSimulationRectDetectorGeneric ()
 GISAS simulation with generic rectangular detector. More...
 
GISASSimulationRectDetectorPerpToDirectBeam ()
 GISAS simulation with the rectangular detector perpendicular to the direct beam. More...
 
GISASSimulationRectDetectorPerpToReflectedBeam ()
 GISAS simulation with the rectangular detector perpendicular to the reflected beam. More...
 
GISASSimulationRectDetectorPerpToReflectedBeamDpos ()
 GISAS simulation with the rectangular detector perpendicular to the reflected beam when the coordinates of direct beam are known. More...
 
GISASSimulationRectDetectorPerpToSample ()
 GISAS simulation with the rectangular detector perpendicular to the sample. More...
 
GISASSimulationRectDetWithRoi ()
 GISAS simulation with rectangular detector, region of interest and mask. More...
 
SpecularSimulationSpecularDivergentBeam ()
 
SpecularSimulationSpecularWithGaussianBeam ()
 
SpecularSimulationSpecularWithSquareBeam ()
 
GISASSimulationSphericalDetWithRoi ()
 GISAS simulation with spherical detector, region of interest and mask. More...
 
SpecularSimulationTOFRWithPointwiseResolution ()
 
SpecularSimulationTOFRWithRelativeResolution ()
 

Detailed Description

Standard pre-defined simulations.

Function Documentation

◆ BasicDepthProbe()

DepthProbeSimulation * StandardSimulations::BasicDepthProbe ( )

Definition at line 584 of file StandardSimulations.cpp.

585 {
586  auto* result = new DepthProbeSimulation;
587 
588  const double wavelength = 10 * angstrom;
589  const size_t n_alpha = 20;
590  const double alpha_min = 0 * deg;
591  const double alpha_max = 1 * deg;
592  const size_t n_z = n_alpha;
593  const double z_min = -100.0 * Units::nm;
594  const double z_max = 100.0 * Units::nm;
595 
596  result->setBeamParameters(wavelength, n_alpha, alpha_min, alpha_max);
597  result->setZSpan(n_z, z_min, z_max);
598 
599  return result;
600 }
static constexpr double deg
Definition: Units.h:46
static constexpr double nm
Definition: Units.h:39
static constexpr double angstrom
Definition: Units.h:34

References Units::angstrom, Units::deg, and Units::nm.

Referenced by SimulationFactory::SimulationFactory().

◆ BasicGISAS()

GISASSimulation * StandardSimulations::BasicGISAS ( )

Basic GISAS simulation with the detector phi[0,2], theta[0,2].

Definition at line 53 of file StandardSimulations.cpp.

54 {
55  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
56  SphericalDetector det(100, 0 * deg, 2 * deg, 100, 0 * deg, 2 * deg);
57  return new GISASSimulation(beam, det);
58 }
An incident neutron or x-ray beam.
Definition: Beam.h:27
A direction in three-dimensional space.
Definition: Direction.h:24
Main class to run a Grazing-Incidence Small-Angle Scattering simulation.
A detector with coordinate axes along angles phi and alpha.

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory(), BasicGISAS00(), and BasicPolarizedGISAS().

◆ BasicGISAS00()

GISASSimulation * StandardSimulations::BasicGISAS00 ( )

Basic GISAS for polarization studies.

Definition at line 62 of file StandardSimulations.cpp.

63 {
64  GISASSimulation* result = BasicGISAS();
65  kvector_t zplus(0.0, 0.0, 1.0);
66  result->beam().setPolarization(zplus);
67  result->detector().setAnalyzerProperties(zplus, 1.0, 0.5);
68  return result;
69 }
void setPolarization(const kvector_t bloch_vector)
Sets the polarization density matrix according to the given Bloch vector.
Definition: Beam.cpp:112
void setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission)
Sets the polarization analyzer characteristics of the detector.
Definition: IDetector.cpp:99
IDetector & detector()
Definition: ISimulation.h:63
Beam & beam()
Definition: ISimulation.h:58
GISASSimulation * BasicGISAS()
Basic GISAS simulation with the detector phi[0,2], theta[0,2].

References BasicGISAS(), ISimulation::beam(), ISimulation::detector(), IDetector::setAnalyzerProperties(), and Beam::setPolarization().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicPolarizedGISAS()

GISASSimulation * StandardSimulations::BasicPolarizedGISAS ( )

Basic GISAS simulation for spin flip channel.

Definition at line 73 of file StandardSimulations.cpp.

74 {
75  GISASSimulation* result = BasicGISAS();
76  kvector_t zplus(0.0, 0.0, 1.0);
77  result->beam().setPolarization(zplus);
78  result->detector().setAnalyzerProperties(zplus, -1.0, 0.5);
79  return result;
80 }

References BasicGISAS(), ISimulation::beam(), ISimulation::detector(), IDetector::setAnalyzerProperties(), and Beam::setPolarization().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecular()

SpecularSimulation * StandardSimulations::BasicSpecular ( )

Definition at line 366 of file StandardSimulations.cpp.

367 {
368  const double wavelength = 1.54 * angstrom;
369  const int number_of_bins = 2000;
370  const double min_angle = 0 * deg;
371  const double max_angle = 5 * deg;
372  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
373 
374  auto* result = new SpecularSimulation();
375  result->setScan(scan);
376  result->getOptions().setUseAvgMaterials(true);
377  return result;
378 }
Scan type with inclination angles as coordinate values and a unique wavelength.
Axis with fixed bin size.
Definition: FixedBinAxis.h:23
Main class to run a specular simulation.

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory(), BasicSpecularMM(), BasicSpecularMP(), BasicSpecularPM(), and BasicSpecularPP().

◆ BasicSpecularMM()

SpecularSimulation * StandardSimulations::BasicSpecularMM ( )

Definition at line 515 of file StandardSimulations.cpp.

516 {
517  auto* simulation = BasicSpecular();
518  simulation->beam().setPolarization({0.0, -1.0, 0.0});
519  simulation->detector().setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
520  return simulation;
521 }
SpecularSimulation * BasicSpecular()

References BasicSpecular().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecularMP()

SpecularSimulation * StandardSimulations::BasicSpecularMP ( )

Definition at line 507 of file StandardSimulations.cpp.

508 {
509  auto* simulation = BasicSpecular();
510  simulation->beam().setPolarization({0.0, -1.0, 0.0});
511  simulation->detector().setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
512  return simulation;
513 }

References BasicSpecular().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecularPM()

SpecularSimulation * StandardSimulations::BasicSpecularPM ( )

Definition at line 499 of file StandardSimulations.cpp.

500 {
501  auto* simulation = BasicSpecular();
502  simulation->beam().setPolarization({0.0, 1.0, 0.0});
503  simulation->detector().setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
504  return simulation;
505 }

References BasicSpecular().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecularPP()

SpecularSimulation * StandardSimulations::BasicSpecularPP ( )

Definition at line 491 of file StandardSimulations.cpp.

492 {
493  auto* simulation = BasicSpecular();
494  simulation->beam().setPolarization({0.0, 1.0, 0.0});
495  simulation->detector().setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
496  return simulation;
497 }

References BasicSpecular().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecularQ()

SpecularSimulation * StandardSimulations::BasicSpecularQ ( )

Definition at line 380 of file StandardSimulations.cpp.

381 {
382  std::vector<double> qs;
383  {
384  const double wavelength_0 = 1.54 * angstrom;
385  const int number_of_bins = 2000;
386  const double min_angle = 0 * deg;
387  const double max_angle = 5 * deg;
388  FixedBinAxis angle_axis("axis", number_of_bins, min_angle, max_angle);
389  auto angles = angle_axis.binCenters();
390 
391  qs.resize(angle_axis.size(), 0.0);
392  for (size_t i = 0, size = qs.size(); i < size; ++i)
393  qs[i] = 4.0 * M_PI * std::sin(angles[i]) / wavelength_0;
394  }
395  QSpecScan q_scan(qs);
396 
397  auto* result = new SpecularSimulation;
398  result->setScan(q_scan);
399  result->getOptions().setUseAvgMaterials(true);
400  return result;
401 }
#define M_PI
Definition: Constants.h:44
Scan type with z-components of scattering vector as coordinate values.
Definition: QSpecScan.h:28
void setScan(const ISpecularScan &scan)
Sets chosen specular scan to the simulation.

References Units::angstrom, FixedBinAxis::binCenters(), Units::deg, M_PI, SpecularSimulation::setScan(), and FixedBinAxis::size().

Referenced by SimulationFactory::SimulationFactory(), BasicSpecularQMM(), BasicSpecularQMP(), BasicSpecularQPM(), and BasicSpecularQPP().

Here is the call graph for this function:

◆ BasicSpecularQMM()

SpecularSimulation * StandardSimulations::BasicSpecularQMM ( )

Definition at line 531 of file StandardSimulations.cpp.

532 {
533  auto* simulation = BasicSpecularQ();
534  simulation->beam().setPolarization({0.0, -1.0, 0.0});
535  simulation->detector().setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
536  return simulation;
537 }
SpecularSimulation * BasicSpecularQ()

References BasicSpecularQ().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecularQMP()

SpecularSimulation * StandardSimulations::BasicSpecularQMP ( )

Definition at line 547 of file StandardSimulations.cpp.

548 {
549  auto* simulation = BasicSpecularQ();
550  simulation->beam().setPolarization({0.0, -1.0, 0.0});
551  simulation->detector().setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
552  return simulation;
553 }

References BasicSpecularQ().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecularQPM()

SpecularSimulation * StandardSimulations::BasicSpecularQPM ( )

Definition at line 539 of file StandardSimulations.cpp.

540 {
541  auto* simulation = BasicSpecularQ();
542  simulation->beam().setPolarization({0.0, 1.0, 0.0});
543  simulation->detector().setAnalyzerProperties({0.0, -1.0, 0.0}, 1.0, 0.5);
544  return simulation;
545 }

References BasicSpecularQ().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ BasicSpecularQPP()

SpecularSimulation * StandardSimulations::BasicSpecularQPP ( )

Definition at line 523 of file StandardSimulations.cpp.

524 {
525  auto* simulation = BasicSpecularQ();
526  simulation->beam().setPolarization({0.0, 1.0, 0.0});
527  simulation->detector().setAnalyzerProperties({0.0, 1.0, 0.0}, 1.0, 0.5);
528  return simulation;
529 }

References BasicSpecularQ().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ ConstantBackgroundGISAS()

GISASSimulation * StandardSimulations::ConstantBackgroundGISAS ( )

Definition at line 347 of file StandardSimulations.cpp.

348 {
349  GISASSimulation* result = MiniGISAS();
350  ConstantBackground bg(1e3);
351  result->setBackground(bg);
352  return result;
353 }
Class representing a constant background signal.
void setBackground(const IBackground &bg)
GISASSimulation * MiniGISAS()
GISAS simulation with small detector and phi[-2,2], theta[0,2].

References MiniGISAS(), and ISimulation::setBackground().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ ExtraLongWavelengthGISAS()

GISASSimulation * StandardSimulations::ExtraLongWavelengthGISAS ( )

GISAS simulation with an extra long wavelength.

Definition at line 357 of file StandardSimulations.cpp.

358 {
359  Beam beam(1e8, 13.52 * Units::nm, Direction(0.2 * deg, 0 * deg));
360  SphericalDetector det(100, -1 * deg, 1 * deg, 100, 0.0, 2 * deg);
361  auto* simulation = new GISASSimulation(beam, det);
362  simulation->getOptions().setIncludeSpecular(true);
363  return simulation;
364 }

References Units::deg, and Units::nm.

Referenced by SimulationFactory::SimulationFactory().

◆ GISASWithMasks()

GISASSimulation * StandardSimulations::GISASWithMasks ( )

GISAS simulation with multiple masks on the detector plane.

Definition at line 125 of file StandardSimulations.cpp.

126 {
127  Beam beam(1e7, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
128  SphericalDetector det(50, -1 * deg, 1 * deg, 50, 0 * deg, 2 * deg);
129  GISASSimulation* result = new GISASSimulation(beam, det);
130 
131  result->maskAll();
132  // pacman
133  const double deg = Units::deg;
134  result->addMask(Ellipse(0.0 * deg, 1.0 * deg, 0.5 * deg, 0.5 * deg), false);
135  result->addMask(Ellipse(0.11 * deg, 1.25 * deg, 0.05 * deg, 0.05 * deg), true);
136 
137  std::vector<std::vector<double>> points = {{0.0 * deg, 1.0 * deg},
138  {0.5 * deg, 1.2 * deg},
139  {0.5 * deg, 0.8 * deg},
140  {0.0 * deg, 1.0 * deg}};
141  result->addMask(Polygon(points), true);
142 
143  result->addMask(Rectangle(0.45 * deg, 0.95 * deg, 0.55 * deg, 1.05 * deg), false);
144  result->addMask(Rectangle(0.61 * deg, 0.95 * deg, 0.71 * deg, 1.05 * deg), false);
145  result->addMask(Rectangle(0.75 * deg, 0.95 * deg, 0.85 * deg, 1.05 * deg), false);
146 
147  // more masks
148  result->addMask(Ellipse(-0.5 * deg, 1.5 * deg, 0.3 * deg, 0.1 * deg, 45. * deg), false);
149  result->addMask(VerticalLine(-0.6 * deg), true);
150  result->addMask(HorizontalLine(0.3 * deg), false);
151 
152  return result;
153 }
An ellipse, for use in detector masks.
Definition: Ellipse.h:23
An infinite horizontal line.
Definition: Line.h:55
void maskAll()
Put the mask for all detector channels (i.e. exclude whole detector from the analysis)
void addMask(const IShape2D &shape, bool mask_value=true)
Adds mask of given shape to the stack of detector masks.
A polygon, for use in detector masks.
Definition: Polygon.h:30
A rectangle, for use in detector masks.
Definition: Rectangle.h:25
An infinite vertical line.
Definition: Line.h:38

References ISimulation2D::addMask(), Units::angstrom, Units::deg, and ISimulation2D::maskAll().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ IsGISAXSSimulation1()

GISASSimulation * StandardSimulations::IsGISAXSSimulation1 ( )

Typical IsGISAXS simulation with the detector phi[-1,1], theta[0,2].

Definition at line 247 of file StandardSimulations.cpp.

248 {
249  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
250  IsGISAXSDetector det(100, -1 * deg, 1 * deg, 100, 0 * deg, 2 * deg);
251  return new GISASSimulation(beam, det);
252 }
A spherical detector used for validation with IsGISAXS results.

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory().

◆ IsGISAXSSimulation2()

GISASSimulation * StandardSimulations::IsGISAXSSimulation2 ( )

Typical IsGISAXS simulation with the detector phi[0,2], theta[0,2].

Definition at line 256 of file StandardSimulations.cpp.

257 {
258  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
259  SphericalDetector det(100, 0 * deg, 2 * deg, 100, 0 * deg, 2 * deg);
260  return new GISASSimulation(beam, det);
261 }

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory().

◆ MaxiGISAS()

GISASSimulation * StandardSimulations::MaxiGISAS ( )

GISAS simulation with large detector to test performance.

Definition at line 227 of file StandardSimulations.cpp.

228 {
229  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
230  SphericalDetector det(256, -2 * deg, 2 * deg, 256, 0 * deg, 2 * deg);
231  return new GISASSimulation(beam, det);
232 }

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory(), and MaxiGISAS00().

◆ MaxiGISAS00()

GISASSimulation * StandardSimulations::MaxiGISAS00 ( )

Basic GISAS for polarization studies.

Definition at line 236 of file StandardSimulations.cpp.

237 {
238  GISASSimulation* result = MaxiGISAS();
239  kvector_t zplus(0.0, 0.0, 1.0);
240  result->beam().setPolarization(zplus);
241  result->detector().setAnalyzerProperties(zplus, 1.0, 0.5);
242  return result;
243 }
GISASSimulation * MaxiGISAS()
GISAS simulation with large detector to test performance.

References ISimulation::beam(), ISimulation::detector(), MaxiGISAS(), IDetector::setAnalyzerProperties(), and Beam::setPolarization().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISAS()

GISASSimulation * StandardSimulations::MiniGISAS ( )

GISAS simulation with small detector and phi[-2,2], theta[0,2].

Definition at line 84 of file StandardSimulations.cpp.

85 {
86  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
87  SphericalDetector det(25, -2 * deg, 2 * deg, 25, 0 * deg, 2 * deg);
88  return new GISASSimulation(beam, det);
89 }

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory(), ConstantBackgroundGISAS(), MiniGISASBeamDivergence(), MiniGISASDetectorResolution(), MiniGISASMonteCarlo(), MiniGISASPolarizationMM(), MiniGISASPolarizationMP(), MiniGISASPolarizationPM(), and MiniGISASPolarizationPP().

◆ MiniGISAS_v2()

GISASSimulation * StandardSimulations::MiniGISAS_v2 ( )

GISAS simulation with small detector and phi[-1,1], theta[0,1].

Definition at line 93 of file StandardSimulations.cpp.

94 {
95  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
96  SphericalDetector det(25, -1 * deg, 1 * deg, 25, 0 * deg, 1 * deg);
97  return new GISASSimulation(beam, det);
98 }

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory().

◆ MiniGISASBeamDivergence()

GISASSimulation * StandardSimulations::MiniGISASBeamDivergence ( )

GISAS simulation with beam divergence applied.

Definition at line 102 of file StandardSimulations.cpp.

103 {
104  GISASSimulation* result = MiniGISAS();
105 
106  DistributionLogNormal wavelength_distr(1 * angstrom, 0.1);
107  DistributionGaussian alpha_distr(0.2 * deg, 0.02 * deg);
108  DistributionGate phi_distr(-0.1 * deg, 0.02 * deg);
109 
110  ParameterPattern pattern1;
111  pattern1.beginsWith("*").add("Beam").add("Wavelength");
112  result->addParameterDistribution(pattern1.toStdString(), wavelength_distr, 5);
113  ParameterPattern pattern2;
114  pattern2.beginsWith("*").add("Beam").add("InclinationAngle");
115  result->addParameterDistribution(pattern2.toStdString(), alpha_distr, 4);
116  ParameterPattern pattern3;
117  pattern3.beginsWith("*").add("Beam").add("AzimuthalAngle");
118  result->addParameterDistribution(pattern3.toStdString(), phi_distr, 3);
119 
120  return result;
121 }
Uniform distribution function with half width hwhm.
Definition: Distributions.h:88
Gaussian distribution with standard deviation std_dev.
Log-normal distribution.
void addParameterDistribution(const std::string &param_name, const IDistribution1D &distribution, size_t nbr_samples, double sigma_factor=0.0, const RealLimits &limits=RealLimits())
Helper class for constructing parameter patterns.
ParameterPattern & beginsWith(std::string start_type)
std::string toStdString() const
ParameterPattern & add(std::string object_type)

References ParameterPattern::add(), ISimulation::addParameterDistribution(), Units::angstrom, ParameterPattern::beginsWith(), Units::deg, MiniGISAS(), and ParameterPattern::toStdString().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASDetectorResolution()

GISASSimulation * StandardSimulations::MiniGISASDetectorResolution ( )

GISAS simulation with detector resolution.

Definition at line 157 of file StandardSimulations.cpp.

158 {
159  GISASSimulation* result = MiniGISAS();
160  ResolutionFunction2DGaussian resfunc(0.0025, 0.0025);
161  result->setDetectorResolutionFunction(resfunc);
162  return result;
163 }
void setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function)
Simple gaussian two-dimensional resolution function.

References MiniGISAS(), and ISimulation::setDetectorResolutionFunction().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASFit()

GISASSimulation * StandardSimulations::MiniGISASFit ( )

ISimulation with fitting.

Beam intensity set to provide reasonably large values in detector channels.

Definition at line 604 of file StandardSimulations.cpp.

605 {
606  auto* result = new GISASSimulation;
607  result->setDetectorParameters(25, -2 * deg, 2 * deg, 25, 0 * deg, 2 * deg);
608  result->setBeamParameters(1 * angstrom, 0.2 * deg, 0 * deg);
609  result->beam().setIntensity(1e6);
610  return result;
611 }
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.

References Units::angstrom, Units::deg, and ISimulation2D::setDetectorParameters().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASMonteCarlo()

GISASSimulation * StandardSimulations::MiniGISASMonteCarlo ( )

GISAS simulation with Monte-Carlo integration switched ON.

Definition at line 318 of file StandardSimulations.cpp.

319 {
320  GISASSimulation* result = MiniGISAS();
321  result->getOptions().setMonteCarloIntegration(true, 100);
322  return result;
323 }
const SimulationOptions & getOptions() const
Definition: ISimulation.h:91
void setMonteCarloIntegration(bool flag=true, size_t mc_points=50)
Enables/disables MonetCarlo integration.

References ISimulation::getOptions(), MiniGISAS(), and SimulationOptions::setMonteCarloIntegration().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASPolarizationMM()

GISASSimulation * StandardSimulations::MiniGISASPolarizationMM ( )

Definition at line 201 of file StandardSimulations.cpp.

202 {
203  GISASSimulation* result = MiniGISAS();
204 
205  kvector_t analyzer_dir(0.0, 0.0, -1.0);
206  kvector_t beampol(0.0, 0.0, -1.0);
207 
208  result->beam().setPolarization(beampol);
209  result->detector().setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
210  return result;
211 }

References ISimulation::beam(), ISimulation::detector(), MiniGISAS(), IDetector::setAnalyzerProperties(), and Beam::setPolarization().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASPolarizationMP()

GISASSimulation * StandardSimulations::MiniGISASPolarizationMP ( )

Definition at line 189 of file StandardSimulations.cpp.

190 {
191  GISASSimulation* result = MiniGISAS();
192 
193  kvector_t analyzer_dir(0.0, 0.0, 1.0);
194  kvector_t beampol(0.0, 0.0, -1.0);
195 
196  result->beam().setPolarization(beampol);
197  result->detector().setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
198  return result;
199 }

References ISimulation::beam(), ISimulation::detector(), MiniGISAS(), IDetector::setAnalyzerProperties(), and Beam::setPolarization().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASPolarizationPM()

GISASSimulation * StandardSimulations::MiniGISASPolarizationPM ( )

Definition at line 177 of file StandardSimulations.cpp.

178 {
179  GISASSimulation* result = MiniGISAS();
180 
181  kvector_t analyzer_dir(0.0, 0.0, -1.0);
182  kvector_t beampol(0.0, 0.0, 1.0);
183 
184  result->beam().setPolarization(beampol);
185  result->detector().setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
186  return result;
187 }

References ISimulation::beam(), ISimulation::detector(), MiniGISAS(), IDetector::setAnalyzerProperties(), and Beam::setPolarization().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASPolarizationPP()

GISASSimulation * StandardSimulations::MiniGISASPolarizationPP ( )

Definition at line 165 of file StandardSimulations.cpp.

166 {
167  GISASSimulation* result = MiniGISAS();
168 
169  kvector_t analyzer_dir(0.0, 0.0, 1.0);
170  kvector_t beampol(0.0, 0.0, 1.0);
171 
172  result->beam().setPolarization(beampol);
173  result->detector().setAnalyzerProperties(analyzer_dir, 1.0, 0.5);
174  return result;
175 }

References ISimulation::beam(), ISimulation::detector(), MiniGISAS(), IDetector::setAnalyzerProperties(), and Beam::setPolarization().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniGISASSpecularPeak()

GISASSimulation * StandardSimulations::MiniGISASSpecularPeak ( )

GISAS simulation with small detector and including specular peak.

Definition at line 215 of file StandardSimulations.cpp.

216 {
217  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
218  SphericalDetector det(25, -2 * deg, 2 * deg, 25, 0 * deg, 2 * deg);
219  GISASSimulation* result = new GISASSimulation(beam, det);
220  result->setBeamParameters(1 * angstrom, 0.2 * deg, 0 * deg);
221  result->getOptions().setIncludeSpecular(true);
222  return result;
223 }
void setBeamParameters(double wavelength, double alpha_i, double phi_i)
Sets beam parameters from here (forwarded to Instrument)
void setIncludeSpecular(bool include_specular)

References Units::angstrom, Units::deg, ISimulation::getOptions(), GISASSimulation::setBeamParameters(), and SimulationOptions::setIncludeSpecular().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ MiniOffSpecular()

OffSpecularSimulation * StandardSimulations::MiniOffSpecular ( )

Definition at line 558 of file StandardSimulations.cpp.

559 {
560  auto* result = new OffSpecularSimulation;
561 
562  const int n_alpha(19);
563  const double alpha_min(0 * deg);
564  const double alpha_max(4 * deg);
565  const int n_phi(9);
566  const double phi_min(-0.1 * deg);
567  const double phi_max(0.1 * deg);
568 
569  result->setDetectorParameters(n_phi, phi_min, phi_max, n_alpha, alpha_min, alpha_max);
570 
571  const int n_scan_points(n_alpha);
572  const double alpha_i_min(alpha_min);
573  const double alpha_i_max(alpha_max);
574 
575  FixedBinAxis alpha_i_axis("alpha_i", n_scan_points, alpha_i_min, alpha_i_max);
576  result->setBeamParameters(5 * angstrom, alpha_i_axis, 0.0);
577 
578  result->beam().setIntensity(1e9);
579  result->getOptions().setIncludeSpecular(true);
580 
581  return result;
582 }
Main class to run an off-specular simulation.

References Units::angstrom, and Units::deg.

Referenced by SimulationFactory::SimulationFactory().

◆ RectDetectorGeneric()

GISASSimulation * StandardSimulations::RectDetectorGeneric ( )

GISAS simulation with generic rectangular detector.

Definition at line 265 of file StandardSimulations.cpp.

266 {
267  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
268  RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height);
269  det.setPosition(kvector_t(rdet_distance, 10.0, 5.0), rdet_width / 2., 1.0,
270  kvector_t(0.1, -1.0, 0.2));
271  return new GISASSimulation(beam, det);
272 }
BasicVector3D< double > kvector_t
Definition: Vectors3D.h:21
A flat rectangular detector with axes and resolution function.

References Units::angstrom, Units::deg, and RectangularDetector::setPosition().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ RectDetectorPerpToDirectBeam()

GISASSimulation * StandardSimulations::RectDetectorPerpToDirectBeam ( )

GISAS simulation with the rectangular detector perpendicular to the direct beam.

Definition at line 286 of file StandardSimulations.cpp.

287 {
288  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
289  RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height);
290  det.setPerpendicularToDirectBeam(rdet_distance, rdet_width / 2., 1.0);
291  return new GISASSimulation(beam, det);
292 }

References Units::angstrom, Units::deg, and RectangularDetector::setPerpendicularToDirectBeam().

Referenced by SimulationFactory::SimulationFactory(), and RectDetWithRoi().

Here is the call graph for this function:

◆ RectDetectorPerpToReflectedBeam()

GISASSimulation * StandardSimulations::RectDetectorPerpToReflectedBeam ( )

GISAS simulation with the rectangular detector perpendicular to the reflected beam.

Definition at line 296 of file StandardSimulations.cpp.

297 {
298  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
299  RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height);
300  det.setPerpendicularToReflectedBeam(rdet_distance, rdet_width / 2., 1.0);
301  return new GISASSimulation(beam, det);
302 }

References Units::angstrom, Units::deg, and RectangularDetector::setPerpendicularToReflectedBeam().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ RectDetectorPerpToReflectedBeamDpos()

GISASSimulation * StandardSimulations::RectDetectorPerpToReflectedBeamDpos ( )

GISAS simulation with the rectangular detector perpendicular to the reflected beam when the coordinates of direct beam are known.

Definition at line 307 of file StandardSimulations.cpp.

308 {
309  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
310  RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height);
311  det.setPerpendicularToReflectedBeam(rdet_distance);
312  det.setDirectBeamPosition(rdet_width / 2., 1.0);
313  return new GISASSimulation(beam, det);
314 }

References Units::angstrom, Units::deg, RectangularDetector::setDirectBeamPosition(), and RectangularDetector::setPerpendicularToReflectedBeam().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ RectDetectorPerpToSample()

GISASSimulation * StandardSimulations::RectDetectorPerpToSample ( )

GISAS simulation with the rectangular detector perpendicular to the sample.

Definition at line 276 of file StandardSimulations.cpp.

277 {
278  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
279  RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height);
280  det.setPerpendicularToSampleX(rdet_distance, rdet_width / 2., 1.0);
281  return new GISASSimulation(beam, det);
282 }

References Units::angstrom, Units::deg, and RectangularDetector::setPerpendicularToSampleX().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ RectDetWithRoi()

GISASSimulation * StandardSimulations::RectDetWithRoi ( )

GISAS simulation with rectangular detector, region of interest and mask.

Definition at line 339 of file StandardSimulations.cpp.

340 {
342  result->addMask(Rectangle(3.0, 4.0, 5.0, 7.0));
343  result->setRegionOfInterest(2.0, 3.0, 18.0, 15.0);
344  return result;
345 }
void setRegionOfInterest(double xlow, double ylow, double xup, double yup)
Sets rectangular region of interest with lower left and upper right corners defined.
GISASSimulation * RectDetectorPerpToDirectBeam()
GISAS simulation with the rectangular detector perpendicular to the direct beam.

References ISimulation2D::addMask(), RectDetectorPerpToDirectBeam(), and ISimulation2D::setRegionOfInterest().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ SpecularDivergentBeam()

SpecularSimulation * StandardSimulations::SpecularDivergentBeam ( )

Definition at line 433 of file StandardSimulations.cpp.

434 {
435  const double wavelength = 1.54 * angstrom;
436  const int number_of_bins = 20;
437  const size_t n_integration_points = 10;
438  const double min_angle = 0 * deg;
439  const double max_angle = 5 * deg;
440  const double wl_stddev = 0.1 * angstrom;
441  const double ang_stddev = 0.1 * deg;
442  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
443 
444  RangedDistributionGaussian wl_distr(n_integration_points, /*sigma_factor = */ 2.0);
445  std::unique_ptr<ScanResolution> wl_res(
446  ScanResolution::scanAbsoluteResolution(wl_distr, wl_stddev));
447 
448  RangedDistributionGaussian alpha_distr(n_integration_points, /*sigma_factor = */ 2.0);
449  std::unique_ptr<ScanResolution> ang_res(
450  ScanResolution::scanAbsoluteResolution(alpha_distr, ang_stddev));
451 
452  scan.setWavelengthResolution(*wl_res);
453  scan.setAngleResolution(*ang_res);
454 
455  auto* result = new SpecularSimulation;
456  result->setScan(scan);
457  return result;
458 }
Gaussian distribution with standard deviation std_dev.
static ScanResolution * scanAbsoluteResolution(const IRangedDistribution &distr, double stddev)

References Units::angstrom, Units::deg, ScanResolution::scanAbsoluteResolution(), AngularSpecScan::setAngleResolution(), SpecularSimulation::setScan(), and AngularSpecScan::setWavelengthResolution().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ SpecularWithGaussianBeam()

SpecularSimulation * StandardSimulations::SpecularWithGaussianBeam ( )

Definition at line 403 of file StandardSimulations.cpp.

404 {
405  const double wavelength = 1.54 * angstrom;
406  const int number_of_bins = 2000;
407  const double min_angle = 0 * deg;
408  const double max_angle = 5 * deg;
409  auto gaussian_ff = std::make_unique<FootprintGauss>(1.0);
410  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
411  scan.setFootprintFactor(gaussian_ff.get());
412 
413  auto* result = new SpecularSimulation;
414  result->setScan(scan);
415  return result;
416 }

References Units::angstrom, Units::deg, AngularSpecScan::setFootprintFactor(), and SpecularSimulation::setScan().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ SpecularWithSquareBeam()

SpecularSimulation * StandardSimulations::SpecularWithSquareBeam ( )

Definition at line 418 of file StandardSimulations.cpp.

419 {
420  const double wavelength = 1.54 * angstrom;
421  const int number_of_bins = 2000;
422  const double min_angle = 0 * deg;
423  const double max_angle = 5 * deg;
424  auto square_ff = std::make_unique<FootprintSquare>(1.0);
425  AngularSpecScan scan(wavelength, FixedBinAxis("axis", number_of_bins, min_angle, max_angle));
426  scan.setFootprintFactor(square_ff.get());
427 
428  auto* result = new SpecularSimulation;
429  result->setScan(scan);
430  return result;
431 }

References Units::angstrom, Units::deg, AngularSpecScan::setFootprintFactor(), and SpecularSimulation::setScan().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ SphericalDetWithRoi()

GISASSimulation * StandardSimulations::SphericalDetWithRoi ( )

GISAS simulation with spherical detector, region of interest and mask.

Definition at line 327 of file StandardSimulations.cpp.

328 {
329  Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0 * deg));
330  SphericalDetector det(40, -2 * deg, 2 * deg, 30, 0 * deg, 3 * deg);
331  GISASSimulation* result = new GISASSimulation(beam, det);
332  result->addMask(Rectangle(-0.5 * deg, 0.3 * deg, -0.2 * deg, 0.6 * deg));
333  result->setRegionOfInterest(-1.5 * deg, 0.25 * deg, 1.5 * deg, 1.75 * deg);
334  return result;
335 }

References ISimulation2D::addMask(), Units::angstrom, Units::deg, and ISimulation2D::setRegionOfInterest().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ TOFRWithPointwiseResolution()

SpecularSimulation * StandardSimulations::TOFRWithPointwiseResolution ( )

Definition at line 472 of file StandardSimulations.cpp.

473 {
474  FixedBinAxis qs("axis", 500, 0.0, 1.0);
475  QSpecScan q_scan(qs);
476 
477  std::vector<double> resolutions;
478  resolutions.reserve(qs.size());
479  auto qs_vector = qs.binCenters();
480  std::for_each(qs_vector.begin(), qs_vector.end(),
481  [&resolutions](double q_val) { resolutions.push_back(0.03 * q_val); });
482  q_scan.setAbsoluteQResolution(RangedDistributionGaussian(20, 2.0), resolutions);
483 
484  auto* result = new SpecularSimulation;
485  result->setScan(q_scan);
486  result->getOptions().setUseAvgMaterials(true);
487  return result;
488 }

References FixedBinAxis::binCenters(), QSpecScan::setAbsoluteQResolution(), SpecularSimulation::setScan(), and FixedBinAxis::size().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function:

◆ TOFRWithRelativeResolution()

SpecularSimulation * StandardSimulations::TOFRWithRelativeResolution ( )

Definition at line 460 of file StandardSimulations.cpp.

461 {
462  FixedBinAxis qs("axis", 500, 0.0, 1.0);
463  QSpecScan q_scan(qs);
464  q_scan.setRelativeQResolution(RangedDistributionGaussian(20, 2.0), 0.03);
465 
466  auto* result = new SpecularSimulation;
467  result->setScan(q_scan);
468  result->getOptions().setUseAvgMaterials(true);
469  return result;
470 }

References QSpecScan::setRelativeQResolution(), and SpecularSimulation::setScan().

Referenced by SimulationFactory::SimulationFactory().

Here is the call graph for this function: