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,298 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xcoll Package. #
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
|
|
6
|
+
import xobjects as xo
|
|
7
|
+
import xtrack as xt
|
|
8
|
+
|
|
9
|
+
from .interaction_types import source, interactions, shortcuts, is_point
|
|
10
|
+
from ..general import _pkg_root
|
|
11
|
+
|
|
12
|
+
import numpy as np
|
|
13
|
+
import pandas as pd
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class InteractionRecord(xt.BeamElement):
|
|
17
|
+
_xofields = {
|
|
18
|
+
'_index': xt.RecordIndex,
|
|
19
|
+
'at_element': xo.Int64[:],
|
|
20
|
+
'at_turn': xo.Int64[:],
|
|
21
|
+
'_inter': xo.Int64[:],
|
|
22
|
+
'id_before': xo.Int64[:],
|
|
23
|
+
's_before': xo.Float64[:],
|
|
24
|
+
'x_before': xo.Float64[:],
|
|
25
|
+
'px_before': xo.Float64[:],
|
|
26
|
+
'y_before': xo.Float64[:],
|
|
27
|
+
'py_before': xo.Float64[:],
|
|
28
|
+
'zeta_before': xo.Float64[:],
|
|
29
|
+
'delta_before': xo.Float64[:],
|
|
30
|
+
'energy_before': xo.Float64[:],
|
|
31
|
+
'mass_before': xo.Float64[:],
|
|
32
|
+
'charge_before': xo.Int64[:],
|
|
33
|
+
'z_before': xo.Int64[:],
|
|
34
|
+
'a_before': xo.Int64[:],
|
|
35
|
+
'pdgid_before': xo.Int64[:],
|
|
36
|
+
'id_after': xo.Int64[:],
|
|
37
|
+
's_after': xo.Float64[:],
|
|
38
|
+
'x_after': xo.Float64[:],
|
|
39
|
+
'px_after': xo.Float64[:],
|
|
40
|
+
'y_after': xo.Float64[:],
|
|
41
|
+
'py_after': xo.Float64[:],
|
|
42
|
+
'zeta_after': xo.Float64[:],
|
|
43
|
+
'delta_after': xo.Float64[:],
|
|
44
|
+
'energy_after': xo.Float64[:],
|
|
45
|
+
'mass_after': xo.Float64[:],
|
|
46
|
+
'charge_after': xo.Int64[:],
|
|
47
|
+
'z_after': xo.Int64[:],
|
|
48
|
+
'a_after': xo.Int64[:],
|
|
49
|
+
'pdgid_after': xo.Int64[:],
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
allow_track = False
|
|
53
|
+
|
|
54
|
+
_extra_c_sources = [
|
|
55
|
+
source,
|
|
56
|
+
_pkg_root.joinpath('headers','particle_states.h'),
|
|
57
|
+
_pkg_root.joinpath('interaction_record','interaction_record_src','interaction_record.h')
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def start(cls, *, line=None, elements=None, names=None, record_impacts=None, record_exits=None,
|
|
63
|
+
record_scatterings=None, capacity=1e6, io_buffer=None, coll_ids=None):
|
|
64
|
+
elements, names = _get_xcoll_elements(line, elements, names)
|
|
65
|
+
if len(names) == 0:
|
|
66
|
+
return
|
|
67
|
+
capacity = int(capacity)
|
|
68
|
+
|
|
69
|
+
if getattr(line, 'tracker', None) is None \
|
|
70
|
+
or getattr(line.tracker, 'io_buffer', None) is None:
|
|
71
|
+
if io_buffer is None:
|
|
72
|
+
io_buffer = xt.new_io_buffer(capacity=capacity)
|
|
73
|
+
elif io_buffer is not None:
|
|
74
|
+
raise ValueError("Cannot provide io_buffer when tracker already built!")
|
|
75
|
+
else:
|
|
76
|
+
io_buffer = line.tracker.io_buffer
|
|
77
|
+
if capacity > io_buffer.capacity:
|
|
78
|
+
io_buffer.grow(capacity - io_buffer.capacity)
|
|
79
|
+
if record_impacts is None and record_scatterings is None:
|
|
80
|
+
record_impacts = True
|
|
81
|
+
record_scatterings = True
|
|
82
|
+
elif record_impacts is None:
|
|
83
|
+
record_impacts = not record_scatterings
|
|
84
|
+
elif record_scatterings is None:
|
|
85
|
+
record_scatterings = not record_impacts
|
|
86
|
+
if record_exits is None:
|
|
87
|
+
# record_exits defaults to True only if the other two are True
|
|
88
|
+
record_exits = record_impacts and record_scatterings
|
|
89
|
+
assert record_impacts is True or record_impacts is False
|
|
90
|
+
assert record_exits is True or record_exits is False
|
|
91
|
+
assert record_scatterings is True or record_scatterings is False
|
|
92
|
+
for el in elements:
|
|
93
|
+
if not el.record_impacts and not el.record_exits and not el.record_scatterings:
|
|
94
|
+
el.record_impacts = record_impacts
|
|
95
|
+
el.record_exits = record_exits
|
|
96
|
+
el.record_scatterings = record_scatterings
|
|
97
|
+
record = xt.start_internal_logging(io_buffer=io_buffer, capacity=capacity, \
|
|
98
|
+
elements=elements)
|
|
99
|
+
record._line = line
|
|
100
|
+
record._io_buffer = io_buffer
|
|
101
|
+
recording_elements = names if len(names) > 0 else elements
|
|
102
|
+
record._recording_elements = recording_elements
|
|
103
|
+
if coll_ids is None:
|
|
104
|
+
if line is None:
|
|
105
|
+
if len(names) > 0:
|
|
106
|
+
record._coll_ids = {name: idx for idx, name in enumerate(names)}
|
|
107
|
+
else:
|
|
108
|
+
record._coll_ids = {name: line.element_names.index(name) for name in names}
|
|
109
|
+
else:
|
|
110
|
+
assert len(coll_ids) == len(names)
|
|
111
|
+
record._coll_ids = {name: idx for name, idx in zip(names, coll_ids)}
|
|
112
|
+
if hasattr(record, '_coll_ids'):
|
|
113
|
+
record._coll_names = {vv: kk for kk, vv in record._coll_ids.items()}
|
|
114
|
+
return record
|
|
115
|
+
|
|
116
|
+
def stop(self, *, elements=False, names=False):
|
|
117
|
+
self.assert_class_init()
|
|
118
|
+
elements, names = _get_xcoll_elements(self.line, elements, names)
|
|
119
|
+
if self.line is not None and self.line.tracker is not None:
|
|
120
|
+
self.line.tracker._check_invalidated()
|
|
121
|
+
xt.stop_internal_logging(elements=elements)
|
|
122
|
+
# Removed the stopped collimators from list of logged elements
|
|
123
|
+
stopping_elements = names if len(names) > 0 else elements
|
|
124
|
+
self._recording_elements = list(set(self._recording_elements) - set(stopping_elements))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def assert_class_init(self):
|
|
128
|
+
if not hasattr(self, '_io_buffer') or not hasattr(self, '_line') \
|
|
129
|
+
or not hasattr(self, '_recording_elements'):
|
|
130
|
+
raise ValueError("This InteractionRecord has been manually instantiated, "
|
|
131
|
+
+ "hence the expanded API is not available. Use "
|
|
132
|
+
+ "InteractionRecord.start() to initialise with extended API.")
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def line(self):
|
|
136
|
+
if hasattr(self, '_line'):
|
|
137
|
+
return self._line
|
|
138
|
+
|
|
139
|
+
@property
|
|
140
|
+
def io_buffer(self):
|
|
141
|
+
if hasattr(self, '_io_buffer'):
|
|
142
|
+
return self._io_buffer
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
def capacity(self):
|
|
146
|
+
if hasattr(self, '_io_buffer'):
|
|
147
|
+
return self.io_buffer.capacity
|
|
148
|
+
|
|
149
|
+
# @capacity.setter
|
|
150
|
+
# def capacity(self, val):
|
|
151
|
+
# if hasattr(self, '_io_buffer'):
|
|
152
|
+
# capacity = int(capacity)
|
|
153
|
+
# if capacity < self.capacity:
|
|
154
|
+
# raise NotImplementedError("Shrinking of capacity not yet implemented!")
|
|
155
|
+
# elif capacity == self.capacity:
|
|
156
|
+
# return
|
|
157
|
+
# else:
|
|
158
|
+
# self.io_buffer.grow(capacity - self.capacity)
|
|
159
|
+
# # TODO: increase capacity of iobuffer AND of fields in record table
|
|
160
|
+
|
|
161
|
+
@property
|
|
162
|
+
def recording_elements(self):
|
|
163
|
+
if hasattr(self, '_recording_elements'):
|
|
164
|
+
return self._recording_elements
|
|
165
|
+
|
|
166
|
+
@recording_elements.setter
|
|
167
|
+
def recording_elements(self, val):
|
|
168
|
+
self.assert_class_init()
|
|
169
|
+
if val is None:
|
|
170
|
+
val = []
|
|
171
|
+
record_start = _get_xcoll_elements(self.line, val)
|
|
172
|
+
self.stop(set(self.recording_elements) - set(record_start))
|
|
173
|
+
elements = [self.line[name] for name in record_start]
|
|
174
|
+
for el in elements: # TODO: this should be smarter
|
|
175
|
+
if not el.record_impacts and not el.record_scatterings:
|
|
176
|
+
el.record_impacts = True
|
|
177
|
+
el.record_scatterings = True
|
|
178
|
+
xt.start_internal_logging(io_buffer=self.io_buffer, capacity=self.capacity, \
|
|
179
|
+
record=self, elements=elements)
|
|
180
|
+
self._recording_elements = record_start
|
|
181
|
+
# Updating coll IDs: careful to correctly overwrite existing values
|
|
182
|
+
self._coll_ids.update({name: self.line.element_names.index(name) for name in record_start})
|
|
183
|
+
self._coll_names = {vv: kk for kk, vv in self._coll_ids.items()}
|
|
184
|
+
|
|
185
|
+
@property
|
|
186
|
+
def interaction_type(self):
|
|
187
|
+
return np.array([interactions[inter] for inter in self._inter])
|
|
188
|
+
|
|
189
|
+
def _collimator_name(self, element_id):
|
|
190
|
+
if not hasattr(self, '_coll_names'):
|
|
191
|
+
return element_id
|
|
192
|
+
elif element_id not in self._coll_names:
|
|
193
|
+
raise ValueError(f"Element {element_id} not found in list of collimators of this record table! "
|
|
194
|
+
+ f"Did the line change without updating the list in the table?")
|
|
195
|
+
else:
|
|
196
|
+
return self._coll_names[element_id]
|
|
197
|
+
|
|
198
|
+
def _collimator_id(self, element_name):
|
|
199
|
+
if not hasattr(self, '_coll_ids'):
|
|
200
|
+
return element_name
|
|
201
|
+
elif element_name not in self._coll_ids:
|
|
202
|
+
raise ValueError(f"Element {element_name} not found in list of collimators of this record table! "
|
|
203
|
+
+ f"Did the line change without updating the list in the table?")
|
|
204
|
+
else:
|
|
205
|
+
return self._coll_ids[element_name]
|
|
206
|
+
|
|
207
|
+
def to_pandas(self, frame=None):
|
|
208
|
+
if frame is None:
|
|
209
|
+
frame = 'jaw'
|
|
210
|
+
frame = frame.lower()
|
|
211
|
+
if frame not in ['jaw', 'collimator', 'lab']:
|
|
212
|
+
raise ValueError(f"Invalid frame {frame}. Must be 'jaw', 'collimator', or 'lab'!")
|
|
213
|
+
n_rows = self._index.num_recorded
|
|
214
|
+
coll_header = 'collimator' if hasattr(self, '_coll_names') else 'collimator_id'
|
|
215
|
+
df = pd.DataFrame({
|
|
216
|
+
'turn': self.at_turn[:n_rows],
|
|
217
|
+
coll_header: [self._collimator_name(element_id) for element_id in self.at_element[:n_rows]],
|
|
218
|
+
'interaction_type': [interactions[inter] for inter in self._inter[:n_rows]],
|
|
219
|
+
**{
|
|
220
|
+
f'{val}_{p}': getattr(self, f'{val}_{p}')[:n_rows]
|
|
221
|
+
for p in ['before', 'after']
|
|
222
|
+
for val in ['id', 's', 'x', 'px', 'y', 'py', 'zeta', 'delta', 'energy', 'mass', 'charge', 'z', 'a', 'pdgid']
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
return df
|
|
226
|
+
|
|
227
|
+
# TODO: list of impacted collimators
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# TODO: does not work when multiple children
|
|
231
|
+
def interactions_per_collimator(self, collimator=0, *, turn=None):
|
|
232
|
+
if isinstance(collimator, str):
|
|
233
|
+
collimator = self._collimator_id(collimator)
|
|
234
|
+
mask = (self._inter > 0) & (self.at_element == collimator)
|
|
235
|
+
if turn is not None:
|
|
236
|
+
mask = mask & (self.at_turn == turn)
|
|
237
|
+
df = pd.DataFrame({
|
|
238
|
+
'int': [shortcuts[inter] for inter in self._inter[mask]],
|
|
239
|
+
'pid': self.id_before[mask]
|
|
240
|
+
})
|
|
241
|
+
return df.groupby('pid', sort=False)['int'].agg(list)
|
|
242
|
+
else:
|
|
243
|
+
df = pd.DataFrame({
|
|
244
|
+
'int': [shortcuts[inter] for inter in self._inter[mask]],
|
|
245
|
+
'turn': self.at_turn[mask],
|
|
246
|
+
'pid': self.id_before[mask]
|
|
247
|
+
})
|
|
248
|
+
return df.groupby(['pid', 'turn'], sort=False)['int'].apply(list)
|
|
249
|
+
|
|
250
|
+
def first_touch_per_turn(self, frame=None):
|
|
251
|
+
n_rows = self._index.num_recorded
|
|
252
|
+
df = pd.DataFrame({'id_before': self.id_before[:n_rows],
|
|
253
|
+
'at_turn': self.at_turn[:n_rows],
|
|
254
|
+
'at_element': self.at_element[:n_rows]})
|
|
255
|
+
mask = np.char.startswith(self.interaction_type[:n_rows], 'Enter Jaw')
|
|
256
|
+
idx_first = [group.at_element.idxmin() for _, group in df[mask].groupby(['at_turn', 'id_before'], sort=False)]
|
|
257
|
+
df_first = self.to_pandas(frame=frame).loc[idx_first]
|
|
258
|
+
df_first.insert(2, "jaw", df_first.interaction_type.astype(str).str[-1])
|
|
259
|
+
to_drop = ['interaction_type',
|
|
260
|
+
*[col for col in df_first.columns if col.endswith('_after')]]
|
|
261
|
+
to_rename = {col: col.replace('_before', '') for col in df_first.columns if col.endswith('before')}
|
|
262
|
+
to_rename['id_before'] = 'pid'
|
|
263
|
+
return df_first.drop(columns=to_drop).rename(columns=to_rename)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def _get_xcoll_elements(line=None, elements=None, names=None):
|
|
267
|
+
from xcoll import element_classes
|
|
268
|
+
if names is not None and names is not False and \
|
|
269
|
+
(not hasattr(names, '__iter__') or isinstance(names, str)):
|
|
270
|
+
names = [names]
|
|
271
|
+
if elements is not None and elements is not False and \
|
|
272
|
+
(not hasattr(elements, '__iter__') or isinstance(elements, str)):
|
|
273
|
+
elements = [elements]
|
|
274
|
+
if line is None:
|
|
275
|
+
if elements is None:
|
|
276
|
+
raise ValueError("No line nor elements provided!")
|
|
277
|
+
else:
|
|
278
|
+
if elements is not None and elements is not False:
|
|
279
|
+
raise ValueError("Cannot provide both line and elements!")
|
|
280
|
+
if names is None or names is True:
|
|
281
|
+
elements, names = line.get_elements_of_type(element_classes)
|
|
282
|
+
if len(names) == 0:
|
|
283
|
+
raise ValueError("No Xcoll elements in line!")
|
|
284
|
+
elif names is False:
|
|
285
|
+
names = []
|
|
286
|
+
elements = []
|
|
287
|
+
else:
|
|
288
|
+
assert elements is not False
|
|
289
|
+
for name in names:
|
|
290
|
+
if name not in line.element_names:
|
|
291
|
+
raise ValueError(f"Element {name} not found in line!")
|
|
292
|
+
elements = [line[name] for name in names]
|
|
293
|
+
for idx, element in enumerate(elements):
|
|
294
|
+
if not isinstance(element, element_classes):
|
|
295
|
+
name = name[idx] if names is not None else element.__class__.__name__
|
|
296
|
+
raise ValueError(f"Element {name} not an Xcoll element!")
|
|
297
|
+
return elements, names
|
|
298
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// copyright ############################### #
|
|
2
|
+
// This file is part of the Xcoll Package. #
|
|
3
|
+
// Copyright (c) CERN, 2024. #
|
|
4
|
+
// ######################################### #
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#ifndef XCOLL_IMPACTS_H
|
|
8
|
+
#define XCOLL_IMPACTS_H
|
|
9
|
+
|
|
10
|
+
// TODO: do we need to pass RecordIndex?
|
|
11
|
+
// probably can do RecordIndex record_index = InteractionRecordData_getp__index(record); ?
|
|
12
|
+
/*gpufun*/
|
|
13
|
+
int64_t InteractionRecordData_log(InteractionRecordData record, RecordIndex record_index, LocalParticle* parent,
|
|
14
|
+
int64_t interaction){
|
|
15
|
+
// This can be used for a point-like interaction where there is no child (or because it's equal to the parent)
|
|
16
|
+
// or to log the parent first, to be followed up with InteractionRecordData_log_child on the same slot
|
|
17
|
+
|
|
18
|
+
int64_t i_slot = -1;
|
|
19
|
+
if (record){
|
|
20
|
+
// Get a slot in the record (this is thread safe)
|
|
21
|
+
i_slot = RecordIndex_get_slot(record_index);
|
|
22
|
+
// The returned slot id is negative if record is NULL or if record is full
|
|
23
|
+
|
|
24
|
+
if (i_slot>=0){
|
|
25
|
+
InteractionRecordData_set_at_element(record, i_slot, LocalParticle_get_at_element(parent));
|
|
26
|
+
InteractionRecordData_set_at_turn(record, i_slot, LocalParticle_get_at_turn(parent));
|
|
27
|
+
InteractionRecordData_set__inter(record, i_slot, interaction);
|
|
28
|
+
|
|
29
|
+
double charge_ratio = LocalParticle_get_charge_ratio(parent);
|
|
30
|
+
double mass_ratio = charge_ratio / LocalParticle_get_chi(parent);
|
|
31
|
+
double energy = ( LocalParticle_get_ptau(parent) + 1 / LocalParticle_get_beta0(parent)
|
|
32
|
+
) * mass_ratio * LocalParticle_get_p0c(parent);
|
|
33
|
+
// All fields have to be written, or the arrays will not have the same length
|
|
34
|
+
// TODO: maybe this is not true, as we are setting by slot index? Don't the arrays come pre-initialised?
|
|
35
|
+
InteractionRecordData_set_id_before(record, i_slot, LocalParticle_get_particle_id(parent));
|
|
36
|
+
InteractionRecordData_set_s_before(record, i_slot, LocalParticle_get_s(parent));
|
|
37
|
+
InteractionRecordData_set_x_before(record, i_slot, LocalParticle_get_x(parent));
|
|
38
|
+
InteractionRecordData_set_px_before(record, i_slot, LocalParticle_get_px(parent));
|
|
39
|
+
InteractionRecordData_set_y_before(record, i_slot, LocalParticle_get_y(parent));
|
|
40
|
+
InteractionRecordData_set_py_before(record, i_slot, LocalParticle_get_py(parent));
|
|
41
|
+
InteractionRecordData_set_zeta_before(record, i_slot, LocalParticle_get_zeta(parent));
|
|
42
|
+
InteractionRecordData_set_delta_before(record, i_slot, LocalParticle_get_delta(parent));
|
|
43
|
+
InteractionRecordData_set_energy_before(record, i_slot, energy);
|
|
44
|
+
InteractionRecordData_set_mass_before(record, i_slot, mass_ratio*LocalParticle_get_mass0(parent));
|
|
45
|
+
InteractionRecordData_set_charge_before(record, i_slot, charge_ratio*LocalParticle_get_q0(parent));
|
|
46
|
+
// TODO: particle info
|
|
47
|
+
InteractionRecordData_set_z_before(record, i_slot, -1);
|
|
48
|
+
InteractionRecordData_set_a_before(record, i_slot, -1);
|
|
49
|
+
InteractionRecordData_set_pdgid_before(record, i_slot, -1);
|
|
50
|
+
|
|
51
|
+
// TODO: maybe this is not needed
|
|
52
|
+
InteractionRecordData_set_id_after(record, i_slot, -1);
|
|
53
|
+
InteractionRecordData_set_s_after(record, i_slot, -1);
|
|
54
|
+
InteractionRecordData_set_x_after(record, i_slot, -1);
|
|
55
|
+
InteractionRecordData_set_px_after(record, i_slot, -1);
|
|
56
|
+
InteractionRecordData_set_y_after(record, i_slot, -1);
|
|
57
|
+
InteractionRecordData_set_py_after(record, i_slot, -1);
|
|
58
|
+
InteractionRecordData_set_zeta_after(record, i_slot, -1);
|
|
59
|
+
InteractionRecordData_set_delta_after(record, i_slot, -1);
|
|
60
|
+
InteractionRecordData_set_energy_after(record, i_slot, -1);
|
|
61
|
+
InteractionRecordData_set_mass_after(record, i_slot, -1);
|
|
62
|
+
InteractionRecordData_set_charge_after(record, i_slot, -1);
|
|
63
|
+
InteractionRecordData_set_z_after(record, i_slot, -1);
|
|
64
|
+
InteractionRecordData_set_a_after(record, i_slot, -1);
|
|
65
|
+
InteractionRecordData_set_pdgid_after(record, i_slot, -1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// printf("Logging %i in slot %i\n", interaction, i_slot);
|
|
69
|
+
return i_slot;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/*gpufun*/
|
|
73
|
+
void InteractionRecordData_log_child(InteractionRecordData record, int64_t i_slot, LocalParticle* child){
|
|
74
|
+
if (record && i_slot>=0){
|
|
75
|
+
double charge_ratio = LocalParticle_get_charge_ratio(child);
|
|
76
|
+
double mass_ratio = charge_ratio / LocalParticle_get_chi(child);
|
|
77
|
+
double energy = ( LocalParticle_get_ptau(child) + 1 / LocalParticle_get_beta0(child)
|
|
78
|
+
) * mass_ratio * LocalParticle_get_p0c(child);
|
|
79
|
+
InteractionRecordData_set_id_after(record, i_slot, LocalParticle_get_particle_id(child));
|
|
80
|
+
InteractionRecordData_set_s_after(record, i_slot, LocalParticle_get_s(child));
|
|
81
|
+
InteractionRecordData_set_x_after(record, i_slot, LocalParticle_get_x(child));
|
|
82
|
+
InteractionRecordData_set_px_after(record, i_slot, LocalParticle_get_px(child));
|
|
83
|
+
InteractionRecordData_set_y_after(record, i_slot, LocalParticle_get_y(child));
|
|
84
|
+
InteractionRecordData_set_py_after(record, i_slot, LocalParticle_get_py(child));
|
|
85
|
+
InteractionRecordData_set_zeta_after(record, i_slot, LocalParticle_get_zeta(child));
|
|
86
|
+
InteractionRecordData_set_delta_after(record, i_slot, LocalParticle_get_delta(child));
|
|
87
|
+
InteractionRecordData_set_energy_after(record, i_slot, energy);
|
|
88
|
+
InteractionRecordData_set_mass_after(record, i_slot, mass_ratio*LocalParticle_get_mass0(child));
|
|
89
|
+
InteractionRecordData_set_charge_after(record, i_slot, charge_ratio*LocalParticle_get_q0(child));
|
|
90
|
+
// TODO: particle info
|
|
91
|
+
InteractionRecordData_set_z_after(record, i_slot, -1);
|
|
92
|
+
InteractionRecordData_set_a_after(record, i_slot, -1);
|
|
93
|
+
InteractionRecordData_set_pdgid_after(record, i_slot, -1);
|
|
94
|
+
// printf("Slot %i: length %f\n", i_slot, ds);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#endif /* XCOLL_IMPACTS_H */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# copyright ############################### #
|
|
2
2
|
# This file is part of the Xcoll Package. #
|
|
3
|
-
# Copyright (c) CERN,
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
4
|
# ######################################### #
|
|
5
5
|
|
|
6
6
|
|
|
@@ -10,15 +10,16 @@ source = r'''
|
|
|
10
10
|
|
|
11
11
|
#define XC_UNITIALISED 0 // NAN // Do not use
|
|
12
12
|
|
|
13
|
-
#define
|
|
14
|
-
#define
|
|
13
|
+
#define XC_ENTER_JAW_L -1 // JI // point (no children) Set ds > 0 if entering later
|
|
14
|
+
#define XC_ENTER_JAW_R -2 // JI // point (no children) Set ds > 0 if entering later
|
|
15
|
+
#define XC_EXIT_JAW -3 // JO // point (no children)
|
|
16
|
+
#define XC_ENTER_JAW -4 // JI // point (no children) Set ds > 0 if entering later still here for compatibility
|
|
15
17
|
#define XC_ABSORBED 1 // A // point (no children) Don't use 0 (is default for unitialised)
|
|
16
18
|
#define XC_MULTIPLE_COULOMB_SCATTERING 13 // MCS // continuous
|
|
17
19
|
#define XC_PN_ELASTIC 14 // PN // point (no children)
|
|
18
20
|
#define XC_PP_ELASTIC 15 // PP // point (no children)
|
|
19
21
|
#define XC_SINGLE_DIFFRACTIVE 16 // SD // point (no children)
|
|
20
22
|
#define XC_COULOMB 17 // C // point (no children)
|
|
21
|
-
#define XC_RUTHERFORD 18 // RU // point (no children)
|
|
22
23
|
#define XC_CHANNELING 100 // CH // continuous
|
|
23
24
|
#define XC_DECHANNELING 101 // DCH // point (no children)
|
|
24
25
|
#define XC_VOLUME_REFLECTION_TRANS_CH 102 // VRCH // point (no children) Transition region around +-xpcrit
|
|
@@ -43,3 +44,9 @@ shortcuts = {
|
|
|
43
44
|
for line in source.split('\n')
|
|
44
45
|
if len(line.split()) > 1 and line.split()[1][:3] == 'XC_' # select the source lines with the definitions
|
|
45
46
|
}
|
|
47
|
+
|
|
48
|
+
is_point = {
|
|
49
|
+
int(line.split()[2]): line.split()[6].lower() == 'point'
|
|
50
|
+
for line in source.split('\n')
|
|
51
|
+
if len(line.split()) > 1 and line.split()[1][:3] == 'XC_' # select the source lines with the definitions
|
|
52
|
+
}
|
xcoll/line_tools.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xcoll Package. #
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import xtrack as xt
|
|
8
|
+
|
|
9
|
+
from .beam_elements import element_classes, _all_collimator_classes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def assign_optics_to_collimators(line, nemitt_x=None, nemitt_y=None, twiss=None):
|
|
13
|
+
if not line._has_valid_tracker():
|
|
14
|
+
raise Exception("Please build tracker before setting the openings!")
|
|
15
|
+
names = line.get_elements_of_type(_all_collimator_classes)[1]
|
|
16
|
+
tw_upstream, tw_downstream = get_optics_at(names, twiss=twiss, line=line)
|
|
17
|
+
beta_gamma_rel = line.particle_ref._xobject.gamma0[0]*line.particle_ref._xobject.beta0[0]
|
|
18
|
+
for coll in names:
|
|
19
|
+
line[coll].assign_optics(name=coll, nemitt_x=nemitt_x, nemitt_y=nemitt_x, twiss_upstream=tw_upstream,
|
|
20
|
+
twiss_downstream=tw_downstream, beta_gamma_rel=beta_gamma_rel)
|
|
21
|
+
|
|
22
|
+
def get_optics_at(names, *, twiss=None, line=None):
|
|
23
|
+
if twiss is None:
|
|
24
|
+
if not line._has_valid_tracker():
|
|
25
|
+
raise Exception("Please pass a line and build tracker before computing the optics for the openings!")
|
|
26
|
+
twiss = line.twiss()
|
|
27
|
+
if not hasattr(names, '__iter__') and not isinstance(names, str):
|
|
28
|
+
names = [names]
|
|
29
|
+
coll_entry_mask = twiss.mask[names]
|
|
30
|
+
tw_entry = twiss.rows[coll_entry_mask]
|
|
31
|
+
tw_exit = twiss.rows[coll_entry_mask+1]
|
|
32
|
+
tw_exit.name = tw_entry.name
|
|
33
|
+
return tw_entry, tw_exit
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def open_collimators(line, names=None):
|
|
37
|
+
if names is None:
|
|
38
|
+
names = line.get_elements_of_type(_all_collimator_classes)[1]
|
|
39
|
+
if len(names) == 0:
|
|
40
|
+
print("No collimators found in line.")
|
|
41
|
+
else:
|
|
42
|
+
for coll in names:
|
|
43
|
+
line[coll].open_jaws(keep_tilts=False)
|
|
44
|
+
line[coll].gap = None
|
|
45
|
+
|
|
46
|
+
def send_to_parking(line, names=None):
|
|
47
|
+
if names is None:
|
|
48
|
+
names = line.get_elements_of_type(_all_collimator_classes)[1]
|
|
49
|
+
if len(names) == 0:
|
|
50
|
+
print("No collimators found in line.")
|
|
51
|
+
else:
|
|
52
|
+
raise NotImplementedError("Need to move this to new type manager or so.")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def enable_scattering(line):
|
|
56
|
+
elements = line.get_elements_of_type(element_classes)[0]
|
|
57
|
+
if len(elements) == 0:
|
|
58
|
+
print("No xcoll elements found in line.")
|
|
59
|
+
else:
|
|
60
|
+
nemitt_x = None
|
|
61
|
+
nemitt_y = None
|
|
62
|
+
for el in elements:
|
|
63
|
+
if hasattr(el, 'optics') and el.optics is not None:
|
|
64
|
+
if nemitt_x is None:
|
|
65
|
+
nemitt_x = el.nemitt_x
|
|
66
|
+
if nemitt_y is None:
|
|
67
|
+
nemitt_y = el.nemitt_y
|
|
68
|
+
if not np.isclose(el.nemitt_x, nemitt_x) \
|
|
69
|
+
or not np.isclose(el.nemitt_x, nemitt_x):
|
|
70
|
+
raise ValueError("Not all collimators have the same "
|
|
71
|
+
+ "emittance. This is not supported.")
|
|
72
|
+
if hasattr(el, 'enable_scattering'):
|
|
73
|
+
el.enable_scattering()
|
|
74
|
+
|
|
75
|
+
def disable_scattering(line):
|
|
76
|
+
elements = line.get_elements_of_type(element_classes)[0]
|
|
77
|
+
if len(elements) == 0:
|
|
78
|
+
print("No xcoll elements found in line.")
|
|
79
|
+
else:
|
|
80
|
+
for el in elements:
|
|
81
|
+
if hasattr(el, 'disable_scattering'):
|
|
82
|
+
el.disable_scattering()
|