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 "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+3.10-2.17-e17-debug/GENIE-Generator/src/Framework/Utils/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
 

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)
 

Detailed Description

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

Author
Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

November 26, 2004

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

Definition at line 38 of file CacheBranchFx.h.

Constructor & Destructor Documentation

CacheBranchFx::CacheBranchFx ( void  )

Definition at line 36 of file CacheBranchFx.cxx.

References Init().

36  :
38 {
39  this->Init();
40 }
CacheBranchFx::CacheBranchFx ( string  name)

Definition at line 42 of file CacheBranchFx.cxx.

References fName, and Init().

42  :
44 {
45  this->Init();
46  fName = name;
47 }
const XML_Char * name
Definition: expat.h:151
string fName
cache branch name
Definition: CacheBranchFx.h:63
CacheBranchFx::~CacheBranchFx ( )

Definition at line 49 of file CacheBranchFx.cxx.

References CleanUp().

50 {
51  this->CleanUp();
52 }

Member Function Documentation

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

Definition at line 60 of file CacheBranchFx.cxx.

References fFx, and fSpline.

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

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

Definition at line 77 of file CacheBranchFx.cxx.

References fFx, fSpline, MECModelEnuComparisons::i, getGoodRuns4SAM::n, submit_syst::x, and submit_syst::y.

Referenced by genie::DISXSec::CacheFreeNucleonXSec(), genie::DMDISXSec::CacheFreeNucleonXSec(), genie::QELEventGeneratorSM::CacheMaxDiffv(), genie::KineGeneratorWithCache::CacheMaxXSec(), genie::QELEventGeneratorSM::CacheMaxXSec2(), genie::ReinSehgalRESXSecWithCache::CacheResExcitationXSec(), genie::ReinSehgalRESXSecWithCacheFast::CacheResExcitationXSec(), genie::QPMDISPXSec::DISRESJoinSuppressionFactor(), genie::QPMDMDISPXSec::DMDISRESJoinSuppressionFactor(), and Spl().

78 {
79  int n = fFx.size();
80  double * x = new double[n];
81  double * y = new double[n];
82 
83  int i=0;
84  map<double,double>::const_iterator iter = fFx.begin();
85  for( ; iter !=fFx.end(); ++iter) {
86  x[i] = iter->first;
87  y[i] = iter->second;
88  i++;
89  }
90 
91  if(fSpline) delete fSpline;
92  fSpline = new Spline(n,x,y);
93 
94  delete [] x;
95  delete [] y;
96 }
map< double, double > fFx
x->y map
Definition: CacheBranchFx.h:64
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:47
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:65
void CacheBranchFx::Init ( void  )
private

Definition at line 54 of file CacheBranchFx.cxx.

References fName, and fSpline.

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

55 {
56  fName = "";
57  fSpline = 0;
58 }
string fName
cache branch name
Definition: CacheBranchFx.h:63
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:65
const map<double,double>& genie::CacheBranchFx::Map ( void  ) const
inline
double CacheBranchFx::operator() ( double  x) const

Definition at line 104 of file CacheBranchFx.cxx.

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

Referenced by Spl().

105 {
106  if(!fSpline) return 0;
107  else return fSpline->Evaluate(x);
108 }
double Evaluate(double x) const
Definition: Spline.cxx:362
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:65
void CacheBranchFx::Print ( ostream &  stream) const

Definition at line 98 of file CacheBranchFx.cxx.

References fFx, and fSpline.

Referenced by genie::operator<<(), and Spl().

99 {
100  stream << "type: [CacheBranchFx] - nentries: " << fFx.size()
101  << " / spline: " << ((fSpline) ? "built" : "null");
102 }
map< double, double > fFx
x->y map
Definition: CacheBranchFx.h:64
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:65
void CacheBranchFx::Reset ( void  )

Definition at line 66 of file CacheBranchFx.cxx.

References CleanUp(), and Init().

Referenced by Spl().

67 {
68  this->CleanUp();
69  this->Init();
70 }
Spline* genie::CacheBranchFx::Spl ( void  ) const
inline

Friends And Related Function Documentation

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

Definition at line 29 of file CacheBranchFx.cxx.

Referenced by Spl().

30  {
31  cbntp.Print(stream);
32  return stream;
33  }
void Print(ostream &stream) const

Member Data Documentation

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

x->y map

Definition at line 64 of file CacheBranchFx.h.

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

string genie::CacheBranchFx::fName
private

cache branch name

Definition at line 63 of file CacheBranchFx.h.

Referenced by CacheBranchFx(), and Init().

Spline* genie::CacheBranchFx::fSpline
private

spline y = f(x)

Definition at line 65 of file CacheBranchFx.h.

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


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