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

Merge pull request #27 from hrosiak/we

We
This commit is contained in:
Andrej Prochazka 2018-02-14 15:11:34 +01:00 committed by GitHub
commit a98da0d8fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 0 deletions

View File

@ -418,4 +418,20 @@ double calculate_tof_from_E(Projectile p, double Eout, const Material &t, const
return res; return res;
} }
double w_magnification(Projectile p, double Ein, const Material &t, const Config &c){
double res = 1.0;
if(t.density()<= 0.0 || t.thickness()<=0){
return res;
}
std::vector<double> energies{0.99*Ein, Ein, 1.1*Ein};
auto eres = energy_out(p,energies,t,c);
if(eres[0]>0.0 && eres[1]>0.0 && eres[2]>0.0){
res = energies[1]*(eres[2]-eres[0])/(eres[1]*(energies[2]-energies[0]));
}
else {
res = 0.0;
}
return res;
}
} // end of atima namespace } // end of atima namespace

View File

@ -209,6 +209,11 @@ namespace catima{
*/ */
double calculate_tof_from_E(Projectile p, double Eout, const Material &t, const Config &c=default_config); double calculate_tof_from_E(Projectile p, double Eout, const Material &t, const Config &c=default_config);
/**
* returns energy magnification after passing material t
*/
double w_magnification(Projectile p, double Ein, const Material &t, const Config &c=default_config);
class DataPoint; class DataPoint;
/** /**
* calculates DataPoint for Projectile Material combinatino * calculates DataPoint for Projectile Material combinatino

View File

@ -450,6 +450,11 @@ def energy_out(Projectile projectile, Material material, energy = None, Config c
energy = projectile.T() energy = projectile.T()
return catimac.energy_out(projectile.cbase, <double>energy, material.cbase, config.cbase) return catimac.energy_out(projectile.cbase, <double>energy, material.cbase, config.cbase)
def w_magnification(Projectile projectile, Material material, energy = None, Config config = default_config):
if(energy is None):
energy = projectile.T()
return catimac.w_magnification(projectile.cbase,energy, material.cbase, config.cbase)
def sezi_dedx_e(Projectile projectile, Target t): def sezi_dedx_e(Projectile projectile, Target t):
return catimac.sezi_dedx_e(projectile.cbase, t.cbase) return catimac.sezi_dedx_e(projectile.cbase, t.cbase)

View File

@ -87,6 +87,8 @@ cdef extern from "catima/catima.h" namespace "catima":
cdef Result calculate(Projectile &p, const Material &t, const Config &c); cdef Result calculate(Projectile &p, const Material &t, const Config &c);
cdef MultiResult calculate(Projectile &p, const Layers &layers, const Config &c); cdef MultiResult calculate(Projectile &p, const Layers &layers, const Config &c);
cdef double w_magnification(Projectile p, double E, const Material &t, const Config &c);
cdef extern from "catima/calculations.h" namespace "catima": cdef extern from "catima/calculations.h" namespace "catima":
cdef double bethek_lindhard(const Projectile &p); cdef double bethek_lindhard(const Projectile &p);
cdef double bethek_lindhard_X(const Projectile &p); cdef double bethek_lindhard_X(const Projectile &p);