19 #include <Math/IFunction.h>
20 #include <Math/IntegratorMultiDim.h>
24 #include "Framework/Conventions/GBuild.h"
49 using std::ostringstream;
51 using namespace genie;
52 using namespace genie::controls;
53 using namespace genie::constants;
92 const double Emin = 0.01;
93 const int nknots_min = (int) (10*(TMath::Log(
fEMax)-TMath::Log(Emin)));
94 const int nknots = TMath::Max(100, nknots_min);
95 double * E =
new double[nknots];
97 TLorentzVector p4(0,0,0,0);
109 for(
unsigned int ires = 0; ires < nres; ires++) {
122 assert(!cache_branch);
126 <<
"\n ** Creating cache branch - key = " << key;
129 assert(cache_branch);
133 LOG(
"ReinSehgalResCF",
pNOTICE) <<
"E threshold = " << Ethr;
138 int nkb = (Ethr>Emin) ? 5 : 0;
139 int nka = nknots-nkb;
141 double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
142 for(
int i=0; i<nkb; i++) {
146 double E0 = TMath::Max(Ethr,Emin);
147 double dEa = (TMath::Log10(
fEMax) - TMath::Log10(E0)) /(nka-1);
148 for(
int i=0; i<nka; i++) {
149 E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i * dEa);
153 for(
int ie=0; ie<nknots; ie++) {
156 p4.SetPxPyPzE(0,0,Ev,Ev);
165 <<
"*** Integrating d^2 XSec/dWdQ^2 for R: "
168 <<
"{W} = " << rW.
min <<
", " << rW.
max;
170 <<
"{Q^2} = " << rQ2.
min <<
", " << rQ2.
max;
174 <<
"** Not allowed kinematically, xsec=0";
179 ig.SetFunction(*func);
180 double kine_min[2] = { rW.
min, rQ2.
min };
181 double kine_max[2] = { rW.
max, rQ2.
max };
182 xsec = ig.Integral(kine_min, kine_max) * (1E-38 *
units::cm2);
187 <<
"** Below threshold E = " << Ev <<
" <= " << Ethr;
212 string nc_nuc = ((nucleonpdgc==
kPdgProton) ?
"p" :
"n");
215 intk <<
"ResExcitationXSec/R:" << res_name <<
";nu:" << nupdgc
216 <<
";int:" << it_name << nc_nuc;
219 string ikey = intk.str();
229 ROOT::Math::IBaseFunctionMultiDim(),
238 bool fUsingDisResJoin = fConfig.
GetBool(
"UseDRJoinScheme");
239 double fWcut = 999999;
249 bool fNormBW = fConfig.
GetBoolDef(
"BreitWignerNorm",
true);
252 double fN2ResMaxNWidths = fConfig.
GetDoubleDef(
"MaxNWidthForN2Res", 2.0);
253 double fN0ResMaxNWidths = fConfig.
GetDoubleDef(
"MaxNWidthForN0Res", 6.0);
254 double fGNResMaxNWidths = fConfig.
GetDoubleDef(
"MaxNWidthForGNRes", 4.0);
260 fWcut = MR + fN0ResMaxNWidths * WR;
262 fWcut = MR + fN2ResMaxNWidths * WR;
264 fWcut = MR + fGNResMaxNWidths * WR;
288 if (isfWcutLessfWmin)
290 double W = fWmin+(fWmax-fWmin)*xin[0];
291 fInteraction->KinePtr()->SetW(W);
293 if (Q2l.
min<0 || Q2l.
max<0)
296 fInteraction->KinePtr()->SetQ2(Q2);
297 double xsec = fModel->XSec(fInteraction,
kPSWQ2fE)*(fWmax-fWmin)*(Q2l.
max-Q2l.
min);
300 ROOT::Math::IBaseFunctionMultiDim *
Cross Section Calculation Interface.
RgDbl GetDoubleDef(RgKey key, RgDbl def_opt, bool set_def=true)
const KPhaseSpace & PhaseSpace(void) const
InteractionType_t InteractionTypeId(void) const
string fGSLIntgType
name of GSL numerical integrator
void SetProbeP4(const TLorentzVector &P4)
Cross Section Integrator Interface.
double DoEval(const double *xin) const
double Q2(const Interaction *const i)
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
int HitNucPdg(void) const
A simple [min,max] interval for doubles.
double Threshold(void) const
Energy threshold.
const XSecAlgorithmI * fSingleResXSecModel
void CreateSpline(string type="TSpline3")
const Interaction * fInteraction
double Mass(Resonance_t res)
resonance mass (GeV)
void CacheResExcitationXSec(const Interaction *interaction) const
double Width(Resonance_t res)
resonance width (GeV)
RgDbl GetDouble(RgKey key) const
enum genie::EResonance Resonance_t
string CacheBranchName(Resonance_t r, InteractionType_t it, int nu, int nuc) const
unsigned int NResonances(void) const
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
void SetResonance(Resonance_t res)
void AddCacheBranch(string key, CacheBranchI *branch)
KPhaseSpace * PhaseSpacePtr(void) const
double W(const Interaction *const i)
unsigned int NDim(void) const
Summary information for an interaction.
void AddValues(double x, double y)
#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
double func(double x, double y)
void SetPdgs(int tgt_pdgc, int probe_pdgc)
static const double kASmallNum
virtual ~ReinSehgalRESXSecWithCacheFast()
Resonance_t Resonance(void) const
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
ReinSehgalRESXSecWithCacheFast()
static string AsString(InteractionType_t type)
XclsTag * ExclTagPtr(void) const
virtual const AlgId & Id(void) const
Get algorithm ID.
int fGSLMaxEval
GSL max evaluations.
A registry. Provides the container for algorithm configuration parameters.
void SetHitNucPdg(int pdgc)
const XclsTag & ExclTag(void) const
Target * TgtPtr(void) const
RgBool GetBool(RgKey key) const
InitialState * InitStatePtr(void) const
const InitialState & InitState(void) const
const char * AsString(Resonance_t res)
resonance id -> string
const ProcessInfo & ProcInfo(void) const
const XSecAlgorithmI * fModel
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...
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
RgBool GetBoolDef(RgKey key, RgBool def_opt, bool set_def=true)
d2XSecRESFast_dWQ2_E(const XSecAlgorithmI *m, const Interaction *i)
Range1D_t WLim(void) const
W limits.
int ResonanceIndex(Resonance_t res)
resonance idx, quark model / SU(6)
double fGSLRelTol
required relative tolerance (error)
Resonance_t ResonanceId(unsigned int ires) const