Spline structure for zero-order & linear splines.
More...
#include <tools.h>
|
double | val (double x) const |
| get value of spline at point x
|
|
double | err (double x) const |
| get error of spline at point x
|
|
double | center () const |
| Get center of the spline domain.
|
|
void | print (TString tag="") |
| print the spline
|
|
|
std::vector< double > | nodes |
| vector of spline nodes
|
|
std::vector< double > | vals |
| vector of spline values
|
|
std::vector< double > | errs |
| vector of spline errors
|
|
Spline structure for zero-order & linear splines.
nodes.size() <= 1 -> order=0 , nodes.size() == vals.size() -> order=1
Definition at line 165 of file tools.h.
◆ Spline()
Definition at line 208 of file tools.h.
208: nodes{}, vals{0}, errs{0} {}
◆ center()
Get center of the spline domain.
Definition at line 177 of file tools.h.
178 {
179 if (nodes.size() == 0)
180 return 0;
181 else if (nodes.size() % 2 == 1)
182 return nodes[nodes.size() / 2];
183 else
184 return (nodes[nodes.size() / 2 - 1] + nodes[nodes.size() / 2]) / 2;
185 }
◆ err()
double err |
( |
double |
x | ) |
const |
|
inline |
get error of spline at point x
Definition at line 174 of file tools.h.
174{
return eval(nodes, errs, x);}
double eval(const std::vector< double > &spl, const std::vector< double > &vals, double x)
Evaluate spline (zero order or first order) in point x.
◆ print()
void print |
( |
TString |
tag = "" | ) |
|
|
inline |
print the spline
Definition at line 188 of file tools.h.
189 {
190 std::cout << tag << " : nodes: ";
191 for (auto n : nodes) {
192 std::cout << n << " ";
193 }
194 std::cout << std::endl;
195 std::cout << tag << " : vals: ";
196 for (auto n : vals) {
197 std::cout << n << " ";
198 }
199 std::cout << std::endl;
200
201 std::cout << tag << " : errs: ";
202 for (auto n : errs) {
203 std::cout << n << " ";
204 }
205 std::cout << std::endl;
206 }
◆ val()
double val |
( |
double |
x | ) |
const |
|
inline |
get value of spline at point x
Definition at line 171 of file tools.h.
171{
return eval(nodes, vals, x);}
◆ errs
vector of spline errors
Definition at line 168 of file tools.h.
◆ nodes
std::vector<double> nodes |
vector of spline nodes
Definition at line 166 of file tools.h.
◆ vals
vector of spline values
Definition at line 167 of file tools.h.
The documentation for this struct was generated from the following file:
- reconstruction/calibration/BeamSpotBoostInvMass/include/tools.h