Bayeux  3.4.1
Core Foundation library for SuperNEMO
triangle_gate_signal_shape.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2016-09-27
4  * Last modified : 2016-09-27
5  *
6  * Copyright (C) 2016 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program 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 (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  * Description:
24  *
25  * A class representing a gate signal shape with arbitrary polarity, rise
26  * and fall times, starting time and charge. Edges have triangular shapes.
27  *
28  * History:
29  *
30  */
31 
32 #ifndef MCTOOLS_SIGNAL_TRIANGLE_GATE_SIGNAL_SHAPE_H
33 #define MCTOOLS_SIGNAL_TRIANGLE_GATE_SIGNAL_SHAPE_H
34 
35 // Third party:
36 // - Bayeux/datatools :
37 #include <datatools/i_cloneable.h>
38 // - Bayeux/mygsl:
39 #include <mygsl/i_unary_function.h>
40 
41 // This project:
42 #include <mctools/signal/utils.h>
43 
44 namespace mctools {
45 
46  namespace signal {
47 
49 
69  : public mygsl::i_unary_function,
71  {
72  public:
73 
75  bool is_valid() const;
76 
79 
82 
84  virtual void initialize(const datatools::properties & config_,
85  const mygsl::unary_function_dict_type & functors_);
86 
88  virtual void reset();
89 
91  virtual bool is_initialized() const;
92 
95 
98 
100  void reset_polarity();
101 
103  double get_rise_time() const;
104 
106  double get_fall_time() const;
107 
109  void set_amplitude(double);
110 
112  double get_amplitude() const;
113 
115  double get_q() const;
116 
118  void set_t0(double);
119 
121  double get_t0() const;
122 
124  void set_t1(double);
125 
127  double get_t1() const;
128 
130  void set_t2(double);
131 
133  double get_t2() const;
134 
136  double get_t3() const;
137 
139  void set_t3(double);
140 
142  double get_tpeak() const;
143 
145  virtual double get_non_zero_domain_min() const;
146 
148  virtual double get_non_zero_domain_max() const;
149 
151  double get_duration() const;
152 
154  virtual void tree_dump(std::ostream & out_ = std::clog,
155  const std::string & title_ = "",
156  const std::string & indent_ = "",
157  bool inherit_ = false) const;
158 
159  protected:
160 
162  void _set_defaults();
163 
165  void _compute_parameters();
166 
168  double _eval(double t_) const;
169 
170  private:
171 
172  // Configuration:
173  polarity_type _polarity_ = POLARITY_UNKNOWN;
174  double _t0_;
175  double _t1_;
176  double _t2_;
177  double _t3_;
178  double _amplitude_;
179 
180  // Working data:
181  double _q_;
182  double _a_rise_;
183  double _b_rise_;
184  double _a_fall_;
185  double _b_fall_;
186 
189 
190 
192 
193  };
194 
195  } // end of namespace signal
196 
197 } // end of namespace mctools
198 
199 #endif // MCTOOLS_SIGNAL_TRIANGLE_GATE_SIGNAL_SHAPE_H
200 
201 // Local Variables: --
202 // mode: c++ --
203 // c-file-style: "gnu" --
204 // tab-width: 2 --
205 // End: --
virtual bool is_initialized() const
Check initialization status.
void set_t0(double)
Set the starting time of the signal.
#define DATATOOLS_CLONEABLE_DECLARATION(Copyable)
Definition: i_cloneable.h:113
double get_t2() const
Return the stopping time of the plateau.
Definition: base_step_hit.h:32
virtual double get_non_zero_domain_max() const
The maximum bound of the non-zero domain (default is plus infinity)
void _compute_parameters()
Automatically compute working data parameters.
void set_polarity(polarity_type)
Set the polarity of the signal.
double get_amplitude() const
Return the amplitude of the signal.
void set_t1(double)
Set the starting time of the plateau.
void set_t3(double)
Set the stopping time of the signal.
polarity_type get_polarity() const
Return the polarity of the signal.
double _eval(double t_) const
Evaluation from parameters.
void _set_defaults()
Set default attributes.
double get_rise_time() const
Return the rise time of the signal.
Unknown polarity.
Definition: utils.h:46
void set_amplitude(double)
Set the amplitude of the signal.
double get_fall_time() const
Return the fall time of the signal.
bool is_valid() const
Check the validity.
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
void reset_polarity()
Reset the polarity of the signal.
triangle_gate_signal_shape()
Default constructor.
void set_t2(double)
Set the stopping time of the plateau.
virtual double get_non_zero_domain_min() const
The minimum bound of the non-zero domain (default is minus infinity)
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart printing.
A pure abstract class (interface) for inherited cloneable classes.
Definition: i_cloneable.h:75
double get_t0() const
Return the starting time of the signal.
double get_q() const
Return the charge of the signal.
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
double get_tpeak() const
Return the first peak time of the signal.
#define MYGSL_UNARY_FUNCTOR_REGISTRATION_INTERFACE(UnaryFunctorClass)
Definition: i_unary_function.h:206
virtual ~triangle_gate_signal_shape()
Destructor.
double get_t3() const
Return the stopping time of the signal.
double get_t1() const
Return the starting time of the plateau.
polarity_type
Definition: utils.h:42
virtual void initialize(const datatools::properties &config_, const mygsl::unary_function_dict_type &functors_)
Initialization.
double get_duration() const
Return the width of the signal.
Triangular gate signal shape.
Definition: triangle_gate_signal_shape.h:68
A dictionary of arbitrary properties.
Definition: properties.h:125