22 #include <Math/IFunction.h>
23 #include <Math/IntegratorMultiDim.h>
24 #include <Math/AdaptiveIntegratorMultiDim.h>
28 #include "Framework/Conventions/GBuild.h"
49 using std::ostringstream;
51 using namespace genie;
52 using namespace genie::controls;
53 using namespace genie::constants;
94 const double Emin = xsl -> Emin() ;
95 const double Emax = std::min(
fEMax, xsl -> Emax() ) ;
97 const int nknots = xsl -> NKnots() ;
99 vector<double> E( nknots, 0. ) ;
117 assert(!cache_branch);
121 <<
"\n ** Creating cache branch - key = " << key;
124 assert(cache_branch);
129 LOG(
"SPPCache",
pNOTICE) <<
"E threshold = " << Ethr;
134 int nkb = (Ethr>Emin) ? 5 : 0;
135 int nka = nknots-nkb;
137 double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
138 for(
int i=0; i<nkb; i++) {
142 double E0 = TMath::Max(Ethr,Emin);
143 double dEa = (TMath::Log10(Emax) - TMath::Log10(E0)) /(nka-1);
144 for(
int i=0; i<nka; i++) {
145 E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i*dEa);
149 for(
int ie=0; ie<nknots; ie++) {
153 TLorentzVector p4(0., 0., Ev, Ev);
159 <<
"*** Integrating d^3 XSec/dWdQ^2dCosTheta for Ch: "
165 if (ig_type == ROOT::Math::IntegrationMultiDim::kADAPTIVE)
167 ROOT::Math::AdaptiveIntegratorMultiDim * cast =
dynamic_cast<ROOT::Math::AdaptiveIntegratorMultiDim*
>( ig.GetIntegrator() );
171 ig.SetFunction(func);
172 double kine_min[3] = { 0., 0., 0.};
173 double kine_max[3] = { 1., 1., 1.};
174 xsec = ig.Integral(kine_min, kine_max)*(1E-38 *
units::cm2);;
177 LOG(
"SPPCache",
pINFO) <<
"** Below threshold E = " << Ev <<
" <= " << Ethr;
187 <<
", E="<< Ev <<
") = "<< xsec <<
" x 1E-38 cm^2";
206 intk <<
"ResSPPXSec/Ch:" << spp_channel_name << nc_nuc << nupdgc
207 <<
";int:" << it_name;
210 string ikey = intk.str();
220 ROOT::Math::IBaseFunctionMultiDim(),
233 const InitialState & init_state = interaction -> InitState();
237 if (Enu < kps->Threshold_SPP_iso())
263 if (isZero)
return 0.;
265 double W2 = Wl.min*Wl.min + (Wl.max*Wl.max - Wl.min*Wl.min)*xin[0];
266 fInteraction->KinePtr()->SetW(TMath::Sqrt(W2));
270 double sqrt_Q2 = TMath::Sqrt(Q2l.
min) + ( TMath::Sqrt(Q2l.
max) - TMath::Sqrt(Q2l.
min) )*xin[1];
271 fInteraction->KinePtr()->SetQ2(sqrt_Q2*sqrt_Q2);
273 fInteraction->KinePtr()->SetKV(
kKVctp, -1. + 2.*xin[2]);
275 double xsec = fModel->XSec(fInteraction,
kPSWQ2ctpfE)*sqrt_Q2*(Wl.max*Wl.max - Wl.min*Wl.min)*(TMath::Sqrt(Q2l.
max) - TMath::Sqrt(Q2l.
min))*2/TMath::Sqrt(W2);
278 ROOT::Math::IBaseFunctionMultiDim *
double DoEval(const double *xin) const
Cross Section Calculation Interface.
static SppChannel_t FromInteraction(const Interaction *interaction)
const KPhaseSpace & PhaseSpace(void) const
InteractionType_t InteractionTypeId(void) const
string fGSLIntgType
name of GSL numerical integrator
bool IsNeutrino(int pdgc)
void SetProbeP4(const TLorentzVector &P4)
Cross Section Integrator Interface.
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
int HitNucPdg(void) const
~d3XSecMK_dWQ2CosTheta_E()
A simple [min,max] interval for doubles.
unsigned int NDim(void) const
void CreateSpline(string type="TSpline3")
double Threshold_SPP_iso(void) const
Energy limit for resonance single pion production on isoscalar nucleon.
static XSecSplineList * Instance()
void AddCacheBranch(string key, CacheBranchI *branch)
enum genie::ESppChannel SppChannel_t
KPhaseSpace * PhaseSpacePtr(void) const
static string AsString(SppChannel_t channel)
Summary information for an interaction.
void AddValues(double x, double y)
string CacheBranchName(SppChannel_t spp_channel, InteractionType_t it, int nu) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
static constexpr double cm2
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
virtual ~SPPXSecWithCache()
string CacheBranchKey(string k0, string k1="", string k2="") const
const XSecAlgorithmI * fSinglePionProductionXSecModel
double func(double x, double y)
void SetPdgs(int tgt_pdgc, int probe_pdgc)
static const double kASmallNum
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
d3XSecMK_dWQ2CosTheta_E(const XSecAlgorithmI *m, const Interaction *i, double wcut)
static string AsString(InteractionType_t type)
virtual const AlgId & Id(void) const
Get algorithm ID.
Interaction * fInteraction
int fGSLMaxEval
GSL max evaluations.
void CacheResExcitationXSec(const Interaction *interaction) const
void SetHitNucPdg(int pdgc)
Target * TgtPtr(void) const
Range1D_t WLim_SPP_iso(void) const
W limits for resonance single pion production on isoscalar nucleon.
InitialState * InitStatePtr(void) const
const InitialState & InitState(void) const
const ProcessInfo & ProcInfo(void) const
const Target & Tgt(void) const
static Cache * Instance(void)
A simple cache branch storing the cached data in a TNtuple.
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
List of cross section vs energy splines.
double ProbeE(RefFrame_t rf) const
static constexpr double m
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
enum genie::EInteractionType InteractionType_t
int fGSLMinEval
GSL min evaluations. Ignored by some integrators.
const UInt_t kISkipProcessChk
if set, skip process validity checks
Initial State information.
double fGSLRelTol
required relative tolerance (error)