16#include <Math/IFunction.h>
17#include <Math/IntegratorMultiDim.h>
18#include "Math/AdaptiveIntegratorMultiDim.h"
21#include "Framework/Conventions/GBuild.h"
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();
#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
double Integrate(const XSecAlgorithmI *model, const Interaction *i) const
XSecIntegratorI interface implementation.
string CacheBranchName(const XSecAlgorithmI *model, const Interaction *in) const
void Configure(const Registry &config)
void CacheFreeNucleonXSec(const XSecAlgorithmI *model, const Interaction *in) const
Initial State information.
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) const
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