xcoll 0.3.6__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xcoll might be problematic. Click here for more details.
- xcoll/__init__.py +13 -4
- xcoll/beam_elements/__init__.py +14 -6
- xcoll/beam_elements/absorber.py +41 -7
- xcoll/beam_elements/base.py +1202 -247
- xcoll/beam_elements/blowup.py +198 -0
- xcoll/beam_elements/elements_src/black_absorber.h +136 -0
- xcoll/beam_elements/elements_src/black_crystal.h +129 -0
- xcoll/beam_elements/elements_src/blowup.h +42 -0
- xcoll/beam_elements/elements_src/emittance_monitor.h +109 -0
- xcoll/beam_elements/{collimators_src → elements_src}/everest_block.h +59 -30
- xcoll/beam_elements/elements_src/everest_collimator.h +237 -0
- xcoll/beam_elements/elements_src/everest_crystal.h +280 -0
- xcoll/beam_elements/everest.py +65 -119
- xcoll/beam_elements/monitor.py +428 -0
- xcoll/colldb.py +276 -747
- xcoll/general.py +5 -5
- xcoll/headers/checks.h +1 -1
- xcoll/headers/particle_states.h +2 -2
- xcoll/initial_distribution.py +207 -0
- xcoll/install.py +179 -0
- xcoll/interaction_record/__init__.py +1 -0
- xcoll/interaction_record/interaction_record.py +298 -0
- xcoll/interaction_record/interaction_record_src/interaction_record.h +98 -0
- xcoll/{impacts → interaction_record}/interaction_types.py +11 -4
- xcoll/line_tools.py +82 -0
- xcoll/lossmap.py +219 -0
- xcoll/manager.py +2 -937
- xcoll/rf_sweep.py +1 -1
- xcoll/scattering_routines/everest/amorphous.h +232 -0
- xcoll/scattering_routines/everest/channeling.h +240 -0
- xcoll/scattering_routines/everest/crystal_parameters.h +137 -0
- xcoll/scattering_routines/everest/everest.h +11 -30
- xcoll/scattering_routines/everest/everest.py +13 -10
- xcoll/scattering_routines/everest/jaw.h +28 -197
- xcoll/scattering_routines/everest/materials.py +37 -15
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +31 -10
- xcoll/scattering_routines/everest/nuclear_interaction.h +86 -0
- xcoll/scattering_routines/everest/properties.h +6 -1
- xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
- xcoll/scattering_routines/geant4/collimasim/.git +1 -0
- xcoll/scattering_routines/geant4/collimasim/.gitignore +12 -0
- xcoll/scattering_routines/geant4/collimasim/.gitmodules +3 -0
- xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +26 -0
- xcoll/scattering_routines/geant4/collimasim/README.md +21 -0
- xcoll/scattering_routines/geant4/collimasim/docs/Makefile +20 -0
- xcoll/scattering_routines/geant4/collimasim/docs/make.bat +35 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +10 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +26 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +37 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +1 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +9 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +386 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +45 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +16 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +969 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +48 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +16 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +45 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +151 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +297 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +29 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +180 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +192 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +11 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +81 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +93 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +310 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +109 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +43 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +171 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +251 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +305 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +1297 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +262 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +396 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +568 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +337 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +13 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +463 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +286 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +174 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +308 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +91 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +95 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +2050 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +542 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +648 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +381 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +343 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +48 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +105 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +72 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +130 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +96 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +548 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +605 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +144 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +1432 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +213 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +2 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +709 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +1021 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +104 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +346 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +467 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +978 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +55 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +606 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +284 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +121 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +193 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +275 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +1741 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +2497 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +1879 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +375 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +747 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +88 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +11 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +52 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +21 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +482 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +63 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +56 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +155 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +503 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +208 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +275 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +33 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +279 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +143 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +85 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +179 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +151 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +91 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +85 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +26 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +25 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +216 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +286 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +536 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +107 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +248 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +227 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +202 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +210 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +550 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +473 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +21 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +35 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +10 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +165 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +53 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +238 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +126 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +141 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +117 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +50 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +69 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +42 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +348 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +771 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +47 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +22 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +326 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +15 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +148 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +272 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +119 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +51 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +5 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +285 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +265 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +397 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +520 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +49 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +94 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +125 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +331 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +153 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +284 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +107 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +257 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +412 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +517 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +102 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +92 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +233 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +360 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +472 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +593 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +524 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +441 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +267 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +235 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +146 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +189 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +82 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +560 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +651 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +500 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +253 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +452 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +318 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +342 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +291 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +131 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +318 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +144 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +29 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +66 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +44 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +22 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +9 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +510 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +408 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +117 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +70 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +86 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +257 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +44 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +39 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +64 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +402 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +233 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +276 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +214 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +41 -0
- xcoll/scattering_routines/geant4/collimasim/pyproject.toml +8 -0
- xcoll/scattering_routines/geant4/collimasim/setup.py +144 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +403 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +100 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +763 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +118 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +8 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +63 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +142 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +556 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +6 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +24 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +1 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +1 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +1 -0
- xcoll/scattering_routines/geant4/collimasim/tests/README.md +25 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +25 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +18 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +68 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +15 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +110 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +7 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +54 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +5 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +51 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +65 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +102 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +75 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +74 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +84 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +159 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +99 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +78 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +88 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +80 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +97 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +96 -0
- xcoll/scattering_routines/geometry/__init__.py +6 -0
- xcoll/scattering_routines/geometry/collimator_geometry.h +218 -0
- xcoll/scattering_routines/geometry/crystal_geometry.h +153 -0
- xcoll/scattering_routines/geometry/geometry.py +26 -0
- xcoll/scattering_routines/geometry/get_s.h +92 -0
- xcoll/scattering_routines/geometry/methods.h +111 -0
- xcoll/scattering_routines/geometry/objects.h +154 -0
- xcoll/scattering_routines/geometry/rotation.h +23 -0
- xcoll/scattering_routines/geometry/segments.h +226 -0
- xcoll/scattering_routines/geometry/sort.h +184 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/METADATA +1 -1
- xcoll-0.5.0.dist-info/RECORD +413 -0
- xcoll/beam_elements/collimators_src/absorber.h +0 -141
- xcoll/beam_elements/collimators_src/everest_collimator.h +0 -142
- xcoll/beam_elements/collimators_src/everest_crystal.h +0 -115
- xcoll/collimator_settings.py +0 -457
- xcoll/impacts/__init__.py +0 -1
- xcoll/impacts/impacts.py +0 -102
- xcoll/impacts/impacts_src/impacts.h +0 -99
- xcoll/scattering_routines/everest/crystal.h +0 -1302
- xcoll/scattering_routines/everest/scatter.h +0 -169
- xcoll/scattering_routines/everest/scatter_crystal.h +0 -260
- xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
- xcoll-0.3.6.dist-info/RECORD +0 -111
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/LICENSE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/NOTICE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#include "BDSBunchSixTrackLink.hh"
|
|
2
|
+
#include "BDSException.hh"
|
|
3
|
+
#include "BDSIMLink.hh"
|
|
4
|
+
#include "BDSIonDefinition.hh"
|
|
5
|
+
#include "BDSParticleCoordsFull.hh"
|
|
6
|
+
#include "BDSParticleDefinition.hh"
|
|
7
|
+
#include "BDSPhysicsUtilities.hh"
|
|
8
|
+
|
|
9
|
+
#include "G4Electron.hh"
|
|
10
|
+
#include "G4GenericIon.hh"
|
|
11
|
+
#include "G4IonTable.hh"
|
|
12
|
+
#include "G4ParticleDefinition.hh"
|
|
13
|
+
#include "G4ParticleTable.hh"
|
|
14
|
+
#include "G4Types.hh"
|
|
15
|
+
|
|
16
|
+
#include "CLHEP/Units/PhysicalConstants.h"
|
|
17
|
+
#include "CLHEP/Units/SystemOfUnits.h"
|
|
18
|
+
|
|
19
|
+
#include <algorithm>
|
|
20
|
+
#include <cmath>
|
|
21
|
+
#include <iostream>
|
|
22
|
+
#include <set>
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <vector>
|
|
25
|
+
|
|
26
|
+
#include <pybind11/pybind11.h>
|
|
27
|
+
#include <pybind11/numpy.h>
|
|
28
|
+
|
|
29
|
+
namespace py = pybind11;
|
|
30
|
+
|
|
31
|
+
// The struct is only used for inactive particle coodrinates for now
|
|
32
|
+
struct XtrackCoordinates{
|
|
33
|
+
double x;
|
|
34
|
+
double y;
|
|
35
|
+
double px;
|
|
36
|
+
double py;
|
|
37
|
+
double zeta;
|
|
38
|
+
double delta;
|
|
39
|
+
double chi;
|
|
40
|
+
double charge_ratio;
|
|
41
|
+
double s;
|
|
42
|
+
int64_t pdgid;
|
|
43
|
+
int64_t trackid;
|
|
44
|
+
int64_t state;
|
|
45
|
+
int64_t at_element;
|
|
46
|
+
int64_t at_turn;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
BDSParticleDefinition* PrepareBDSParticleDefition(long long int pdgIDIn, double momentumIn,
|
|
50
|
+
double kineticEnergyIn, double ionChargeIn);
|
|
51
|
+
|
|
52
|
+
/// TODO: make a base class for the interface classes as there is a lot of shared functionality
|
|
53
|
+
class XtrackInterface
|
|
54
|
+
{
|
|
55
|
+
public:
|
|
56
|
+
XtrackInterface() = delete; // No default constructor
|
|
57
|
+
|
|
58
|
+
XtrackInterface(const std::string& bdsimConfigFile,
|
|
59
|
+
long long int referencePdgIdIn,
|
|
60
|
+
double referenceEkIn,
|
|
61
|
+
double relativeEnergyCutIn,
|
|
62
|
+
int seedIn,
|
|
63
|
+
int referenceIonChargeIn=0,
|
|
64
|
+
bool batchMode=true);
|
|
65
|
+
|
|
66
|
+
virtual ~XtrackInterface();
|
|
67
|
+
|
|
68
|
+
void addCollimator(const std::string& name,
|
|
69
|
+
const std::string& material,
|
|
70
|
+
double lengthIn,
|
|
71
|
+
double apertureLeftIn,
|
|
72
|
+
double apertureRightIn,
|
|
73
|
+
double rotationIn,
|
|
74
|
+
double xOffsetIn,
|
|
75
|
+
double yOffsetIn,
|
|
76
|
+
double jawTiltLeft,
|
|
77
|
+
double jawTiltRight,
|
|
78
|
+
int side);
|
|
79
|
+
|
|
80
|
+
void addParticles(const py::list& coordinates);
|
|
81
|
+
|
|
82
|
+
// This is not exposed to python
|
|
83
|
+
void addParticle(double xIn,
|
|
84
|
+
double yIn,
|
|
85
|
+
double pxIn,
|
|
86
|
+
double pyIn,
|
|
87
|
+
double ctIn,
|
|
88
|
+
double deltapIn,
|
|
89
|
+
double chiIn,
|
|
90
|
+
double chargeRatioIn,
|
|
91
|
+
double sIn,
|
|
92
|
+
int64_t pdgIDIn,
|
|
93
|
+
int64_t trackidIn);
|
|
94
|
+
|
|
95
|
+
void collimate();
|
|
96
|
+
void clearData();
|
|
97
|
+
void selectCollimator(const std::string& name);
|
|
98
|
+
|
|
99
|
+
double getReferenceMass() { return refParticleDefinition->Mass() / CLHEP::GeV; }
|
|
100
|
+
|
|
101
|
+
py::dict collimateReturn(const py::list& coordinates);
|
|
102
|
+
|
|
103
|
+
private:
|
|
104
|
+
BDSIMLink* bds = nullptr;
|
|
105
|
+
BDSBunchSixTrackLink* stp = nullptr;
|
|
106
|
+
std::vector<char *> argv;
|
|
107
|
+
|
|
108
|
+
std::vector<bool> particleActiveState;
|
|
109
|
+
std::vector<XtrackCoordinates*> xtrackParticles;
|
|
110
|
+
|
|
111
|
+
BDSParticleDefinition* refParticleDefinition = nullptr;
|
|
112
|
+
|
|
113
|
+
std::string currentCollimatorName;
|
|
114
|
+
|
|
115
|
+
int64_t maxParticleID=0;
|
|
116
|
+
double relativeEnergyCut=0.0;
|
|
117
|
+
int seed=0;
|
|
118
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#include <pybind11/pybind11.h>
|
|
2
|
+
#include <pybind11/iostream.h>
|
|
3
|
+
|
|
4
|
+
#include "BDSPyATInterface.hh"
|
|
5
|
+
#include "BDSXtrackInterface.hh"
|
|
6
|
+
|
|
7
|
+
#define STRINGIFY(x) #x
|
|
8
|
+
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
|
9
|
+
|
|
10
|
+
namespace py = pybind11;
|
|
11
|
+
using namespace pybind11::literals;
|
|
12
|
+
|
|
13
|
+
PYBIND11_MODULE(g4interface, m) {
|
|
14
|
+
m.doc() = R"pbdoc(Python interface to BDSIM (Geant4). The main purpose of the interface is to enable collimation studies, including particle-matter interaction in collimators, for pure particle tracking codes.)pbdoc";
|
|
15
|
+
|
|
16
|
+
py::class_<PyATInterface>(m, "PyATInterface")
|
|
17
|
+
.def(py::init<const std::string&, int, double, double, int, bool>(),
|
|
18
|
+
"bdsimConfigFile"_a, "referencePdgId"_a, "referenceEk"_a,
|
|
19
|
+
"relativeEnergyCut"_a, "seed"_a, "batchMode"_a=true)
|
|
20
|
+
.def("addCollimator", &PyATInterface::addCollimator,
|
|
21
|
+
"name"_a, "material"_a, "length"_a, "aperture"_a, "rotation"_a,
|
|
22
|
+
"xOffset"_a, "yOffset"_a, "jawTiltLeft"_a, "jawTiltRight"_a, "side"_a,
|
|
23
|
+
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
|
|
24
|
+
.def("addParticle",
|
|
25
|
+
static_cast<void (PyATInterface::*)(const py::array_t<double>&)>(&PyATInterface::addParticle),
|
|
26
|
+
"coordinate_array"_a)
|
|
27
|
+
.def("collimate", &PyATInterface::collimate,
|
|
28
|
+
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
|
|
29
|
+
.def("selectCollimator", &PyATInterface::selectCollimator, "collimatorName"_a)
|
|
30
|
+
.def("collimateReturn", &PyATInterface::collimateReturn,
|
|
31
|
+
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
|
|
32
|
+
.def("GetEnergyDifferential", &PyATInterface::GetEnergyDifferential)
|
|
33
|
+
.def("clearData", &PyATInterface::clearData);
|
|
34
|
+
|
|
35
|
+
py::class_<XtrackInterface>(m, "XtrackInterface")
|
|
36
|
+
.def(py::init<const std::string&, int, double, double, int, int, bool>(),
|
|
37
|
+
"bdsimConfigFile"_a, "referencePdgId"_a, "referenceEk"_a,
|
|
38
|
+
"relativeEnergyCut"_a, "seed"_a, "referenceIonCharge"_a=0,"batchMode"_a=true,
|
|
39
|
+
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
|
|
40
|
+
.def("addCollimator", &XtrackInterface::addCollimator,
|
|
41
|
+
"name"_a, "material"_a, "length"_a, "apertureLeft"_a, "apertureRight"_a, "rotation"_a,
|
|
42
|
+
"xOffset"_a, "yOffset"_a, "jawTiltLeft"_a, "jawTiltRight"_a, "side"_a,
|
|
43
|
+
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
|
|
44
|
+
/// The cast here to disambiguate overloaded methods. The other versions of
|
|
45
|
+
/// addParticles were removed, but keep the cast for reference for now.
|
|
46
|
+
.def("addParticles", static_cast<void (XtrackInterface::*)
|
|
47
|
+
(const py::list& coordinates)>(&XtrackInterface::addParticles), "coordinates"_a)
|
|
48
|
+
/// The C++ ostream and estream are redirected to the Python streams
|
|
49
|
+
/// so all io can be handled on the Python side
|
|
50
|
+
.def("collimate", &XtrackInterface::collimate,
|
|
51
|
+
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
|
|
52
|
+
.def("selectCollimator", &XtrackInterface::selectCollimator, "collimatorName"_a)
|
|
53
|
+
.def("collimateReturn", &XtrackInterface::collimateReturn,
|
|
54
|
+
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>())
|
|
55
|
+
.def("clearData", &XtrackInterface::clearData)
|
|
56
|
+
.def("getReferenceMass", &XtrackInterface::getReferenceMass);
|
|
57
|
+
|
|
58
|
+
#ifdef VERSION_INFO
|
|
59
|
+
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
|
|
60
|
+
#else
|
|
61
|
+
m.attr("__version__") = "dev";
|
|
62
|
+
#endif
|
|
63
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import numpy
|
|
2
|
+
|
|
3
|
+
import collimasim
|
|
4
|
+
|
|
5
|
+
'''
|
|
6
|
+
This is a specialised pass method that performs a full simulation of physical
|
|
7
|
+
interactions in collimators using Geant4. The interface to BDSIM (Geant4) is
|
|
8
|
+
provided by the collimasim package.
|
|
9
|
+
|
|
10
|
+
The interface must be initialised first, with a list of parameters and a file
|
|
11
|
+
containing the collimator specification. All collimators that will be used
|
|
12
|
+
must be provided in the collimator file and are accessed by name. Currently,
|
|
13
|
+
collimators are limited to block jaw collimators, and the geometry model is
|
|
14
|
+
built automatically.
|
|
15
|
+
|
|
16
|
+
The passmethods contains a function trackFunction(), used for tracking by pyat,
|
|
17
|
+
and has to be in the python path or in at.integrators
|
|
18
|
+
|
|
19
|
+
The element creation is as follows:
|
|
20
|
+
|
|
21
|
+
collimator = elements.Element('MyColl', 1.0, PassMethod='pyCollimatorPass')
|
|
22
|
+
|
|
23
|
+
To be noted:
|
|
24
|
+
The name of a collimator using the pyCollimatorPass method must match a
|
|
25
|
+
collimator defined during initialisation. For collimators where a physical
|
|
26
|
+
interaction simulation is not required, please specify a different pass method,
|
|
27
|
+
e.g. drift.
|
|
28
|
+
'''
|
|
29
|
+
|
|
30
|
+
bdsimlink = None # Keep this as a global variable for now
|
|
31
|
+
|
|
32
|
+
def load_collgaps(collgaps_file):
|
|
33
|
+
coll_dict = {}
|
|
34
|
+
|
|
35
|
+
coll_data = numpy.genfromtxt(collgaps_file, dtype=None, encoding=None, comments='#')
|
|
36
|
+
|
|
37
|
+
for coll in coll_data:
|
|
38
|
+
name = coll[1].lower()
|
|
39
|
+
one_coll = {}
|
|
40
|
+
|
|
41
|
+
one_coll["material"] = coll[6]
|
|
42
|
+
one_coll["length"] = float(coll[7])
|
|
43
|
+
one_coll["angle"] = float(coll[2])
|
|
44
|
+
one_coll["halfgap"] = float(coll[5])
|
|
45
|
+
# The collgaps do not specify the offsets
|
|
46
|
+
# or if a collimator is one-sided
|
|
47
|
+
# TODO: add the closed orbit at the collimator
|
|
48
|
+
one_coll["xoffs"] = 0
|
|
49
|
+
one_coll["yoffs"] = 0
|
|
50
|
+
one_coll["side"] = 0 # 0 is two sided
|
|
51
|
+
|
|
52
|
+
coll_dict[name] = one_coll
|
|
53
|
+
|
|
54
|
+
return coll_dict
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def initialise(bdsim_config_file, collimator_info, reference_pdg_id,
|
|
58
|
+
reference_Ek, relative_energy_cut, seed):
|
|
59
|
+
|
|
60
|
+
global bdsimlink
|
|
61
|
+
|
|
62
|
+
# Initialise a code interface
|
|
63
|
+
if bdsimlink is not None:
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
bdsimlink = collimasim.PyATInterface(bdsimConfigFile=bdsim_config_file,
|
|
67
|
+
referencePdgId=reference_pdg_id,
|
|
68
|
+
referenceEk=reference_Ek,
|
|
69
|
+
relativeEnergyCut=relative_energy_cut,
|
|
70
|
+
seed=seed, batchMode=True)
|
|
71
|
+
|
|
72
|
+
if isinstance(collimator_info, dict):
|
|
73
|
+
collimators = collimator_info
|
|
74
|
+
else:
|
|
75
|
+
collimators = load_collgaps(collimator_info)
|
|
76
|
+
|
|
77
|
+
for name in collimators:
|
|
78
|
+
cdict = collimators[name]
|
|
79
|
+
material = cdict["material"]
|
|
80
|
+
length = cdict["length"]
|
|
81
|
+
angle = cdict["angle"]
|
|
82
|
+
halfgap = cdict["halfgap"]
|
|
83
|
+
xoffs = cdict["xoffs"]
|
|
84
|
+
yoffs = cdict["yoffs"]
|
|
85
|
+
side = cdict["side"]
|
|
86
|
+
|
|
87
|
+
bdsimlink.addCollimator(name, material, length, aperture=halfgap*2,
|
|
88
|
+
rotation=angle, xOffset=xoffs, yOffset=yoffs,
|
|
89
|
+
jawTiltLeft=0.0, jawTiltRight=0.0,
|
|
90
|
+
side=side)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def process_particles(collimator_name):
|
|
94
|
+
# MAD-X convention uses . in the names, while pyAT convention uses _
|
|
95
|
+
# Provide handling for MAD-X name to avoid trivial issues
|
|
96
|
+
try:
|
|
97
|
+
bdsimlink.selectCollimator(collimator_name)
|
|
98
|
+
except RuntimeError:
|
|
99
|
+
try:
|
|
100
|
+
collimator_name_madx = collimator_name.replace("_", ".").lower()
|
|
101
|
+
bdsimlink.selectCollimator(collimator_name_madx)
|
|
102
|
+
except RuntimeError:
|
|
103
|
+
raise ValueError(f"No collimator {collimator_name} (or "
|
|
104
|
+
f"{collimator_name_madx} defined)")
|
|
105
|
+
|
|
106
|
+
print(f"Processing collimator: {collimator_name}")
|
|
107
|
+
# Perform the Geant4 simulation
|
|
108
|
+
bdsimlink.collimate()
|
|
109
|
+
|
|
110
|
+
# Collect the surviving particles - a 1D array with n * 6 elements
|
|
111
|
+
arr_out = bdsimlink.collimateReturn()
|
|
112
|
+
|
|
113
|
+
return arr_out
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def trackFunction(rin,elem=None):
|
|
117
|
+
if bdsimlink is None:
|
|
118
|
+
raise ValueError("The Geant4 interface is not initialised. Call"
|
|
119
|
+
" pyCollimatorPass.initialise(...) before tracking")
|
|
120
|
+
|
|
121
|
+
bdsimlink.clearData() # Clear the old data
|
|
122
|
+
|
|
123
|
+
name = elem.FamName
|
|
124
|
+
# rin is a (6,n) array
|
|
125
|
+
for rtmp in numpy.atleast_2d(rin.T):
|
|
126
|
+
if hasattr(elem,'T1'): rtmp += elem.T1
|
|
127
|
+
if hasattr(elem,'R1'): rtmp[:] = numpy.dot(elem.R1,rtmp)
|
|
128
|
+
bdsimlink.addParticle(rtmp)
|
|
129
|
+
|
|
130
|
+
rout = process_particles(name)
|
|
131
|
+
|
|
132
|
+
# The returned array may be longer than the original
|
|
133
|
+
# due to secondary particles. Access by index and only
|
|
134
|
+
# change only the primary coordinates
|
|
135
|
+
for i in range(len(rin.T)):
|
|
136
|
+
part = rout.T[i, :]
|
|
137
|
+
if hasattr(elem,'R2'): part[:] = numpy.dot(elem.R2, part)
|
|
138
|
+
if hasattr(elem,'T2'): part += elem.T2
|
|
139
|
+
|
|
140
|
+
rin.T[i, :] = part
|
|
141
|
+
|
|
142
|
+
#return rin # This return value doesn't seem to be used by pyAT
|