MECUtils.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \namespace genie::utils::mec
5 
6 \brief MEC utilities
7 
8 \author
9 
10 \created
11 
12 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
13  For the full text of the license visit http://copyright.genie-mc.org
14 */
15 //____________________________________________________________________________
16 
17 #ifndef _MEC_UTILS_H_
18 #define _MEC_UTILS_H_
19 
21 #include <Math/IFunction.h>
22 #include <Math/IntegratorMultiDim.h>
24 
25 namespace genie {
26 
27 class Interaction;
28 class XSecAlgorithmI;
29 
30 namespace utils {
31 namespace mec {
32 
33  // ---------------------- this should be removed (is replaced by code below)
34  //
35  // Kinematic calculation: Give q0q3 (and Enu and lepton mass) and
36  // return muon KE and costheta, and jacobian area.
37  // Contributed by R.Gran.
38  double GetTmuCostFromq0q3(
39  double dq0, double dq3, double Enu, double lmass, double &tmu, double &cost, double &area);
40  // -----------------------
41 
42 
43  //----------------------- once in trunk, this could be copied in KineUtils
44  // Kinematic calculations:
45  // Get lepton KE and costheta from q0, q3 (and Enu and lepton mass)
46  bool GetTlCostlFromq0q3(
47  double q0, double q3, double Enu, double ml, double & Tl, double & costl);
48  // Get q0, q3 from lepton KE and costheta (and Enu and lepton mass)
49  bool Getq0q3FromTlCostl(
50  double Tl, double costl, double Enu, double ml, double & q0, double & q3);
51  //----------------------- once in trunk, this could be embedded in KineUtils::Jacobian()
52  // Jacobian for tranformation of d2sigma / dT dcostl to d2sigma / dq0 dq3
53  double J(double q0, double q3, double Enu, double ml);
54  //----------------------
55 
56 
57  // Utility that encodes the Qvalues for the kinematic calculation.
58  // this is used in the code that contracts the hadron tensor with the lepton tensor
59  // Contributed by R.Gran.
60  double Qvalue(int targetpdg, int nupdg);
61 
62 
63  //Version of the tesor contraction in GENIE 2.12.X (modified to use new hadron tensor pool) for debugging purposes
64  //double OldTensorContraction(int nupdg, int targetpdg, double Enu, double Ml, double Tl, double costhl, int tensorpdg, genie::HadronTensorType_t tensor_type, char* tensor_model);
65  double OldTensorContraction(int nupdg, int targetpdg, double Enu, double Ml, double Tl, double costhl, int tensorpdg, genie::HadronTensorType_t tensor_type, char* tensor_model );
66 
67  // Performs a brute-force scan of the kPSTlctl phase space to compute the
68  // maximum value of the differential cross section within a specified
69  // tolerance. An optional safety factor can be applied to the final result.
70  // This function is used by MECGenerator::SelectSuSALeptonKinematics() during
71  // rejection sampling. -- S. Gardiner, 16 March 2020
72  double GetMaxXSecTlctl( const XSecAlgorithmI& xsec_model,
73  const Interaction& inter, const double tolerance = 0.01,
74  const double safety_factor = 1.2, const int max_n_layers = 100 );
75 
76  // Hard-coded bounds for the scan over phase space in GetMaxXSecTlctl.
77  // These are based on the upper limits in the current set of SuSAv2 hadron
78  // tensor tables. In the future, it would be good to refactor GetMaxXSecTlctl
79  // to retrieve these bounds from the relevant hadron tensor model itself.
80  // - S. Gardiner
81 
82  // Maximum tabulated energy transfer (GeV)
83  const double Q0LimitMaxXSec = 2.;
84 
85  // Maximum tabulated momentum transfer (GeV)
86  const double QMagLimitMaxXSec = 2.;
87 
88  namespace gsl {
89  //_____________________________________________________________________________________
90  //
91  // GSL wrappers
92  //
93  //_____________________________________________________________________________________
94 
95  class d2Xsec_dTCosth: public ROOT::Math::IBaseFunctionMultiDim
96  {
97  public:
98  d2Xsec_dTCosth(const XSecAlgorithmI * m, const Interaction & i, const double Enu,
99  const double LepMass, const double Factor = 1. );
100  ~d2Xsec_dTCosth();
101  // ROOT::Math::IBaseFunctionMultiDim interface
102  unsigned int NDim (void) const;
103  double DoEval (const double * xin) const;
104  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
105 
106  private:
109  const double fEnu ;
110  const double fLepMass ;
111  const double fFactor;
112  };
113 
114  }
115 } // mec namespace
116 } // utils namespace
117 } // genie namespace
118 
119 #endif // _MEC_UTILS_H_
Cross Section Calculation Interface.
bool GetTlCostlFromq0q3(double q0, double q3, double Enu, double ml, double &Tl, double &costl)
Definition: MECUtils.cxx:82
double J(double q0, double q3, double Enu, double ml)
Definition: MECUtils.cxx:147
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
double GetMaxXSecTlctl(const XSecAlgorithmI &xsec_model, const Interaction &inter, const double tolerance=0.01, const double safety_factor=1.2, const int max_n_layers=100)
Definition: MECUtils.cxx:334
auto const tolerance
const double Q0LimitMaxXSec
Definition: MECUtils.h:83
enum genie::HadronTensorType HadronTensorType_t
double Qvalue(int targetpdg, int nupdg)
Definition: MECUtils.cxx:164
Summary information for an interaction.
Definition: Interaction.h:56
bool Getq0q3FromTlCostl(double Tl, double costl, double Enu, double ml, double &q0, double &q3)
Definition: MECUtils.cxx:121
unsigned int NDim(void) const
Definition: MECUtils.cxx:487
double DoEval(const double *xin) const
Definition: MECUtils.cxx:492
d2Xsec_dTCosth(const XSecAlgorithmI *m, const Interaction &i, const double Enu, const double LepMass, const double Factor=1.)
Definition: MECUtils.cxx:470
const XSecAlgorithmI * fModel
Definition: MECUtils.h:107
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
Definition: MECUtils.cxx:521
Definition: utils.py:1
const double QMagLimitMaxXSec
Definition: MECUtils.h:86
double GetTmuCostFromq0q3(double dq0, double dq3, double Enu, double lmass, double &tmu, double &cost, double &area)
Definition: MECUtils.cxx:33
double OldTensorContraction(int nupdg, int targetpdg, double Enu, double Ml, double Tl, double costhl, int tensorpdg, genie::HadronTensorType_t tensor_type, char *tensor_model)
Definition: MECUtils.cxx:208