19#include "Framework/Conventions/GBuild.h"
30using std::ostringstream;
54 double hitNucleonRadius)
const
63 TH1D * prob = this->
ProbDistro(target,hitNucleonRadius);
66 <<
"Null nucleon momentum probability distribution";
72 double costheta = -1. + 2. * rnd->
RndGen().Rndm();
73 double sintheta = TMath::Sqrt(1.-costheta*costheta);
74 double fi = 2 *
kPi * rnd->
RndGen().Rndm();
75 double cosfi = TMath::Cos(fi);
76 double sinfi = TMath::Sin(fi);
83 map<int,double>::const_iterator it =
fNucRmvE.find(Z);
89 p = prob->GetRandom();
91 LOG(
"LocalFGM",
pINFO) <<
"|p,nucleon| = " << p;
93 px = p*sintheta*cosfi;
94 py = p*sintheta*sinfi;
106 double T_F = TMath::Sqrt(TMath::Power(nucl_mass,2)+TMath::Power(KF,2)) - nucl_mass;
110 double localEb = T_F;
113 double T_nucl = TMath::Sqrt(TMath::Power(
fCurrMomentum.Mag(),2)+TMath::Power(nucl_mass,2))- nucl_mass;
117 if(it !=
fNucRmvE.end()) q_val_offset = it->second;
141 <<
" ^-- sampled nucleon resulted in negative LFG removal"
142 <<
" energy and was rejected. Resampling ...";
158 const double maxBindE = std::sqrt( target.
Mass()*target.
Mass()
160 LOG(
"LocalFGM",
pDEBUG) <<
" using max removalE = " << maxBindE;
163 LOG(
"LocalFGM",
pDEBUG) <<
" ^-- note: sampled nucleon resulted"
164 <<
" in negative LFG removal energy, so its removal energy was"
165 <<
" resampled from an SRC-like Maxwell-Boltzmann distribution:"
177 double hitNucleonRadius)
const
180 TH1D * prob = this->
ProbDistro(target, hitNucleonRadius);
181 int bin = prob->FindBin(p);
182 double y = prob->GetBinContent(bin);
183 double dx = prob->GetBinWidth(bin);
195 <<
"Computing P = f(p_nucleon) for: " << target.
AsString()
196 <<
", Nucleon Radius = " << r;
198 <<
", P(max) = " <<
fPMax;
227 int npbins = (int) (1000*
fPMax);
228 TH1D * prob =
new TH1D(
"",
"", npbins, 0,
fPMax);
229 prob->SetDirectory(0);
231 double dp =
fPMax / (npbins-1);
235 for(
int i = 0; i < npbins; i++) {
237 double p2 = TMath::Power(p,2);
251 double dP_dp = 4*
kPi * p2 * phi2;
252#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
253 LOG(
"LocalFGM",
pDEBUG) <<
"p = " << p <<
", dP/dp = " << dP_dp;
255 prob->Fill(p, dP_dp);
258 double normfactor = prob->Integral(
"width");
261 if (normfactor > 0) prob->Scale(1/normfactor);
281 x = rnd->
RndGen().Uniform( Ermv_min, Ermv_max );
284 const double arg2 = arg * arg;
286 const double MB = normFactor * arg2 * exp(-arg2);
288 if (MB >= rnd->
RndGen().Uniform())
301 double numNuc = (double) ( (is_p) ? t.
Z() : t.
N() );
348 LOG(
"LocalFGM",
pFATAL) <<
"Momentum CutOff greater than Momentum Max";
354 LOG(
"LocalFGM",
pFATAL) <<
"Configured SRC Maxwell-Boltzmann sigma (" <<
fSRC_Ermv_sigma <<
") invalid: must be nonnegative";
363 for(
int Z=1; Z<140; Z++) {
364 for(
int A=Z; A<3*Z; A++) {
367 key <<
"RFG-NucRemovalE@Pdg=" << pdgc;
368 RgKey rgkey = key.str();
370 if (
GetParam( rgkey, eb,
false ) ) {
371 eb = TMath::Max(eb, 0.);
372 LOG(
"LocalFGM",
pINFO) <<
"Nucleus: " << pdgc <<
" -> using Eb = " << eb <<
" GeV";
373 fNucRmvE.insert(map<int,double>::value_type(Z,eb));
#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 double LocalFermiMomentum(const Target &t, int nucleon_pdg, double radius) const
double Prob(double p, double w, const Target &t, double hitNucleonRadius) const
map< int, double > fNucRmvE
double MaxwellBoltzmannRemovalE(const Target &t, double Ermv_min, double Ermv_max) const
TH1D * ProbDistro(const Target &t, double r) const
bool GenerateNucleon(const Target &t, double hitNucleonRadius) const
void Configure(const Registry &config)
virtual void LoadConfig()
double fCurrRemovalEnergy
A singleton holding random number generator classes. All random number generation in GENIE should tak...
static RandomGen * Instance()
Access instance.
TRandom3 & RndGen(void) const
rnd number generator for generic usage
A registry. Provides the container for algorithm configuration parameters.
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
string AsString(void) const
int HitNucPdg(void) const
double HitNucMass(void) const
bool HitNucIsSet(void) const
int IonPdgCode(int A, int Z)
static constexpr double fermi
Simple functions for loading and reading nucleus dependent keys from config files.
double Density(double r, int A, double ring=0.)
double BindEnergyPerNucleon(const Target &target)
Root of GENIE utility namespaces.
THE MAIN GENIE PROJECT NAMESPACE