GENIEGenerator
Loading...
Searching...
No Matches
XSecSplineList.h
Go to the documentation of this file.
1//____________________________________________________________________________
2/*!
3
4\class genie::XSecSplineList
5
6\brief List of cross section vs energy splines
7
8\author Costas Andreopoulos <c.andreopoulos \at cern.ch>
9 University of Liverpool
10
11\created May 12, 2005
12
13\cpright Copyright (c) 2003-2025, The GENIE Collaboration
14 For the full text of the license visit http://copyright.genie-mc.org
15*/
16//____________________________________________________________________________
17
18#ifndef _XSEC_SPLINE_LIST_H_
19#define _XSEC_SPLINE_LIST_H_
20
21#include <ostream>
22#include <map>
23#include <set>
24#include <vector>
25#include <string>
26
28
29using std::map;
30using std::set;
31using std::pair;
32using std::vector;
33using std::string;
34using std::ostream;
35
36namespace genie {
37
38class XSecAlgorithmI;
39class Interaction;
40class Spline;
41
42class XSecSplineList;
43ostream & operator << (ostream & stream, const XSecSplineList & xsl);
44
46
47public:
48
49 static XSecSplineList * Instance();
50
51 // Save/load to/from XML file
52 void SaveAsXml (const string & filename, bool save_init = true) const;
53 XmlParserStatus_t LoadFromXml (const string & filename, bool keep = false);
54
55 // Print available splines
56 void Print (ostream & stream) const;
57 friend ostream & operator << (ostream & stream, const XSecSplineList & xsl);
58
59 // Set and query current tune.
60 // An XSecSplineList can keep splines for numerous tunes and pick the appropriate
61 // one for each process, as instructed.
62 void SetCurrentTune (const string & tune) { fCurrentTune = tune; }
63 string CurrentTune (void) const { return fCurrentTune; }
64 bool HasSplineFromTune( const string & tune ) const { return fSplineMap.count(tune) > 0 ; }
65
66 // Query the existence, access or create a spline
67 // The results of the following methods depend on the current tune setting
68 bool SplineExists (const XSecAlgorithmI * alg, const Interaction * i) const;
69 bool SplineExists (string spline_key) const;
70 const Spline * GetSpline (const XSecAlgorithmI * alg, const Interaction * i) const;
71 const Spline * GetSpline (string spline_key) const;
72 void CreateSpline (const XSecAlgorithmI * alg, const Interaction * i,
73 int nknots = -1, double e_min = -1, double e_max = -1);
74 int NSplines (void) const;
75 bool IsEmpty (void) const;
76
77 // Methods for building / getting keys
78 // The results of the following methods depend on the current tune setting
79 string BuildSplineKey(const XSecAlgorithmI * alg, const Interaction * i) const;
80 const vector<string> * GetSplineKeys(void) const;
81
82
83 // XSecSplineList options
84 void SetLogE (bool on); ///< set opt to build splines as f(E) or as f(logE)
85 void SetNKnots (int nk); ///< set default number of knots for building the spline
86 void SetMinE (double Ev); ///< set default minimum energy for xsec splines
87 void SetMaxE (double Ev); ///< set default maximum energy for xsec splines
88 bool UseLogE (void) const { return fUseLogE; }
89 int NKnots (void) const { return fNKnots; }
90 double Emin (void) const { return fEmin; }
91 double Emax (void) const { return fEmax; }
92
93private:
94
96 XSecSplineList(const XSecSplineList & spline_list);
97 virtual ~XSecSplineList();
98
100
103 double fEmin;
104 double fEmax;
105
106 string fCurrentTune; ///< The `active' tune, out the many that can co-exist
107
108 map<string, map<string, Spline *> > fSplineMap; ///< tune -> { xsec_alg/xsec_config/interaction -> Spline }
109 map<string, set<string> > fLoadedSplineSet; ///< tune -> { set of initialy loaded splines }
110
120 friend struct Cleaner;
121};
122
123} // genie namespace
124
125#endif // _XSEC_SPLINE_LIST_H_
Summary information for an interaction.
Definition Interaction.h:56
A numeric analysis tool class for interpolating 1-D functions.
Definition Spline.h:58
Cross Section Calculation Interface.
List of cross section vs energy splines.
void SetMinE(double Ev)
set default minimum energy for xsec splines
void SaveAsXml(const string &filename, bool save_init=true) const
XSecSplineList(const XSecSplineList &spline_list)
string CurrentTune(void) const
void SetLogE(bool on)
set opt to build splines as f(E) or as f(logE)
map< string, map< string, Spline * > > fSplineMap
tune -> { xsec_alg/xsec_config/interaction -> Spline }
bool UseLogE(void) const
string fCurrentTune
The ‘active’ tune, out the many that can co-exist.
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
double Emax(void) const
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
bool IsEmpty(void) const
string BuildSplineKey(const XSecAlgorithmI *alg, const Interaction *i) const
XmlParserStatus_t LoadFromXml(const string &filename, bool keep=false)
map< string, set< string > > fLoadedSplineSet
tune -> { set of initialy loaded splines }
static XSecSplineList * Instance()
void SetMaxE(double Ev)
set default maximum energy for xsec splines
void CreateSpline(const XSecAlgorithmI *alg, const Interaction *i, int nknots=-1, double e_min=-1, double e_max=-1)
void SetNKnots(int nk)
set default number of knots for building the spline
double Emin(void) const
friend ostream & operator<<(ostream &stream, const XSecSplineList &xsl)
static XSecSplineList * fInstance
void SetCurrentTune(const string &tune)
void Print(ostream &stream) const
int NKnots(void) const
bool HasSplineFromTune(const string &tune) const
const vector< string > * GetSplineKeys(void) const
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
enum genie::EXmlParseStatus XmlParserStatus_t
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)