INukeOsetTable.h
Go to the documentation of this file.
1 /**
2  * @brief Table-based implementation of Oset model
3  *
4  * @author Tomasz Golan
5  * @date 2015
6  * @warning Applicable for pion with Tk < 350 MeV
7  * @remarks
8  * Tables taken from NuWro's implementation of:
9  * E. Oset et al., Nucl. Phys. A484 (1988) 557-592
10  *
11  * This implementation is kept from historical reasons.
12  * Due to different approach to cascade in GENIE and NuWro there are some normalization issues.
13  * Default Oset model can be found in INukeOsetFormula
14  *
15 */
16 
17 #ifndef INUKE_OSET_TABLE_H
18 #define INUKE_OSET_TABLE_H
19 
20 #include "INukeOset.h"
21 #include <vector>
22 #include <string>
23 
24 // handle tables with Oset cross sections
25 class INukeOsetTable : public INukeOset
26 {
27  public:
28 
29  //! constructor
30  INukeOsetTable (const char* filename);
31 
32  //! use to set up Oset class (assign pion Tk, nuclear density etc)
33  void setupOset (const double &density, const double &pionTk, const int &pionPDG, const double &protonFraction);
34 
35  private:
36 
37  //! quasi-elastic piN cross section
38  /*! vector contains values in the following order:
39  * d0 e0, d0 e1, ... , d0 en, d1 e0 ... \n
40  * channel = 0 -> pi+n or pi-p, 1 -> pi+p or pi-n, 2 -> pi0
41  */
42  std::vector <double> fQelCrossSectionTable [fNChannels];
43 
44  //! charge-exchange piN cross section
45  /*! vector contains values in the following order:
46  * d0 e0, d0 e1, ... , d0 en, d1 e0 ... \n
47  * channel = 0 -> pi+n or pi-p, 1 -> pi+p or pi-n, 2 -> pi0
48  */
49  std::vector <double> fCexCrossSectionTable [fNChannels];
50 
51  //! pi absorption cross section
52  /*! vector contains values in the following order:
53  * d0 e0, d0 e1, ... , d0 en, d1 e0 ...
54  */
55  std::vector <double> fAbsorptionCrossSectionTable;
56 
57  unsigned int fNDensityBins; //!< number of denisty bins
58  unsigned int fNEnergyBins; //!< number of energy bins
59  double fDensityBinWidth; //!< density step (must be fixed)
60  double fEnergyBinWidth; //!< energy step (must be fixed)
61 
62  //! interpolate cross section (method fixed for Oset tables)
63  double interpolate (const std::vector<double> &data) const;
64 
65  //! process single line from table file, push values to proper vector (method fixed for Oset tables)
66  int processLine (const std::string &line);
67 
68  //! check if data in file is consistent (method fixed for Oset tables)
69  int checkIntegrity (const double &densityValue, const double &energyValue);
70 
71  //! stop program and through an error if input file is corrupted (method fixed for Oset tables)
72  void badFile (const char* file, const int &errorCode, const int &line = 0) const;
73 
74  //! calculalte cross sections for each channel
75  void setCrossSections ();
76 
77  //! handle table's index and weights for given density and energy
78  struct PointHandler
79  {
80  double value; //!< exact value as read from table
81  double lowWeight; //!< distance from high boundary
82  double highWeight; //!< distance from low boundary
83  int index; //!< point index = index of low boundary
84  double binWidth; //!< bin width used to calculate distances
85  int nBins; //!< nBins to check isEdge
86  bool isEdge; //!< true if value is on edge of table (should never happen)
87 
88  PointHandler () : value (-1.0) {}; //!< constructor
89 
90  //! set up binWidth and nBins
91  inline void setHandler (const double &width, const int &bins)
92  {
93  binWidth = width;
94  nBins = bins;
95  }
96 
97  void update (const double &newValue); //!< update point if changed
98  };
99 
100  PointHandler fDensityHandler; //!< nuclear density handler
101  PointHandler fEnergyHandler; //!< pion kinetic energy handler
102 };
103 
104 #endif // INUKE_OSET_TABLE_H
double interpolate(const std::vector< double > &data) const
interpolate cross section (method fixed for Oset tables)
double lowWeight
distance from high boundary
void update(const double &newValue)
update point if changed
double fEnergyBinWidth
energy step (must be fixed)
std::string string
Definition: nybbler.cc:12
Table-based implementation of Oset model.
PointHandler fDensityHandler
nuclear density handler
int index
point index = index of low boundary
double highWeight
distance from low boundary
string filename
Definition: train.py:213
bool isEdge
true if value is on edge of table (should never happen)
static const unsigned int fNChannels
number of possible channels: pi+n, pi+p, pi0
Definition: INukeOset.h:81
PointHandler fEnergyHandler
pion kinetic energy handler
std::vector< double > fCexCrossSectionTable[fNChannels]
charge-exchange piN cross section
double binWidth
bin width used to calculate distances
void setHandler(const double &width, const int &bins)
constructor
handle table&#39;s index and weights for given density and energy
unsigned int fNEnergyBins
number of energy bins
double fDensityBinWidth
density step (must be fixed)
void setupOset(const double &density, const double &pionTk, const int &pionPDG, const double &protonFraction)
use to set up Oset class (assign pion Tk, nuclear density etc)
int processLine(const std::string &line)
process single line from table file, push values to proper vector (method fixed for Oset tables) ...
INukeOsetTable(const char *filename)
constructor
double value
exact value as read from table
void line(double t, double *p, double &x, double &y, double &z)
void setCrossSections()
calculalte cross sections for each channel
int checkIntegrity(const double &densityValue, const double &energyValue)
check if data in file is consistent (method fixed for Oset tables)
void badFile(const char *file, const int &errorCode, const int &line=0) const
stop program and through an error if input file is corrupted (method fixed for Oset tables) ...
int nBins
nBins to check isEdge
std::vector< double > fQelCrossSectionTable[fNChannels]
quasi-elastic piN cross section
std::vector< double > fAbsorptionCrossSectionTable
pi absorption cross section
unsigned int fNDensityBins
number of denisty bins