From ba023b48ddbc4faec0f3c99a47cf1d31f3b21e31 Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Sat, 20 Aug 2022 09:05:34 -0700 Subject: [PATCH] Now passes intial testing, seems fully functional. Need to do some optimization tests against old way to see if actually improved anything. --- src/Mask/MassLookup.cpp | 4 ++-- src/Mask/MassLookup.h | 6 +++--- src/Mask/Nucleus.cpp | 2 +- src/Mask/Nucleus.h | 6 +++--- src/Plotters/RootPlotter.cpp | 25 ++++++++++++++----------- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/Mask/MassLookup.cpp b/src/Mask/MassLookup.cpp index 4bd1e7c..ad26256 100644 --- a/src/Mask/MassLookup.cpp +++ b/src/Mask/MassLookup.cpp @@ -41,7 +41,7 @@ namespace Mask { MassLookup::~MassLookup() {} //Returns nuclear mass in MeV - double MassLookup::FindMass(int Z, int A) + double MassLookup::FindMass(uint32_t Z, uint32_t A) { KeyPair key({Z, A}); auto data = massTable.find(key.GetID()); @@ -52,7 +52,7 @@ namespace Mask { } //returns element symbol - std::string MassLookup::FindSymbol(int Z, int A) + std::string MassLookup::FindSymbol(uint32_t Z, uint32_t A) { KeyPair key({Z, A}); auto data = elementTable.find(key.GetID()); diff --git a/src/Mask/MassLookup.h b/src/Mask/MassLookup.h index 61220cf..fac5e9e 100644 --- a/src/Mask/MassLookup.h +++ b/src/Mask/MassLookup.h @@ -35,9 +35,9 @@ namespace Mask { }; ~MassLookup(); - 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); + double FindMass(uint32_t Z, uint32_t A); + double FindMassU(uint32_t Z, uint32_t A) { return FindMass(Z, A)/u_to_mev; } + std::string FindSymbol(uint32_t Z, uint32_t A); static MassLookup& GetInstance() { return *s_instance; } diff --git a/src/Mask/Nucleus.cpp b/src/Mask/Nucleus.cpp index d375fb3..c82b7f5 100644 --- a/src/Mask/Nucleus.cpp +++ b/src/Mask/Nucleus.cpp @@ -2,7 +2,7 @@ namespace Mask { - Nucleus CreateNucleus(int z, int a) + Nucleus CreateNucleus(uint32_t z, uint32_t a) { Nucleus nuc; nuc.Z = z; diff --git a/src/Mask/Nucleus.h b/src/Mask/Nucleus.h index d5b4b47..2769cf6 100644 --- a/src/Mask/Nucleus.h +++ b/src/Mask/Nucleus.h @@ -37,8 +37,8 @@ namespace Mask { return vec4.M() - groundStateMass; } - int Z = 0; - int A = 0; + uint32_t Z = 0; + uint32_t A = 0; double groundStateMass = 0.0; std::string isotopicSymbol = ""; double thetaCM = 0.0; @@ -50,7 +50,7 @@ namespace Mask { double detectedPhi = 0.0; }; - Nucleus CreateNucleus(int z, int a); + Nucleus CreateNucleus(uint32_t z, uint32_t a); bool EnforceDictionaryLinked(); diff --git a/src/Plotters/RootPlotter.cpp b/src/Plotters/RootPlotter.cpp index 6bb7310..81918d9 100644 --- a/src/Plotters/RootPlotter.cpp +++ b/src/Plotters/RootPlotter.cpp @@ -5,6 +5,11 @@ #include +static double FullPhi(double phi) +{ + return phi < 0.0 ? 2.0*M_PI + phi : phi; +} + RootPlotter::RootPlotter() { TH1::AddDirectory(kFALSE); @@ -46,7 +51,7 @@ void RootPlotter::Run(const std::string& inputname, const std::string& outputnam output->cd(); for(auto& obj : m_map) - obj.second->Write(obj.second->GetName(), TObject::kOverwrite); + obj.second->Write(); output->Close(); } @@ -68,19 +73,17 @@ void RootPlotter::FillData(const Mask::Nucleus& nuc) std::string angdist_name = sym + modifier +"_angDist"; std::string angdist_title = angdist_name+";cos#right(#theta_{CM}#left);counts"; + + MyFill(ke_vs_th_name.c_str(), ke_vs_th_title.c_str(), nuc.vec4.Theta()*s_rad2deg, nuc.GetKE(), 2); + MyFill(ke_vs_ph_name.c_str(), ke_vs_ph_title.c_str(), FullPhi(nuc.vec4.Phi())*s_rad2deg, nuc.GetKE(), 4); + MyFill(th_vs_ph_name.c_str(), th_vs_ph_title.c_str(), nuc.vec4.Theta()*s_rad2deg, FullPhi(nuc.vec4.Phi())*s_rad2deg, 2); + MyFill(ex_name.c_str(),ex_title.c_str(),260,-1.0,25,nuc.GetExcitationEnergy()); + MyFill(angdist_name.c_str(), angdist_title.c_str(),20,-1.0,1.0,std::cos(nuc.thetaCM)); if(nuc.isDetected) - { - MyFill(ke_vs_th_name.c_str(), ke_vs_th_title.c_str(), nuc.vec4.Theta()*s_rad2deg, nuc.GetKE(), 2); - MyFill(ke_vs_ph_name.c_str(), ke_vs_ph_title.c_str(), nuc.vec4.Phi()*s_rad2deg, nuc.GetKE(), 4); - MyFill(th_vs_ph_name.c_str(), th_vs_ph_title.c_str(), nuc.vec4.Theta()*s_rad2deg, nuc.vec4.Phi()*s_rad2deg, 2); - MyFill(ex_name.c_str(),ex_title.c_str(),260,-1.0,25,nuc.GetExcitationEnergy()); - MyFill(angdist_name.c_str(), angdist_title.c_str(),20,-1.0,1.0,std::cos(nuc.thetaCM)); - } - else { MyFill(ke_vs_th_name.c_str(), ke_vs_th_title.c_str(), nuc.vec4.Theta()*s_rad2deg, nuc.detectedKE, 2); - MyFill(ke_vs_ph_name.c_str(), ke_vs_ph_title.c_str(), nuc.vec4.Phi()*s_rad2deg, nuc.detectedKE, 4); - MyFill(th_vs_ph_name.c_str(), th_vs_ph_title.c_str(), nuc.vec4.Theta()*s_rad2deg, nuc.vec4.Phi()*s_rad2deg, 2); + MyFill(ke_vs_ph_name.c_str(), ke_vs_ph_title.c_str(), FullPhi(nuc.vec4.Phi())*s_rad2deg, nuc.detectedKE, 4); + MyFill(th_vs_ph_name.c_str(), th_vs_ph_title.c_str(), nuc.vec4.Theta()*s_rad2deg, FullPhi(nuc.vec4.Phi())*s_rad2deg, 2); MyFill(ex_name.c_str(),ex_title.c_str(),260,-1.0,25,nuc.GetExcitationEnergy()); MyFill(angdist_name.c_str(), angdist_title.c_str(),20,-1.0,1.0,std::cos(nuc.thetaCM)); }