mirror of
https://github.com/gwm17/catima.git
synced 2024-11-26 20:18:51 -05:00
commit
1e144980f3
|
@ -556,6 +556,10 @@ double beta_from_T(double T){
|
||||||
return sqrt(1.0-1.0/(gamma*gamma));
|
return sqrt(1.0-1.0/(gamma*gamma));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double p_from_T(double T, double M){
|
||||||
|
return sqrt(T*(T+2*atomic_mass_unit))*M;
|
||||||
|
}
|
||||||
|
|
||||||
double energy_straggling_firsov(double z1,double energy, double z2, double m2){
|
double energy_straggling_firsov(double z1,double energy, double z2, double m2){
|
||||||
double gamma = gamma_from_T(energy);
|
double gamma = gamma_from_T(energy);
|
||||||
double beta2=1.0-1.0/(gamma*gamma);
|
double beta2=1.0-1.0/(gamma*gamma);
|
||||||
|
@ -566,7 +570,7 @@ double energy_straggling_firsov(double z1,double energy, double z2, double m2){
|
||||||
double angular_scattering_variance(Projectile &p, Target &t){
|
double angular_scattering_variance(Projectile &p, Target &t){
|
||||||
if(p.T<=0)return 0.0;
|
if(p.T<=0)return 0.0;
|
||||||
double e=p.T;
|
double e=p.T;
|
||||||
double _p = sqrt(e*(e+2*atomic_mass_unit))*p.A;
|
double _p = p_from_T(e,p.A);
|
||||||
double beta = _p/((e+atomic_mass_unit)*p.A);
|
double beta = _p/((e+atomic_mass_unit)*p.A);
|
||||||
double lr = radiation_length(t.Z,t.A);
|
double lr = radiation_length(t.Z,t.A);
|
||||||
return 198.81 * pow(p.Z,2)/(lr*pow(_p*beta,2));
|
return 198.81 * pow(p.Z,2)/(lr*pow(_p*beta,2));
|
||||||
|
|
|
@ -174,6 +174,7 @@ namespace catima{
|
||||||
//helper
|
//helper
|
||||||
double gamma_from_T(double T);
|
double gamma_from_T(double T);
|
||||||
double beta_from_T(double T);
|
double beta_from_T(double T);
|
||||||
|
double p_from_T(double T, double M);
|
||||||
std::complex<double> lngamma( const std::complex<double> &z );
|
std::complex<double> lngamma( const std::complex<double> &z );
|
||||||
std::complex<double> hyperg(const std::complex<double> &a,
|
std::complex<double> hyperg(const std::complex<double> &a,
|
||||||
const std::complex<double> &b,
|
const std::complex<double> &b,
|
||||||
|
|
12
catima.cpp
12
catima.cpp
|
@ -418,18 +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){
|
std::pair<double,double> w_magnification(Projectile p, double Ein, const Material &t, const Config &c){
|
||||||
double res = 1.0;
|
std::pair<double, double> res{1.0,1.0};
|
||||||
if(t.density()<= 0.0 || t.thickness()<=0){
|
if(t.density()<= 0.0 || t.thickness()<=0){
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
std::vector<double> energies{0.99*Ein, Ein, 1.1*Ein};
|
std::vector<double> energies{0.99*Ein, Ein, 1.01*Ein};
|
||||||
auto eres = energy_out(p,energies,t,c);
|
auto eres = energy_out(p,energies,t,c);
|
||||||
if(eres[0]>0.0 && eres[1]>0.0 && eres[2]>0.0){
|
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]));
|
res.first = energies[1]*(eres[2]-eres[0])/(eres[1]*(energies[2]-energies[0]));
|
||||||
|
res.second = p_from_T(energies[1],p.A)*(p_from_T(eres[2],p.A)-p_from_T(eres[0],p.A))/( p_from_T(eres[1],p.A)*( p_from_T(energies[2],p.A)-p_from_T(energies[0],p.A) ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res = 0.0;
|
res.first = 0.0;
|
||||||
|
res.second = 0.0;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
2
catima.h
2
catima.h
|
@ -212,7 +212,7 @@ namespace catima{
|
||||||
/**
|
/**
|
||||||
* returns energy magnification after passing material t
|
* returns energy magnification after passing material t
|
||||||
*/
|
*/
|
||||||
double w_magnification(Projectile p, double Ein, const Material &t, const Config &c=default_config);
|
std::pair<double,double> w_magnification(Projectile p, double Ein, const Material &t, const Config &c=default_config);
|
||||||
|
|
||||||
class DataPoint;
|
class DataPoint;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from libcpp.vector cimport vector
|
from libcpp.vector cimport vector
|
||||||
|
from libcpp.pair cimport pair
|
||||||
from libcpp cimport bool
|
from libcpp cimport bool
|
||||||
|
|
||||||
cdef extern from "catima/structures.h" namespace "catima":
|
cdef extern from "catima/structures.h" namespace "catima":
|
||||||
|
@ -87,7 +88,7 @@ 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 pair[double,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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user