From 2068c037b29a5d3dda62c6615242e36d8ecc15bf Mon Sep 17 00:00:00 2001 From: hrocho Date: Fri, 10 May 2019 21:02:51 +0200 Subject: [PATCH] Config refactoring --- calculations.cpp | 25 ++++++++-------------- calculations.h | 14 ++----------- catima.pyx | 42 ++++++++++++++++++------------------- catimac.pxd | 6 ++---- srim.cpp | 23 ++++++++++---------- srim.h | 5 +++-- tests/test_calculations.cpp | 39 +++++++++++++--------------------- 7 files changed, 64 insertions(+), 90 deletions(-) diff --git a/calculations.cpp b/calculations.cpp index dc35ae6..f0875e1 100644 --- a/calculations.cpp +++ b/calculations.cpp @@ -88,7 +88,7 @@ double bethek_dedx_e(Projectile &p, const Target &t, const Config &c, double I){ double f2 = log(2.0*electron_mass*1000000*beta2/Ipot); double eta = beta*gamma; - if(!(c.dedx&corrections::no_shell_correction) && eta>=0.13){ //shell corrections + if(!(c.corrections&corrections::no_shell_correction) && eta>=0.13){ //shell corrections double cor = (+0.422377*pow(eta,-2) +0.0304043*pow(eta,-4) -0.00038106*pow(eta,-6))*1e-6*pow(Ipot,2) @@ -100,21 +100,21 @@ double bethek_dedx_e(Projectile &p, const Target &t, const Config &c, double I){ f2+=2*log(gamma) -beta2; double barkas=1.0; - if(!(c.dedx&corrections::no_barkas)){ + if(!(c.corrections&corrections::no_barkas)){ barkas = bethek_barkas(zp_eff,eta,t.Z); } double delta = bethek_density_effect(beta, t.Z); double LS = 0.0; - if(!(c.dedx&corrections::no_lindhard)){ + if(!(c.corrections&corrections::no_lindhard)){ //double LS = bethek_lindhard(p); LS = precalculated_lindhard(p); } double result = (f2)*barkas + LS - delta/2.; result *=f1; - if( (p.T>50000.0) && !(c.dedx&corrections::no_highenergy)){ + if( (p.T>50000.0) && !(c.corrections&corrections::no_highenergy)){ result += pair_production(p,t); result += bremsstrahlung(p,t); } @@ -444,23 +444,16 @@ double bremsstrahlung(const Projectile &p, const Target &t){ return 16.0*C*gamma*p.Z*p.Z*p.Z*p.Z*t.Z*t.Z*Lbs/(t.A*p.A*3.0*4.0*M_PI); }; -double sezi_p_se(double energy,const Target &t){ - return 100*p_se(t.Z, energy)*Avogadro/t.A; -} - -double sezi_dedx_e(const Projectile &p, const Target &t){ - return 100*srim_dedx_e(p.Z,t.Z,p.T)*Avogadro/t.A; -} - -double sezi_dedx_e(const Projectile &p, const Material &mat){ +double sezi_dedx_e(const Projectile &p, const Material &mat, const Config &c){ double w; double sum=0.0; + bool use95 = config_lowenergy(c) == low_energy_types::srim_95; for(int i=0;i