90 const double L =
lambda (rho);
91 const double B =
beta (rho);
93 const double L2 = L * L;
95 const double num = (L2 + k2) * (L2 + k2);
97 return m * num / (num - 2.0 * L2 * B * m);
101double INukeNucleonCorr :: localFermiMom (
const double rho,
const int A,
const int Z,
const int pdg)
103 static double factor = 3.0 *
kPi *
kPi / 2.0;
106 pow (factor * rho * (A - Z) / A, 1.0 / 3.0) / (
units::fermi);
117TLorentzVector INukeNucleonCorr :: generateTargetNucleon (
const double mass,
const double fermiMom)
122 const double costheta = 2.0 * rnd->
RndGen().Rndm() - 1.0;
123 const double sintheta = sqrt (1.0 - costheta * costheta);
124 const double phi = 2.0 *
kPi * rnd->
RndGen().Rndm();
127 const double p = rnd->
RndGen().Rndm() * fermiMom;
129 const TVector3 p3 = TVector3 (p * sintheta * cos (phi), p * sintheta * sin (phi), p * costheta);
130 const double energy = sqrt (p3.Mag2() + mass * mass);
132 return TLorentzVector (p3, energy);
136double INukeNucleonCorr :: getCorrection (
const double mass,
const double rho,
137 const TVector3 &k1,
const TVector3 &k2,
138 const TVector3 &k3,
const TVector3 &k4)
140 const double num = (k1 - k2).Mag() *
mstar (rho, (k3.Mag2() + k4.Mag2()) / 2.0) / mass / mass;
141 const double den = (k1 * (1.0 /
mstar (rho, k1.Mag2())) - k2 * (1.0 /
mstar (rho, k2.Mag2()))).Mag();
147double INukeNucleonCorr :: AvgCorrection (
const double rho,
const int A,
const int Z,
const int pdg,
const double Ek)
155 const double energy = Ek + mass;
157 TLorentzVector p (0.0, 0.0, sqrt (energy * energy - mass * mass), energy);
160 double corrPauliBlocking = 0.0;
161 double corrPotential = 0.0;
163 for (
unsigned int i = 0; i <
fRepeat; i++)
172 TLorentzVector outNucl1, outNucl2, RemnP4;
184 corrPotential +=
getCorrection (mass, rho, p.Vect(), target.Vect(), outNucl1.Vect(), outNucl2.Vect());
190 return corrPotential * corrPauliBlocking;
199 file.open((
char*)rfilename.c_str(), ios::in);
205 while (getline(file,line))
212 vector<double> temp_vector;
213 istringstream iss(line);
215 for (
int i=0; i<18; i++)
218 temp_vector.push_back(atof(s.c_str()));
224 LOG(
"INukeNucleonCorr",
pNOTICE) <<
"Successful open file" << rfilename <<
"\n";
228 LOG(
"INukeNucleonCorr",
pNOTICE) <<
"Could not open " << rfilename <<
"\n";
237double INukeNucleonCorr :: getAvgCorrection(
double rho,
double A,
double ke)
240 int Column = round(rho*100);
241 if(rho<.01) Column = 1;
244 if(ke<=.002) Row = 1;
245 if(ke>.002&&ke<=.1) Row = round(ke*1000.);
246 if(ke>.1&&ke<=.5) Row = round(.1*1000.+(ke-.1)*200);
247 if(ke>.5&&ke<=1) Row = round(.1*1000.+(.5-.1)*200+(ke-.5)*40);
248 if(ke>1) Row =
NRows-1;
254 static bool ReadFile =
false;
255 if( ReadFile ==
true ) {
257 TGraph * Interp =
new TGraph(Npoints);
263 Interp->SetPoint(3,56,
IronValues[Row][Column]);
264 Interp->SetPoint(4,120,
TinValues[Row][Column]);
270 double returnval = Interp->Eval(A);
273 <<
"Nucleon Corr interpolated correction factor = "
275 <<
" for rho, KE, A= "<< rho <<
" " << ke <<
" " << A;
307 <<
"Nucleon Corr interpolation files read in successfully";
310 TGraph * Interp =
new TGraph(Npoints);
316 Interp->SetPoint(3,56,
IronValues[Row][Column]);
317 Interp->SetPoint(4,120,
TinValues[Row][Column]);
322 double returnval = Interp->Eval(A);
326 <<
"Nucleon Corr interpolated correction factor = "
328 <<
" for rho, KE, A= "<< rho <<
" " << ke <<
" " << A;
334void INukeNucleonCorr :: OutputFiles(
int A,
int Z)
336 string outputdir =
genie_dir + string(
"/data/evgen/nncorr/");
342 file = outputdir+
"NNCorrection.txt";
343 header =
"##Correction values for protons (density(horizontal) and energy(vertical))";
347 double output[1002][18];
349 for(
int r = 1; r < 18; r++)
350 {
double rho = (r-1)*0.01;
354 for(
int e = 1;
e < 1002;
e++)
355 {
double energy = (
e-1)*0.001;
356 output[
e][0] = energy;}
359 for(
int e = 1;
e < 1002;
e++){
360 for(
int r = 1; r < 18; r++){
361 double energy = (
e-1)*0.001;
362 double density = (r-1)*0.01;
364 output[
e][r] = correction;
369 outfile.open((
char*)file.c_str(), ios::trunc);
370 if (outfile.is_open()) {
372 outfile << header << endl;
373 outfile << left << setw(12) <<
"##";
374 for (
int e = 0;
e < 1002;
e++) {
375 for (
int r = 0; r < 18; r++) {
376 if((
e == 0) && (r == 0)) {}
377 else{outfile << left << setw(12) << output[
e][r];}
vector< vector< double > > CarbonValues
vector< vector< double > > clear
vector< vector< double > > infile_values
string genie_dir(std::getenv("GENIE"))
vector< vector< double > > UraniumValues
void read_file(string rfilename)
vector< vector< double > > TinValues
vector< string > comments
vector< vector< double > > IronValues
vector< vector< double > > CalciumValues
vector< vector< double > > HeliumValues
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Correction to free NN xsec in nuclear matter.
double fermiMomentum(const int pdg)
return proper Fermi momentum based on nucleon PDG
double beta(const double rho)
potential component (Eq. 2.18)
double mstar(const double rho, const double k2)
m* calculated based on Eqs. 2.6 and 2.16
double lambda(const double rho)
potential component (Eq. 2.19)
static INukeNucleonCorr * getInstance()
get single instance of INukeNucleonCorr; create if necessary
TLorentzVector generateTargetNucleon(const double mass, const double fermiMomentum)
generate target nucleon
static INukeNucleonCorr * fInstance
single instance of INukeNucleonCorr
static const double fLambda1
lambda coefficient as defined by Eq. 2.19
static const double fLambda0
lambda coefficient as defined by Eq. 2.19
static const double fRho0
equilibrium density
static const double fBeta1
beta coefficient as defined by Eq. 2.18
void setFermiLevel(const double rho, const int A, const int Z)
double AvgCorrection(const double rho, const int A, const int Z, const int pdg, const double Ek)
generate kinematics fRepeat times to calculate average correction
static const unsigned int fRepeat
number of repetition to get average correction
double getCorrection(const double mass, const double rho, const TVector3 &k1, const TVector3 &k2, const TVector3 &k3, const TVector3 &k4)
calculate xsec correction
STDHEP-like event record entry that can fit a particle or a nucleus.
static INukeHadroData2018 * Instance(void)
double IntBounce(const GHepParticle *p, int target, int s1, INukeFateHN_t fate)
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
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
Utilities for improving the code readability when using PDG codes.
static constexpr double fermi
bool TwoBodyKinematics(double M3, double M4, TLorentzVector tP1L, TLorentzVector tP2L, TLorentzVector &tP3L, TLorentzVector &tP4L, double C3CM, TLorentzVector &RemnP4, double bindE=0)
THE MAIN GENIE PROJECT NAMESPACE