2017-07-31 20:27:31 -04:00
|
|
|
"""
|
|
|
|
catima cython
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
:copyright: (c) 2017 by Andrej Prochazka
|
|
|
|
:licence: GNU Affero General Public License, see LICENCE for more details
|
|
|
|
"""
|
|
|
|
|
2017-07-25 12:19:11 -04:00
|
|
|
from libcpp.vector cimport vector
|
2018-02-16 10:13:09 -05:00
|
|
|
from libcpp.pair cimport pair
|
2017-07-31 20:27:31 -04:00
|
|
|
from libcpp cimport bool
|
2017-07-25 12:19:11 -04:00
|
|
|
|
|
|
|
cdef extern from "catima/structures.h" namespace "catima":
|
|
|
|
cdef struct Target:
|
|
|
|
double A
|
|
|
|
int Z
|
2017-12-14 09:29:23 -05:00
|
|
|
double stn
|
2017-07-25 12:19:11 -04:00
|
|
|
|
|
|
|
cdef struct Projectile:
|
|
|
|
double A
|
|
|
|
double Z
|
|
|
|
double Q
|
|
|
|
double T
|
|
|
|
|
|
|
|
cdef struct Result:
|
|
|
|
double Ein
|
|
|
|
double Eout
|
|
|
|
double Eloss
|
|
|
|
double range
|
|
|
|
double dEdxi
|
|
|
|
double dEdxo
|
|
|
|
double sigma_E
|
|
|
|
double sigma_a
|
|
|
|
double sigma_r
|
|
|
|
double tof
|
2018-07-30 19:41:44 -04:00
|
|
|
double sp
|
2017-07-25 12:19:11 -04:00
|
|
|
|
2017-07-31 20:27:31 -04:00
|
|
|
cdef cppclass MultiResult:
|
|
|
|
vector[Result] results
|
|
|
|
Result total_result
|
2017-07-25 12:19:11 -04:00
|
|
|
|
|
|
|
cdef cppclass Material:
|
|
|
|
Material() except +
|
|
|
|
void add_element(double , int , double )
|
2017-12-14 09:29:23 -05:00
|
|
|
Target get_element(int)
|
2017-07-25 12:19:11 -04:00
|
|
|
int ncomponents()
|
|
|
|
double M()
|
|
|
|
double density()
|
|
|
|
void density(double val)
|
|
|
|
double thickness()
|
|
|
|
void thickness(double val)
|
2018-09-18 13:03:17 -04:00
|
|
|
void thickness_cm(double val)
|
2017-12-14 09:29:23 -05:00
|
|
|
void calculate()
|
2018-01-29 07:38:54 -05:00
|
|
|
double I()
|
|
|
|
void I(double val)
|
2017-07-25 12:19:11 -04:00
|
|
|
|
|
|
|
cdef cppclass Layers:
|
|
|
|
Layers() except +
|
|
|
|
const vector[Material]& get_materials() const
|
|
|
|
void add(Material m)
|
|
|
|
int num()const
|
|
|
|
Material& operator[](int i)
|
|
|
|
Layers& operator=(const Layers& other)
|
|
|
|
|
2017-07-31 20:27:31 -04:00
|
|
|
cdef extern from "catima/material_database.h" namespace "catima":
|
|
|
|
cdef Material get_material(int)
|
|
|
|
|
2017-07-25 12:19:11 -04:00
|
|
|
cdef extern from "catima/config.h" namespace "catima":
|
|
|
|
cdef struct Config:
|
|
|
|
char z_effective;
|
|
|
|
char skip;
|
2019-05-10 15:02:51 -04:00
|
|
|
char corrections;
|
|
|
|
char calculation;
|
2017-07-25 12:19:11 -04:00
|
|
|
|
|
|
|
cdef extern from "catima/catima.h" namespace "catima":
|
|
|
|
cdef double dedx(Projectile &p, double T, const Material &t,const Config &c)
|
2017-12-14 05:51:45 -05:00
|
|
|
cdef double domega2dx(Projectile &p, double T, const Material &mat, const Config &c)
|
2017-07-25 12:19:11 -04:00
|
|
|
cdef double range(Projectile &p, double T, const Material &t, const Config &c);
|
|
|
|
cdef double dedx_from_range(Projectile &p, double T, const Material &t, const Config &c);
|
2018-02-14 05:53:56 -05:00
|
|
|
cdef vector[double] dedx_from_range(Projectile &p, vector[double] &T, const Material &t, const Config &c);
|
2017-07-25 12:19:11 -04:00
|
|
|
cdef double energy_out(Projectile &p, double T, const Material &t, const Config &c);
|
2018-02-14 05:53:56 -05:00
|
|
|
cdef vector[double] energy_out(Projectile &p, vector[double] &T, const Material &t, const Config &c);
|
2017-07-25 12:19:11 -04:00
|
|
|
|
|
|
|
cdef double domega2de(Projectile &p, double T, const Material &t, const Config &c);
|
|
|
|
cdef double da2de(Projectile &p, double T, const Material &t, const Config &c);
|
|
|
|
|
|
|
|
cdef double range_straggling(Projectile &p, double T, const Material &t, const Config &c);
|
|
|
|
cdef double da2dx(Projectile &p, double T, const Material &t, const Config &c);
|
|
|
|
cdef double angular_variance(Projectile &p, double T, 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);
|
|
|
|
|
2018-02-16 10:13:09 -05:00
|
|
|
cdef pair[double,double] w_magnification(Projectile p, double E, const Material &t, const Config &c);
|
2018-02-14 09:04:49 -05:00
|
|
|
|
2017-07-25 12:19:11 -04:00
|
|
|
cdef extern from "catima/calculations.h" namespace "catima":
|
2018-01-22 13:36:50 -05:00
|
|
|
cdef double bethek_lindhard(const Projectile &p);
|
|
|
|
cdef double bethek_lindhard_X(const Projectile &p);
|
2018-02-08 12:58:12 -05:00
|
|
|
cdef double bethek_dedx_e(Projectile &p,const Target &t, const Config &c, double I);
|
2017-07-25 12:19:11 -04:00
|
|
|
cdef double z_effective(const Projectile &p, const Target &t, const Config &c);
|
|
|
|
cdef double z_eff_Pierce_Blann(double z, double beta);
|
2018-01-15 09:11:51 -05:00
|
|
|
cdef double z_eff_Anthony_Landford(double pz, double beta, double tz);
|
|
|
|
cdef double z_eff_Hubert(double pz, double E, double tz);
|
|
|
|
cdef double z_eff_Winger(double pz, double beta, double tz);
|
|
|
|
cdef double z_eff_global(double pz, double E, double tz);
|
2018-01-18 13:20:42 -05:00
|
|
|
cdef double z_eff_atima14(double pz, double E, double tz);
|
2018-01-15 09:11:51 -05:00
|
|
|
cdef double z_eff_Schiwietz(double pz, double beta, double tz);
|
|
|
|
cdef double gamma_from_T(double T);
|
|
|
|
cdef double beta_from_T(double T);
|
2017-07-25 12:19:11 -04:00
|
|
|
|
|
|
|
cdef extern from "catima/constants.h" namespace "catima":
|
2017-10-08 18:54:14 -04:00
|
|
|
int max_datapoints "catima::max_datapoints"
|
2017-10-18 19:36:54 -04:00
|
|
|
int max_storage_data "catima::max_storage_data"
|
2017-10-08 18:54:14 -04:00
|
|
|
int logEmin "catima::logEmin"
|
|
|
|
int logEmax "catima::logEmax"
|
2018-07-30 19:41:44 -04:00
|
|
|
bool reactions "catima::reactions"
|
2018-10-21 16:08:16 -04:00
|
|
|
|
2017-07-25 12:19:11 -04:00
|
|
|
cdef extern from "catima/storage.h" namespace "catima":
|
|
|
|
cdef cppclass Interpolator:
|
2017-10-08 18:54:14 -04:00
|
|
|
Interpolator(const double *x, const double *y, int num) except +
|
2017-07-25 12:19:11 -04:00
|
|
|
double eval(double)
|
|
|
|
double derivative(double)
|
2017-10-08 18:54:14 -04:00
|
|
|
|
|
|
|
cdef cppclass DataPoint:
|
2017-10-18 19:36:54 -04:00
|
|
|
Projectile p
|
|
|
|
Material m
|
|
|
|
Config config
|
2017-10-08 18:54:14 -04:00
|
|
|
vector[double] range
|
|
|
|
vector[double] range_straggling
|
|
|
|
vector[double] angular_variance
|
|
|
|
|
2017-10-18 19:36:54 -04:00
|
|
|
cdef cppclass Data:
|
|
|
|
Data() except +
|
|
|
|
DataPoint& Get(unsigned int i)
|
|
|
|
int GetN()
|
|
|
|
|
|
|
|
|
2017-10-08 18:54:14 -04:00
|
|
|
cdef cppclass EnergyTableType "catima::EnergyTable[max_datapoints]":
|
|
|
|
size_t num;
|
|
|
|
double operator()(int i)
|
|
|
|
|
2017-10-18 19:36:54 -04:00
|
|
|
cdef EnergyTableType energy_table;
|
|
|
|
cdef Data _storage;
|
2018-10-21 16:08:16 -04:00
|
|
|
cdef DataPoint& get_data(const Projectile &p, const Material &t, const Config c);
|