Belle II Software development
Spline Struct Reference

Spline structure for zero-order & linear splines. More...

#include <tools.h>

Public Member Functions

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
 

Public Attributes

std::vector< double > nodes
 vector of spline nodes
 
std::vector< double > vals
 vector of spline values
 
std::vector< double > errs
 vector of spline errors
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Spline()

Spline ( )
inline

Definition at line 208 of file tools.h.

208: nodes{}, vals{0}, errs{0} {}

Member Function Documentation

◆ center()

double center ( ) const
inline

Get center of the spline domain.

Definition at line 177 of file tools.h.

178 {
179 if (nodes.size() == 0) //dummy situation
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.
Definition: tools.h:115

◆ 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);}

Member Data Documentation

◆ errs

std::vector<double> 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

std::vector<double> vals

vector of spline values

Definition at line 167 of file tools.h.


The documentation for this struct was generated from the following file: