From 87bde213bad2dfe69ec8059f11440e0daea1b6b4 Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Tue, 8 Jun 2021 09:58:24 -0400 Subject: [PATCH] Removed gsl dependence for compatibility with NRB machines. Added in homeade legendre polynomials. Updated README to reflect --- README.md | 2 +- include/LegendrePoly.h | 6 ++++++ input.txt | 2 +- makefile | 2 +- src/LegendrePoly.cpp | 11 +++++++++++ src/ReactionSystem.cpp | 4 ++-- 6 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 include/LegendrePoly.h create mode 100644 src/LegendrePoly.cpp diff --git a/README.md b/README.md index d7879dd..3e624b1 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,4 @@ To run MASK simply do the following from the MASK directory: Input.txt can be replaced by any text file with the correct format. ## Requirements -MASK requires that ROOT is installed for data writting and visualization, as well as for random number generation. It also requires gsl to calculate Legendre Polynomials. Testing has been done only on ROOT 6. Mileage on all other ROOT versions will vary. \ No newline at end of file +MASK requires that ROOT is installed for data writting and visualization, as well as for random number generation. Testing has been done only on ROOT 6. Mileage on all other ROOT versions will vary. diff --git a/include/LegendrePoly.h b/include/LegendrePoly.h new file mode 100644 index 0000000..d05808b --- /dev/null +++ b/include/LegendrePoly.h @@ -0,0 +1,6 @@ +#ifndef LEGENDREPOLY_H +#define LEGENDREPOLY_H + +double P_l(int l, double x); + +#endif \ No newline at end of file diff --git a/input.txt b/input.txt index 28d8328..3b38af1 100644 --- a/input.txt +++ b/input.txt @@ -1,5 +1,5 @@ ----------Data Information---------- -OutputFile: /media/gordon/b6414c35-ec1f-4fc1-83bc-a6b68ca4325a/gwm17/12C3Hed_13N3546keV_ps_fixedThetaBins_test.root +OutputFile: /data1/gwm17/10B3He/Feb2021/12C3Hed_13N3546keV_ps_fixedThetaBins_test.root SaveTree: yes SavePlots: yes ----------Reaction Information---------- diff --git a/makefile b/makefile index 11edf5c..c6e4090 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,7 @@ CC=g++ ROOTGEN=rootcint CFLAGS=-g -Wall `root-config --cflags` CPPFLAGS=-I ./include -LDFLAGS=`root-config --glibs` -lgsl +LDFLAGS=`root-config --glibs` ROOTINCLDIR=./ INCLDIR=./include diff --git a/src/LegendrePoly.cpp b/src/LegendrePoly.cpp new file mode 100644 index 0000000..ddeeace --- /dev/null +++ b/src/LegendrePoly.cpp @@ -0,0 +1,11 @@ +#include "LegendrePoly.h" + +double P_l(int l, double x) { + if(l == 0) { + return 1.0; + } else if (l == 1) { + return x; + } else { + return ((2.0*l + 1.0)*x*P_l(l-1, x) - (l-1.0)*P_l(l-2, x))/(double(l)); + } +} \ No newline at end of file diff --git a/src/ReactionSystem.cpp b/src/ReactionSystem.cpp index 199257c..dfc2f7e 100644 --- a/src/ReactionSystem.cpp +++ b/src/ReactionSystem.cpp @@ -1,6 +1,6 @@ #include "ReactionSystem.h" #include "KinematicsExceptions.h" -#include +#include "LegendrePoly.h" namespace Mask { @@ -65,7 +65,7 @@ double ReactionSystem::GetDecayTheta(int L) { do { costheta = generator->Uniform(-1.0, 1.0); check = generator->Uniform(0.0, 1.0); - probability = std::pow(gsl_sf_legendre_Pl(L, costheta), 2.0); + probability = std::pow(P_l(L, costheta), 2.0); } while(check > probability); return std::acos(costheta);