Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
genie::CacheBranchFx Class Reference

A simple cache branch storing the cached data in a TNtuple. More...

#include <CacheBranchFx.h>

Inheritance diagram for genie::CacheBranchFx:
genie::CacheBranchI

Public Member Functions

 CacheBranchFx ()
 
 CacheBranchFx (string name)
 
 ~CacheBranchFx ()
 
const map< double, double > & Map (void) const
 
SplineSpl (void) const
 
void CreateSpline (void)
 
void AddValues (double x, double y)
 
void Reset (void)
 
void Print (ostream &stream) const
 
double operator() (double x) const
 
- Public Member Functions inherited from genie::CacheBranchI
virtual ~CacheBranchI ()
 

Private Member Functions

void Init (void)
 
void CleanUp (void)
 

Private Attributes

string fName
 cache branch name More...
 
map< double, double > fFx
 x->y map More...
 
SplinefSpline
 spline y = f(x) More...
 

Friends

ostream & operator<< (ostream &stream, const CacheBranchFx &cbntp)
 

Additional Inherited Members

- Protected Member Functions inherited from genie::CacheBranchI
 CacheBranchI ()
 

Detailed Description

A simple cache branch storing the cached data in a TNtuple.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

November 26, 2004

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 37 of file CacheBranchFx.h.

Constructor & Destructor Documentation

CacheBranchFx::CacheBranchFx ( void  )

Definition at line 27 of file CacheBranchFx.cxx.

27  :
29 {
30  this->Init();
31 }
CacheBranchFx::CacheBranchFx ( string  name)

Definition at line 33 of file CacheBranchFx.cxx.

33  :
35 {
36  this->Init();
37  fName = name;
38 }
static QCString name
Definition: declinfo.cpp:673
string fName
cache branch name
Definition: CacheBranchFx.h:62
CacheBranchFx::~CacheBranchFx ( )

Definition at line 40 of file CacheBranchFx.cxx.

41 {
42  this->CleanUp();
43 }

Member Function Documentation

void CacheBranchFx::AddValues ( double  x,
double  y 
)

Definition at line 63 of file CacheBranchFx.cxx.

64 {
65  fFx.insert(map<double,double>::value_type(x,y));
66 }
map< double, double > fFx
x->y map
Definition: CacheBranchFx.h:63
list x
Definition: train.py:276
void CacheBranchFx::CleanUp ( void  )
private

Definition at line 51 of file CacheBranchFx.cxx.

52 {
53  if(fSpline) delete fSpline;
54  fFx.clear();
55 }
map< double, double > fFx
x->y map
Definition: CacheBranchFx.h:63
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:64
void CacheBranchFx::CreateSpline ( void  )

Definition at line 68 of file CacheBranchFx.cxx.

69 {
70  int n = fFx.size();
71  double * x = new double[n];
72  double * y = new double[n];
73 
74  int i=0;
76  for( ; iter !=fFx.end(); ++iter) {
77  x[i] = iter->first;
78  y[i] = iter->second;
79  i++;
80  }
81 
82  if(fSpline) delete fSpline;
83  fSpline = new Spline(n,x,y);
84 
85  delete [] x;
86  delete [] y;
87 }
map< double, double > fFx
x->y map
Definition: CacheBranchFx.h:63
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:46
intermediate_table::const_iterator const_iterator
std::void_t< T > n
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:64
list x
Definition: train.py:276
void CacheBranchFx::Init ( void  )
private

Definition at line 45 of file CacheBranchFx.cxx.

46 {
47  fName = "";
48  fSpline = 0;
49 }
string fName
cache branch name
Definition: CacheBranchFx.h:62
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:64
const map<double,double>& genie::CacheBranchFx::Map ( void  ) const
inline

Definition at line 46 of file CacheBranchFx.h.

46 { return fFx; }
map< double, double > fFx
x->y map
Definition: CacheBranchFx.h:63
double CacheBranchFx::operator() ( double  x) const

Definition at line 95 of file CacheBranchFx.cxx.

96 {
97  if(!fSpline) return 0;
98  else return fSpline->Evaluate(x);
99 }
double Evaluate(double x) const
Definition: Spline.cxx:361
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:64
list x
Definition: train.py:276
void CacheBranchFx::Print ( ostream &  stream) const

Definition at line 89 of file CacheBranchFx.cxx.

90 {
91  stream << "type: [CacheBranchFx] - nentries: " << fFx.size()
92  << " / spline: " << ((fSpline) ? "built" : "null");
93 }
map< double, double > fFx
x->y map
Definition: CacheBranchFx.h:63
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:64
void CacheBranchFx::Reset ( void  )

Definition at line 57 of file CacheBranchFx.cxx.

58 {
59  this->CleanUp();
60  this->Init();
61 }
Spline* genie::CacheBranchFx::Spl ( void  ) const
inline

Definition at line 47 of file CacheBranchFx.h.

47 { return fSpline; }
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:64

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const CacheBranchFx cbntp 
)
friend

Definition at line 20 of file CacheBranchFx.cxx.

21  {
22  cbntp.Print(stream);
23  return stream;
24  }
void Print(ostream &stream) const

Member Data Documentation

map<double,double> genie::CacheBranchFx::fFx
private

x->y map

Definition at line 63 of file CacheBranchFx.h.

string genie::CacheBranchFx::fName
private

cache branch name

Definition at line 62 of file CacheBranchFx.h.

Spline* genie::CacheBranchFx::fSpline
private

spline y = f(x)

Definition at line 64 of file CacheBranchFx.h.


The documentation for this class was generated from the following files: