mirror of
https://github.com/gwm17/Mask.git
synced 2024-11-22 18:28:51 -05:00
Some commenting added
This commit is contained in:
parent
dc7f3923ed
commit
4ccaabb534
|
@ -46,6 +46,7 @@ class EnergyLoss {
|
||||||
|
|
||||||
//constants for calculations
|
//constants for calculations
|
||||||
static constexpr double MAX_FRACTIONAL_STEP = 0.001;
|
static constexpr double MAX_FRACTIONAL_STEP = 0.001;
|
||||||
|
static constexpr double MAX_DEPTH = 50;
|
||||||
static constexpr double MAX_H_E_PER_U = 100000.0;
|
static constexpr double MAX_H_E_PER_U = 100000.0;
|
||||||
static constexpr double AVOGADRO = 0.60221367; //N_A times 10^(-24) for converting
|
static constexpr double AVOGADRO = 0.60221367; //N_A times 10^(-24) for converting
|
||||||
static constexpr double MEV2U = 1.0/931.4940954;
|
static constexpr double MEV2U = 1.0/931.4940954;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
Nucleus.h
|
||||||
|
Nucleus is a derived class of Vec4. A nucleus is the kinematics is essentially a 4 vector with the
|
||||||
|
additional properties of the number of total nucleons (A), the number of protons (Z), a ground state mass,
|
||||||
|
an exctitation energy, and an isotopic symbol.
|
||||||
|
|
||||||
|
--GWM Jan 2021
|
||||||
|
*/
|
||||||
#ifndef NUCLEUS_H
|
#ifndef NUCLEUS_H
|
||||||
#define NUCLEUS_H
|
#define NUCLEUS_H
|
||||||
|
|
||||||
|
@ -25,7 +33,8 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Nucleus operator+(const Nucleus& daughter) {
|
//Conservation of nucleons and momentum
|
||||||
|
inline Nucleus operator+(const Nucleus& daughter) {
|
||||||
return Nucleus(GetZ()+daughter.GetZ(), GetA()+daughter.GetA(), GetPx()+daughter.GetPx(), GetPy()+daughter.GetPy(), GetPz()+daughter.GetPz(), GetE()+daughter.GetE());
|
return Nucleus(GetZ()+daughter.GetZ(), GetA()+daughter.GetA(), GetPx()+daughter.GetPx(), GetPy()+daughter.GetPy(), GetPz()+daughter.GetPz(), GetE()+daughter.GetE());
|
||||||
};
|
};
|
||||||
inline Nucleus operator-(const Nucleus& daughter) {
|
inline Nucleus operator-(const Nucleus& daughter) {
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
Reaction.h
|
||||||
|
Reaction is a class which implements either a decay or scattering reaction. As such it requires either
|
||||||
|
3 (decay) or 4 (scattering) nuclei to perform any calcualtions. I also links together the target, which provides
|
||||||
|
energy loss calculations, with the kinematics. Note that Reaction does not own the LayeredTarget.
|
||||||
|
|
||||||
|
--GWM Jan. 2021
|
||||||
|
*/
|
||||||
#ifndef REACTION_H
|
#ifndef REACTION_H
|
||||||
#define REACTION_H
|
#define REACTION_H
|
||||||
|
|
||||||
|
@ -15,6 +23,8 @@ public:
|
||||||
void SetNuclei(int zt, int at, int zp, int ap, int ze, int ae);
|
void SetNuclei(int zt, int at, int zp, int ap, int ze, int ae);
|
||||||
void SetNuclei(const Nucleus* nucs);
|
void SetNuclei(const Nucleus* nucs);
|
||||||
void SetBeamKE(double bke);
|
void SetBeamKE(double bke);
|
||||||
|
|
||||||
|
/*Setters and getters*/
|
||||||
inline void SetLayeredTarget(LayeredTarget* targ) { target = targ; };
|
inline void SetLayeredTarget(LayeredTarget* targ) { target = targ; };
|
||||||
inline void SetPolarRxnAngle(double theta) { m_theta = theta; };
|
inline void SetPolarRxnAngle(double theta) { m_theta = theta; };
|
||||||
inline void SetAzimRxnAngle(double phi) { m_phi = phi; };
|
inline void SetAzimRxnAngle(double phi) { m_phi = phi; };
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
ReactionSystem.h
|
||||||
|
ReactionSystem is the base class from which all kinematics calculations should inherit. It contains all members and functions
|
||||||
|
to perform a single step reaction/decay, which is the basic building block of all subsequent types of reactions in MASK. More
|
||||||
|
complicated systems (see TwoStepSystem and ThreeStepSystem) add further data members and override the virtual functions.
|
||||||
|
|
||||||
|
--GWM Jan. 2021
|
||||||
|
*/
|
||||||
#ifndef REACTIONSYSTEM_H
|
#ifndef REACTIONSYSTEM_H
|
||||||
#define REACTIONSYSTEM_H
|
#define REACTIONSYSTEM_H
|
||||||
|
|
||||||
|
@ -12,12 +20,16 @@ public:
|
||||||
ReactionSystem();
|
ReactionSystem();
|
||||||
ReactionSystem(std::vector<int>& z, std::vector<int>& a);
|
ReactionSystem(std::vector<int>& z, std::vector<int>& a);
|
||||||
virtual ~ReactionSystem();
|
virtual ~ReactionSystem();
|
||||||
|
|
||||||
virtual bool SetNuclei(std::vector<int>& z, std::vector<int>& a);
|
virtual bool SetNuclei(std::vector<int>& z, std::vector<int>& a);
|
||||||
void AddTargetLayer(std::vector<int>& zt, std::vector<int>& at, std::vector<int>& stoich, double thickness);
|
void AddTargetLayer(std::vector<int>& zt, std::vector<int>& at, std::vector<int>& stoich, double thickness);
|
||||||
|
|
||||||
|
/*Set sampling parameters*/
|
||||||
inline void SetRandomGenerator(TRandom3* gen) { generator = gen; gen_set_flag = true; };
|
inline void SetRandomGenerator(TRandom3* gen) { generator = gen; gen_set_flag = true; };
|
||||||
inline void SetBeamDistro(double mean, double sigma) { m_beamDist = std::make_pair(mean, sigma); };
|
inline void SetBeamDistro(double mean, double sigma) { m_beamDist = std::make_pair(mean, sigma); };
|
||||||
inline void SetTheta1Range(double min, double max) { m_theta1Range = std::make_pair(min*deg2rad, max*deg2rad); };
|
inline void SetTheta1Range(double min, double max) { m_theta1Range = std::make_pair(min*deg2rad, max*deg2rad); };
|
||||||
inline void SetExcitationDistro(double mean, double sigma) { m_exDist = std::make_pair(mean, sigma); };
|
inline void SetExcitationDistro(double mean, double sigma) { m_exDist = std::make_pair(mean, sigma); };
|
||||||
|
|
||||||
virtual void RunSystem();
|
virtual void RunSystem();
|
||||||
|
|
||||||
inline const Nucleus& GetTarget() const { return step1.GetTarget(); };
|
inline const Nucleus& GetTarget() const { return step1.GetTarget(); };
|
||||||
|
@ -32,6 +44,8 @@ protected:
|
||||||
|
|
||||||
Reaction step1;
|
Reaction step1;
|
||||||
LayeredTarget target;
|
LayeredTarget target;
|
||||||
|
|
||||||
|
//Sampling information
|
||||||
std::pair<double, double> m_beamDist, m_theta1Range, m_exDist;
|
std::pair<double, double> m_beamDist, m_theta1Range, m_exDist;
|
||||||
TRandom3* generator; //not owned by ReactionSystem
|
TRandom3* generator; //not owned by ReactionSystem
|
||||||
|
|
||||||
|
|
15
input.txt
15
input.txt
|
@ -3,24 +3,25 @@ OutputFile: /media/gordon/b6414c35-ec1f-4fc1-83bc-a6b68ca4325a/gwm17/test_newkin
|
||||||
SaveTree: yes
|
SaveTree: yes
|
||||||
SavePlots: yes
|
SavePlots: yes
|
||||||
----------Reaction Information----------
|
----------Reaction Information----------
|
||||||
ReactionType: 0
|
ReactionType: 2
|
||||||
Z A (order is target, projectile, ejectile, break1, break3)
|
Z A (order is target, projectile, ejectile, break1, break3)
|
||||||
5 9
|
5 10
|
||||||
0 0
|
2 3
|
||||||
1 1
|
2 4
|
||||||
|
1 2
|
||||||
----------Target Information----------
|
----------Target Information----------
|
||||||
Name: test_targ
|
Name: test_targ
|
||||||
Layers: 2
|
Layers: 2
|
||||||
~Layer1
|
~Layer1
|
||||||
Thickness(ug/cm^2): 0
|
Thickness(ug/cm^2): 10
|
||||||
Z A Stoich
|
Z A Stoich
|
||||||
6 12 1
|
6 12 1
|
||||||
0
|
0
|
||||||
~
|
~
|
||||||
~Layer2
|
~Layer2
|
||||||
Thickness(ug/cm^2): 0
|
Thickness(ug/cm^2): 80
|
||||||
Z A Stoich
|
Z A Stoich
|
||||||
5 9 1
|
5 10 1
|
||||||
0
|
0
|
||||||
~
|
~
|
||||||
----------Sampling Information----------
|
----------Sampling Information----------
|
||||||
|
|
|
@ -55,6 +55,8 @@ double EnergyLoss::GetEnergyLoss(int zp, int ap, double e_initial, double thickn
|
||||||
double e_step = GetTotalStoppingPower(e_final)*x_step/1000.0; //initial step in e
|
double e_step = GetTotalStoppingPower(e_final)*x_step/1000.0; //initial step in e
|
||||||
double e_threshold = 0.05*e_initial;
|
double e_threshold = 0.05*e_initial;
|
||||||
|
|
||||||
|
int depth=0;
|
||||||
|
|
||||||
|
|
||||||
if(thickness == 0.0) return 0;
|
if(thickness == 0.0) return 0;
|
||||||
else if(e_initial == 0.0) return 0;
|
else if(e_initial == 0.0) return 0;
|
||||||
|
@ -62,16 +64,20 @@ double EnergyLoss::GetEnergyLoss(int zp, int ap, double e_initial, double thickn
|
||||||
bool go = true;
|
bool go = true;
|
||||||
while(go) {
|
while(go) {
|
||||||
//If intial guess of step size is too large, shrink until in range
|
//If intial guess of step size is too large, shrink until in range
|
||||||
if(e_step/e_final > MAX_FRACTIONAL_STEP /*&& e_step >= E_PRECISION_LIMIT*/) {
|
if(e_step/e_final > MAX_FRACTIONAL_STEP && depth < MAX_DEPTH) {
|
||||||
|
depth++;
|
||||||
x_step *= 0.5;
|
x_step *= 0.5;
|
||||||
e_step = GetTotalStoppingPower(e_final)*x_step/1000.0;
|
e_step = GetTotalStoppingPower(e_final)*x_step/1000.0;
|
||||||
} else if((x_step + x_traversed) >= thickness) { //last chunk
|
} else if((x_step + x_traversed) >= thickness) { //last chunk
|
||||||
go = false;
|
go = false;
|
||||||
x_step = thickness - x_traversed; //get valid portion of last chunk
|
x_step = thickness - x_traversed; //get valid portion of last chunk
|
||||||
e_final -= GetTotalStoppingPower(e_final)*x_step/1000.0;
|
e_final -= GetTotalStoppingPower(e_final)*x_step/1000.0;
|
||||||
|
if(depth > 20)std::cout<<"depth: "<<depth<<std::endl;
|
||||||
if(e_final <= e_threshold) {
|
if(e_final <= e_threshold) {
|
||||||
return e_initial;
|
return e_initial;
|
||||||
}
|
}
|
||||||
|
} else if(depth == MAX_DEPTH) {
|
||||||
|
return e_initial;
|
||||||
} else {
|
} else {
|
||||||
x_traversed += x_step;
|
x_traversed += x_step;
|
||||||
e_step = GetTotalStoppingPower(e_final)*x_step/1000.0;
|
e_step = GetTotalStoppingPower(e_final)*x_step/1000.0;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
Nucleus.cpp
|
||||||
|
Nucleus is a derived class of Vec4. A nucleus is the kinematics is essentially a 4 vector with the
|
||||||
|
additional properties of the number of total nucleons (A), the number of protons (Z), a ground state mass,
|
||||||
|
an exctitation energy, and an isotopic symbol.
|
||||||
|
|
||||||
|
--GWM Jan 2021
|
||||||
|
*/
|
||||||
#include "Nucleus.h"
|
#include "Nucleus.h"
|
||||||
#include "MassLookup.h"
|
#include "MassLookup.h"
|
||||||
|
|
||||||
|
@ -13,7 +21,7 @@ Nucleus::Nucleus(int Z, int A) :
|
||||||
{
|
{
|
||||||
m_gs_mass = MASS.FindMass(Z, A);
|
m_gs_mass = MASS.FindMass(Z, A);
|
||||||
m_symbol = MASS.FindSymbol(Z, A);
|
m_symbol = MASS.FindSymbol(Z, A);
|
||||||
SetVectorCartesian(0,0,0,m_gs_mass);
|
SetVectorCartesian(0,0,0,m_gs_mass); //by defualt a nucleus has mass given by the g.s.
|
||||||
}
|
}
|
||||||
|
|
||||||
Nucleus::Nucleus(int Z, int A, double px, double py, double pz, double E) :
|
Nucleus::Nucleus(int Z, int A, double px, double py, double pz, double E) :
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
Reaction.cpp
|
||||||
|
Reaction is a class which implements either a decay or scattering reaction. As such it requires either
|
||||||
|
3 (decay) or 4 (scattering) nuclei to perform any calcualtions. I also links together the target, which provides
|
||||||
|
energy loss calculations, with the kinematics. Note that Reaction does not own the LayeredTarget.
|
||||||
|
|
||||||
|
--GWM Jan. 2021
|
||||||
|
*/
|
||||||
#include "Reaction.h"
|
#include "Reaction.h"
|
||||||
#include "KinematicsExceptions.h"
|
#include "KinematicsExceptions.h"
|
||||||
|
|
||||||
|
@ -69,6 +77,7 @@ void Reaction::SetBeamKE(double bke) {
|
||||||
m_bke = bke - target->GetProjectileEnergyLoss(reactants[1].GetZ(), reactants[1].GetA(), bke, rxnLayer, 0);
|
m_bke = bke - target->GetProjectileEnergyLoss(reactants[1].GetZ(), reactants[1].GetA(), bke, rxnLayer, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Methods given by Iliadis in Nuclear Physics of Stars, Appendix C
|
||||||
void Reaction::CalculateReaction() {
|
void Reaction::CalculateReaction() {
|
||||||
//Target assumed at rest, with 0 excitation energy
|
//Target assumed at rest, with 0 excitation energy
|
||||||
reactants[0].SetVectorCartesian(0.,0.,0.,reactants[0].GetGroundStateMass());
|
reactants[0].SetVectorCartesian(0.,0.,0.,reactants[0].GetGroundStateMass());
|
||||||
|
@ -112,6 +121,7 @@ void Reaction::CalculateReaction() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Calculate in CM, where decay is isotropic
|
||||||
void Reaction::CalculateDecay() {
|
void Reaction::CalculateDecay() {
|
||||||
|
|
||||||
double Q = reactants[0].GetInvMass() - reactants[2].GetGroundStateMass() - reactants[3].GetGroundStateMass();
|
double Q = reactants[0].GetInvMass() - reactants[2].GetGroundStateMass() - reactants[3].GetGroundStateMass();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user