BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ConstantBackground.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sim/Background/ConstantBackground.cpp
6 //! @brief Implements class ConstantBackground.
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 
16 
17 ConstantBackground::ConstantBackground(const std::vector<double> P)
18  : IBackground(P)
19  , m_background_value(m_P[0])
20 {
21  checkNodeArgs();
22 }
23 
25  : ConstantBackground(std::vector<double>{background_value})
26 {
27 }
28 
30 {
32 }
33 
34 double ConstantBackground::addBackground(double intensity) const
35 {
36  return intensity + m_background_value;
37 }
Defines class ConstantBackground.
Constant background, to be added to simulated scattering.
double addBackground(double intensity) const override
const double & m_background_value
ConstantBackground * clone() const override
ConstantBackground(std::vector< double > P)
Abstract base class for background noise, to be added to simulated scattering.
Definition: IBackground.h:27
void checkNodeArgs() const
Raises exception if a parameter value is invalid.
Definition: INode.cpp:27