diff --git a/private/LeptonInjector/Controller.cxx b/private/LeptonInjector/Controller.cxx index c1b8775..956b4f8 100644 --- a/private/LeptonInjector/Controller.cxx +++ b/private/LeptonInjector/Controller.cxx @@ -71,6 +71,10 @@ namespace LeptonInjector { this->earthModel = earthModel_; } + void Controller::setEarthModel(const std::string & earthModelName_, const std::string & earthModelTablePath_){ + this->earthModel = std::make_shared(earthModelName_, earthModelTablePath_); + } + void Controller::NameOutfile( std::string out_file_){ out_file = out_file_; } diff --git a/private/pybindings/LeptonInjector.cxx b/private/pybindings/LeptonInjector.cxx index a4bd224..6d0ec68 100644 --- a/private/pybindings/LeptonInjector.cxx +++ b/private/pybindings/LeptonInjector.cxx @@ -87,6 +87,7 @@ BOOST_PYTHON_MODULE(LeptonInjector){ (args("injectors"),args("minimum energy"),args("maximum energy"),args("spectral index"),args("minimum azimuth"),args("maximum azimuth"),args("minimum zenith"),args("maximum zenith"),args("injection radius")=1200., args("endcap length")=1200., args("cylinder radius")=1200., args("cylinder height")=1200.)) ) .def("Execute",&Controller::Execute) + .def("SetEarthModel",&Controller::setEarthModel) .def("AddInjector",&Controller::AddInjector) .def("NameOutfile",&Controller::NameOutfile) .def("NameLicFile",&Controller::NameLicFile) diff --git a/public/LeptonInjector/Controller.h b/public/LeptonInjector/Controller.h index ab7da84..3978144 100644 --- a/public/LeptonInjector/Controller.h +++ b/public/LeptonInjector/Controller.h @@ -73,6 +73,8 @@ class Controller{ // changes the Earth model to be used with the injectors void SetEarthModel(std::shared_ptr earthModel); + void setEarthModel(const std::string & earthmodel, const std::string &earthmodelpath); + // adds a new injector to be used in the process void AddInjector(Injector configs_received); // changes the name of the data file diff --git a/resources/examples/inject_muons.py b/resources/examples/inject_muons.py index a3c72af..3adcb46 100644 --- a/resources/examples/inject_muons.py +++ b/resources/examples/inject_muons.py @@ -22,8 +22,8 @@ diff_xs = xs_folder + "/test_xs.fits" total_xs = xs_folder + "/test_xs_total.fits" is_ranged = True -final_1 = LI.Particle.MuMinus -final_2 = LI.Particle.Hadrons +final_1 = LI.Particle.ParticleType.MuMinus +final_2 = LI.Particle.ParticleType.Hadrons the_injector = LI.Injector( n_events , final_1, final_2, diff_xs, total_xs, is_ranged) @@ -42,7 +42,9 @@ # construct the controller controller = LI.Controller( the_injector, minE, maxE, gamma, minAzimuth, maxAzimuth, minZenith, maxZenith) -# specify the output +# specify the output, earth model +path_to = os.path.join(os.path.dirname(__file__), "..","earthparams/") +controller.SetEarthModel("Planet", path_to) controller.NameOutfile("./data_output.h5") controller.NameLicFile("./config.lic")