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

Description

Definition at line 20 of file BeamAngleItems.h.

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

Public Member Functions

 BeamAzimuthalAngleItem ()
 
double azimuthalAngle () const
 
DistributionItemdistribution () const
 
SelectionDescriptor< DistributionItem * > distributionSelection () const
 
std::unique_ptr< ParameterDistribution > getParameterDistributionForName (ParameterDistribution::WhichParameter which) const
 
virtual double meanValue () const
 
void resetToValue (double value)
 
double scaleFactor () const override
 
void serialize (Streamer &s) override
 
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
 

Static Private Member Functions

static void initDistribution (DistributionItem *newDistribution, const DistributionItem *currentDistribution)
 

Constructor & Destructor Documentation

◆ BeamAzimuthalAngleItem()

BeamAzimuthalAngleItem::BeamAzimuthalAngleItem ( )

Definition at line 20 of file BeamAngleItems.cpp.

21 {
23  "Distribution", "", "distribution", DistributionItemCatalog::types(), initDistribution);
24 }
static void initDistribution(DistributionItem *newDistribution, const DistributionItem *currentDistribution)
SelectionProperty< DistributionItem * > m_distribution
static QVector< Type > types()
Available types of items.
void initWithInitializer(const QString &label, const QString &tooltip, const QString &persistentTag, std::function< void(T newItem, const T oldItem)> initializer)
Initialize by means of a catalog class and an initializer function.

References initDistribution(), SelectionProperty< T >::initWithInitializer(), BeamDistributionItem::m_distribution, and DistributionItemCatalog::types().

Here is the call graph for this function:

Member Function Documentation

◆ azimuthalAngle()

double BeamAzimuthalAngleItem::azimuthalAngle ( ) const

Definition at line 55 of file BeamAngleItems.cpp.

56 {
58 }
virtual double meanValue() const

References BeamDistributionItem::meanValue().

Here is the call graph for this function:

◆ 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

◆ 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:

◆ initDistribution()

void BeamAzimuthalAngleItem::initDistribution ( DistributionItem newDistribution,
const DistributionItem currentDistribution 
)
staticprivate

Definition at line 37 of file BeamAngleItems.cpp.

39 {
40  newDistribution->setLimits(RealLimits::limited(-90.0, 90.0));
41  newDistribution->setUnit(Unit::degree);
42 
43  double meanVal = 0.0;
44  if (auto* cd = dynamic_cast<const SymmetricResolutionItem*>(currentDistribution))
45  meanVal = cd->mean();
46 
47  if (auto* nd = dynamic_cast<SymmetricResolutionItem*>(newDistribution)) {
48  nd->setMean(meanVal);
49  nd->setMeanDecimals(3);
50  }
51 
52  newDistribution->initDistribution(meanVal);
53 };
@ degree
virtual void setLimits(const RealLimits &limits)
virtual void initDistribution(double)
virtual void setUnit(const variant< QString, Unit > &unit)=0
Set the unit of the distributed value.

References degree, DistributionItem::initDistribution(), DistributionItem::setLimits(), and DistributionItem::setUnit().

Referenced by BeamAzimuthalAngleItem().

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 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 BeamAzimuthalAngleItem::scaleFactor ( ) const
overridevirtual

Reimplemented from BeamDistributionItem.

Definition at line 60 of file BeamAngleItems.cpp.

61 {
62  return Units::deg;
63 }

◆ serialize()

void BeamAzimuthalAngleItem::serialize ( Streamer s)
overridevirtual

Implements BeamDistributionItem.

Definition at line 26 of file BeamAngleItems.cpp.

27 {
28  s.assertVersion(0);
29  Serialize::rwSelected<DistributionItemCatalog>(s, m_distribution);
30 
31  if (s.xmlReader()) {
32  m_distribution->setLimits(RealLimits::limited(-90.0, 90.0));
34  }
35 }
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(), degree, BeamDistributionItem::m_distribution, 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:

Member Data Documentation

◆ m_distribution


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