GeneticAlgoithm
Implementation of the genetic algorithm
ParametricModel.cxx
1 #include "ParametricModel.h"
2 
3 #include <stdexcept>
4 #include <sstream>
5 
7  IModel()
8 {
9  m_formula=0;
10 }
11 
13 {
14  // The formula is a clone that we own.
15  if(m_formula) delete m_formula;
16 }
17 
18 /**
19  * @param formula A <a href="https://root.cern.ch/doc/v610/classTF1.html">TF1</a> formula.
20  *
21  * This function keeps a clone of the formula in order to make sure that modifying it later
22  * does not affect other instances that might share the same original formula.
23  */
24 void ParametricModel::setFormula(TF1 *formula)
25 {
26 
27  if(m_formula) delete m_formula;
28  m_formula = (TF1*)formula->Clone();
29 }
30 
31 /**
32  * @return a pointer to the <a href="https://root.cern.ch/doc/v610/classTF1.html">TF1</a>
33  * formula for this model.
34  */
36 {
37  return m_formula;
38 }
39 
40 
41 /**
42  * @return a const pointer to the <a href="https://root.cern.ch/doc/v610/classTF1.html">TF1</a>
43  * formula for this model.
44  */
45 const TF1 *ParametricModel::getFormula() const
46 {
47  return m_formula;
48 }
49 
50 
51 
void setFormula(TF1 *formula)
virtual ~ParametricModel()
TF1 * m_formula
Holds the formula for this model.
Abstract class describing the interface for a model.
Definition: IModel.h:13