GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CacheBranchFx.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::CacheBranchFx
5 
6 \brief A simple cache branch storing the cached data in a TNtuple
7 
8 \author Costas Andreopoulos <c.andreopoulos \at cern.ch>
9  University of Liverpool
10 
11  Update May 15, 2022 IK:
12  Now type of spline can be: TSpline3, TSpline5 and
13  ROOT::Math::GSLInterpolator (LINEAR, POLYNOMIAL, CSPLINE, CSPLINE_PERIODIC,
14  AKIMA, AKIMA_PERIODIC)
15 
16 \ref [1] GENIE docdb 297
17 
18 \author Costas Andreopoulos <c.andreopoulos \at cern.ch>
19  University of Liverpool \n
20  Igor Kakorin <kakorin@jinr.ru>
21  Joint Institute for Nuclear Research
22 
23 \created November 26, 2004
24 
25 \cpright Copyright (c) 2003-2024, The GENIE Collaboration
26  For the full text of the license visit http://copyright.genie-mc.org
27 */
28 //____________________________________________________________________________
29 
30 #ifndef _CACHE_BRANCH_FUNC_X_H_
31 #define _CACHE_BRANCH_FUNC_X_H_
32 
33 #include <iostream>
34 #include <string>
35 #include <map>
36 
39 
40 using std::string;
41 using std::ostream;
42 using std::map;
43 
44 namespace genie {
45 
46 class CacheBranchFx;
47 ostream & operator << (ostream & stream, const CacheBranchFx & cbntp);
48 
50 {
51 public:
52  using TObject::Print; // suppress clang 'hides overloaded virtual function [-Woverloaded-virtual]' warnings
53 
54  CacheBranchFx();
55  CacheBranchFx(string name);
57 
58  const map<double,double> & Map (void) const { return fFx; }
59  Spline * Spl (void) const { return fSpline; }
60 
61  void CreateSpline(string type = "TSpline3");
62  void AddValues(double x, double y);
63 
64  void Reset (void);
65  void Print (ostream & stream) const;
66 
67  double operator () (double x) const;
68  friend ostream & operator << (ostream & stream, const CacheBranchFx & cbntp);
69 
70 private:
71  void Init (void);
72  void CleanUp (void);
73 
74  string fName; ///< cache branch name
75  map<double,double> fFx; ///< x->y map
76  Spline * fSpline; ///< spline y = f(x)
77 
78 ClassDef(CacheBranchFx,1)
79 };
80 
81 } // genie namespace
82 #endif // _CACHE_BRANCH_FUNC_X_H_
void Print(ostream &stream) const
map< double, double > fFx
x-&gt;y map
Definition: CacheBranchFx.h:75
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:58
string fName
cache branch name
Definition: CacheBranchFx.h:74
void CreateSpline(string type="TSpline3")
friend ostream & operator<<(ostream &stream, const CacheBranchFx &cbntp)
void AddValues(double x, double y)
Spline * Spl(void) const
Definition: CacheBranchFx.h:59
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:76
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:58
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
double operator()(double x) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:49
The TObject at the root of concrete cache branches.
Definition: CacheBranchI.h:25