Changes to allow NuWro to be used a library for event simulation#16
Open
marzece wants to merge 26 commits intoNuWro:masterfrom
Open
Changes to allow NuWro to be used a library for event simulation#16marzece wants to merge 26 commits intoNuWro:masterfrom
marzece wants to merge 26 commits intoNuWro:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes allow NuWro to be compiled as a static library (libnuwro.a) and used by other programs that include NuWro. To do this I added a few functions to the
NuWroclass that allow parameters and data paths to be set at run time by whatever program instantiates a new NuWro instance. I also wrapped a few of the more important API classes (event,particle,params&NuWro) in aNUWROnamespace to ensure there's no namespace clashes.In principle none of my changes should effect the physics output of the simulation at all. I tested this by running a few simulations with a fixed seed on a version of NuWro with and without these changes. The output energy, momentum and particle multiplicity distributions were completely identical. If anyone has suggestions for further tests that could be done to ensure the simulation results haven't been changed I'd be happy to do them.
If anyone has an objections or questions or requests about any of these changes let me know and I'd be happy to try and address it. Also I'd be happy to squash all of these changes down to a single commit if people would prefer that.
Finally here's a quick example script for how one could use NuWro via the static library.
https://gist.github.com/marzece/2324121477b85f8acb1a8845ba29dd46