GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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:
Inheritance graph
[legend]
Collaboration diagram for genie::CacheBranchFx:
Collaboration graph
[legend]

Public Member Functions

 CacheBranchFx ()
 
 CacheBranchFx (string name)
 
 ~CacheBranchFx ()
 
const map< double, double > & Map (void) const
 
SplineSpl (void) const
 
void CreateSpline (string type="TSpline3")
 
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 <c.andreopoulos cern.ch> University of Liverpool

Update May 15, 2022 IK: Now type of spline can be: TSpline3, TSpline5 and ROOT::Math::GSLInterpolator (LINEAR, POLYNOMIAL, CSPLINE, CSPLINE_PERIODIC, AKIMA, AKIMA_PERIODIC)

References:
[1] GENIE docdb 297
Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Igor Kakorin kakor.nosp@m.in@j.nosp@m.inr.r.nosp@m.u Joint Institute for Nuclear Research
Created:
November 26, 2004
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 49 of file CacheBranchFx.h.

Constructor & Destructor Documentation

CacheBranchFx::CacheBranchFx ( void  )

Definition at line 27 of file CacheBranchFx.cxx.

References Init().

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

Definition at line 33 of file CacheBranchFx.cxx.

References fName, and Init().

33  :
35 {
36  this->Init();
37  fName = name;
38 }
string fName
cache branch name
Definition: CacheBranchFx.h:74
const char * name
CacheBranchFx::~CacheBranchFx ( )

Definition at line 40 of file CacheBranchFx.cxx.

References CleanUp().

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

Member Function Documentation

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

Definition at line 51 of file CacheBranchFx.cxx.

References fFx, and fSpline.

Referenced by Reset(), and ~CacheBranchFx().

52 {
53  if(fSpline) delete fSpline;
54  fFx.clear();
55 }
map< double, double > fFx
x-&gt;y map
Definition: CacheBranchFx.h:75
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:76
void CacheBranchFx::CreateSpline ( string  type = "TSpline3")

Definition at line 68 of file CacheBranchFx.cxx.

References fFx, fSpline, and genie::Spline::SetType().

Referenced by genie::DISXSec::CacheFreeNucleonXSec(), genie::DMDISXSec::CacheFreeNucleonXSec(), genie::KineGeneratorWithCache::CacheMaxXSec(), genie::ReinSehgalRESXSecWithCache::CacheResExcitationXSec(), genie::SPPXSecWithCache::CacheResExcitationXSec(), genie::ReinSehgalRESXSecWithCacheFast::CacheResExcitationXSec(), and genie::KNOTunedQPMDISPXSec::DISRESJoinSuppressionFactor().

69 {
70  int n = fFx.size();
71  double * x = new double[n];
72  double * y = new double[n];
73 
74  int i=0;
75  map<double,double>::const_iterator iter = fFx.begin();
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  fSpline->SetType(type);
85 
86  delete [] x;
87  delete [] y;
88 }
map< double, double > fFx
x-&gt;y map
Definition: CacheBranchFx.h:75
void SetType(string type)
Definition: Spline.cxx:769
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:58
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:76
void CacheBranchFx::Init ( void  )
private

Definition at line 45 of file CacheBranchFx.cxx.

References fName, and fSpline.

Referenced by CacheBranchFx(), and Reset().

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

Definition at line 58 of file CacheBranchFx.h.

References fFx.

Referenced by genie::KineGeneratorWithCache::CacheMaxXSec(), and genie::KineGeneratorWithCache::FindMaxXSec().

58 { return fFx; }
map< double, double > fFx
x-&gt;y map
Definition: CacheBranchFx.h:75
double CacheBranchFx::operator() ( double  x) const

Definition at line 96 of file CacheBranchFx.cxx.

References genie::Spline::Evaluate(), and fSpline.

97 {
98  if(!fSpline) return 0;
99  else return fSpline->Evaluate(x);
100 }
double Evaluate(double x) const
Definition: Spline.cxx:363
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:76
void CacheBranchFx::Print ( ostream &  stream) const

Definition at line 90 of file CacheBranchFx.cxx.

References fFx, and fSpline.

Referenced by genie::operator<<().

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

Definition at line 57 of file CacheBranchFx.cxx.

References CleanUp(), and Init().

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

Definition at line 59 of file CacheBranchFx.h.

References fSpline.

Referenced by genie::KineGeneratorWithCache::CacheMaxXSec(), and genie::KineGeneratorWithCache::FindMaxXSec().

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

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 75 of file CacheBranchFx.h.

Referenced by AddValues(), CleanUp(), CreateSpline(), Map(), and Print().

string genie::CacheBranchFx::fName
private

cache branch name

Definition at line 74 of file CacheBranchFx.h.

Referenced by CacheBranchFx(), and Init().

Spline* genie::CacheBranchFx::fSpline
private

spline y = f(x)

Definition at line 76 of file CacheBranchFx.h.

Referenced by CleanUp(), CreateSpline(), Init(), operator()(), Print(), and Spl().


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