1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-22 18:28:51 -05:00

skip var removed from Config

This commit is contained in:
hrocho 2019-10-08 20:25:30 +02:00
parent cbef244599
commit 8419555f93
5 changed files with 11 additions and 45 deletions

View File

@ -254,7 +254,7 @@ Result calculate(Projectile &p, const Material &t, const Config &c){
spline_type angular_variance_spline = get_angular_variance_spline(data); spline_type angular_variance_spline = get_angular_variance_spline(data);
res.sigma_a = sqrt(angular_variance_spline(T) - angular_variance_spline(res.Eout)); res.sigma_a = sqrt(angular_variance_spline(T) - angular_variance_spline(res.Eout));
#endif #endif
if( !(c.skip&skip_tof) && t.thickness()>0){ if( t.thickness()>0){
//auto tofdata = calculate_tof(p,t,c); //auto tofdata = calculate_tof(p,t,c);
//Interpolator tof_spline(energy_table.values, tofdata.data(), energy_table.num,interpolation_t::linear); //Interpolator tof_spline(energy_table.values, tofdata.data(), energy_table.num,interpolation_t::linear);
//res.tof = tof_spline(res.Ein) - tof_spline(res.Eout); //res.tof = tof_spline(res.Ein) - tof_spline(res.Eout);

View File

@ -19,17 +19,6 @@ namespace catima{
atima14 = 7 atima14 = 7
}; };
/**
* enum to select which calculation to skip
*/
enum skip_calculation:unsigned char{
skip_none = 0,
skip_tof = 1,
skip_sigma_a = 2,
skip_sigma_r = 4,
skip_reactions = 128
};
/** /**
* enum to select which dEdx correction to skip * enum to select which dEdx correction to skip
*/ */
@ -58,11 +47,6 @@ namespace catima{
/** /**
* structure to store calculation configuration * structure to store calculation configuration
* each group of options are grouped and enum are suppose to use
* see catima::z_eff_type, catima::skip_calculation, catima::corrections
*
* check catima::z_effective()
*
*/ */
struct Config{ struct Config{
#ifndef GLOBAL #ifndef GLOBAL
@ -71,12 +55,6 @@ namespace catima{
unsigned char z_effective=z_eff_type::atima14; unsigned char z_effective=z_eff_type::atima14;
#endif #endif
#ifdef REACTIONS
unsigned char skip=skip_none;
#else
unsigned char skip=skip_calculation::skip_reactions;
#endif
unsigned char corrections = 0; unsigned char corrections = 0;
unsigned char calculation = 1; unsigned char calculation = 1;
}; };

View File

@ -7,7 +7,6 @@ extern "C" {
CatimaResult catima_calculate(double pa, int pz, double T, double ta, double tz, double thickness, double density){ CatimaResult catima_calculate(double pa, int pz, double T, double ta, double tz, double thickness, double density){
catima::default_config.z_effective = catima_defaults.z_effective; catima::default_config.z_effective = catima_defaults.z_effective;
catima::default_config.skip = catima_defaults.skip;
catima::Material mat; catima::Material mat;
catima::Projectile p(pa,pz); catima::Projectile p(pa,pz);
if(tz>200){ if(tz>200){

View File

@ -15,28 +15,26 @@ struct CatimaResult{
double sigma_E; double sigma_E;
double sigma_a; double sigma_a;
double sigma_r; double sigma_r;
double tof; double tof;
}; };
enum z_eff_type { enum z_eff_type {
none = 0, none = 0,
atima = 1 pierce_blann = 1,
}; anthony_landorf = 2,
hubert = 3,
enum skip_calculation{ winger = 4,
skip_none = 0, schiwietz = 5,
skip_tof = 1, global = 6,
skip_sigma_a = 2, atima14 = 7
skip_sigma_r = 4
}; };
struct CatimaConfig { struct CatimaConfig {
char z_effective; char z_effective;
char skip;
}; };
struct CatimaConfig catima_defaults = {none,skip_none}; struct CatimaConfig catima_defaults = {none};
typedef struct CatimaResult CatimaResult; typedef struct CatimaResult CatimaResult;
@ -49,4 +47,4 @@ double catima_energy_straggling_from_E(double pa, int pz, double Tin, double Tou
} }
#endif #endif
#endif #endif

View File

@ -213,13 +213,6 @@ PYBIND11_MODULE(pycatima,m){
.value("global", z_eff_type::global) .value("global", z_eff_type::global)
.value("atima14", z_eff_type::atima14); .value("atima14", z_eff_type::atima14);
py::enum_<skip_calculation>(m,"skip_calculation")
.value("skip_none", skip_calculation::skip_none)
.value("skip_tof", skip_calculation::skip_tof)
.value("skip_sigma_a", skip_calculation::skip_sigma_a)
.value("skip_sigma_r", skip_calculation::skip_sigma_r)
.value("skip_reactions", skip_calculation::skip_reactions);
py::enum_<corrections>(m,"corrections") py::enum_<corrections>(m,"corrections")
.value("no_barkas", corrections::no_barkas) .value("no_barkas", corrections::no_barkas)
.value("no_lindhard", corrections::no_lindhard) .value("no_lindhard", corrections::no_lindhard)
@ -264,13 +257,11 @@ PYBIND11_MODULE(pycatima,m){
.def_readwrite("z_effective", &Config::z_effective) .def_readwrite("z_effective", &Config::z_effective)
.def_readwrite("corrections", &Config::corrections) .def_readwrite("corrections", &Config::corrections)
.def_readwrite("calculation", &Config::calculation) .def_readwrite("calculation", &Config::calculation)
.def_readwrite("skip", &Config::skip)
.def("get",[](const Config &r){ .def("get",[](const Config &r){
py::dict d; py::dict d;
d["z_effective"] = r.z_effective; d["z_effective"] = r.z_effective;
d["corrections"] = r.corrections; d["corrections"] = r.corrections;
d["calculation"] = r.calculation; d["calculation"] = r.calculation;
d["skip"] = r.skip;
return d; return d;
}) })
.def("__str__",[](const Config &r){ .def("__str__",[](const Config &r){