1
0
Fork 0
mirror of https://github.com/gwm17/Mask.git synced 2024-11-12 13:38:51 -05:00

Now passes intial testing, seems fully functional. Need to do some optimization tests against old way to see if actually improved anything.

This commit is contained in:
Gordon McCann 2022-08-20 09:05:34 -07:00
parent 0b7b06e4f1
commit ba023b48dd
5 changed files with 23 additions and 20 deletions

View File

@ -41,7 +41,7 @@ namespace Mask {
MassLookup::~MassLookup() {} MassLookup::~MassLookup() {}
//Returns nuclear mass in MeV //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}); KeyPair key({Z, A});
auto data = massTable.find(key.GetID()); auto data = massTable.find(key.GetID());
@ -52,7 +52,7 @@ namespace Mask {
} }
//returns element symbol //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}); KeyPair key({Z, A});
auto data = elementTable.find(key.GetID()); auto data = elementTable.find(key.GetID());

View File

@ -35,9 +35,9 @@ namespace Mask {
}; };
~MassLookup(); ~MassLookup();
double FindMass(int Z, int A); double FindMass(uint32_t Z, uint32_t A);
double FindMassU(int Z, int A) { return FindMass(Z, A)/u_to_mev; } double FindMassU(uint32_t Z, uint32_t A) { return FindMass(Z, A)/u_to_mev; }
std::string FindSymbol(int Z, int A); std::string FindSymbol(uint32_t Z, uint32_t A);
static MassLookup& GetInstance() { return *s_instance; } static MassLookup& GetInstance() { return *s_instance; }

View File

@ -2,7 +2,7 @@
namespace Mask { namespace Mask {
Nucleus CreateNucleus(int z, int a) Nucleus CreateNucleus(uint32_t z, uint32_t a)
{ {
Nucleus nuc; Nucleus nuc;
nuc.Z = z; nuc.Z = z;

View File

@ -37,8 +37,8 @@ namespace Mask {
return vec4.M() - groundStateMass; return vec4.M() - groundStateMass;
} }
int Z = 0; uint32_t Z = 0;
int A = 0; uint32_t A = 0;
double groundStateMass = 0.0; double groundStateMass = 0.0;
std::string isotopicSymbol = ""; std::string isotopicSymbol = "";
double thetaCM = 0.0; double thetaCM = 0.0;
@ -50,7 +50,7 @@ namespace Mask {
double detectedPhi = 0.0; double detectedPhi = 0.0;
}; };
Nucleus CreateNucleus(int z, int a); Nucleus CreateNucleus(uint32_t z, uint32_t a);
bool EnforceDictionaryLinked(); bool EnforceDictionaryLinked();

View File

@ -5,6 +5,11 @@
#include <iostream> #include <iostream>
static double FullPhi(double phi)
{
return phi < 0.0 ? 2.0*M_PI + phi : phi;
}
RootPlotter::RootPlotter() RootPlotter::RootPlotter()
{ {
TH1::AddDirectory(kFALSE); TH1::AddDirectory(kFALSE);
@ -46,7 +51,7 @@ void RootPlotter::Run(const std::string& inputname, const std::string& outputnam
output->cd(); output->cd();
for(auto& obj : m_map) for(auto& obj : m_map)
obj.second->Write(obj.second->GetName(), TObject::kOverwrite); obj.second->Write();
output->Close(); output->Close();
} }
@ -68,19 +73,17 @@ void RootPlotter::FillData(const Mask::Nucleus& nuc)
std::string angdist_name = sym + modifier +"_angDist"; std::string angdist_name = sym + modifier +"_angDist";
std::string angdist_title = angdist_name+";cos#right(#theta_{CM}#left);counts"; 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) 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_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(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, nuc.vec4.Phi()*s_rad2deg, 2); 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(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)); MyFill(angdist_name.c_str(), angdist_title.c_str(),20,-1.0,1.0,std::cos(nuc.thetaCM));
} }