12#include <Math/IFunction.h>
13#include <Math/IntegratorMultiDim.h>
14#include "Math/AdaptiveIntegratorMultiDim.h"
17#include "Framework/Conventions/GBuild.h"
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();
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
virtual const AlgId & Id(void) const
Get algorithm ID.
A simple cache branch storing the cached data in a TNtuple.
void CreateSpline(string type="TSpline3")
void AddValues(double x, double y)
string CacheBranchKey(string k0, string k1="", string k2="") const
void AddCacheBranch(string key, CacheBranchI *branch)
static Cache * Instance(void)
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
void CacheFreeNucleonXSec(const XSecAlgorithmI *model, const Interaction *in) const
string CacheBranchName(const XSecAlgorithmI *model, const Interaction *in) const
void Configure(const Registry &config)
double Integrate(const XSecAlgorithmI *model, const Interaction *i) const
XSecIntegratorI interface implementation.
Initial State information.
const Target & Tgt(void) const
void SetProbeP4(const TLorentzVector &P4)
double ProbeE(RefFrame_t rf) const
Target * TgtPtr(void) const
Summary information for an interaction.
string AsString(void) const
InitialState * InitStatePtr(void) const
const KPhaseSpace & PhaseSpace(void) const
const InitialState & InitState(void) const
double Threshold(void) const
Energy threshold.
bool IsAboveThreshold(void) const
Checks whether the interaction is above the energy threshold.
Range1D_t WLim(void) const
W limits.
Range1D_t Q2Lim(void) const
Q2 limits.
A simple [min,max] interval for doubles.
A registry. Provides the container for algorithm configuration parameters.
bool BareXSecPreCalc(void) const
static RunOpt * Instance(void)
A numeric analysis tool class for interpolating 1-D functions.
double Evaluate(double x) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
int HitNucPdg(void) const
bool IsNucleus(void) const
Cross Section Calculation Interface.
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
int fGSLMinEval
GSL min evaluations. Ignored by some integrators.
string fGSLIntgType
name of GSL numerical integrator
int fGSLMaxEval
GSL max evaluations.
double fGSLRelTol
required relative tolerance (error)
List of cross section vs energy splines.
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
static XSecSplineList * Instance()
double func(double x, double y)
Misc GENIE control constants.
static const double kASmallNum
static constexpr double cm2
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
THE MAIN GENIE PROJECT NAMESPACE
const UInt_t kINoNuclearCorrection
if set, inhibit nuclear corrections
const UInt_t kISkipProcessChk
if set, skip process validity checks
const UInt_t kIAssumeFreeNucleon