Multiple Changes:
Conceptional Change, where terminated Particles were set to Energy = 0. Now Particles are just moved within mover and termination detects, position and starts Interaction only if particle remains in tank. Added function_container: Filled with anker points and get values corresponding to input by interpolation. 2D Interpolation needs improvement. CSV-Read in function needs error checks of input file. Changes in katrin class: Boris Push and Drift Approximation improved. Minor Renamings.
This commit is contained in:
@@ -15,72 +15,74 @@
|
||||
using namespace std;
|
||||
|
||||
|
||||
double calc_vecAbs(vec3 vec) {
|
||||
double get_vecAbs(vec3 vec) {
|
||||
return( sqrt( pow(vec[0],2) + pow(vec[1],2) + pow(vec[2],2)) );
|
||||
}
|
||||
|
||||
double calc_Ekin_eV_from_speed(double Speed_ms, double mass_eV) {
|
||||
|
||||
|
||||
double get_Ekin_eV_from_speed(double Speed_ms, double mass_eV) {
|
||||
double beta = Speed_ms/Constants::c_ms;
|
||||
if (beta>=1) {
|
||||
stringstream ss;
|
||||
ss<<"calc_Ekin_eV_from_speed(): Input speed v="<<Speed_ms<<" m/s equal or exeeds speed of light.";
|
||||
ss<<"get_Ekin_eV_from_speed(): Input speed v="<<Speed_ms<<" m/s equal or exeeds speed of light.";
|
||||
throw MyException(ss.str());
|
||||
} else if (beta<0) {
|
||||
stringstream ss;
|
||||
ss<<"calc_Ekin_eV_from_speed(): Input speed v="<<Speed_ms<<" m/s is expected to be absolute value therfore >0.";
|
||||
ss<<"get_Ekin_eV_from_speed(): Input speed v="<<Speed_ms<<" m/s is expected to be absolute value therfore >0.";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
double gamma = calc_gamma_from_beta(beta);
|
||||
double gamma = get_gamma_from_beta(beta);
|
||||
return ( (gamma-1) * mass_eV );
|
||||
}
|
||||
|
||||
double calc_gamma_from_beta(double beta) {
|
||||
double get_gamma_from_beta(double beta) {
|
||||
if (beta>=1) {
|
||||
stringstream ss;
|
||||
ss<<"calc_gamma_from_beta(): Input beta ="<<beta<<" equal or exeeds 1.";
|
||||
ss<<"get_gamma_from_beta(): Input beta ="<<beta<<" equal or exeeds 1.";
|
||||
throw MyException(ss.str());
|
||||
} else if (beta<0) {
|
||||
stringstream ss;
|
||||
ss<<"calc_gamma_from_beta(): Input beta ="<<beta<<" negative.";
|
||||
ss<<"get_gamma_from_beta(): Input beta ="<<beta<<" negative.";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
return( pow(1 - pow(beta,2),-0.5) ) ;
|
||||
}
|
||||
|
||||
double calc_Speed_from_Ekin_eV(double Ekin_eV, double mass_eV) {
|
||||
double get_Speed_from_Ekin_eV(double Ekin_eV, double mass_eV) {
|
||||
if (Ekin_eV<0) {
|
||||
stringstream ss;
|
||||
ss<<"calc_Speed_from_Ekin_eV(): Input Ekin_eV ="<<Ekin_eV<<" negative.";
|
||||
ss<<"get_Speed_from_Ekin_eV(): Input Ekin_eV ="<<Ekin_eV<<" negative.";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
double gamma = calc_gamma_from_Ekin_eV(Ekin_eV, mass_eV);
|
||||
double beta = calc_beta_from_gamma(gamma);
|
||||
double gamma = get_gamma_from_Ekin_eV(Ekin_eV, mass_eV);
|
||||
double beta = get_beta_from_gamma(gamma);
|
||||
return(beta * Constants::c_ms);
|
||||
}
|
||||
|
||||
double calc_gamma_from_Ekin_eV(double Ekin_eV, double mass_eV) {
|
||||
double get_gamma_from_Ekin_eV(double Ekin_eV, double mass_eV) {
|
||||
if (Ekin_eV<0) {
|
||||
stringstream ss;
|
||||
ss<<"calc_gamma_from_Ekin_eV(): Input Ekin_eV ="<<Ekin_eV<<" negative.";
|
||||
ss<<"get_gamma_from_Ekin_eV(): Input Ekin_eV ="<<Ekin_eV<<" negative.";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
return (1. + Ekin_eV/mass_eV);
|
||||
}
|
||||
|
||||
double calc_beta_from_gamma(double gamma) {
|
||||
double get_beta_from_gamma(double gamma) {
|
||||
if (gamma<1) {
|
||||
stringstream ss;
|
||||
ss<<"calc_beta_from_gamma(): Input gamma ="<<gamma<<" smaller 1.";
|
||||
ss<<"get_beta_from_gamma(): Input gamma ="<<gamma<<" smaller 1.";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
return( sqrt(1 - pow(gamma,-2)) );
|
||||
}
|
||||
|
||||
vec3 calc_Newdirection(vec3 direction_old, double theta_change,double phi_change) {
|
||||
vec3 get_Newdirection(vec3 direction_old, double theta_change,double phi_change) {
|
||||
// Transformation of direction following Plante and Cucinotta
|
||||
double theta_old = acos(direction_old[2]/calc_vecAbs(direction_old));
|
||||
double theta_old = acos(direction_old[2]/get_vecAbs(direction_old));
|
||||
double phi_old = atan2(direction_old[1],direction_old[0]);
|
||||
|
||||
double A3 = sin(theta_change)*cos(phi_change);
|
||||
@@ -136,7 +138,7 @@ double roll_MBEnergy(double Temp_K,double mass_eV,ranlib::NormalUnit<double> *rn
|
||||
}
|
||||
beta = sqrt(C*(sum));
|
||||
|
||||
return((calc_gamma_from_beta(beta)-1)*mass_eV);
|
||||
return((get_gamma_from_beta(beta)-1)*mass_eV);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user