37 using namespace genie;
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);
103 static double factor = 3.0 *
kPi *
kPi / 2.0;
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);
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();
152 setFermiLevel (rho, A, Z);
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++)
170 const TLorentzVector
target = generateTargetNucleon (targetMass, fermiMomentum (targetPdg));
172 TLorentzVector outNucl1, outNucl2, RemnP4;
181 corrPauliBlocking += (outNucl1.Vect().Mag() > fermiMomentum (pdg) and outNucl2.Vect().Mag() > fermiMomentum (targetPdg));
184 corrPotential += getCorrection (mass, rho, p.Vect(), target.Vect(), outNucl1.Vect(), outNucl2.Vect());
187 corrPauliBlocking /= fRepeat;
188 corrPotential /= fRepeat;
190 return corrPotential * corrPauliBlocking;
199 file.open((
char*)rfilename.c_str(), ios::in);
205 while (getline(file,line))
209 comments.push_back(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()));
220 infile_values.push_back(temp_vector);
224 LOG(
"INukeNucleonCorr",
pNOTICE) <<
"Successful open file" << rfilename <<
"\n";
228 LOG(
"INukeNucleonCorr",
pNOTICE) <<
"Could not open " << rfilename <<
"\n";
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);
260 Interp->SetPoint(0,4,HeliumValues[Row][Column]);
261 Interp->SetPoint(1,12,CarbonValues[Row][Column]);
262 Interp->SetPoint(2,40,CalciumValues[Row][Column]);
263 Interp->SetPoint(3,56,IronValues[Row][Column]);
264 Interp->SetPoint(4,120,TinValues[Row][Column]);
265 Interp->SetPoint(5,238,UraniumValues[Row][Column]);
270 double returnval = Interp->Eval(A);
273 <<
"Nucleon Corr interpolated correction factor = " 275 <<
" for rho, KE, A= "<< rho <<
" " << ke <<
" " <<
A;
284 infile_values =
clear;
288 infile_values =
clear;
292 infile_values =
clear;
296 infile_values =
clear;
298 read_file(dir+
"NNCorrection_50_120.txt");
300 infile_values =
clear;
302 read_file(dir+
"NNCorrection_92_238.txt");
304 infile_values =
clear;
307 <<
"Nucleon Corr interpolation files read in successfully";
310 TGraph * Interp =
new TGraph(Npoints);
313 Interp->SetPoint(0,4,HeliumValues[Row][Column]);
314 Interp->SetPoint(1,12,CarbonValues[Row][Column]);
315 Interp->SetPoint(2,40,CalciumValues[Row][Column]);
316 Interp->SetPoint(3,56,IronValues[Row][Column]);
317 Interp->SetPoint(4,120,TinValues[Row][Column]);
318 Interp->SetPoint(5,238,UraniumValues[Row][Column]);
322 double returnval = Interp->Eval(A);
326 <<
"Nucleon Corr interpolated correction factor = " 328 <<
" for rho, KE, A= "<< rho <<
" " << ke <<
" " <<
A;
342 file = outputdir+
"NNCorrection.txt";
343 header =
"##Correction values for protons (density(horizontal) and energy(vertical))";
349 for(
int r = 1;
r < 18;
r++)
350 {
double rho = (
r-1)*0.01;
354 for(
int e = 1;
e < 1002;
e++)
359 for(
int e = 1;
e < 1002;
e++){
360 for(
int r = 1;
r < 18;
r++){
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];}
double beta(double KE, const simb::MCParticle *part)
static INukeNucleonCorr * getInstance()
get single instance of INukeNucleonCorr; create if necessary
THE MAIN GENIE PROJECT NAMESPACE
double getCorrection(const double mass, const double rho, const TVector3 &k1, const TVector3 &k2, const TVector3 &k3, const TVector3 &k4)
calculate xsec correction
static INukeNucleonCorr * fInstance
single instance of INukeNucleonCorr
double mstar(const double rho, const double k2)
m* calculated based on Eqs. 2.6 and 2.16
static RandomGen * Instance()
Access instance.
void read_file(string rfilename)
vector< vector< double > > UraniumValues
vector< vector< double > > infile_values
static const double fRho0
equilibrium density
A singleton holding random number generator classes. All random number generation in GENIE should tak...
vector< vector< double > > TinValues
TLorentzVector generateTargetNucleon(const double mass, const double fermiMomentum)
generate target nucleon
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
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
std::string getenv(std::string const &name)
bool TwoBodyKinematics(double M3, double M4, TLorentzVector tP1L, TLorentzVector tP2L, TLorentzVector &tP3L, TLorentzVector &tP4L, double C3CM, TLorentzVector &RemnP4, double bindE=0)
Correction to free NN xsec in nuclear matter.
vector< vector< double > > CarbonValues
static const double fLambda0
lambda coefficient as defined by Eq. 2.19
static const double fLambda1
lambda coefficient as defined by Eq. 2.19
Q_EXPORT QTSManip setw(int w)
void OutputFiles(int A, int Z)
vector< vector< double > > HeliumValues
double getAvgCorrection(const double rho, const double A, const double Ek)
get the correction for given four-momentum and density
static PDGLibrary * Instance(void)
static const double fBeta1
beta coefficient as defined by Eq. 2.18
static INukeHadroData2018 * Instance(void)
void line(double t, double *p, double &x, double &y, double &z)
TRandom3 & RndGen(void) const
rnd number generator for generic usage
static const unsigned int fRepeat
number of repetition to get average correction
vector< vector< double > > IronValues
string genie_dir(std::getenv("GENIE"))
static constexpr double fermi
vector< vector< double > > clear
vector< vector< double > > CalciumValues
TParticlePDG * Find(int pdgc, bool must_exist=true)
double localFermiMom(const double rho, const int A, const int Z, const int pdg)
calculate local Fermi momentum
vector< string > comments
STDHEP-like event record entry that can fit a particle or a nucleus.
double IntBounce(const GHepParticle *p, int target, int s1, INukeFateHN_t fate)
QTextStream & endl(QTextStream &s)