BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
BackgroundItems.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/BackgroundItems.cpp
6 //! @brief Implements BackgroundItem classes
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
18 
20 
21 // Background none
22 /* ------------------------------------------------ */
23 
25 
26 std::unique_ptr<IBackground> BackgroundNoneItem::createBackground() const
27 {
28  return {};
29 }
30 
31 // Constant background
32 /* ------------------------------------------------ */
33 
34 namespace {
35 const QString constant_background_value_tooltip = "Constant background value [counts/pixel]";
36 }
37 
38 const QString ConstantBackgroundItem::P_VALUE = QString::fromStdString("BackgroundValue");
39 
41 {
42  addProperty(P_VALUE, 0.0)
44  .setToolTip(constant_background_value_tooltip);
45 }
46 
47 std::unique_ptr<IBackground> ConstantBackgroundItem::createBackground() const
48 {
49  return std::make_unique<ConstantBackground>(getItemValue(P_VALUE).toDouble());
50 }
51 
52 // Background consisting of Poisson noise
53 /* ------------------------------------------------ */
54 
56 {
57 }
58 
59 std::unique_ptr<IBackground> PoissonNoiseBackgroundItem::createBackground() const
60 {
61  return std::make_unique<PoissonNoiseBackground>();
62 }
Defines BackgroundItem classes.
Defines class ConstantBackground.
Defines class PoissonNoiseBackground.
BackgroundItem(const QString &model_type)
std::unique_ptr< IBackground > createBackground() const
static const QString P_VALUE
std::unique_ptr< IBackground > createBackground() const
std::unique_ptr< IBackground > createBackground() const
static RealLimits nonnegative()
Creates an object which can have only positive values with 0. included.
Definition: RealLimits.cpp:115
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
SessionItem & setToolTip(const QString &tooltip)
SessionItem & setLimits(const RealLimits &value)
std::string model_type
Definition: types.h:23