Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecore
dunecore
DuneCommon
Utility
RootParFormula.h
Go to the documentation of this file.
1
// RootParFormula.h
2
//
3
// David Adams
4
// July 2021
5
//
6
// Implementation of ParFormula base on TFormula.
7
8
#ifndef RootParFormula_H
9
#define RootParFormula_H
10
11
#include "
dunecore/DuneInterface/Utility/ParFormula.h
"
12
#include "TFormula.h"
13
14
class
RootParFormula
:
public
ParFormula
{
15
16
public
:
17
18
// Ctor from a string formula.
19
RootParFormula
(
Name
snam,
Name
sform);
20
21
// Name.
22
Name
name
()
const override
{
return
m_nam
; }
23
24
// Formula.
25
Name
formulaString
()
const override
{
return
m_sform
; }
26
27
// Variable dimension.
28
Index
nvar
()
const override
{
return
m_ptf
==
nullptr
? 0 :
m_ptf
->GetNdim(); }
29
30
// Parameter counts.
31
Index
npar
()
const override
{
return
m_parNames
.size(); }
32
Names
pars
()
const override
{
return
m_parNames
; }
33
Names
setPars
()
const override
;
34
Names
unsetPars
()
const override
;
35
Names
resetPars
()
const override
;
36
37
// Return if a parameter appears in the equation.
38
bool
isPar
(
Name
parnam)
const override
;
39
40
// Return if ready for evaluation.
41
bool
ready
()
const override
;
42
43
// Default return.
44
Value
defaultEval
()
const override
{
return
m_defval
; }
45
46
// Evaluate.
47
double
eval
(
const
Values
& vars)
const override
{
48
return
ready
() &&
nvar
() <= vars.size() ?
m_ptf
->EvalPar(&vars[0], &
m_parValues
[0]) :
m_defval
;
49
}
50
double
eval
(
Value
var
)
const override
{
51
return
ready
() &&
nvar
() <= 1 ?
m_ptf
->Eval(var) :
m_defval
;
52
}
53
double
eval
()
const override
{
54
return
ready
() &&
nvar
() == 0 ?
m_ptf
->Eval(0.0) :
m_defval
;
55
}
56
57
// Set a parameter value.
58
int
setParValue
(
Name
parnam,
Value
parval)
override
;
59
60
// Set default return.
61
int
setDefaultEval
(
Value
val
)
override
{
m_defval
=
val
;
return
0; }
62
63
// Unset paramter values.
64
int
unsetParValues
()
override
;
65
66
private
:
67
68
Name
m_nam
;
69
TFormula*
m_ptf
;
70
Name
m_sform
;
71
Names
m_parNames
;
72
Values
m_parValues
;
73
std::vector<Index>
m_setCounts
;
74
Value
m_defval
;
75
76
};
77
78
#endif
79
ParFormula::Name
std::string Name
Definition:
ParFormula.h:23
val
Definition:
registry_via_id_test_2.cc:15
RootParFormula::name
Name name() const override
Definition:
RootParFormula.h:22
RootParFormula::m_setCounts
std::vector< Index > m_setCounts
Definition:
RootParFormula.h:73
ParFormula::Index
unsigned int Index
Definition:
ParFormula.h:22
RootParFormula::eval
double eval() const override
Definition:
RootParFormula.h:53
RootParFormula::setParValue
int setParValue(Name parnam, Value parval) override
Definition:
RootParFormula.cxx:69
RootParFormula::setPars
Names setPars() const override
Definition:
RootParFormula.cxx:39
RootParFormula::nvar
Index nvar() const override
Definition:
RootParFormula.h:28
RootParFormula::npar
Index npar() const override
Definition:
RootParFormula.h:31
RootParFormula::eval
double eval(const Values &vars) const override
Definition:
RootParFormula.h:47
RootParFormula::defaultEval
Value defaultEval() const override
Definition:
RootParFormula.h:44
RootParFormula::RootParFormula
RootParFormula(Name snam, Name sform)
Definition:
RootParFormula.cxx:9
ParFormula::Value
double Value
Definition:
ParFormula.h:20
RootParFormula::m_ptf
TFormula * m_ptf
Definition:
RootParFormula.h:69
RootParFormula::formulaString
Name formulaString() const override
Definition:
RootParFormula.h:25
RootParFormula::pars
Names pars() const override
Definition:
RootParFormula.h:32
RootParFormula::m_parNames
Names m_parNames
Definition:
RootParFormula.h:71
ParFormula
Definition:
ParFormula.h:16
RootParFormula::m_sform
Name m_sform
Definition:
RootParFormula.h:70
RootParFormula
Definition:
RootParFormula.h:14
testsqlite3.val
list val
Definition:
testsqlite3.py:13
ParFormula::Names
std::vector< Name > Names
Definition:
ParFormula.h:24
RootParFormula::unsetParValues
int unsetParValues() override
Definition:
RootParFormula.cxx:83
RootParFormula::unsetPars
Names unsetPars() const override
Definition:
RootParFormula.cxx:49
RootParFormula::ready
bool ready() const override
Definition:
RootParFormula.cxx:29
RootParFormula::m_parValues
Values m_parValues
Definition:
RootParFormula.h:72
var
int var
Definition:
018_def.c:9
RootParFormula::resetPars
Names resetPars() const override
Definition:
RootParFormula.cxx:59
RootParFormula::isPar
bool isPar(Name parnam) const override
Definition:
RootParFormula.cxx:23
ParFormula::Values
std::vector< Value > Values
Definition:
ParFormula.h:21
RootParFormula::m_defval
Value m_defval
Definition:
RootParFormula.h:74
ParFormula.h
RootParFormula::eval
double eval(Value var) const override
Definition:
RootParFormula.h:50
RootParFormula::m_nam
Name m_nam
Definition:
RootParFormula.h:68
RootParFormula::setDefaultEval
int setDefaultEval(Value val) override
Definition:
RootParFormula.h:61
Generated by
1.8.11