INukeOset.h
Go to the documentation of this file.
1 /**
2  * @brief Oset model handler (abstract class)
3  *
4  * @author Tomasz Golan
5  * @date 2015
6  * @warning Applicable for pion with Tk < 350 MeV
7  * @remarks Based on E. Oset et al., Nucl. Phys. A484 (1988) 557-592
8  *
9 */
10 
11 #ifndef INUKE_OSET_H
12 #define INUKE_OSET_H
13 
14 #include <cmath>
15 #include <limits>
16 
20 
21 using namespace genie;
22 using namespace genie::constants;
23 
24 class INukeOset
25 {
26  public:
27 
28  INukeOset (); //!< contructor
29 
30  //! use to set up Oset class (assign pion Tk, nuclear density etc)
31  virtual void setupOset (const double &density, const double &pionTk, const int &pionPDG,
32  const double &protonFraction) = 0;
33 
34  //! return total = (qel+cex+abs) cross section
35  inline double getTotalCrossSection () const
36  {
37  return fTotalCrossSection;
38  }
39 
40  //! return cex cross section
41  inline double getCexCrossSection () const
42  {
43  return fCexCrossSection;
44  }
45 
46  //! return absorption cross section
47  inline double getAbsorptionCrossSection () const
48  {
49  return fAbsorptionCrossSection;
50  }
51 
52  //! return fraction of cex events
53  inline double getCexFraction () const
54  {
55  return fCexCrossSection / fTotalCrossSection;
56  }
57 
58  //! return fraction of absorption events
59  inline double getAbsorptionFraction () const
60  {
61  return fAbsorptionCrossSection / fTotalCrossSection;
62  }
63 
64  protected:
65 
66  double fNuclearDensity; //!< nuclear density in fm-3
67  double fPionKineticEnergy; //!< pion kinetic energy in MeV
68 
69  //! el+cex+abs cross section (averaged over proton / neutron fraction)
71  //! cex cross section (averaged over proton / neutron fraction)
73  //! absorption cross section (averaged over proton / neutron fraction)
75 
76  //! number of possible channels: pi+n, pi+p, pi0
77  /*! if (pi0) channel = 2 \n
78  * else channel = [(10 * pip + pim) == (10 * p + n)] \n \n
79  * 0 -> pi+n or pi-p, 1 -> pi+p or pi-n, 2 -> pi0
80  */
81  static const unsigned int fNChannels = 3;
82 
83  //! total qel (el+cex) cross section for each channel
84  double fQelCrossSections[fNChannels];
85  double fCexCrossSections[fNChannels]; //!< cex cross section for each channel
86 
87  //! calculalte cross sections for each channel
88  virtual void setCrossSections () = 0;
89 
90  //! calculate avg cross sections according to proton / neutron fraction
91  void setCrossSections (const int &pionPDG,
92  const double &protonFraction);
93 };
94 
95 namespace osetUtils
96 {
97  // workaround to get access to last instance
98  extern INukeOset* currentInstance;
99  // check if double == double with defined accuracy
100  inline bool isEqual (const double &x, const double &y,
101  const double &epsilon)
102  {
103  return std::abs(x - y) < epsilon;
104  }
105  // check if double == double with best accuracy
106  inline bool isEqual (const double &x, const double &y)
107  {
108  static const double epsilon = std::numeric_limits<double>::epsilon();
109  return isEqual (x, y, epsilon);
110  }
111  // x -> variale, a->coefficients
112  inline double quadraticFunction (const double &x, const double *a)
113  {
114  return a[0] * x * x + a[1] * x + a[2];
115  }
116 } // namespace osetUtils
117 
118 #endif // INUKE_OSET_H
Basic constants.
INukeOset * currentInstance
Definition: INukeOset.cxx:5
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
bool isEqual(float x1, float x2)
double fCexCrossSection
cex cross section (averaged over proton / neutron fraction)
Definition: INukeOset.h:72
double getAbsorptionCrossSection() const
return absorption cross section
Definition: INukeOset.h:47
double fPionKineticEnergy
pion kinetic energy in MeV
Definition: INukeOset.h:67
double quadraticFunction(const double &x, const double *a)
Definition: INukeOset.h:112
double fTotalCrossSection
el+cex+abs cross section (averaged over proton / neutron fraction)
Definition: INukeOset.h:70
double getAbsorptionFraction() const
return fraction of absorption events
Definition: INukeOset.h:59
double getCexCrossSection() const
return cex cross section
Definition: INukeOset.h:41
T abs(T value)
double getTotalCrossSection() const
return total = (qel+cex+abs) cross section
Definition: INukeOset.h:35
double getCexFraction() const
return fraction of cex events
Definition: INukeOset.h:53
const double a
double fAbsorptionCrossSection
absorption cross section (averaged over proton / neutron fraction)
Definition: INukeOset.h:74
list x
Definition: train.py:276
double fNuclearDensity
nuclear density in fm-3
Definition: INukeOset.h:66
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...