BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
BeamItem Class Referenceabstract

Description

Definition at line 34 of file BeamItems.h.

Inheritance diagram for BeamItem:
[legend]
Collaboration diagram for BeamItem:
[legend]

Public Member Functions

virtual ~BeamItem ()=default
 
BeamAzimuthalAngleItemazimuthalAngleItem () const
 
std::unique_ptr< Beam > createBeam () const
 
 DOUBLE_PROPERTY (intensity, Intensity)
 
double getAzimuthalAngle () const
 
virtual double getInclinationAngle () const =0
 
virtual BeamDistributionIteminclinationAngleItem () const
 
virtual void serialize (Streamer &s)
 
void setAzimuthalAngle (double value)
 
virtual void setInclinationAngle (double value)
 
void setWavelength (double value)
 
double wavelength () const
 
BeamWavelengthItemwavelengthItem () const
 

Protected Member Functions

 BeamItem ()
 
template<typename T >
void initInclinationAngle ()
 
template<typename T >
void initWavelength ()
 

Protected Attributes

std::unique_ptr< BeamAzimuthalAngleItemm_azimuthalAngleItem
 
std::unique_ptr< BeamDistributionItemm_inclinationAngleItem
 
std::unique_ptr< BeamWavelengthItemm_wavelengthItem
 

Constructor & Destructor Documentation

◆ ~BeamItem()

virtual BeamItem::~BeamItem ( )
virtualdefault

◆ BeamItem()

BeamItem::BeamItem ( )
protected

Definition at line 40 of file BeamItems.cpp.

41 {
42  m_intensity.init("Intensity", "Beam intensity in neutrons (or gammas) per sec.", 1e+08,
43  Unit::unitless, 3, RealLimits::limited(0.0, 1e+32), "intensity");
44 
46 }
@ unitless
std::unique_ptr< BeamAzimuthalAngleItem > m_azimuthalAngleItem
Definition: BeamItems.h:65

References m_azimuthalAngleItem, and unitless.

Member Function Documentation

◆ azimuthalAngleItem()

BeamAzimuthalAngleItem * BeamItem::azimuthalAngleItem ( ) const

Definition at line 92 of file BeamItems.cpp.

93 {
94  return m_azimuthalAngleItem.get();
95 }

References m_azimuthalAngleItem.

Referenced by GISASBeamEditor::GISASBeamEditor().

◆ createBeam()

std::unique_ptr< Beam > BeamItem::createBeam ( ) const

Definition at line 97 of file BeamItems.cpp.

98 {
99  double lambda = wavelength();
100  double inclination_angle = Units::deg2rad(getInclinationAngle());
101  double azimuthal_angle = Units::deg2rad(getAzimuthalAngle());
102 
103  auto result =
104  std::make_unique<Beam>(intensity(), lambda, Direction(inclination_angle, azimuthal_angle));
105 
106  return result;
107 }
double wavelength() const
Definition: BeamItems.cpp:57
virtual double getInclinationAngle() const =0
double getAzimuthalAngle() const
Definition: BeamItems.cpp:82

References getAzimuthalAngle(), getInclinationAngle(), and wavelength().

Referenced by SpecularInstrumentItem::createCoordSystem(), Instrument2DItem::createInstrument(), Instrument2DItem::createOffspecSimulation(), and Instrument2DItem::createScatteringSimulation().

Here is the call graph for this function:

◆ DOUBLE_PROPERTY()

BeamItem::DOUBLE_PROPERTY ( intensity  ,
Intensity   
)

◆ getAzimuthalAngle()

double BeamItem::getAzimuthalAngle ( ) const

Definition at line 82 of file BeamItems.cpp.

83 {
84  return m_azimuthalAngleItem->azimuthalAngle();
85 }

References m_azimuthalAngleItem.

Referenced by createBeam().

◆ getInclinationAngle()

virtual double BeamItem::getInclinationAngle ( ) const
pure virtual

Implemented in GISASBeamItem, and SpecularBeamItem.

Referenced by createBeam().

◆ inclinationAngleItem()

BeamDistributionItem * BeamItem::inclinationAngleItem ( ) const
virtual

Reimplemented in SpecularBeamItem.

Definition at line 77 of file BeamItems.cpp.

78 {
79  return m_inclinationAngleItem.get();
80 }
std::unique_ptr< BeamDistributionItem > m_inclinationAngleItem
Definition: BeamItems.h:66

References m_inclinationAngleItem.

Referenced by GISASBeamEditor::GISASBeamEditor(), GISASBeamItem::getInclinationAngle(), and SpecularBeamItem::inclinationAngleItem().

◆ initInclinationAngle()

template<typename T >
void BeamItem::initInclinationAngle
protected

Definition at line 116 of file BeamItems.cpp.

117 {
118  m_inclinationAngleItem.reset(new T());
119 }

References m_inclinationAngleItem.

◆ initWavelength()

template<typename T >
void BeamItem::initWavelength
protected

Definition at line 110 of file BeamItems.cpp.

111 {
112  m_wavelengthItem.reset(new T());
113 }
std::unique_ptr< BeamWavelengthItem > m_wavelengthItem
Definition: BeamItems.h:64

References m_wavelengthItem.

◆ serialize()

void BeamItem::serialize ( Streamer s)
virtual

Reimplemented in SpecularBeamItem.

Definition at line 48 of file BeamItems.cpp.

49 {
50  s.assertVersion(0);
51  Serialize::rwProperty(s, m_intensity);
52  Serialize::rwClass(s, "wavelength", *m_wavelengthItem);
54  Serialize::rwClass(s, "inclination", *m_inclinationAngleItem);
55 }
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26
void rwProperty(Streamer &s, DoubleProperty &d)
void rwClass(Streamer &s, const QString &tag, T &t)
Serializes an item from a class that provides the function void serialize(Streamer&).
Definition: Serialize.h:77

References Streamer::assertVersion(), m_azimuthalAngleItem, m_inclinationAngleItem, m_wavelengthItem, Serialize::rwClass(), and Serialize::rwProperty().

Here is the call graph for this function:

◆ setAzimuthalAngle()

void BeamItem::setAzimuthalAngle ( double  value)

Definition at line 87 of file BeamItems.cpp.

88 {
89  m_azimuthalAngleItem->resetToValue(value);
90 }

References m_azimuthalAngleItem.

◆ setInclinationAngle()

void BeamItem::setInclinationAngle ( double  value)
virtual

Reimplemented in SpecularBeamItem.

Definition at line 72 of file BeamItems.cpp.

73 {
74  m_inclinationAngleItem->resetToValue(value);
75 }

References m_inclinationAngleItem.

Referenced by SpecularBeamItem::setInclinationAngle().

◆ setWavelength()

void BeamItem::setWavelength ( double  value)

Definition at line 62 of file BeamItems.cpp.

63 {
64  m_wavelengthItem->resetToValue(value);
65 }

References m_wavelengthItem.

◆ wavelength()

double BeamItem::wavelength ( ) const

Definition at line 57 of file BeamItems.cpp.

58 {
59  return m_wavelengthItem->wavelength();
60 }

References m_wavelengthItem.

Referenced by createBeam(), and SpecularBeamItem::updateWavelength().

◆ wavelengthItem()

BeamWavelengthItem * BeamItem::wavelengthItem ( ) const

Member Data Documentation

◆ m_azimuthalAngleItem

std::unique_ptr<BeamAzimuthalAngleItem> BeamItem::m_azimuthalAngleItem
protected

◆ m_inclinationAngleItem

std::unique_ptr<BeamDistributionItem> BeamItem::m_inclinationAngleItem
protected

◆ m_wavelengthItem

std::unique_ptr<BeamWavelengthItem> BeamItem::m_wavelengthItem
protected

Definition at line 64 of file BeamItems.h.

Referenced by initWavelength(), serialize(), setWavelength(), wavelength(), and wavelengthItem().


The documentation for this class was generated from the following files: