BornAgain  1.19.79
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/Model/Device/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 #include "Sim/Background/ConstantBackground.h"
19 #include "Sim/Background/PoissonBackground.h"
20 
22 {
23  m_backgroundValue.init("Background value", "Constant background value", 0.0, "counts/pixel", 3,
24  RealLimits::nonnegative(), "value");
25 }
26 
27 std::unique_ptr<IBackground> ConstantBackgroundItem::createBackground() const
28 {
29  return std::make_unique<ConstantBackground>(m_backgroundValue);
30 }
31 
33 {
34  s.assertVersion(0);
35  Serialize::rwProperty(s, m_backgroundValue);
36 }
37 
38 std::unique_ptr<IBackground> PoissonBackgroundItem::createBackground() const
39 {
40  return std::make_unique<PoissonBackground>();
41 }
42 
43 std::unique_ptr<IBackground> NoBackgroundItem::createBackground() const
44 {
45  return {};
46 }
Defines BackgroundItem classes.
Defines class DoubleDescriptor.
Defines class Streamer.
void serialize(Streamer &s) override
std::unique_ptr< IBackground > createBackground() const override
std::unique_ptr< IBackground > createBackground() const override
std::unique_ptr< IBackground > createBackground() const override
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36
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)