mirror of
https://github.com/gwm17/PunchTable.git
synced 2024-11-22 10:18:51 -05:00
Added capability to query table for the projectile and material used
This commit is contained in:
parent
9bb87e999e
commit
0333103ef1
|
@ -34,10 +34,16 @@ namespace PunchTable {
|
|||
double value;
|
||||
std::vector<double> energyLoss, energyFinal;
|
||||
|
||||
std::getline(input, junk);
|
||||
while(junk != "---------------------------------")
|
||||
input>>junk>>junk>>m_projectileString;
|
||||
input>>junk>>junk;
|
||||
|
||||
while(input>>junk)
|
||||
{
|
||||
std::getline(input, junk);
|
||||
if(junk == "---------------------------------")
|
||||
break;
|
||||
input>>junk;
|
||||
m_materialString += junk;
|
||||
input>>junk;
|
||||
}
|
||||
input>>junk>>m_thetaMin>>junk>>m_thetaMax>>junk>>m_thetaStep;
|
||||
std::getline(input, junk);
|
||||
|
|
|
@ -21,11 +21,16 @@ namespace PunchTable {
|
|||
~ElossTable();
|
||||
|
||||
void ReadFile(const std::string& filename);
|
||||
double GetEnergyLoss(double thetaIncident, double finalEnergy);
|
||||
std::string GetProjectile() { return m_projectileString; }
|
||||
std::string GetMaterial() { return m_materialString; }
|
||||
|
||||
double GetEnergyLoss(double thetaIncident, double finalEnergy);
|
||||
|
||||
inline const bool IsValid() const { return m_isValid; }
|
||||
|
||||
private:
|
||||
std::string m_projectileString;
|
||||
std::string m_materialString;
|
||||
std::vector<CubicSpline> m_splines;
|
||||
double m_thetaStep, m_thetaMin, m_thetaMax;
|
||||
|
||||
|
|
|
@ -106,18 +106,21 @@ namespace PunchTable {
|
|||
}
|
||||
output<<std::setprecision(5);
|
||||
|
||||
output<<"Materials: "<<std::endl;;
|
||||
output<<"---------------------------------"<<std::endl;
|
||||
output<<"Projectile: "<<masses.FindSymbol(params.projectileZ, params.projectileA)<<std::endl;
|
||||
output<<"---------------------------------"<<std::endl;
|
||||
output<<"Materials: "<<std::endl;
|
||||
for(size_t i=0; i<depLayer; i++)
|
||||
{
|
||||
output<<"\tGoing through: ";
|
||||
output<<"\tGoingThrough: ";
|
||||
for(size_t j=0; j<params.targetZ[i].size(); j++)
|
||||
output<<masses.FindSymbol(params.targetZ[i][j], params.targetA[i][j])<<params.targetS[i][j];
|
||||
output<<" ("<<params.targetThickness[i]<<" ug/cm2)"<<std::endl;
|
||||
output<<" ("<<params.targetThickness[i]<<"ug/cm2)"<<std::endl;
|
||||
}
|
||||
output<<"\tDeposting into: ";
|
||||
output<<"\tDepostingInto: ";
|
||||
for(size_t i=0; i<params.targetZ[depLayer].size(); i++)
|
||||
output<<masses.FindSymbol(params.targetZ[depLayer][i], params.targetA[depLayer][i])<<params.targetS[depLayer][i];
|
||||
output<<" ("<<params.targetThickness[depLayer]<<" ug/cm2)"<<std::endl;
|
||||
output<<" ("<<params.targetThickness[depLayer]<<"ug/cm2)"<<std::endl;
|
||||
output<<"---------------------------------"<<std::endl;
|
||||
|
||||
output<<"IncidentAngleRange(deg): "<<params.minTheta<<" to "<<params.maxTheta<<" stepSize: "<<params.stepTheta<<std::endl;
|
||||
|
@ -232,13 +235,16 @@ namespace PunchTable {
|
|||
}
|
||||
output<<std::setprecision(5);
|
||||
|
||||
output<<"---------------------------------"<<std::endl;
|
||||
output<<"Projectile: "<<masses.FindSymbol(params.projectileZ, params.projectileA)<<std::endl;
|
||||
output<<"---------------------------------"<<std::endl;
|
||||
output<<"Materials: "<<std::endl;;
|
||||
for(size_t i=0; i<nlayers; i++)
|
||||
{
|
||||
output<<"\tGoing through: ";
|
||||
output<<"\tGoingThrough: ";
|
||||
for(size_t j=0; j<params.targetZ[i].size(); j++)
|
||||
output<<masses.FindSymbol(params.targetZ[i][j], params.targetA[i][j])<<params.targetS[i][j];
|
||||
output<<" ("<<params.targetThickness[i]<<" ug/cm2)"<<std::endl;
|
||||
output<<" ("<<params.targetThickness[i]<<"ug/cm2)"<<std::endl;
|
||||
}
|
||||
output<<"---------------------------------"<<std::endl;
|
||||
output<<"IncidentAngleRange(deg): "<<params.minTheta<<" to "<<params.maxTheta<<" stepSize: "<<params.stepTheta<<std::endl;
|
||||
|
|
|
@ -33,11 +33,18 @@ namespace PunchTable {
|
|||
double value;
|
||||
std::vector<double> energyIn, energyDep;
|
||||
|
||||
std::getline(input, junk);
|
||||
while(junk != "---------------------------------")
|
||||
input>>junk>>junk>>m_projectileString;
|
||||
input>>junk>>junk;
|
||||
|
||||
while(input>>junk)
|
||||
{
|
||||
std::getline(input, junk);
|
||||
if(junk == "---------------------------------")
|
||||
break;
|
||||
input>>junk;
|
||||
m_materialString += junk;
|
||||
input>>junk;
|
||||
}
|
||||
|
||||
input>>junk>>m_thetaMin>>junk>>m_thetaMax>>junk>>m_thetaStep;
|
||||
std::getline(input, junk);
|
||||
std::getline(input, junk);
|
||||
|
|
|
@ -13,11 +13,17 @@ namespace PunchTable {
|
|||
PunchTable();
|
||||
PunchTable(const std::string& filename);
|
||||
~PunchTable();
|
||||
|
||||
void ReadFile(const std::string& filename);
|
||||
std::string GetProjectile() { return m_projectileString; }
|
||||
std::string GetMaterial() { return m_materialString; }
|
||||
|
||||
double GetInitialKineticEnergy(double theta_incident, double e_deposited); //radians, MeV
|
||||
inline bool IsValid() const { return m_validFlag; }
|
||||
|
||||
private:
|
||||
std::string m_projectileString;
|
||||
std::string m_materialString;
|
||||
std::vector<CubicSpline> m_splines;
|
||||
double m_thetaStep, m_thetaMin, m_thetaMax;
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ int main(int argc, char** argv)
|
|||
std::cout<<"-------------Testing---------"<<std::endl;
|
||||
PunchTable::PunchTable table(params.filename);
|
||||
std::cout<<"Is the table valid? "<<table.IsValid()<<std::endl;
|
||||
std::cout<<"Table Projectile: "<<table.GetProjectile()<<std::endl;
|
||||
std::cout<<"Table Material: "<<table.GetMaterial()<<std::endl;
|
||||
double ke_test = 14.5; //MeV
|
||||
double theta_test = 35.5*M_PI/180.0;
|
||||
double ke_dep = PunchTable::GetEnergyDeposited(params, theta_test, ke_test);
|
||||
|
@ -58,6 +60,8 @@ int main(int argc, char** argv)
|
|||
std::cout<<"-------------Testing---------"<<std::endl;
|
||||
PunchTable::ElossTable table(params.filename);
|
||||
std::cout<<"Is the table valid? "<<table.IsValid()<<std::endl;
|
||||
std::cout<<"Table Projectile: "<<table.GetProjectile()<<std::endl;
|
||||
std::cout<<"Table Material: "<<table.GetMaterial()<<std::endl;
|
||||
double ke_test = 0.5; //MeV
|
||||
double theta_test = 35.5*M_PI/180.0;
|
||||
double eloss = table.GetEnergyLoss(theta_test, ke_test);
|
||||
|
|
Loading…
Reference in New Issue
Block a user