GENIEGenerator
|
A numeric analysis tool class for interpolating 1-D functions. More...
#include <Spline.h>
Public Member Functions | |
Spline () | |
Spline (string filename, string xtag="", string ytag="", bool is_xml=false) | |
Spline (TNtupleD *ntuple, string xy, string cut="") | |
Spline (TTree *tree, string xy, string cut="") | |
Spline (TSQLServer *db, string query) | |
Spline (int nentries, double x[], double y[]) | |
Spline (int nentries, float x[], float y[]) | |
Spline (const Spline &spline) | |
Spline (const TSpline3 &spline, int nknots) | |
virtual | ~Spline () |
bool | LoadFromXmlFile (string filename, string xtag, string ytag) |
bool | LoadFromAsciiFile (string filename) |
bool | LoadFromNtuple (TNtupleD *nt, string xy, string cut="") |
bool | LoadFromTree (TTree *tr, string xy, string cut="") |
bool | LoadFromDBase (TSQLServer *db, string query) |
bool | LoadFromTSpline3 (const TSpline3 &spline, int nknots) |
int | NKnots (void) const |
void | GetKnot (int iknot, double &x, double &y) const |
double | GetKnotX (int iknot) const |
double | GetKnotY (int iknot) const |
double | XMin (void) const |
double | XMax (void) const |
double | YMax (void) const |
double | Evaluate (double x) const |
bool | IsWithinValidRange (double x) const |
void | SetName (string name) |
string | Name (void) const |
void | YCanBeNegative (bool tf) |
void | SaveAsXml (string filename, string xtag, string ytag, string name="") const |
void | SaveAsXml (ofstream &str, string xtag, string ytag, string name="") const |
void | SaveAsText (string filename, string format="%10.6f\t%10.6f") const |
void | SaveAsROOT (string filename, string name="", bool recreate=false) const |
TGraph * | GetAsTGraph (int np=500, bool xscaling=false, bool inlog=false, double fx=1., double fy=1.) const |
TSpline3 * | GetAsTSpline (void) const |
void | FindClosestKnot (double x, double &xknot, double &yknot, Option_t *opt="-+") const |
bool | ClosestKnotValueIsZero (double x, Option_t *opt="-+") const |
void | Add (const Spline &spl, double c=1) |
void | Multiply (const Spline &spl, double c=1) |
void | Divide (const Spline &spl, double c=1) |
void | Add (double a) |
void | Multiply (double a) |
void | Divide (double a) |
void | SetType (string type) |
string | GetType (void) |
void | Print (ostream &stream) const |
Private Member Functions | |
void | InitSpline (void) |
void | ResetSpline (void) |
void | BuildSpline (int nentries, double x[], double y[]) |
Private Attributes | |
string | fName |
int | fNKnots |
double | fXMin |
double | fXMax |
double | fYMax |
TSpline3 * | fInterpolator |
bool | fYCanBeNegative |
TSpline5 * | fInterpolator5 |
ROOT::Math::Interpolator * | fGSLInterpolator |
string | fInterpolatorType |
Friends | |
ostream & | operator<< (ostream &stream, const Spline &spl) |
A numeric analysis tool class for interpolating 1-D functions.
Uses ROOT's TSpline3 for the actual interpolation and can retrieve function (x,y(x)) pairs from an XML file, a flat ascii file, a TNtuple, a TTree or an SQL database.\n Update May 15, 2022 IK: Adding as extra interpolators TSpline5 and ROOT::Math::GSLInterpolator (LINEAR, POLYNOMIAL, CSPLINE, CSPLINE_PERIODIC, AKIMA, AKIMA_PERIODIC)
Spline::Spline | ( | ) |
Spline::Spline | ( | string | filename, |
string | xtag = "" , |
||
string | ytag = "" , |
||
bool | is_xml = false |
||
) |
Definition at line 57 of file Spline.cxx.
References InitSpline(), LoadFromAsciiFile(), LoadFromXmlFile(), LOG, and pDEBUG.
Spline::Spline | ( | TNtupleD * | ntuple, |
string | xy, | ||
string | cut = "" |
||
) |
Definition at line 73 of file Spline.cxx.
References InitSpline(), LoadFromNtuple(), LOG, and pDEBUG.
Spline::Spline | ( | TTree * | tree, |
string | xy, | ||
string | cut = "" |
||
) |
Definition at line 82 of file Spline.cxx.
References InitSpline(), LoadFromTree(), LOG, and pDEBUG.
Spline::Spline | ( | TSQLServer * | db, |
string | query | ||
) |
Definition at line 91 of file Spline.cxx.
References InitSpline(), LoadFromDBase(), LOG, and pDEBUG.
Spline::Spline | ( | int | nentries, |
double | x[], | ||
double | y[] | ||
) |
Definition at line 100 of file Spline.cxx.
References BuildSpline(), InitSpline(), LOG, and pDEBUG.
Spline::Spline | ( | int | nentries, |
float | x[], | ||
float | y[] | ||
) |
Definition at line 110 of file Spline.cxx.
References BuildSpline(), InitSpline(), LOG, and pDEBUG.
Spline::Spline | ( | const Spline & | spline | ) |
Definition at line 131 of file Spline.cxx.
References GetAsTSpline(), InitSpline(), LoadFromTSpline3(), LOG, NKnots(), and pDEBUG.
Spline::Spline | ( | const TSpline3 & | spline, |
int | nknots | ||
) |
Definition at line 139 of file Spline.cxx.
References InitSpline(), LoadFromTSpline3(), LOG, and pDEBUG.
|
virtual |
Definition at line 148 of file Spline.cxx.
References fGSLInterpolator, fInterpolator, and fInterpolator5.
void Spline::Add | ( | const Spline & | spl, |
double | c = 1 |
||
) |
Definition at line 587 of file Spline.cxx.
References BuildSpline(), Evaluate(), GetKnot(), IsWithinValidRange(), LOG, NKnots(), pERROR, ResetSpline(), XMax(), and XMin().
void Spline::Add | ( | double | a | ) |
Definition at line 670 of file Spline.cxx.
References a, BuildSpline(), GetKnot(), NKnots(), and ResetSpline().
|
private |
Definition at line 750 of file Spline.cxx.
References fInterpolator, fNKnots, fXMax, fXMin, fYMax, LOG, and pDEBUG.
Referenced by Add(), Divide(), LoadFromTree(), LoadFromTSpline3(), LoadFromXmlFile(), Multiply(), and Spline().
bool Spline::ClosestKnotValueIsZero | ( | double | x, |
Option_t * | opt = "-+" |
||
) | const |
Definition at line 561 of file Spline.cxx.
References genie::utils::math::AreEqual(), and FindClosestKnot().
Referenced by Evaluate(), and genie::PhysInteractionSelector::SelectInteraction().
void Spline::Divide | ( | const Spline & | spl, |
double | c = 1 |
||
) |
Definition at line 637 of file Spline.cxx.
References BuildSpline(), Evaluate(), GetKnot(), IsWithinValidRange(), LOG, NKnots(), pERROR, ResetSpline(), XMax(), and XMin().
void Spline::Divide | ( | double | a | ) |
Definition at line 702 of file Spline.cxx.
References a, BuildSpline(), GetKnot(), LOG, NKnots(), pERROR, and ResetSpline().
double Spline::Evaluate | ( | double | x | ) | const |
Definition at line 363 of file Spline.cxx.
References ClosestKnotValueIsZero(), fGSLInterpolator, FindClosestKnot(), fInterpolator, fInterpolator5, fInterpolatorType, fXMax, fXMin, fYCanBeNegative, IsWithinValidRange(), LOG, pDEBUG, and pINFO.
Referenced by Add(), BuildSpectrum(), CalcTotalXSec(), genie::GMCJDriver::ComputeInteractionProbabilities(), genie::GMCJDriver::ComputeProbScales(), genie::NuclearData::DeuteriumSuppressionFactor(), Divide(), genie::GiBUURESFormFactor::FormFactors::FFRes(), genie::KineGeneratorWithCache::FindMaxXSec(), genie::AGCharm2019::GenerateCharmHadron(), GetAsTGraph(), genie::DISXSec::Integrate(), genie::HEDISXSec::Integrate(), genie::DMDISXSec::Integrate(), genie::HELeptonXSec::Integrate(), genie::AlamSimoAtharVacasSKXSec::Integrate(), genie::SPPXSec::Integrate(), genie::ReinSehgalRESXSec::Integrate(), genie::ReinSehgalRESXSecFast::Integrate(), genie::SpectralFunc1d::LoadConfig(), Multiply(), genie::CacheBranchFx::operator()(), SaveGraphsToRootFile(), genie::PhysInteractionSelector::SelectInteraction(), genie::ReinSehgalRESPXSec::XSec(), and genie::GEVGDriver::XSecSum().
void Spline::FindClosestKnot | ( | double | x, |
double & | xknot, | ||
double & | yknot, | ||
Option_t * | opt = "-+" |
||
) | const |
Definition at line 534 of file Spline.cxx.
References fInterpolator.
Referenced by ClosestKnotValueIsZero(), and Evaluate().
TGraph * Spline::GetAsTGraph | ( | int | np = 500 , |
bool | xscaling = false , |
||
bool | inlog = false , |
||
double | fx = 1. , |
||
double | fy = 1. |
||
) | const |
Definition at line 496 of file Spline.cxx.
References Evaluate(), fXMax, and fXMin.
Referenced by SaveToPsFile().
|
inline |
void Spline::GetKnot | ( | int | iknot, |
double & | x, | ||
double & | y | ||
) | const |
Definition at line 326 of file Spline.cxx.
References fInterpolator, LOG, and pWARN.
Referenced by Add(), Divide(), Multiply(), and Print().
double Spline::GetKnotX | ( | int | iknot | ) | const |
Definition at line 335 of file Spline.cxx.
References fInterpolator, LOG, and pWARN.
double Spline::GetKnotY | ( | int | iknot | ) | const |
Definition at line 346 of file Spline.cxx.
References fInterpolator, LOG, and pWARN.
|
inline |
|
private |
Definition at line 723 of file Spline.cxx.
References fGSLInterpolator, fInterpolator, fInterpolator5, fInterpolatorType, fName, fXMax, fXMin, fYCanBeNegative, fYMax, LOG, and pDEBUG.
Referenced by ResetSpline(), and Spline().
bool Spline::IsWithinValidRange | ( | double | x | ) | const |
Definition at line 357 of file Spline.cxx.
Referenced by Add(), Divide(), Evaluate(), and Multiply().
bool Spline::LoadFromAsciiFile | ( | string | filename | ) |
Definition at line 242 of file Spline.cxx.
References LoadFromNtuple(), LOG, and pDEBUG.
Referenced by Spline().
bool Spline::LoadFromDBase | ( | TSQLServer * | db, |
string | query | ||
) |
Definition at line 299 of file Spline.cxx.
Referenced by Spline().
bool Spline::LoadFromNtuple | ( | TNtupleD * | nt, |
string | xy, | ||
string | cut = "" |
||
) |
Definition at line 253 of file Spline.cxx.
References LoadFromTree().
Referenced by LoadFromAsciiFile(), and Spline().
bool Spline::LoadFromTree | ( | TTree * | tr, |
string | xy, | ||
string | cut = "" |
||
) |
Definition at line 261 of file Spline.cxx.
References BuildSpline(), LOG, and pDEBUG.
Referenced by LoadFromNtuple(), and Spline().
bool Spline::LoadFromTSpline3 | ( | const TSpline3 & | spline, |
int | nknots | ||
) |
Definition at line 305 of file Spline.cxx.
References BuildSpline().
Referenced by Spline().
bool Spline::LoadFromXmlFile | ( | string | filename, |
string | xtag, | ||
string | ytag | ||
) |
Definition at line 155 of file Spline.cxx.
References BuildSpline(), genie::utils::xml::GetAttribute(), LOG, pDEBUG, pERROR, pINFO, genie::utils::str::TrimSpaces(), and genie::utils::xml::TrimSpaces().
Referenced by Spline().
void Spline::Multiply | ( | const Spline & | spl, |
double | c = 1 |
||
) |
Definition at line 612 of file Spline.cxx.
References BuildSpline(), Evaluate(), GetKnot(), IsWithinValidRange(), LOG, NKnots(), pERROR, ResetSpline(), XMax(), and XMin().
void Spline::Multiply | ( | double | a | ) |
Definition at line 686 of file Spline.cxx.
References a, BuildSpline(), GetKnot(), NKnots(), and ResetSpline().
|
inline |
|
inline |
Definition at line 84 of file Spline.h.
References fNKnots.
Referenced by Add(), Divide(), Multiply(), Print(), SaveAsText(), SaveAsXml(), and Spline().
void Spline::Print | ( | ostream & | stream | ) | const |
Definition at line 569 of file Spline.cxx.
References GetKnot(), Name(), NKnots(), XMax(), and XMin().
Referenced by genie::operator<<().
|
private |
Definition at line 742 of file Spline.cxx.
References fGSLInterpolator, fInterpolator, fInterpolator5, and InitSpline().
Referenced by Add(), Divide(), and Multiply().
void Spline::SaveAsROOT | ( | string | filename, |
string | name = "" , |
||
bool | recreate = false |
||
) | const |
void Spline::SaveAsText | ( | string | filename, |
string | format = "%10.6f\t%10.6f" |
||
) | const |
Definition at line 464 of file Spline.cxx.
References fInterpolator, LOG, NKnots(), and pERROR.
void Spline::SaveAsXml | ( | string | filename, |
string | xtag, | ||
string | ytag, | ||
string | name = "" |
||
) | const |
Definition at line 419 of file Spline.cxx.
References fName, LOG, and pERROR.
Referenced by genie::XSecSplineList::SaveAsXml().
void Spline::SaveAsXml | ( | ofstream & | str, |
string | xtag, | ||
string | ytag, | ||
string | name = "" |
||
) | const |
|
inline |
void Spline::SetType | ( | string | type | ) |
Definition at line 769 of file Spline.cxx.
References fGSLInterpolator, fInterpolator, fInterpolator5, fInterpolatorType, fNKnots, LOG, pWARN, and genie::utils::str::ToUpper().
Referenced by genie::CacheBranchFx::CreateSpline().
|
inline |
Definition at line 89 of file Spline.h.
References fXMax.
Referenced by Add(), genie::KineGeneratorWithCache::CacheMaxXSec(), Divide(), genie::KineGeneratorWithCache::FindMaxXSec(), Multiply(), and Print().
|
inline |
Definition at line 88 of file Spline.h.
References fXMin.
Referenced by Add(), Divide(), genie::KineGeneratorWithCache::FindMaxXSec(), Multiply(), and Print().
|
inline |
|
inline |
|
friend |
Definition at line 45 of file Spline.cxx.
|
private |
Definition at line 146 of file Spline.h.
Referenced by Evaluate(), InitSpline(), ResetSpline(), SetType(), and ~Spline().
|
private |
Definition at line 143 of file Spline.h.
Referenced by BuildSpline(), Evaluate(), FindClosestKnot(), GetAsTSpline(), GetKnot(), GetKnotX(), GetKnotY(), InitSpline(), ResetSpline(), SaveAsROOT(), SaveAsText(), SaveAsXml(), SetType(), and ~Spline().
|
private |
Definition at line 145 of file Spline.h.
Referenced by Evaluate(), InitSpline(), ResetSpline(), SetType(), and ~Spline().
|
private |
Definition at line 147 of file Spline.h.
Referenced by Evaluate(), GetType(), InitSpline(), and SetType().
|
private |
Definition at line 138 of file Spline.h.
Referenced by InitSpline(), Name(), SaveAsROOT(), SaveAsXml(), and SetName().
|
private |
Definition at line 139 of file Spline.h.
Referenced by BuildSpline(), NKnots(), and SetType().
|
private |
Definition at line 141 of file Spline.h.
Referenced by BuildSpline(), Evaluate(), GetAsTGraph(), InitSpline(), IsWithinValidRange(), and XMax().
|
private |
Definition at line 140 of file Spline.h.
Referenced by BuildSpline(), Evaluate(), GetAsTGraph(), InitSpline(), IsWithinValidRange(), and XMin().
|
private |
Definition at line 144 of file Spline.h.
Referenced by Evaluate(), InitSpline(), and YCanBeNegative().
|
private |
Definition at line 142 of file Spline.h.
Referenced by BuildSpline(), InitSpline(), and YMax().