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 <costas.andreopoulos \at stfc.ac.uk>
9  University of Liverpool & STFC Rutherford Appleton Lab
10 
11 \created November 26, 2004
12 
13 \cpright Copyright (c) 2003-2019, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15  or see $GENIE/LICENSE
16 */
17 //____________________________________________________________________________
18 
19 #ifndef _CACHE_BRANCH_FUNC_X_H_
20 #define _CACHE_BRANCH_FUNC_X_H_
21 
22 #include <iostream>
23 #include <string>
24 #include <map>
25 
28 
29 using std::string;
30 using std::ostream;
31 using std::map;
32 
33 namespace genie {
34 
35 class CacheBranchFx;
36 ostream & operator << (ostream & stream, const CacheBranchFx & cbntp);
37 
39 {
40 public:
41  using TObject::Print; // suppress clang 'hides overloaded virtual function [-Woverloaded-virtual]' warnings
42 
43  CacheBranchFx();
44  CacheBranchFx(string name);
46 
47  const map<double,double> & Map (void) const { return fFx; }
48  Spline * Spl (void) const { return fSpline; }
49 
50  void CreateSpline(void);
51  void AddValues(double x, double y);
52 
53  void Reset (void);
54  void Print (ostream & stream) const;
55 
56  double operator () (double x) const;
57  friend ostream & operator << (ostream & stream, const CacheBranchFx & cbntp);
58 
59 private:
60  void Init (void);
61  void CleanUp (void);
62 
63  string fName; ///< cache branch name
64  map<double,double> fFx; ///< x->y map
65  Spline * fSpline; ///< spline y = f(x)
66 
67 ClassDef(CacheBranchFx,1)
68 };
69 
70 } // genie namespace
71 #endif // _CACHE_BRANCH_FUNC_X_H_
72 
const XML_Char * name
Definition: expat.h:151
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
void Print(ostream &stream) const
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
string fName
cache branch name
Definition: CacheBranchFx.h:63
friend ostream & operator<<(ostream &stream, const CacheBranchFx &cbntp)
void AddValues(double x, double y)
Spline * Spl(void) const
Definition: CacheBranchFx.h:48
Spline * fSpline
spline y = f(x)
Definition: CacheBranchFx.h:65
void Print(std::string prefix, std::string name, std::string suffix="")
Definition: nue_pid_effs.C:68
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:47
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:38
The TObject at the root of concrete cache branches.
Definition: CacheBranchI.h:26
enum BeamMode string