32 using std::ostringstream;
34 using namespace genie;
35 using namespace genie::constants;
36 using namespace genie::controls;
37 using namespace genie::utils;
62 map<int, double>::const_iterator dbl_it;
63 map<int, Spline*>::const_iterator spl_it;
67 spl_it =
fSFk.find(Z);
75 double prob_max = dbl_it->second;
76 LOG(
"SpectralFunc1",
pDEBUG) <<
"Max probability = " << prob_max;
79 unsigned int niter = 0;
83 <<
"Couldn't generate a hit nucleon after " << niter <<
" iterations";
89 else p = rnd->
RndGen().Rndm();
91 double prob = spl_it->second->Evaluate(p);
92 double probg = prob_max * rnd->
RndGen().Rndm();
93 LOG(
"SpectralFunc1",
pDEBUG) <<
"Trying p = " << p <<
" / prob = " << prob;
95 bool accept = (probg<prob);
99 LOG(
"SpectralFunc1",
pINFO) <<
"|p,nucleon| = " << p;
101 double costheta = -1. + 2. * rnd->
RndGen().Rndm();
102 double sintheta = TMath::Sqrt(1.-costheta*costheta);
103 double fi = 2 *
kPi * rnd->
RndGen().Rndm();
104 double cosfi = TMath::Cos(fi);
105 double sinfi = TMath::Sin(fi);
107 double px = p*sintheta*cosfi;
108 double py = p*sintheta*sinfi;
109 double pz = p*costheta;
122 spl_it =
fSFw.find(Z);
123 if(spl_it==
fSFw.end()) {
134 double p,
double ,
const Target & target)
const
139 map<int, Spline*>::const_iterator spl_it =
fSFk.find(Z);
141 if(spl_it ==
fSFk.end())
return 0;
142 else return TMath::Max(0.,spl_it->second->Evaluate(p));
162 LOG(
"SpectralFunc1",
pDEBUG) <<
"Loading coonfiguration for SpectralFunc1d";
171 string(gSystem->Getenv(
"GENIE")) +
string(
"/data/evgen/nucl/spectral_functions/");
173 string c12_sf1dk_file = data_dir +
"benhar-sf1dk-12c.data";
174 string fe56_sf1dk_file = data_dir +
"benhar-sf1dk-56fe.data";
175 string c12_sf1dw_file = data_dir +
"benhar-sf1dw-12c.data";
176 string fe56_sf1dw_file = data_dir +
"benhar-sf1dw-56fe.data";
180 spl =
new Spline(c12_sf1dk_file);
181 fSFk.insert(map<int, Spline*>::value_type(6,spl));
182 spl =
new Spline(fe56_sf1dk_file);
183 fSFk.insert(map<int, Spline*>::value_type(26,spl));
185 spl =
new Spline(c12_sf1dw_file);
186 fSFw.insert(map<int, Spline*>::value_type(6,spl));
187 spl =
new Spline(fe56_sf1dw_file);
188 fSFw.insert(map<int, Spline*>::value_type(26,spl));
191 map<int, Spline*>::const_iterator spliter;
195 for(spliter =
fSFk.begin(); spliter !=
fSFk.end(); ++spliter) {
197 int Z = spliter->first;
198 spl = spliter->second;
199 for(
int i=0; i<n; i++) {
200 double p = pmin + i*dp;
201 prob_max = TMath::Max(prob_max, spl->
Evaluate(p));
203 fMaxProb.insert(map<int,double>::value_type(Z,prob_max));
221 for(
int Z=1; Z<140; Z++) {
222 for(
int A=Z;
A<3*Z;
A++) {
225 key <<
"RFG-NucRemovalE@Pdg=" << pdgc;
226 RgKey rgkey = key.str();
228 if (
GetParam( rgkey, eb,
false ) ) {
229 eb = TMath::Max(eb, 0.);
231 <<
"Nucleus: " << pdgc <<
" -> using Eb = " << eb <<
" GeV";
232 fNucRmvE.insert(map<int,double>::value_type(Z,eb));
240 map<int, Spline*>::iterator spliter;
242 for(spliter =
fSFk.begin(); spliter !=
fSFk.end(); ++spliter) {
243 Spline * spl = spliter->second;
246 for(spliter =
fSFw.begin(); spliter !=
fSFw.end(); ++spliter) {
247 Spline * spl = spliter->second;
void Configure(const Registry &config)
static RandomGen * Instance()
Access instance.
bool GenerateNucleon(const Target &t) const
A numeric analysis tool class for interpolating 1-D functions.
map< int, double > fNucRmvE
Removal energies as used in FG model.
map< int, Spline * > fSFk
All available spectral funcs integrated over removal energy.
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
double Evaluate(double x) const
A singleton holding random number generator classes. All random number generation in GENIE should tak...
virtual ~SpectralFunc1d()
double BindEnergyPerNucleon(const Target &target)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
static constexpr double A
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
virtual void Configure(const Registry &config)
bool fUseRFGMomentumCutoff
double fCurrRemovalEnergy
virtual void LoadConfig()
double Prob(double p, double w, const Target &t) const
A registry. Provides the container for algorithm configuration parameters.
map< int, double > fMaxProb
Max SF(k) probability used in rejection method.
TRandom3 & RndGen(void) const
rnd number generator for generic usage
int IonPdgCode(int A, int Z)
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
static const unsigned int kRjMaxIterations
map< int, Spline * > fSFw
Average nucleon removal as a function of pF - computed from the spectral function.
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...