30 using namespace genie;
65 double kmin = sf->GetXmin();
66 double kmax = sf->GetXmax();
67 double wmin = sf->GetYmin();
68 double wmax = sf->GetYmax();
69 double probmax = sf->GetZmax();
72 double dk = kmax - kmin;
73 double dw = wmax - wmin;
75 LOG(
"SpectralFunc",
pINFO) <<
"Momentum range = [" << kmin <<
", " << kmax <<
"]";
76 LOG(
"SpectralFunc",
pINFO) <<
"Rmv energy range = [" << wmin <<
", " << wmax <<
"]";
80 unsigned int niter = 0;
84 <<
"Couldn't generate a hit nucleon after " << niter <<
" iterations";
90 double kc = kmin + dk * rnd->
RndGen().Rndm();
91 double wc = wmin + dw * rnd->
RndGen().Rndm();
92 LOG(
"SpectralFunc",
pINFO) <<
"Trying p = " << kc <<
", w = " << wc;
95 double prob = this->
Prob(kc,wc, target);
96 double probg = probmax * rnd->
RndGen().Rndm();
97 bool accept = (probg < prob);
100 LOG(
"SpectralFunc",
pINFO) <<
"|p,nucleon| = " <<
kc;
101 LOG(
"SpectralFunc",
pINFO) <<
"|w,nucleon| = " << wc;
104 double costheta = -1. + 2. * rnd->
RndGen().Rndm();
105 double sintheta = TMath::Sqrt(1.-costheta*costheta);
106 double fi = 2 *
kPi * rnd->
RndGen().Rndm();
107 double cosfi = TMath::Cos(fi);
108 double sinfi = TMath::Sin(fi);
110 double kx = kc*sintheta*cosfi;
111 double ky = kc*sintheta*sinfi;
112 double kz = kc*costheta;
129 return sf->Interpolate(p,w);
149 LOG(
"SpectralFunc",
pDEBUG) <<
"Loading Benhar et al. spectral functions";
152 string(gSystem->Getenv(
"GENIE")) +
153 string(
"/data/evgen/nucl/spectral_functions/");
154 string c12file = data_dir +
"benhar-sf-12c.data";
155 string fe56file = data_dir +
"benhar-sf-56fe.data";
157 TNtupleD sfdata_fe56(
"sfdata_fe56",
"",
"k:e:prob");
158 TNtupleD sfdata_c12 (
"sfdata_c12",
"",
"k:e:prob");
160 sfdata_fe56.ReadFile ( fe56file.c_str() );
161 sfdata_c12. ReadFile ( c12file.c_str () );
163 LOG(
"SpectralFunc",
pDEBUG) <<
"Loaded " << sfdata_fe56.GetEntries() <<
" Fe56 points";
164 LOG(
"SpectralFunc",
pDEBUG) <<
"Loaded " << sfdata_c12.GetEntries() <<
" C12 points";
173 fSfC12 ->SetName(
"sf_c12");
178 int np = sfdata.GetEntries();
179 TGraph2D * sfgraph =
new TGraph2D(np);
181 sfdata.Draw(
"k:e:prob",
"",
"GOFF");
182 assert(np==sfdata.GetSelectedRows());
183 double *
k = sfdata.GetV1();
184 double *
e = sfdata.GetV2();
185 double *
p = sfdata.GetV3();
187 for(
int i=0; i<np; i++) {
190 double pi = p[i] * TMath::Power(ki,2);
191 sfgraph->SetPoint(i, ki,ei,pi);
205 <<
"** The spectral function for target " << pdgc <<
" isn't available";
208 LOG(
"SpectralFunc",
pERROR) <<
"** Null spectral function";
TGraph2D * fSfFe56
Benhar's Fe56 SF.
THE MAIN GENIE PROJECT NAMESPACE
static RandomGen * Instance()
Access instance.
TGraph2D * Convert2Graph(TNtupleD &data) const
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
static constexpr double MeV
double Prob(double p, double w, const Target &t) const
A singleton holding random number generator classes. All random number generation in GENIE should tak...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
constexpr double kc
Speed of light in vacuum in LArSoft units [cm/ns].
static constexpr double GeV
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
virtual void Configure(const Registry &config)
bool GenerateNucleon(const Target &t) const
Misc GENIE control constants.
double fCurrRemovalEnergy
virtual void LoadConfig()
A registry. Provides the container for algorithm configuration parameters.
void Configure(const Registry &config)
TRandom3 & RndGen(void) const
rnd number generator for generic usage
TGraph2D * fSfC12
Benhar's C12 SF.
TGraph2D * SelectSpectralFunction(const Target &target) const
static const unsigned int kRjMaxIterations
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...