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

Description

The BeamDistributionItem handles wavelength, inclination and azimuthal parameter distribution for BeamItem.

Definition at line 25 of file BeamDistributionItem.h.

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

Public Member Functions

virtual ~BeamDistributionItem ()=default
 
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
 
virtual void serialize (Streamer &s)=0
 
void setDistribution (DistributionItem *d)
 
template<typename T >
T * setDistributionType ()
 

Protected Member Functions

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

Protected Attributes

SelectionProperty< DistributionItem * > m_distribution
 

Constructor & Destructor Documentation

◆ ~BeamDistributionItem()

virtual BeamDistributionItem::~BeamDistributionItem ( )
virtualdefault

Member Function Documentation

◆ createDistribution1D()

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

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(), distribution(), and scaleFactor().

Referenced by getParameterDistributionForName(), and meanValue().

Here is the call graph for this function:

◆ distribution()

DistributionItem * BeamDistributionItem::distribution ( ) const

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 m_distribution.

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

Here is the call graph for this function:

◆ distributionSelection()

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

Definition at line 65 of file BeamDistributionItem.cpp.

66 {
67  return m_distribution;
68 }

References m_distribution.

Referenced by DistributionSelector::DistributionSelector(), and DistributionSelector::refresh().

◆ getParameterDistributionForName()

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

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 createDistribution1D(), distribution(), and scaleFactor().

Here is the call graph for this function:

◆ meanValue()

double BeamDistributionItem::meanValue ( ) const
virtual

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 createDistribution1D(), distribution(), and scaleFactor().

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

Here is the call graph for this function:

◆ resetToValue()

void BeamDistributionItem::resetToValue ( double  value)

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 m_distribution, and SelectionProperty< T >::set().

Here is the call graph for this function:

◆ scaleFactor()

double BeamDistributionItem::scaleFactor ( ) const
virtual

Reimplemented in SpecularBeamInclinationItem, BeamInclinationAngleItem, and BeamAzimuthalAngleItem.

Definition at line 55 of file BeamDistributionItem.cpp.

56 {
57  return 1.0;
58 }

Referenced by createDistribution1D(), getParameterDistributionForName(), and meanValue().

◆ serialize()

virtual void BeamDistributionItem::serialize ( Streamer s)
pure virtual

◆ setDistribution()

void BeamDistributionItem::setDistribution ( DistributionItem d)

Definition at line 70 of file BeamDistributionItem.cpp.

71 {
73 }

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

Here is the call graph for this function:

◆ setDistributionType()

template<typename T >
T * BeamDistributionItem::setDistributionType

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(), m_distribution, and SelectionProperty< T >::set().

Here is the call graph for this function:

Member Data Documentation

◆ m_distribution


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