26#include <Math/IFunction.h>
27#include <Math/RootFinder.h>
29#include "Framework/Conventions/GBuild.h"
43using std::ostringstream;
53Algorithm(
"genie::SmithMonizUtils", config)
86 const std::string keyStart =
"RFG-NucRemovalE@Pdg=";
90 for(RgIMap::const_iterator it = entries.begin(); it != entries.end(); ++it)
92 const std::string& key = it->first;
95 if (0 == key.compare(0, keyStart.size(), keyStart.c_str()))
97 pdg = atoi(key.c_str() + keyStart.size());
100 if (0 !=
pdg && 0 != Z)
102 ostringstream key_ss ;
103 key_ss << keyStart <<
pdg;
104 RgKey rgkey = key_ss.str();
107 eb = TMath::Max(eb, 0.);
108 fNucRmvE.insert(map<int,double>::value_type(Z,eb));
121 const InitialState & init_state = interaction -> InitState();
122 const Target & target = init_state.
Tgt();
138 TParticlePDG * nucl_fin = pdglib->
Find( nucl_pdg_fin );
140 m_fin = nucl_fin -> Mass();
156 int Zf = (is_p) ? Zi-1 : Zi;
162 <<
"Unknwown nuclear target! No target with code: "
167 m_rnu = nucl_f -> Mass();
189 if(is_p)
P_Fermi *= TMath::Power( 2.*Z/A, 1./3);
191 P_Fermi *= TMath::Power( 2.*N/A, 1./3);
197 map<int,double>::const_iterator it =
fNucRmvE.find(Z);
216 const int MFC = 10000;
217 const double EPSABS = 0.;
218 const double EPSREL = 1.0e-08;
226 E_min = TMath::Max(E_min, E_min2);
234 ROOT::Math::RootFinder rfgb(ROOT::Math::RootFinder::kGSL_BRENT);
236 if ( rfgb.Solve(QEL_EnuMin_SM_, E_min, 50., MFC, EPSABS, EPSREL) )
241 E_min = TMath::Max(E_min, 0.);
250 const double EPS = 1.0e-06;
251 const double Delta= 1.0e-14;
252 const double Precision = std::numeric_limits<double>::epsilon();
256 double E_nu_CM = (s-
mm_tar)/2/TMath::Sqrt(s);
258 double E_l_CM = (s+
mm_lep-W2)/2/TMath::Sqrt(s);
259 double P_l_CM = E_l_CM>
m_lep?TMath::Sqrt(E_l_CM*E_l_CM-
mm_lep):Precision;
261 double Q2_lim1 = 2*E_nu_CM*(E_l_CM-P_l_CM)-
mm_lep;
262 double Q2_lim2 = 2*E_nu_CM*(E_l_CM+P_l_CM)-
mm_lep;
268 DMINFC(Q2lim1_SM_,Q2_lim1,Q2_lim2,EPS,Delta,Q2_0,F_MIN,LLM);
319 const int MFC = 1000;
320 const double EPS = 1.0e-08;
321 const double Delta= 1.0e-14;
322 const double EPSABS = 0;
323 const double EPSREL = 1.0e-08;
324 const double Precision = std::numeric_limits<double>::epsilon();
332 double E_nu_CM = (s-
mm_ini)/2/TMath::Sqrt(s);
334 double E_l_CM = (s+
mm_lep-W2)/2/TMath::Sqrt(s);
335 double P_l_CM = E_l_CM>
m_lep?TMath::Sqrt(E_l_CM*E_l_CM-
mm_lep):Precision;
337 double Q2_min = 2*E_nu_CM*(E_l_CM-P_l_CM)-
mm_lep;
338 double Q2_max = 2*E_nu_CM*(E_l_CM+P_l_CM)-
mm_lep;
339 Q2_min= TMath::Max(Q2_min,0.0);
347 double E_nu_CM = (s-
mm_tar)/2/TMath::Sqrt(s);
349 double E_l_CM = (s+
mm_lep-W2)/2/TMath::Sqrt(s);
350 double P_l_CM = E_l_CM>
m_lep?TMath::Sqrt(E_l_CM*E_l_CM-
mm_lep):Precision;
352 double Q2_min = 2*E_nu_CM*(E_l_CM-P_l_CM)-
mm_lep;
353 double Q2_max = 2*E_nu_CM*(E_l_CM+P_l_CM)-
mm_lep;
359 DMINFC(Q2lim1_SM_,Q2_min,Q2_max,EPS,Delta,Q2_0,F_MIN,LLM);
363 <<
"No overlapped area for energy " <<
E_nu <<
"\n" <<
364 "Q2_min=" << Q2_min <<
" Q2_max=" << Q2_max <<
"\n" <<
365 "Q2_0=" << Q2_0 <<
" F_MIN=" << F_MIN;
374 ROOT::Math::RootFinder rfgb(ROOT::Math::RootFinder::kGSL_BRENT);
376 if (rfgb.Solve(Q2lim1_SM_, Q2_min, Q2_0, MFC, EPSABS, EPSREL))
386 ROOT::Math::RootFinder rfgb(ROOT::Math::RootFinder::kGSL_BRENT);
388 if (rfgb.Solve(Q2lim1_SM_, Q2_0, Q2_max, MFC, EPSABS, EPSREL))
399 LOG(
"SmithMoniz",
pWARN) <<
"The RFG model is not applicable! The cross section is set zero!";
407 ROOT::Math::RootFinder rfgb(ROOT::Math::RootFinder::kGSL_BRENT);
409 if (rfgb.Solve(Q2lim2_SM_, Q2_min,Q2_max, MFC, EPSABS, EPSREL))
415 Q2_min = TMath::Max(Q2_min,0.0);
440 double tmp1 =
a*(E-
E_BIN);
441 double tmp2 =
P_Fermi*TMath::Sqrt(
a*
a+Q2*b);
443 double nu_1 = (tmp1-tmp2)/b;
444 double nu_2 = (tmp1+tmp2)/b;
446 nu_min= TMath::Max(nu_min,nu_1);
448 nu_max= TMath::Min(nu_max,nu_2);
454 return Range1D_t(0.5*(nu_min+nu_max),0.5*(nu_min+nu_max));
462 const double EPS = 1.0e-08;
463 const double Delta= 1.0e-14;
472 DMINFC(vlim1_SM_,Q2_min,Q2_max,EPS,Delta,Q2_0,F_MIN,LLM);
482 const double EPS = 1.0e-08;
483 const double Delta= 1.0e-14;
492 DMINFC(vlim2_SM_,Q2_min,Q2_max,EPS,Delta,Q2_0,F_MIN,LLM);
509 nu_min= TMath::Max(nu_min,nu_1);
524 nu_max= TMath::Min(nu_max,nu_2);
531 double qv = TMath::Sqrt(nu*nu+Q2);
532 double c_f = (nu-
E_BIN)/qv;
535 double Ef_min= TMath::Max(
m_ini*(c_f*d_f+TMath::Sqrt(1.0-c_f*c_f+d_f*d_f))/(1.0-c_f*c_f), TMath::Sqrt(
P_Fermi*
P_Fermi+
mm_ini)-nu);
536 double kF_min=
P_Fermi!=0?TMath::Sqrt(TMath::Max(Ef_min*Ef_min-
mm_ini,0.0)):0.;
542 R =
Range1D_t(0.5*(kF_min+kF_max),0.5*(kF_min+kF_max));
550 const double W5 = TMath::Sqrt(5);
551 const double HV = (3-W5)/2;
552 const double HW = (W5-1)/2;
553 const double R1 = 1.0;
554 const double HF = R1/2;
557 if(A!=B) N = TMath::Nint(2.08*TMath::Log(TMath::Abs((A-B)/EPS)));
567 double V, FV, W, FW, H;
575 LLM = TMath::Abs(X-A)>DELTA && TMath::Abs(X-B)>DELTA;
623 return 1.0/(1.0 + TMath::Exp(-(
P_Fermi-p)/T_Fermi));
641 return TMath::ACos((v + (
mm_lep-v*v+qv*qv)/2/
E_nu)/qv);
664 const int kNQ2 = 101;
667 double dQ2 = (rQ2.
max-rQ2.
min)/(kNQ2-1);
668 for(
int iq2=0; iq2<kNQ2-1; iq2++)
670 double Q2 = rQ2.
min + iq2*dQ2;
672 double dv = (rv.
max-rv.
min)/(kNv-1);
673 for(
int iv=0; iv<kNv-1; iv++)
675 double v = rv.
min + iv*dv;
677 double dkF = (rkF.
max-rkF.
min);
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
virtual const Registry & GetConfig(void) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
Singleton class to load & serve tables of Fermi momentum constants.
const FermiMomentumTable * GetTable(string name)
static FermiMomentumTablePool * Instance(void)
A table of Fermi momentum constants.
double FindClosestKF(int target_pdgc, int nucleon_pdgc) const
Initial State information.
const Target & Tgt(void) const
double ProbeE(RefFrame_t rf) const
Summary information for an interaction.
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
const InitialState & InitState(void) const
Singleton class to load & serve a TDatabasePDG.
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
A simple [min,max] interval for doubles.
A registry. Provides the container for algorithm configuration parameters.
const RgIMap & GetItemMap(void) const
virtual ~SmithMonizUtils()
double m_fin
Mass of final hadron or hadron system (GeV)
double vlim2_SM(double Q2) const
double mm_tar
Squared mass of target nucleus (GeV)
Range1D_t Q2QES_SM_lim(void) const
double E_nu
Neutrino energy (GeV)
double m_rnu
Mass of residual nucleus (GeV)
double GetTheta_p(double pv, double v, double qv, double &E_p) const
void Configure(const Registry &config)
double mm_ini
Sqared mass of initial hadron or hadron system (GeV)
void DMINFC(Functor1D &F, double A, double B, double EPS, double DELTA, double &X, double &Y, bool &LLM) const
double P_Fermi
Maximum value of Fermi momentum of target nucleon (GeV)
static double rho(double P_Fermi, double T_Fermi, double p)
double E_nu_thr_SM(void) const
double mm_fin
Squared mass of final hadron or hadron system (GeV)
double E_BIN
Binding energy (GeV)
void SetInteraction(const Interaction *i)
const Interaction * fInteraction
double PhaseSpaceVolume(KinePhaseSpace_t ps) const
Range1D_t vQES_SM_lim(double Q2) const
double Q2lim1_SM(double Q2, double Enu) const
map< int, double > fNucRmvE
double mm_lep
Squared mass of final charged lepton (GeV)
double m_tar
Mass of target nucleus (GeV)
double QEL_EnuMin_SM(double E_nu) const
double m_lep
Mass of final charged lepton (GeV)
double m_ini
Mass of initial hadron or hadron system (GeV)
double GetTheta_k(double v, double qv) const
double GetBindingEnergy(void) const
double mm_rnu
Squared mass of residual nucleus (GeV)
Range1D_t kFQES_SM_lim(double nu, double Q2) const
double vlim1_SM(double Q2) const
double Q2lim2_SM(double Q2) const
double vQES_SM_min(double Q2min, double Q2max) const
double GetFermiMomentum(void) const
double vQES_SM_max(double Q2min, double Q2max) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
int HitNucPdg(void) const
double HitNucMass(void) const
bool HitNucIsSet(void) const
Utilities for improving the code readability when using PDG codes.
int IonPdgCode(int A, int Z)
int SwitchProtonNeutron(int pdgc)
int IonPdgCodeToZ(int pdgc)
double FermiMomentumForIsoscalarNucleonParametrization(const Target &target)
double BindEnergyPerNucleon(const Target &target)
double BindEnergyPerNucleonParametrization(const Target &target)
THE MAIN GENIE PROJECT NAMESPACE
map< RgKey, RegistryItemI * > RgIMap
enum genie::EKinePhaseSpace KinePhaseSpace_t