BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
anonymous_namespace{SpecularSimulation.cpp} Namespace Reference

Functions

std::unique_ptr< AngularSpecScanmangledScan (const AngularSpecScan &scan, const Beam &beam)
 
std::vector< SpecularSimulationElementgenerateSimulationElements (const Instrument &instrument, const ISpecularScan &scan)
 

Function Documentation

◆ mangledScan()

std::unique_ptr<AngularSpecScan> anonymous_namespace{SpecularSimulation.cpp}::mangledScan ( const AngularSpecScan scan,
const Beam beam 
)

Definition at line 33 of file SpecularSimulation.cpp.

34 {
35  const double wl = beam.getWavelength();
36  const double angle_shift = beam.getAlpha();
37  std::vector<double> angles = scan.coordinateAxis()->getBinCenters();
38  for (auto& val : angles)
39  val += angle_shift;
40  auto* result = new AngularSpecScan(wl, PointwiseAxis("alpha_i", std::move(angles)));
41  result->setFootprintFactor(scan.footprintFactor());
42  result->setWavelengthResolution(*scan.wavelengthResolution());
43  result->setAngleResolution(*scan.angleResolution());
44  return std::unique_ptr<AngularSpecScan>(result);
45 }
Scan type with inclination angles as coordinate values and a unique wavelength.
virtual const IFootprintFactor * footprintFactor() const override
Returns IFootprintFactor object pointer.
const ScanResolution * wavelengthResolution() const
const ScanResolution * angleResolution() const
virtual const IAxis * coordinateAxis() const override
Returns coordinate axis assigned to the data holder.
double getWavelength() const
Definition: Beam.h:69
double getAlpha() const
Definition: Beam.h:70
virtual std::vector< double > getBinCenters() const
Definition: IAxis.cpp:23
Axis containing arbitrary (non-equidistant) coordinate values.
Definition: PointwiseAxis.h:33

References AngularSpecScan::angleResolution(), AngularSpecScan::coordinateAxis(), AngularSpecScan::footprintFactor(), Beam::getAlpha(), IAxis::getBinCenters(), Beam::getWavelength(), and AngularSpecScan::wavelengthResolution().

Referenced by generateSimulationElements(), and SpecularSimulation::normalize().

Here is the call graph for this function:

◆ generateSimulationElements()

std::vector<SpecularSimulationElement> anonymous_namespace{SpecularSimulation.cpp}::generateSimulationElements ( const Instrument instrument,
const ISpecularScan scan 
)

Definition at line 47 of file SpecularSimulation.cpp.

49 {
50  std::vector<SpecularSimulationElement> result;
51 
52  // TODO: remove if-else statement when pointwise resolution is implemented
53  if (const auto* aScan = dynamic_cast<const AngularSpecScan*>(&scan))
54  result = mangledScan(*aScan, instrument.getBeam())->generateSimulationElements();
55  else
56  result = scan.generateSimulationElements();
57 
58  // add polarization and analyzer operators
59  const auto& polarization = instrument.getBeam().getPolarization();
60  const auto& analyzer = instrument.detector().detectionProperties().analyzerOperator();
61 
62  for (auto& elem : result)
63  elem.setPolarizationHandler({polarization, analyzer});
64 
65  return result;
66 }
Eigen::Matrix2cd getPolarization() const
Returns the polarization density matrix (in spin basis along z-axis)
Definition: Beam.cpp:123
Eigen::Matrix2cd analyzerOperator() const
Return the polarization density matrix (in spin basis along z-axis)
const DetectionProperties & detectionProperties() const
Returns detection properties.
Definition: IDetector.h:93
virtual std::vector< SpecularSimulationElement > generateSimulationElements() const =0
Generates simulation elements for specular simulations.
Beam & getBeam()
Definition: Instrument.h:44
IDetector & detector()
Definition: Instrument.cpp:133
std::unique_ptr< AngularSpecScan > mangledScan(const AngularSpecScan &scan, const Beam &beam)

References DetectionProperties::analyzerOperator(), IDetector::detectionProperties(), Instrument::detector(), ISpecularScan::generateSimulationElements(), Instrument::getBeam(), Beam::getPolarization(), and mangledScan().

Referenced by SpecularSimulation::initSimulationElementVector().

Here is the call graph for this function: