1
0
Fork 0
mirror of https://github.com/gwm17/Mask.git synced 2024-11-22 18:28:51 -05:00

Added catima for better energy loss calculations

This commit is contained in:
Gordon McCann 2022-06-09 11:29:02 -04:00
parent 0b2f4f74ee
commit 0b63196077
12 changed files with 59 additions and 9 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/vendor/catima"]
path = src/vendor/catima
url = https://github.com/gwm17/catima.git

View File

@ -8,6 +8,7 @@ set(MASK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
add_subdirectory(src/vendor/catima)
add_subdirectory(src/Mask) add_subdirectory(src/Mask)
add_subdirectory(src/MaskApp) add_subdirectory(src/MaskApp)
add_subdirectory(src/Detectors) add_subdirectory(src/Detectors)

View File

@ -22,6 +22,7 @@ namespace Mask {
public: public:
~MassLookup(); ~MassLookup();
double FindMass(int Z, int A); double FindMass(int Z, int A);
double FindMassU(int Z, int A) { return FindMass(Z, A)/u_to_mev; }
std::string FindSymbol(int Z, int A); std::string FindSymbol(int Z, int A);
static MassLookup& GetInstance() { static MassLookup& GetInstance() {

View File

@ -25,6 +25,7 @@ private:
Mask::Target deadlayer; Mask::Target deadlayer;
Mask::Target sabre_eloss; Mask::Target sabre_eloss;
Mask::Target degrader;
SabreDeadChannelMap dmap; SabreDeadChannelMap dmap;
//Sabre constants //Sabre constants
@ -41,6 +42,7 @@ private:
const double DEG2RAD = M_PI/180.0; const double DEG2RAD = M_PI/180.0;
static constexpr double DEADLAYER_THIN = 50 * 1e-7 * 2.3296 * 1e6; // ug/cm^2 (50 nm thick * density) static constexpr double DEADLAYER_THIN = 50 * 1e-7 * 2.3296 * 1e6; // ug/cm^2 (50 nm thick * density)
static constexpr double SABRE_THICKNESS = 500 * 1e-4 * 2.3926 * 1e6; // ug/cm^2 (500 um thick * density) static constexpr double SABRE_THICKNESS = 500 * 1e-4 * 2.3926 * 1e6; // ug/cm^2 (500 um thick * density)
static constexpr double DEGRADER_THICKNESS = 70.0 * 1.0e-4 * 16.69 * 1e6; //tantalum degrader (70 um thick)
const double ENERGY_THRESHOLD = 0.2; //in MeV const double ENERGY_THRESHOLD = 0.2; //in MeV

View File

@ -17,6 +17,8 @@ Written by G.W. McCann Aug. 2020
#include <vector> #include <vector>
#include <cmath> #include <cmath>
#include "EnergyLoss.h" #include "EnergyLoss.h"
#include "catima/gwm_integrators.h"
#include "MassLookup.h"
namespace Mask { namespace Mask {
@ -39,7 +41,9 @@ namespace Mask {
private: private:
EnergyLoss eloss; EnergyLoss eloss;
catima::Material target_material;
double thickness; double thickness;
double thickness_gcm2;
std::vector<int> Z, A, Stoich; std::vector<int> Z, A, Stoich;
}; };

View File

@ -1,6 +1,7 @@
#include "AnasenEfficiency.h" #include "AnasenEfficiency.h"
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iostream>
AnasenEfficiency::AnasenEfficiency() : AnasenEfficiency::AnasenEfficiency() :
DetectorEfficiency(), det_silicon(si_thickness) DetectorEfficiency(), det_silicon(si_thickness)

View File

@ -14,6 +14,7 @@ target_sources(DetectEff PUBLIC
target_link_libraries(DetectEff target_link_libraries(DetectEff
Mask Mask
catima
) )
set_target_properties(DetectEff PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${MASK_BINARY_DIR}) set_target_properties(DetectEff PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${MASK_BINARY_DIR})

View File

@ -26,4 +26,5 @@ target_sources(Mask PRIVATE
Vec4.cpp Vec4.cpp
) )
target_link_libraries(Mask catima)
set_target_properties(Mask PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${MASK_LIBRARY_DIR}) set_target_properties(Mask PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${MASK_LIBRARY_DIR})

View File

@ -11,12 +11,14 @@ Written by G.W. McCann Aug. 2020
*/ */
#include "Target.h" #include "Target.h"
#include "catima/nucdata.h"
namespace Mask { namespace Mask {
/*Targets must be of known thickness*/ /*Targets must be of known thickness*/
Target::Target(double thick) { Target::Target(double thick) {
thickness = thick; thickness = thick;
thickness_gcm2 = thickness*1.0e-6;
} }
Target::~Target() {} Target::~Target() {}
@ -26,8 +28,12 @@ namespace Mask {
Z = z; Z = z;
A = a; A = a;
Stoich = stoich; Stoich = stoich;
MassLookup& masses = MassLookup::GetInstance();
eloss.SetTargetComponents(Z, A, Stoich); eloss.SetTargetComponents(Z, A, Stoich);
for(size_t i=0; i<Z.size(); i++)
{
target_material.add_element(masses.FindMassU(Z[i], A[i]), Z[i], Stoich[i]);
}
} }
/*Element verification*/ /*Element verification*/
@ -44,8 +50,11 @@ namespace Mask {
return startEnergy; return startEnergy;
else if (theta > M_PI/2.) else if (theta > M_PI/2.)
theta = M_PI - theta; theta = M_PI - theta;
catima::Projectile proj(MassLookup::GetInstance().FindMassU(zp, ap), zp, 0.0, 0.0);
return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/fabs(cos(theta))); proj.T = startEnergy/proj.A;
target_material.thickness(thickness_gcm2/fabs(cos(theta)));
return catima::integrate_energyloss(proj, target_material);
//return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/fabs(cos(theta)));
} }
/*Calculates the energy loss for traveling some fraction through the target*/ /*Calculates the energy loss for traveling some fraction through the target*/
@ -56,7 +65,11 @@ namespace Mask {
else if (theta > M_PI/2.) else if (theta > M_PI/2.)
theta = M_PI-theta; theta = M_PI-theta;
return eloss.GetEnergyLoss(zp, ap, finalEnergy, thickness*percent_depth/(std::fabs(std::cos(theta)))); catima::Projectile proj(MassLookup::GetInstance().FindMassU(zp, ap), zp, 0.0, 0.0);
proj.T = finalEnergy/proj.A;
target_material.thickness(thickness_gcm2*percent_depth/fabs(cos(theta)));
return catima::integrate_energyloss(proj, target_material);
//return eloss.GetEnergyLoss(zp, ap, finalEnergy, thickness*percent_depth/(std::fabs(std::cos(theta))));
} }
/*Calculates reverse energy loss for travelling all the way through the target*/ /*Calculates reverse energy loss for travelling all the way through the target*/
@ -66,7 +79,11 @@ namespace Mask {
else if (theta > M_PI/2.) else if (theta > M_PI/2.)
theta = M_PI - theta; theta = M_PI - theta;
return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/fabs(cos(theta))); catima::Projectile proj(MassLookup::GetInstance().FindMassU(zp, ap), zp, 0.0, 0.0);
proj.T = finalEnergy/proj.A;
target_material.thickness(thickness_gcm2/fabs(cos(theta)));
return catima::reverse_integrate_energyloss(proj, target_material);
//return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/fabs(cos(theta)));
} }
/*Calculates the reverse energy loss for traveling some fraction through the target*/ /*Calculates the reverse energy loss for traveling some fraction through the target*/
@ -76,8 +93,11 @@ namespace Mask {
return finalEnergy; return finalEnergy;
else if (theta > M_PI/2.) else if (theta > M_PI/2.)
theta = M_PI-theta; theta = M_PI-theta;
catima::Projectile proj(MassLookup::GetInstance().FindMassU(zp, ap), zp, 0.0, 0.0);
return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness*percent_depth/(std::fabs(std::cos(theta)))); proj.T = finalEnergy/proj.A;
target_material.thickness(thickness_gcm2*percent_depth/fabs(cos(theta)));
return catima::reverse_integrate_energyloss(proj, target_material);
//return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness*percent_depth/(std::fabs(std::cos(theta))));
} }
} }

View File

@ -1,5 +1,6 @@
#include "RootPlotter.h" #include "RootPlotter.h"
#include <TFile.h> #include <TFile.h>
#include <TVector3.h>
#include <iostream> #include <iostream>
@ -57,12 +58,19 @@ void RootPlotter::FillCorrelations(const Mask::MaskFileData& data, Mask::RxnType
if(type == Mask::RxnType::TwoStepRxn || type == Mask::RxnType::ThreeStepRxn) if(type == Mask::RxnType::TwoStepRxn || type == Mask::RxnType::ThreeStepRxn)
{ {
TVector3 p1, p2;
p1.SetMagThetaPhi(1.0, data.theta[3], data.phi[3]);
p2.SetMagThetaPhi(1.0, data.theta[4], data.phi[4]);
double theta_resid_break1 = std::acos(p1.Dot(p2));
std::string theta_break1_theta_break2_name = "theta_break1_theta_break2_cor"; std::string theta_break1_theta_break2_name = "theta_break1_theta_break2_cor";
std::string theta_break1_theta_break2_title = theta_break1_theta_break2_name + ";#theta_{lab} Breakup1 (deg);#theta_{lab} Breakup2 (deg)"; std::string theta_break1_theta_break2_title = theta_break1_theta_break2_name + ";#theta_{lab} Breakup1 (deg);#theta_{lab} Breakup2 (deg)";
MyFill(theta_break1_theta_break2_name, theta_break1_theta_break2_title, data.theta[4]*rad2deg, data.theta[5]*rad2deg, 4); MyFill(theta_break1_theta_break2_name, theta_break1_theta_break2_title, data.theta[4]*rad2deg, data.theta[5]*rad2deg, 4);
std::string theta_resid_theta_break1_name = "theta_resid_theta_break1_cor"; std::string theta_resid_theta_break1_name = "theta_resid_theta_break1_cor";
std::string theta_resid_theta_break1_title = theta_resid_theta_break1_name + ";#theta_{lab} Residual (deg);#theta_{lab} Breakup1 (deg)"; std::string theta_resid_theta_break1_title = theta_resid_theta_break1_name + ";#theta_{lab} Residual (deg);#theta_{lab} Breakup1 (deg)";
MyFill(theta_resid_theta_break1_name, theta_resid_theta_break1_title, data.theta[3]*rad2deg, data.theta[4]*rad2deg, 4); MyFill(theta_resid_theta_break1_name, theta_resid_theta_break1_title, data.theta[3]*rad2deg, data.theta[4]*rad2deg, 4);
std::string ke_break1_theta_rel_name = "ke_break1_theta_rel";
std::string ke_break1_theta_rel_title = ke_break1_theta_rel_name + ";#theta_{resid-break1};KE_{break1} (MeV)";
MyFill(ke_break1_theta_rel_name, ke_break1_theta_rel_title, theta_resid_break1*rad2deg, data.KE[4], 4);
} }
if(type == Mask::RxnType::ThreeStepRxn) if(type == Mask::RxnType::ThreeStepRxn)
{ {
@ -86,9 +94,16 @@ void RootPlotter::FillCorrelationsDetected(const Mask::MaskFileData& data, Mask:
} }
if((type == Mask::RxnType::TwoStepRxn || type == Mask::RxnType::ThreeStepRxn) && data.detect_flag[4]) if((type == Mask::RxnType::TwoStepRxn || type == Mask::RxnType::ThreeStepRxn) && data.detect_flag[4])
{ {
TVector3 p1, p2;
p1.SetMagThetaPhi(1.0, data.theta[3], data.phi[3]);
p2.SetMagThetaPhi(1.0, data.theta[4], data.phi[4]);
double theta_resid_break1 = std::acos(p1.Dot(p2));
std::string theta_resid_theta_break1_name = "theta_resid_theta_break1_cor_detected"; std::string theta_resid_theta_break1_name = "theta_resid_theta_break1_cor_detected";
std::string theta_resid_theta_break1_title = theta_resid_theta_break1_name + ";#theta_{lab} Residual (deg);#theta_{lab} Breakup1 (deg)"; std::string theta_resid_theta_break1_title = theta_resid_theta_break1_name + ";#theta_{lab} Residual (deg);#theta_{lab} Breakup1 (deg)";
MyFill(theta_resid_theta_break1_name, theta_resid_theta_break1_title, data.theta[3]*rad2deg, data.theta[4]*rad2deg, 4); MyFill(theta_resid_theta_break1_name, theta_resid_theta_break1_title, data.theta[3]*rad2deg, data.theta[4]*rad2deg, 4);
std::string ke_break1_theta_rel_name = "ke_break1_theta_rel_detected";
std::string ke_break1_theta_rel_title = ke_break1_theta_rel_name + ";#theta_{resid-break1};KE_{break1} (MeV)";
MyFill(ke_break1_theta_rel_name, ke_break1_theta_rel_title, theta_resid_break1*rad2deg, data.KE[4], 4);
} }
if((type == Mask::RxnType::TwoStepRxn || type == Mask::RxnType::ThreeStepRxn) && data.detect_flag[4] && data.detect_flag[5]) if((type == Mask::RxnType::TwoStepRxn || type == Mask::RxnType::ThreeStepRxn) && data.detect_flag[4] && data.detect_flag[5])

1
src/vendor/catima vendored Submodule

@ -0,0 +1 @@
Subproject commit 629690a6f90ad9d343e02f72d4fad860fce1ed6d