11 fDensityBinWidth (0.0), fEnergyBinWidth (0.0)
14 std::ifstream fileWithTables (filename);
16 if (not fileWithTables.is_open())
badFile (filename, 1);
23 while (fileWithTables.get() ==
'#' and ++lineCounter)
24 getline (fileWithTables, tempLine);
26 while (getline (fileWithTables, tempLine) and ++lineCounter)
49 std::istringstream splitLine (line);
52 double currentDensityValue, currentEnergyValue;
55 splitLine >> currentDensityValue >> currentEnergyValue;
57 if (
int exitCode =
checkIntegrity (currentDensityValue, currentEnergyValue))
63 double xsecQel, xsecCex;
64 splitLine >> xsecQel >> xsecCex;
72 splitLine >> absorption;
82 static unsigned int energyBinCounter = 0;
85 energyBinCounter = -1;
107 energyBinCounter = 0;
143 std::cerr <<
"\nERROR: " << file <<
" is corrupted (";
147 case 1: std::cerr <<
"could not be opened).\n"; exit(errorCode);
148 case 2: std::cerr <<
"wrong density";
break;
149 case 3: std::cerr <<
"different number of energy bins per density";
break;
150 case 4: std::cerr <<
"wrong energy";
break;
151 default: std::cerr <<
"undefined error";
154 std::cerr <<
" in line " << line <<
").\n";
173 double highDensityValue = lowValue;
174 double highEnergyValue = lowValue;
175 double highValue = lowValue;
200 return (lowValue + highDensityValue + highEnergyValue + highValue) /
230 const double &protonFraction)
double interpolate(const std::vector< double > &data) const
interpolate cross section (method fixed for Oset tables)
double lowWeight
distance from high boundary
bool isEqual(float x1, float x2)
void update(const double &newValue)
update point if changed
double fEnergyBinWidth
energy step (must be fixed)
PointHandler fDensityHandler
nuclear density handler
double fPionKineticEnergy
pion kinetic energy in MeV
double highWeight
distance from low boundary
int index
point index = index of low boundary
double fCexCrossSections[fNChannels]
cex cross section for each channel
bool isEdge
true if value is on edge of table (should never happen)
double fAbsorptionCrossSection
absorption cross section (averaged over proton / neutron fraction)
double fQelCrossSections[fNChannels]
total qel (el+cex) cross section for each channel
static const unsigned int fNChannels
number of possible channels: pi+n, pi+p, pi0
PointHandler fEnergyHandler
pion kinetic energy handler
std::vector< double > fCexCrossSectionTable[fNChannels]
charge-exchange piN cross section
void setHandler(const double &width, const int &bins)
constructor
unsigned int fNEnergyBins
number of energy bins
double fDensityBinWidth
density step (must be fixed)
virtual void setCrossSections()=0
calculalte cross sections for each channel
void setupOset(const double &density, const double &pionTk, const int &pionPDG, const double &protonFraction)
use to set up Oset class (assign pion Tk, nuclear density etc)
int processLine(const std::string &line)
process single line from table file, push values to proper vector (method fixed for Oset tables) ...
INukeOsetTable(const char *filename)
constructor
void line(double t, double *p, double &x, double &y, double &z)
void setCrossSections()
calculalte cross sections for each channel
int checkIntegrity(const double &densityValue, const double &energyValue)
check if data in file is consistent (method fixed for Oset tables)
double fNuclearDensity
nuclear density in fm-3
void badFile(const char *file, const int &errorCode, const int &line=0) const
stop program and through an error if input file is corrupted (method fixed for Oset tables) ...
std::vector< double > fQelCrossSectionTable[fNChannels]
quasi-elastic piN cross section
std::vector< double > fAbsorptionCrossSectionTable
pi absorption cross section
unsigned int fNDensityBins
number of denisty bins