16 #include <Math/IFunction.h>
17 #include <Math/IntegratorMultiDim.h>
18 #include "Math/AdaptiveIntegratorMultiDim.h"
21 #include "Framework/Conventions/GBuild.h"
38 using namespace genie;
39 using namespace genie::controls;
40 using namespace genie::constants;
67 LOG(
"DMDISXSec",
pDEBUG) <<
"*** Below energy threshold";
76 init_state.
Tgt().
Z() : init_state.
Tgt().
N();
93 <<
"From XSecSplineList: XSec[DIS,free nucleon] (E = " << Ed <<
" GeV) = " << xsec;
96 LOG(
"DMDISXSec",
pINFO) <<
"XSec[DIS] (E = " << Ed <<
" GeV) = " << xsec;
111 if(precalc_bare_xsec) {
115 LOG(
"DMDISXSec",
pINFO) <<
"Finding cache branch with key: " << key;
122 assert(cache_branch);
125 double xsec = cb(Ed);
127 LOG(
"DMDISXSec",
pINFO) <<
"XSec[DIS] (E = " << Ed <<
" GeV) = " << xsec;
152 <<
"W integration range = [" << Wl.
min <<
", " << Wl.
max <<
"]";
154 <<
"Q2 integration range = [" << Q2l.
min <<
", " << Q2l.
max <<
"]";
157 (Q2l.
min >= 0. && Q2l.
max >= 0. && Q2l.
max >= Q2l.
min &&
163 ROOT::Math::IBaseFunctionMultiDim *
func =
165 ROOT::Math::IntegrationMultiDim::Type ig_type =
170 double kine_min[2] = { Wl.
min, Q2l.
min };
171 double kine_max[2] = { Wl.
max, Q2l.
max };
172 xsec = ig.Integral(kine_min, kine_max) * (1E-38 *
units::cm2);
176 LOG(
"DMDISXSec",
pINFO) <<
"XSec[DIS] (E = " << Ed <<
" GeV) = " << xsec;
203 int max_eval, min_eval ;
220 <<
"Wait while computing/caching free nucleon DIS xsections first...";
227 assert(!cache_branch);
245 const int nknots_min = (int) (10*(TMath::Log(Emax) - TMath::Log(Emin)));
246 const int nknots = TMath::Max(40, nknots_min);
251 double * E =
new double[nknots];
252 int nkb = (Ethr>Emin) ? 5 : 0;
253 int nka = nknots-nkb;
255 double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
256 for(
int i=0; i<nkb; i++) {
260 double E0 = TMath::Max(Ethr,Emin);
261 double dEa = (TMath::Log10(Emax) - TMath::Log10(E0)) /(nka-1);
262 for(
int i=0; i<nka; i++) {
263 E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i * dEa);
267 ROOT::Math::IBaseFunctionMultiDim *
func =
273 for(
int ie=0; ie<nknots; ie++) {
274 LOG(
"DMDISXSec",
pDEBUG) <<
"Dealing with knot " << ie <<
" out of " << nknots;
276 double pd = TMath::Max(Ed*Ed - Md2,0.);
277 pd = TMath::Sqrt(pd);
278 TLorentzVector p4(0,0,pd,Ed);
285 <<
"W integration range = [" << Wl.
min <<
", " << Wl.
max <<
"]";
287 <<
"Q2 integration range = [" << Q2l.
min <<
", " << Q2l.
max <<
"]";
290 (Q2l.
min >= 0. && Q2l.
max >= 0. && Q2l.
max >= Q2l.
min &&
294 ROOT::Math::IntegrationMultiDim::Type ig_type =
299 if (ig_type == ROOT::Math::IntegrationMultiDim::kADAPTIVE) {
300 ROOT::Math::AdaptiveIntegratorMultiDim * cast =
301 dynamic_cast<ROOT::Math::AdaptiveIntegratorMultiDim*
>( ig.GetIntegrator() );
305 double kine_min[2] = { Wl.
min, Q2l.
min };
306 double kine_max[2] = { Wl.
max, Q2l.
max };
307 xsec = ig.Integral(kine_min, kine_max) * (1E-38 *
units::cm2);
312 <<
"Caching: XSec[DMDIS] (E = " << Ed <<
" GeV) = "
313 << xsec / (1E-38 *
units::cm2) <<
" x 1E-38 cm^2";
331 string algkey = model->
Id().
Key();
332 string ikey = interaction->
AsString();
Cross Section Calculation Interface.
double Integrate(const XSecAlgorithmI *model, const Interaction *i) const
XSecIntegratorI interface implementation.
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
void Configure(const Registry &config)
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")
void CacheFreeNucleonXSec(const XSecAlgorithmI *model, const Interaction *in) const
static XSecSplineList * Instance()
Range1D_t Q2Lim(void) const
Q2 limits.
double Evaluate(double x) const
string AsString(void) const
void AddCacheBranch(string key, CacheBranchI *branch)
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)
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
string CacheBranchName(const XSecAlgorithmI *model, const Interaction *in) const
bool IsAboveThreshold(void) const
Checks whether the interaction is above the energy threshold.
InitialState * InitStatePtr(void) const
const InitialState & InitState(void) 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.
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) const
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)