BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularBeamWavelengthItem Class Reference

Description

Definition at line 32 of file BeamWavelengthItem.h.

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

Public Member Functions

 SpecularBeamWavelengthItem ()
 
DistributionItemdistribution () const
 
SelectionDescriptor< DistributionItem * > distributionSelection () const
 
std::unique_ptr< ParameterDistribution > getParameterDistributionForName (ParameterDistribution::WhichParameter which) const
 
virtual double meanValue () const
 
void resetToValue (double value)
 
virtual double scaleFactor () const
 
void serialize (Streamer &s) override
 
void setDistribution (DistributionItem *d)
 
template<typename T >
T * setDistributionType ()
 
void setToRange (const RealLimits &limits)
 
double wavelength () const
 Returns wavelength. In the case of distribution applied, returns its mean. More...
 

Protected Member Functions

virtual std::unique_ptr< IDistribution1D > createDistribution1D () const
 

Protected Attributes

SelectionProperty< DistributionItem * > m_distribution
 

Constructor & Destructor Documentation

◆ SpecularBeamWavelengthItem()

SpecularBeamWavelengthItem::SpecularBeamWavelengthItem ( )

Definition at line 75 of file BeamWavelengthItem.cpp.

76  : BeamWavelengthItem(true)
77 {
78 }

Member Function Documentation

◆ createDistribution1D()

std::unique_ptr< IDistribution1D > BeamDistributionItem::createDistribution1D ( ) const
protectedvirtualinherited

Definition at line 75 of file BeamDistributionItem.cpp.

76 {
78 }
DistributionItem * distribution() const
virtual double scaleFactor() const
virtual std::unique_ptr< IDistribution1D > createDistribution(double scale=1.0) const =0

References DistributionItem::createDistribution(), BeamDistributionItem::distribution(), and BeamDistributionItem::scaleFactor().

Referenced by BeamDistributionItem::getParameterDistributionForName(), and BeamDistributionItem::meanValue().

Here is the call graph for this function:

◆ distribution()

DistributionItem * BeamDistributionItem::distribution ( ) const
inherited

Definition at line 60 of file BeamDistributionItem.cpp.

61 {
62  return m_distribution.get();
63 }
SelectionProperty< DistributionItem * > m_distribution
T get() const
Direct access to the stored pointer.

References SelectionProperty< T >::get(), and BeamDistributionItem::m_distribution.

Referenced by ParameterTreeBuilder::addBeamDistribution(), BeamDistributionItem::createDistribution1D(), DistributionSelector::createDistributionWidgets(), BeamDistributionItem::getParameterDistributionForName(), BeamDistributionItem::meanValue(), setToRange(), DistributionEditor::updatePlot(), and InclinationAnglesEditor::updatePlot().

Here is the call graph for this function:

◆ distributionSelection()

SelectionDescriptor< DistributionItem * > BeamDistributionItem::distributionSelection ( ) const
inherited

◆ getParameterDistributionForName()

std::unique_ptr< ParameterDistribution > BeamDistributionItem::getParameterDistributionForName ( ParameterDistribution::WhichParameter  which) const
inherited

Definition at line 22 of file BeamDistributionItem.cpp.

24 {
25  if (const auto* d = distribution()) {
26  auto distribution1D = createDistribution1D();
27 
28  if (distribution1D) {
29  const auto nbrOfSamples = d->numberOfSamples();
30  const double sigmaFactor = d->hasSigmaFactor() ? d->sigmaFactor() : 0.0;
31  const auto limits = d->limits().scaledLimits(scaleFactor());
32 
33  return std::make_unique<ParameterDistribution>(which, *distribution1D, nbrOfSamples,
34  sigmaFactor, limits);
35  }
36  }
37  return {};
38 }
virtual std::unique_ptr< IDistribution1D > createDistribution1D() const

References BeamDistributionItem::createDistribution1D(), BeamDistributionItem::distribution(), and BeamDistributionItem::scaleFactor().

Here is the call graph for this function:

◆ meanValue()

double BeamDistributionItem::meanValue ( ) const
virtualinherited

Definition at line 40 of file BeamDistributionItem.cpp.

41 {
42  std::unique_ptr<IDistribution1D> domainDistr = createDistribution1D();
43  if (domainDistr)
44  return domainDistr->mean() / scaleFactor();
45  return dynamic_cast<SymmetricResolutionItem*>(distribution())->mean();
46 }

References BeamDistributionItem::createDistribution1D(), BeamDistributionItem::distribution(), and BeamDistributionItem::scaleFactor().

Referenced by BeamAzimuthalAngleItem::azimuthalAngle(), BeamInclinationAngleItem::inclinationAngle(), and BeamWavelengthItem::wavelength().

Here is the call graph for this function:

◆ resetToValue()

void BeamDistributionItem::resetToValue ( double  value)
inherited

Definition at line 48 of file BeamDistributionItem.cpp.

49 {
50  auto* d = new DistributionNoneItem();
51  d->setMean(value);
53 }
void set(T t, bool callInitializer=false)
Directly set the new item.

References BeamDistributionItem::m_distribution, and SelectionProperty< T >::set().

Here is the call graph for this function:

◆ scaleFactor()

double BeamDistributionItem::scaleFactor ( ) const
virtualinherited

◆ serialize()

void BeamWavelengthItem::serialize ( Streamer s)
overridevirtualinherited

Implements BeamDistributionItem.

Definition at line 57 of file BeamWavelengthItem.cpp.

58 {
59  s.assertVersion(0);
60  Serialize::rwSelected<DistributionItemCatalog>(s, m_distribution);
61 
62  if (s.xmlReader()) {
63  m_distribution->setLimits(RealLimits::positive());
65  }
66 }
@ nanometer
virtual void setLimits(const RealLimits &limits)
virtual void setUnit(const variant< QString, Unit > &unit)=0
Set the unit of the distributed value.
QXmlStreamReader * xmlReader()
Returns stream reader or nullptr.
Definition: Streamer.h:48
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26

References Streamer::assertVersion(), BeamDistributionItem::m_distribution, nanometer, DistributionItem::setLimits(), DistributionItem::setUnit(), and Streamer::xmlReader().

Here is the call graph for this function:

◆ setDistribution()

void BeamDistributionItem::setDistribution ( DistributionItem d)
inherited

Definition at line 70 of file BeamDistributionItem.cpp.

71 {
73 }

References BeamDistributionItem::m_distribution, and SelectionProperty< T >::set().

Here is the call graph for this function:

◆ setDistributionType()

template<typename T >
T * BeamDistributionItem::setDistributionType
inherited

Definition at line 52 of file BeamDistributionItem.h.

53 {
54  m_distribution.set<T>();
55  return dynamic_cast<T*>(m_distribution.get());
56 }

References SelectionProperty< T >::get(), BeamDistributionItem::m_distribution, and SelectionProperty< T >::set().

Here is the call graph for this function:

◆ setToRange()

void SpecularBeamWavelengthItem::setToRange ( const RealLimits &  limits)

Definition at line 80 of file BeamWavelengthItem.cpp.

81 {
82  if (auto* symmetricDistribution = dynamic_cast<SymmetricResolutionItem*>(distribution())) {
83  if (!limits.isInRange(wavelength())) {
84  const double new_value =
85  limits.isLimited() ? (limits.upperLimit() - limits.lowerLimit()) / 2. : default_wl;
86  symmetricDistribution->setMean(new_value);
87  }
88  symmetricDistribution->setLimits(limits);
89  }
90 }
double wavelength() const
Returns wavelength. In the case of distribution applied, returns its mean.

References BeamDistributionItem::distribution(), and BeamWavelengthItem::wavelength().

Here is the call graph for this function:

◆ wavelength()

double BeamWavelengthItem::wavelength ( ) const
inherited

Returns wavelength. In the case of distribution applied, returns its mean.

Definition at line 68 of file BeamWavelengthItem.cpp.

69 {
71 }
virtual double meanValue() const

References BeamDistributionItem::meanValue().

Referenced by setToRange().

Here is the call graph for this function:

Member Data Documentation

◆ m_distribution


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