Bayeux  3.4.1
Core Foundation library for SuperNEMO
gaussian_function.h
Go to the documentation of this file.
1 //
4 // Copyright (c) 2015 by François Mauger <mauger@lpccaen.in2p3.fr>
5 //
6 // This file is part of Bayeux.
7 //
8 // Bayeux is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // Bayeux is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with Bayeux. If not, see <http://www.gnu.org/licenses/>.
20 
21 #ifndef MYGSL_GAUSSIAN_FUNCTION_H
22 #define MYGSL_GAUSSIAN_FUNCTION_H
23 
24 // Standard library:
25 #include <limits>
26 
27 // Third party:
28 // - Bayeux/datatools :
29 #include <datatools/i_cloneable.h>
30 
31 // This project:
32 #include <mygsl/i_unary_function.h>
33 
34 namespace mygsl {
35 
38  : public i_unary_function,
40  {
41  public:
42 
45 
47  gaussian_function(double sigma_,
48  double mu_);
49 
51  gaussian_function(double sigma_,
52  double mu_,
53  double amplitude_);
54 
56  virtual ~gaussian_function();
57 
59  virtual bool is_initialized() const;
60 
62  virtual void initialize(const datatools::properties & config_,
63  const unary_function_dict_type & functors_);
64 
66  void reset();
67 
69  void set_sigma(double sigma_);
70 
72  double get_sigma() const;
73 
75  void set_mu(double mu_);
76 
78  double get_mu() const;
79 
81  bool has_amplitude() const;
82 
84  void set_amplitude(double amplitude_);
85 
87  double get_amplitude() const;
88 
90  void reset_amplitude();
91 
93  virtual void tree_dump(std::ostream & out_ = std::clog,
94  const std::string & title_ = "",
95  const std::string & indent_ = "",
96  bool inherit_ = false) const;
97 
98  protected:
99 
101  double _eval(double x_) const;
102 
104  void _set_defaults();
105 
106  private:
107 
109  void _init_();
110 
111  private:
112 
113  // Configuration:
114  double _mu_;
115  double _sigma_;
116  double _amplitude_;
117 
118  // Working data:
119  double _factor_;
120 
121 
124 
125 
127 
128  };
129 
130 } // end of namespace mygsl
131 
132 #endif // MYGSL_GAUSSIAN_FUNCTION_H
133 
134 // Local Variables: --
135 // mode: c++ --
136 // c-file-style: "gnu" --
137 // tab-width: 2 --
138 // End: --
Gaussian function.
Definition: gaussian_function.h:37
#define DATATOOLS_CLONEABLE_DECLARATION(Copyable)
Definition: i_cloneable.h:113
virtual ~gaussian_function()
Destructor.
void reset()
Reset the function.
double get_sigma() const
Return the sigma.
virtual void initialize(const datatools::properties &config_, const unary_function_dict_type &functors_)
Initialization from a container of parameters and a dictionary of functors.
double _eval(double x_) const
Evaluation.
void set_sigma(double sigma_)
Set the sigma.
double get_amplitude() const
Return the amplitude.
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart printing.
void set_mu(double mu_)
Set the center.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
bool has_amplitude() const
Check if amplitude is forced.
A pure abstract class (interface) for inherited cloneable classes.
Definition: i_cloneable.h:75
void _set_defaults()
Set default attributes values.
virtual bool is_initialized() const
Check initialization status.
std::map< std::string, unary_function_handle_type > unary_function_dict_type
Alias for dictionary of handles to unary function objects.
Definition: unary_function_utils.h:30
#define MYGSL_UNARY_FUNCTOR_REGISTRATION_INTERFACE(UnaryFunctorClass)
Definition: i_unary_function.h:206
void set_amplitude(double amplitude_)
Set the amplitude.
void reset_amplitude()
Reset the amplitude.
gaussian_function()
Default constructor.
double get_mu() const
Return the mu.
A dictionary of arbitrary properties.
Definition: properties.h:125