BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ItemizeSimulation.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/FromCore/ItemizeSimulation.cpp
6 //! @brief Implements functions that convert ISimulation from core to GUI items
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"
17 #include "Base/Util/Assert.h"
18 #include "Device/Beam/Beam.h"
19 #include "Device/Beam/FootprintGauss.h"
20 #include "Device/Beam/FootprintSquare.h"
21 #include "Device/Detector/RectangularDetector.h"
22 #include "Device/Detector/SphericalDetector.h"
23 #include "Device/Mask/DetectorMask.h"
24 #include "Device/Mask/Ellipse.h"
25 #include "Device/Mask/InfinitePlane.h"
26 #include "Device/Mask/Line.h"
27 #include "Device/Mask/Polygon.h"
28 #include "Device/Mask/Rectangle.h"
29 #include "Device/Resolution/ConvolutionDetectorResolution.h"
30 #include "Device/Resolution/ResolutionFunction2DGaussian.h"
47 #include "GUI/Util/Error.h"
48 #include "Param/Distrib/Distributions.h"
49 #include "Param/Distrib/RangedDistributions.h"
50 #include "Param/Node/NodeUtils.h"
51 #include "Resample/Options/SimulationOptions.h"
52 #include "Sim/Background/ConstantBackground.h"
53 #include "Sim/Background/PoissonBackground.h"
54 #include "Sim/Scan/AlphaScan.h"
55 #include "Sim/Scan/ScanResolution.h"
56 #include "Sim/Simulation/includeSimulations.h"
57 
58 namespace {
59 
60 void setMaskContainer(MaskItems* destMaskItems, const IDetector& detector, double scale)
61 {
62  const auto* detectorMask = detector.detectorMask();
63  for (size_t i_mask = 0; i_mask < detectorMask->numberOfMasks(); ++i_mask) {
64  const MaskPattern* pat = detectorMask->patternAt(i_mask);
65  IShape2D* shape = pat->shape;
66  bool mask_value = pat->doMask;
67 
68  if (const auto* ellipse = dynamic_cast<const Ellipse*>(shape)) {
69  auto* ellipseItem = new EllipseItem();
70  ellipseItem->setXCenter(scale * ellipse->getCenterX());
71  ellipseItem->setYCenter(scale * ellipse->getCenterY());
72  ellipseItem->setXRadius(scale * ellipse->radiusX());
73  ellipseItem->setYRadius(scale * ellipse->radiusY());
74  ellipseItem->setAngle(scale * ellipse->getTheta());
75  ellipseItem->setMaskValue(mask_value);
76  destMaskItems->insertMask(0, ellipseItem);
77  }
78 
79  else if (const auto* rectangle = dynamic_cast<const Rectangle*>(shape)) {
80  auto* rectangleItem = new RectangleItem();
81  rectangleItem->setXLow(scale * rectangle->getXlow());
82  rectangleItem->setYLow(scale * rectangle->getYlow());
83  rectangleItem->setXUp(scale * rectangle->getXup());
84  rectangleItem->setYUp(scale * rectangle->getYup());
85  rectangleItem->setMaskValue(mask_value);
86  destMaskItems->insertMask(0, rectangleItem);
87  }
88 
89  else if (const auto* polygon = dynamic_cast<const Polygon*>(shape)) {
90  auto* polygonItem = new PolygonItem();
91  std::vector<double> xpos, ypos;
92  polygon->getPoints(xpos, ypos);
93  for (size_t i_point = 0; i_point < xpos.size(); ++i_point)
94  polygonItem->addPoint(scale * xpos[i_point], scale * ypos[i_point]);
95 
96  polygonItem->setMaskValue(mask_value);
97  polygonItem->setIsClosed(true);
98 
99  destMaskItems->insertMask(0, polygonItem);
100  }
101 
102  else if (const auto* vline = dynamic_cast<const VerticalLine*>(shape)) {
103  auto* lineItem = new VerticalLineItem();
104  lineItem->setPosX(scale * vline->getXpos());
105  lineItem->setMaskValue(mask_value);
106  destMaskItems->insertMask(0, lineItem);
107  }
108 
109  else if (const auto* hline = dynamic_cast<const HorizontalLine*>(shape)) {
110  auto* lineItem = new HorizontalLineItem();
111  lineItem->setPosY(scale * hline->getYpos());
112  lineItem->setMaskValue(mask_value);
113  destMaskItems->insertMask(0, lineItem);
114  }
115 
116  else if (const auto* plane = dynamic_cast<const InfinitePlane*>(shape)) {
117  Q_UNUSED(plane);
118  auto* planeItem = new MaskAllItem();
119  planeItem->setMaskValue(mask_value);
120  destMaskItems->insertMask(-1, planeItem);
121  }
122 
123  else
124  throw Error("Cannot convert detector mask from core to GUI: Unknown shape");
125  }
126 
127  if (detector.hasExplicitRegionOfInterest()) {
128  const auto xBounds = detector.regionOfInterestBounds(0);
129  const auto yBounds = detector.regionOfInterestBounds(1);
130 
131  auto* roiItem = new RegionOfInterestItem();
132  roiItem->setXLow(scale * xBounds.first);
133  roiItem->setYLow(scale * yBounds.first);
134  roiItem->setXUp(scale * xBounds.second);
135  roiItem->setYUp(scale * yBounds.second);
136  destMaskItems->insertMask(-1, roiItem);
137  }
138 }
139 
140 void setDetectorMasks(DetectorItem* detector_item, const ISimulation2D& simulation)
141 {
142  const IDetector& detector = simulation.detector();
143  if ((detector.detectorMask() && detector.detectorMask()->hasMasks())
144  || detector.hasExplicitRegionOfInterest()) {
145  const double scale = 1.0 / detector_item->axesToCoreUnitsFactor();
146  setMaskContainer(&detector_item->maskItems(), detector, scale);
147  }
148 }
149 
150 void setFootprintFactor(const IFootprintFactor* footprint, SpecularBeamItem* beam_item)
151 {
152  if (!footprint)
153  return;
154  if (const auto* const gaussian_fp = dynamic_cast<const FootprintGauss*>(footprint))
155  beam_item->setGaussianFootprint(gaussian_fp->widthRatio());
156  else if (const auto* const square_fp = dynamic_cast<const FootprintSquare*>(footprint))
157  beam_item->setSquareFootprint(square_fp->widthRatio());
158 }
159 
160 void setDistribution(BeamDistributionItem* part_distr_item, ParameterDistribution par_distr,
161  double factor)
162 {
163  const IDistribution1D* p_distribution = par_distr.getDistribution();
164 
165  DistributionItem* distItem = nullptr;
166  if (const auto* distr = dynamic_cast<const DistributionGate*>(p_distribution)) {
167  auto* distr_gate_item = part_distr_item->setDistributionType<DistributionGateItem>();
168  distr_gate_item->setRange(factor * distr->min(), factor * distr->max());
169  distItem = distr_gate_item;
170  } else if (const auto* distr = dynamic_cast<const DistributionLorentz*>(p_distribution)) {
171  auto* distr_lorentz_item = part_distr_item->setDistributionType<DistributionLorentzItem>();
172  distr_lorentz_item->setMean(factor * distr->mean());
173  distr_lorentz_item->setHwhm(factor * distr->hwhm());
174  distItem = distr_lorentz_item;
175  } else if (const auto* distr = dynamic_cast<const DistributionGaussian*>(p_distribution)) {
176  auto* distr_gauss_item = part_distr_item->setDistributionType<DistributionGaussianItem>();
177  distr_gauss_item->setMean(factor * distr->mean());
178  distr_gauss_item->setStandardDeviation(factor * distr->getStdDev());
179  distItem = distr_gauss_item;
180  } else if (const auto* distr = dynamic_cast<const DistributionLogNormal*>(p_distribution)) {
181  auto* distr_lognorm_item =
183  distr_lognorm_item->setMedian(factor * distr->getMedian());
184  distr_lognorm_item->setScaleParameter(distr->getScalePar());
185  distItem = distr_lognorm_item;
186  } else if (const auto* distr = dynamic_cast<const DistributionCosine*>(p_distribution)) {
187  auto* distr_cos_item = part_distr_item->setDistributionType<DistributionCosineItem>();
188  distr_cos_item->setMean(factor * distr->mean());
189  distr_cos_item->setSigma(factor * distr->sigma());
190  distItem = distr_cos_item;
191  } else if (const auto* distr = dynamic_cast<const DistributionTrapezoid*>(p_distribution)) {
192  auto* distr_trapez_item = part_distr_item->setDistributionType<DistributionTrapezoidItem>();
193  distr_trapez_item->setCenter(factor * distr->mean());
194  distr_trapez_item->setLeftWidth(factor * distr->getLeftWidth());
195  distr_trapez_item->setMiddleWidth(factor * distr->getMiddleWidth());
196  distr_trapez_item->setRightWidth(factor * distr->getRightWidth());
197  distItem = distr_trapez_item;
198  } else
199  throw Error("setDistribution: -> unknown distribution");
200 
201  distItem->setNumberOfSamples((int)par_distr.nDraws());
202 
203  if (distItem->hasSigmaFactor())
204  distItem->setSigmaFactor(par_distr.sigmaFactor());
205 
206  // TODO It's wrong if domain distribution made for angles.
207  distItem->setLimits(par_distr.getLimits().scaledLimits(factor));
208 }
209 
210 void setItemFromSample(BeamDistributionItem* beam_distribution_item,
211  const ParameterDistribution& parameter_distribution)
212 {
213  ASSERT(beam_distribution_item);
214 
215  if (parameter_distribution.getMinValue() < parameter_distribution.getMaxValue()) {
216  throw Error(
217  "setItemFromSample(BeamDistributionItem* "
218  "beamDistributionItem,"
219  "const ParameterDistribution& parameterDistribution) -> Error. ParameterDistribution "
220  "with defined min,max are not yet implemented in GUI");
221  }
222 
223  const double unit_factor = 1.0 / beam_distribution_item->scaleFactor();
224  setDistribution(beam_distribution_item, parameter_distribution, unit_factor);
225 }
226 
227 void addDistributionToBeamItem(ParameterDistribution::WhichParameter which,
228  BeamDistributionItem* item,
229  const ParameterDistribution& distribution)
230 {
231  if (distribution.whichParameter() != which)
232  return;
233 
234  setItemFromSample(item, distribution);
235 }
236 
237 void addRangedDistributionToItem(BeamDistributionItem* distributionItem,
238  const IRangedDistribution& ranged, double mean, double std_dev)
239 {
240  if (!distributionItem)
241  return;
242  ParameterDistribution par_distr(ParameterDistribution::None,
243  *ranged.distribution(mean, std_dev), ranged.nSamples(),
244  ranged.sigmaFactor(), ranged.limits());
245  setItemFromSample(distributionItem, par_distr);
246 }
247 
248 void setGISASBeamItem(BeamItem* beam_item, const ScatteringSimulation& simulation)
249 {
250  ASSERT(beam_item);
251  const Beam& beam = simulation.beam();
252 
253  beam_item->setIntensity(beam.intensity());
254  beam_item->setWavelength(beam.wavelength());
255  beam_item->setInclinationAngle(Units::rad2deg(beam.direction().alpha()));
256  beam_item->setAzimuthalAngle(Units::rad2deg(beam.direction().phi()));
257 
258  // distribution parameters
259  const std::vector<ParameterDistribution>& distributions = simulation.getDistributions();
260  for (size_t i = 0; i < distributions.size(); ++i) {
261  // try all, one will have the right 'whichParameter'
262  addDistributionToBeamItem(ParameterDistribution::BeamWavelength,
263  beam_item->wavelengthItem(), distributions[i]);
264  addDistributionToBeamItem(ParameterDistribution::BeamInclinationAngle,
265  beam_item->inclinationAngleItem(), distributions[i]);
266  addDistributionToBeamItem(ParameterDistribution::BeamAzimuthalAngle,
267  beam_item->azimuthalAngleItem(), distributions[i]);
268  }
269 }
270 
271 void setOffspecBeamItem(BeamItem* beam_item, const OffspecSimulation& simulation)
272 {
273  const Beam& beam = simulation.beam();
274 
275  beam_item->setIntensity(beam.intensity());
276  beam_item->setWavelength(beam.wavelength());
277  beam_item->setInclinationAngle(Units::rad2deg(beam.direction().alpha()));
278  beam_item->setAzimuthalAngle(Units::rad2deg(beam.direction().phi()));
279  // TODO implement beam divergence
280 }
281 
282 void setAxisItem(BasicAxisItem* item, const IAxis& axis, double factor)
283 {
284  if (!dynamic_cast<const FixedBinAxis*>(&axis))
285  throw Error("setAxisItem() -> Error. Unexpected axis");
286 
287  item->setBinCount(static_cast<int>(axis.size()));
288  item->setLowerBound(factor * axis.min());
289  item->setUpperBound(factor * axis.max());
290  item->setTitle(QString::fromStdString(axis.axisName()));
291 }
292 
293 void setSphericalDetector(SphericalDetectorItem* detectorItem, const SphericalDetector& detector)
294 {
295  // Axes
296  const IAxis& phi_axis = detector.axis(0);
297  const IAxis& alpha_axis = detector.axis(1);
298 
299  auto& phiAxis = detectorItem->phiAxis();
300  phiAxis.setNbins(phi_axis.size());
301  phiAxis.setMin(Units::rad2deg(phi_axis.min()));
302  phiAxis.setMax(Units::rad2deg(phi_axis.max()));
303 
304  auto& alphaAxis = detectorItem->alphaAxis();
305  alphaAxis.setNbins(alpha_axis.size());
306  alphaAxis.setMin(Units::rad2deg(alpha_axis.min()));
307  alphaAxis.setMax(Units::rad2deg(alpha_axis.max()));
308 }
309 
310 void setRectangularDetector(RectangularDetectorItem* detectorItem,
311  const RectangularDetector& detector)
312 {
313  // Axes
314  detectorItem->setXSize(detector.xSize());
315  detectorItem->setWidth(detector.width());
316 
317  detectorItem->setYSize(detector.ySize());
318  detectorItem->setHeight(detector.height());
319 
320  detectorItem->setDetectorAlignment(detector.getDetectorArrangment());
321  if (detector.getDetectorArrangment() == RectangularDetector::GENERIC) {
322  R3 normal = detector.getNormalVector();
323  detectorItem->setNormalVector(normal);
324 
325  R3 direction = detector.getDirectionVector();
326  detectorItem->setDirectionVector(direction);
327 
328  detectorItem->setU0(detector.getU0());
329  detectorItem->setV0(detector.getV0());
330  }
331 
332  else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_SAMPLE) {
333  detectorItem->setDistance(detector.getDistance());
334  detectorItem->setU0(detector.getU0());
335  detectorItem->setV0(detector.getV0());
336  } else if (detector.getDetectorArrangment()
337  == RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM) {
338  detectorItem->setDistance(detector.getDistance());
339  detectorItem->setU0(detector.getU0());
340  detectorItem->setV0(detector.getV0());
341  } else if (detector.getDetectorArrangment()
342  == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM) {
343  detectorItem->setDistance(detector.getDistance());
344  detectorItem->setU0(detector.getU0());
345  detectorItem->setV0(detector.getV0());
346  } else if (detector.getDetectorArrangment()
347  == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM_DPOS) {
348  detectorItem->setDistance(detector.getDistance());
349  detectorItem->setU0(detector.getDirectBeamU0());
350  detectorItem->setV0(detector.getDirectBeamV0());
351  } else {
352  throw Error("setItemFromSample(RectangularDetectorItem* "
353  "detectorItem "
354  "Error. Unknown detector arrangement");
355  }
356 }
357 
358 void setDetectorGeometry(Instrument2DItem* instrument_item, const IDetector& detector)
359 {
360  if (const auto* det = dynamic_cast<const SphericalDetector*>(&detector)) {
361  auto* item = instrument_item->setDetectorType<SphericalDetectorItem>();
362  setSphericalDetector(item, *det);
363  } else if (const auto* det = dynamic_cast<const RectangularDetector*>(&detector)) {
364  auto* item = instrument_item->setDetectorType<RectangularDetectorItem>();
365  setRectangularDetector(item, *det);
366  } else {
367  throw Error("setDetectorGeometry() -> Unknown detector type.");
368  }
369 }
370 
371 void setDetectorResolution(DetectorItem* detector_item, const IDetector& detector)
372 {
373  const IDetectorResolution* p_resfunc = detector.detectorResolution();
374 
375  if (!p_resfunc)
376  return;
377 
378  if (const auto* p_convfunc = dynamic_cast<const ConvolutionDetectorResolution*>(p_resfunc)) {
379  if (const auto* resfunc = dynamic_cast<const ResolutionFunction2DGaussian*>(
380  p_convfunc->getResolutionFunction2D())) {
381  auto* item =
383  const double scale = 1.0 / detector_item->axesToCoreUnitsFactor();
384  item->setSigmaX(scale * resfunc->sigmaX());
385  item->setSigmaY(scale * resfunc->sigmaY());
386  } else {
387  throw Error("setDetectorResolution() -> Error. "
388  "Unknown detector resolution function");
389  }
390  } else {
391  throw Error("setDetectorResolution() -> Error. "
392  "Not a ConvolutionDetectorResolution function");
393  }
394 }
395 
396 void setPolarizerAnalyzer(Instrument2DItem* instrument_item, const ISimulation2D& simulation)
397 {
398  instrument_item->setPolarization(simulation.beam().polVector());
399 
400  const IDetector& detector = simulation.detector();
401  double total_transmission = detector.analyzer().totalTransmission();
402  if (total_transmission <= 0.0)
403  return;
404 
405  R3 analyzer_dir = detector.analyzer().analyzerDirection();
406  double efficiency = detector.analyzer().analyzerEfficiency();
407  instrument_item->setAnalyzerDirection(analyzer_dir);
408  instrument_item->setAnalyzerEfficiency(efficiency);
409  instrument_item->setAnalyzerTotalTransmission(total_transmission);
410 }
411 
412 void updateDetector(Instrument2DItem* instrument_item, const ISimulation2D& simulation)
413 {
414  const IDetector& detector = simulation.detector();
415  setDetectorGeometry(instrument_item, detector);
416 
417  auto* detector_item = instrument_item->detectorItem();
418 
419  setDetectorResolution(detector_item, detector);
420  setDetectorMasks(detector_item, simulation);
421  setPolarizerAnalyzer(instrument_item, simulation);
422 }
423 
424 void setBackground(InstrumentItem* instrument_item, const ISimulation& simulation)
425 {
426  const auto* p_bg = simulation.background();
427  if (const auto* p_constant_bg = dynamic_cast<const ConstantBackground*>(p_bg)) {
428  auto* constant_bg_item = instrument_item->setBackgroundType<ConstantBackgroundItem>();
429  double value = p_constant_bg->backgroundValue();
430  constant_bg_item->setBackgroundValue(value);
431  } else if (dynamic_cast<const PoissonBackground*>(p_bg))
432  instrument_item->setBackgroundType<PoissonBackgroundItem>();
433 }
434 
435 GISASInstrumentItem* createGISASInstrumentItem(const ScatteringSimulation& simulation)
436 {
437  auto* result = new GISASInstrumentItem();
438  setGISASBeamItem(result->beamItem(), simulation);
439  updateDetector(result, simulation);
440 
441  return result;
442 }
443 
444 OffspecInstrumentItem* createOffspecInstrumentItem(const OffspecSimulation& simulation)
445 {
446  auto* result = new OffspecInstrumentItem();
447  setOffspecBeamItem(result->beamItem(), simulation);
448  updateDetector(result, simulation);
449 
450  const double factor = 1. / Units::deg;
451  result->alphaAxis().setNbins(simulation.beamAxis()->size());
452  result->alphaAxis().setMin(factor * simulation.beamAxis()->min());
453  result->alphaAxis().setMax(factor * simulation.beamAxis()->max());
454 
455  return result;
456 }
457 
458 SpecularInstrumentItem* createSpecularInstrumentItem(const SpecularSimulation& simulation)
459 {
460  auto* result = new SpecularInstrumentItem();
461  SpecularBeamItem* beam_item = result->beamItem();
462 
463  const ISpecularScan* scan = simulation.scan();
464 
465  beam_item->setIntensity(1.0); // TODO ISSUE #303
466  beam_item->setWavelength(scan->wavelength());
467  beam_item->setInclinationAngle(0.0); // inclination angle is hardcoded
468  beam_item->setAzimuthalAngle(0.0); // azimuthal angle is hardcoded
469 
470  auto* axis_item = beam_item->inclinationAxis();
471  setAxisItem(axis_item, *scan->coordinateAxis(), 1. / Units::deg);
472 
473  setFootprintFactor(scan->footprintFactor(), beam_item);
474 
475  const auto* alphaScan = dynamic_cast<const AlphaScan*>(scan);
476  if (!alphaScan)
477  return result;
478 
479  const auto* resolution = alphaScan->wavelengthResolution();
480  if (!resolution->empty()) {
481  double mean = alphaScan->wavelength();
482  double std_dev = resolution->stdDevs(mean, 1).front();
483  addRangedDistributionToItem(beam_item->wavelengthItem(), *resolution->distribution(), mean,
484  std_dev);
485  }
486 
487  resolution = alphaScan->angleResolution();
488  if (resolution && !resolution->empty()) {
489  double std_dev = resolution->stdDevs(0.0, 1).front();
490  addRangedDistributionToItem(beam_item->inclinationAngleItem(), *resolution->distribution(),
491  0.0, std_dev);
492  }
493 
494  return result;
495 }
496 
497 } // namespace
498 
499 
501 {
502  InstrumentItem* item;
503 
504  if (const auto* gisasSimulation = dynamic_cast<const ScatteringSimulation*>(&simulation))
505  item = createGISASInstrumentItem(*gisasSimulation);
506  else if (const auto* offspecSimulation = dynamic_cast<const OffspecSimulation*>(&simulation))
507  item = createOffspecInstrumentItem(*offspecSimulation);
508  else if (const auto* spec_simulation = dynamic_cast<const SpecularSimulation*>(&simulation))
509  item = createSpecularInstrumentItem(*spec_simulation);
510  else
511  ASSERT(0);
512 
513  setBackground(item, simulation);
514 
515  auto* collection = new InstrumentCollection;
516  collection->emplace_back(item);
517  return collection;
518 }
519 
521 {
522  auto* result = new SimulationOptionsItem;
523 
524  if (simulation.options().isIntegrate())
526  static_cast<unsigned>(simulation.options().getMcPoints()));
527  else
528  result->setUseAnalytical();
529 
530  result->setUseAverageMaterials(simulation.options().useAvgMaterials());
531  result->setIncludeSpecularPeak(simulation.options().includeSpecular());
532 
533  return result;
534 }
Defines various axis items.
Defines BackgroundItem classes.
Defines class BeamAngleItems.
Defines class BeamWavelengthItem.
Defines error class.
Defines class InstrumentCollection.
Defines class InstrumentItem and all its children.
Defines class GUISampleBuilder.
Defines namespace GUI::Model::ObjectBuilder.
Defines class LayerItem.
Defines MaskItems classes.
Defines class MesoCrystalItem.
Defines class ParticleItem.
Defines class ParticleLayoutItem.
Defines class RectangularDetectorItem.
Defines family of ResolutionFunctionItem.
Defines class SimulationOptionsItem.
Defines class SphericalDetectorItem.
void setBinCount(size_t value)
Definition: AxesItems.cpp:31
void setLowerBound(double value)
Definition: AxesItems.cpp:48
void setUpperBound(double value)
Definition: AxesItems.cpp:65
void setTitle(const QString &title)
Definition: AxesItems.cpp:85
The BeamDistributionItem handles wavelength, inclination and azimuthal parameter distribution for Bea...
DistributionItem * distribution() const
virtual double scaleFactor() const
virtual BeamDistributionItem * inclinationAngleItem() const
Definition: BeamItems.cpp:77
void setWavelength(double value)
Definition: BeamItems.cpp:62
BeamAzimuthalAngleItem * azimuthalAngleItem() const
Definition: BeamItems.cpp:92
virtual void setInclinationAngle(double value)
Definition: BeamItems.cpp:72
void setAzimuthalAngle(double value)
Definition: BeamItems.cpp:87
BeamWavelengthItem * wavelengthItem() const
Definition: BeamItems.cpp:67
MaskItems & maskItems()
virtual double axesToCoreUnitsFactor() const
Scales the values provided by axes (to perform deg->rad conversion on the way to domain).
Definition: DetectorItems.h:57
T * setResolutionFunctionType()
Definition: DetectorItems.h:73
void setRange(double min, double max)
bool hasSigmaFactor() const
virtual void setLimits(const RealLimits &limits)
Definition: Error.h:21
DetectorItem * detectorItem() const
void emplace_back(InstrumentItem *item)
Abstract base class for instrument-specific item classes.
List of MaskItems.
Definition: MaskItems.h:232
void insertMask(int index, MaskItem *maskItem)
Takes ownership of maskItem.
Definition: MaskItems.cpp:497
void setXSize(size_t nx) override
sets the size of x-axis of the detector
void setYSize(size_t ny) override
sets the size of y-axis of the detector
void setDetectorAlignment(RectangularDetector::EDetectorArrangement alignment)
The SimulationOptionsItem class holds simulation status (run policy, number of threads,...
void setUseMonteCarloIntegration(unsigned numberOfPoints)
void setSquareFootprint(double value)
Definition: BeamItems.cpp:176
void setInclinationAngle(double value) override
Definition: BeamItems.cpp:144
BasicAxisItem * inclinationAxis() const
Definition: BeamItems.cpp:156
void setGaussianFootprint(double value)
Definition: BeamItems.cpp:171
SpecularBeamInclinationItem * inclinationAngleItem() const override
Definition: BeamItems.cpp:151
InstrumentCollection * itemizeInstruments(const ISimulation &simulation)
SimulationOptionsItem * itemizeOptions(const ISimulation &simulation)