12 #include <Math/IFunction.h>
13 #include <Math/IntegratorMultiDim.h>
14 #include "Math/AdaptiveIntegratorMultiDim.h"
17 #include "Framework/Conventions/GBuild.h"
34 using namespace genie;
35 using namespace genie::controls;
36 using namespace genie::constants;
63 LOG(
"DISXSec",
pDEBUG) <<
"*** Below energy threshold";
72 init_state.
Tgt().
Z() : init_state.
Tgt().
N();
89 <<
"From XSecSplineList: XSec[DIS,free nucleon] (E = " << Ev <<
" GeV) = " << xsec;
92 LOG(
"DISXSec",
pINFO) <<
"XSec[DIS] (E = " << Ev <<
" GeV) = " << xsec;
107 if(precalc_bare_xsec) {
111 LOG(
"DISXSec",
pINFO) <<
"Finding cache branch with key: " << key;
118 assert(cache_branch);
121 double xsec = cb(Ev);
123 LOG(
"DISXSec",
pINFO) <<
"XSec[DIS] (E = " << Ev <<
" GeV) = " << xsec;
148 <<
"W integration range = [" << Wl.
min <<
", " << Wl.
max <<
"]";
150 <<
"Q2 integration range = [" << Q2l.
min <<
", " << Q2l.
max <<
"]";
153 (Q2l.
min >= 0. && Q2l.
max >= 0. && Q2l.
max >= Q2l.
min &&
159 ROOT::Math::IBaseFunctionMultiDim *
func =
161 ROOT::Math::IntegrationMultiDim::Type ig_type =
166 double kine_min[2] = { Wl.
min, Q2l.
min };
167 double kine_max[2] = { Wl.
max, Q2l.
max };
168 xsec = ig.Integral(kine_min, kine_max) * (1E-38 *
units::cm2);
172 LOG(
"DISXSec",
pINFO) <<
"XSec[DIS] (E = " << Ev <<
" GeV) = " << xsec;
199 int max_eval, min_eval ;
216 <<
"Wait while computing/caching free nucleon DIS xsections first...";
223 assert(!cache_branch);
241 const int nknots_min = (int) (10*(TMath::Log(Emax) - TMath::Log(Emin)));
242 const int nknots = TMath::Max(40, nknots_min);
247 double * E =
new double[nknots];
248 int nkb = (Ethr>Emin) ? 5 : 0;
249 int nka = nknots-nkb;
251 double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
252 for(
int i=0; i<nkb; i++) {
256 double E0 = TMath::Max(Ethr,Emin);
257 double dEa = (TMath::Log10(Emax) - TMath::Log10(E0)) /(nka-1);
258 for(
int i=0; i<nka; i++) {
259 E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i * dEa);
263 ROOT::Math::IBaseFunctionMultiDim *
func =
267 for(
int ie=0; ie<nknots; ie++) {
269 TLorentzVector p4(0,0,Ev,Ev);
276 <<
"W integration range = [" << Wl.
min <<
", " << Wl.
max <<
"]";
278 <<
"Q2 integration range = [" << Q2l.
min <<
", " << Q2l.
max <<
"]";
281 (Q2l.
min >= 0. && Q2l.
max >= 0. && Q2l.
max >= Q2l.
min &&
285 ROOT::Math::IntegrationMultiDim::Type ig_type =
290 if (ig_type == ROOT::Math::IntegrationMultiDim::kADAPTIVE) {
291 ROOT::Math::AdaptiveIntegratorMultiDim * cast =
292 dynamic_cast<ROOT::Math::AdaptiveIntegratorMultiDim*
>( ig.GetIntegrator() );
297 double kine_min[2] = { Wl.
min, Q2l.
min };
298 double kine_max[2] = { Wl.
max, Q2l.
max };
299 xsec = ig.Integral(kine_min, kine_max) * (1E-38 *
units::cm2);
304 <<
"Caching: XSec[DIS] (E = " << Ev <<
" GeV) = "
305 << xsec / (1E-38 *
units::cm2) <<
" x 1E-38 cm^2";
323 string algkey = model->
Id().
Key();
324 string ikey = interaction->
AsString();
Cross Section Calculation Interface.
const KPhaseSpace & PhaseSpace(void) const
string fGSLIntgType
name of GSL numerical integrator
void SetProbeP4(const TLorentzVector &P4)
Cross Section Integrator Interface.
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
int HitNucPdg(void) const
A simple [min,max] interval for doubles.
double Threshold(void) const
Energy threshold.
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
A numeric analysis tool class for interpolating 1-D functions.
bool IsNucleus(void) const
void CreateSpline(string type="TSpline3")
static XSecSplineList * Instance()
Range1D_t Q2Lim(void) const
Q2 limits.
double Evaluate(double x) const
string AsString(void) const
void Configure(const Registry &config)
void AddCacheBranch(string key, CacheBranchI *branch)
double Integrate(const XSecAlgorithmI *model, const Interaction *i) const
XSecIntegratorI interface implementation.
Summary information for an interaction.
void AddValues(double x, double y)
bool BareXSecPreCalc(void) const
const UInt_t kINoNuclearCorrection
if set, inhibit nuclear corrections
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
static constexpr double cm2
string CacheBranchKey(string k0, string k1="", string k2="") const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
virtual void Configure(const Registry &config)
void CacheFreeNucleonXSec(const XSecAlgorithmI *model, const Interaction *in) const
double func(double x, double y)
static const double kASmallNum
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
virtual const AlgId & Id(void) const
Get algorithm ID.
int fGSLMaxEval
GSL max evaluations.
static RunOpt * Instance(void)
A registry. Provides the container for algorithm configuration parameters.
const UInt_t kIAssumeFreeNucleon
Target * TgtPtr(void) const
bool IsAboveThreshold(void) const
Checks whether the interaction is above the energy threshold.
InitialState * InitStatePtr(void) const
const InitialState & InitState(void) const
string CacheBranchName(const XSecAlgorithmI *model, const Interaction *in) const
bool GetParamDef(const RgKey &name, T &p, const T &def) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
const Target & Tgt(void) const
static Cache * Instance(void)
A simple cache branch storing the cached data in a TNtuple.
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
List of cross section vs energy splines.
double ProbeE(RefFrame_t rf) const
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
int fGSLMinEval
GSL min evaluations. Ignored by some integrators.
Range1D_t WLim(void) const
W limits.
const UInt_t kISkipProcessChk
if set, skip process validity checks
Initial State information.
double fGSLRelTol
required relative tolerance (error)