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);
146 LOG(
"SpectralFunc",
pDEBUG) <<
"Loading Benhar et al. spectral functions";
149 string(gSystem->Getenv(
"GENIE")) +
150 string(
"/data/evgen/nucl/spectral_functions/");
151 string c12file = data_dir +
"benhar-sf-12c.data";
152 string fe56file = data_dir +
"benhar-sf-56fe.data";
154 TNtupleD sfdata_fe56(
"sfdata_fe56",
"",
"k:e:prob");
155 TNtupleD sfdata_c12 (
"sfdata_c12",
"",
"k:e:prob");
157 sfdata_fe56.ReadFile ( fe56file.c_str() );
158 sfdata_c12.
ReadFile ( c12file.c_str () );
160 LOG(
"SpectralFunc",
pDEBUG) <<
"Loaded " << sfdata_fe56.GetEntries() <<
" Fe56 points";
161 LOG(
"SpectralFunc",
pDEBUG) <<
"Loaded " << sfdata_c12.GetEntries() <<
" C12 points";
170 fSfC12 ->SetName(
"sf_c12");
175 int np = sfdata.GetEntries();
176 TGraph2D * sfgraph =
new TGraph2D(np);
178 sfdata.Draw(
"k:e:prob",
"",
"GOFF");
179 assert(np==sfdata.GetSelectedRows());
180 double * k = sfdata.GetV1();
181 double *
e = sfdata.GetV2();
182 double *
p = sfdata.GetV3();
184 for(
int i=0;
i<np;
i++) {
187 double pi = p[
i] * TMath::Power(ki,2);
188 sfgraph->SetPoint(
i, ki,ei,pi);
202 <<
"** The spectral function for target " << pdgc <<
" isn't available";
205 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 ...
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...
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
Var Sqrt(const Var &v)
Use to take sqrt of a var.
A registry. Provides the container for algorithm configuration parameters.
void Configure(const Registry &config)
cosmicTree ReadFile("CosmicList.txt","isSA/I:isA17/I:HadEfrac/F:CCE/F:CCESA/F")
TRandom3 & RndGen(void) const
rnd number generator for generic usage
TGraph2D * fSfC12
Benhar's C12 SF.
assert(nhit_max >=nhit_nbins)
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...