xcoll 0.5.11__py3-none-any.whl → 0.6.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 +5 -18
- xcoll/beam_elements/__init__.py +1 -0
- xcoll/beam_elements/absorber.py +12 -2
- xcoll/beam_elements/base.py +162 -62
- xcoll/beam_elements/blowup.py +1 -0
- xcoll/beam_elements/elements_src/black_absorber.h +57 -58
- xcoll/beam_elements/elements_src/black_crystal.h +49 -50
- xcoll/beam_elements/elements_src/everest_block.h +21 -11
- xcoll/beam_elements/elements_src/everest_collimator.h +100 -91
- xcoll/beam_elements/elements_src/everest_crystal.h +145 -140
- xcoll/beam_elements/elements_src/transparent_collimator.h +126 -0
- xcoll/beam_elements/elements_src/transparent_crystal.h +118 -0
- xcoll/beam_elements/everest.py +16 -5
- xcoll/beam_elements/monitor.py +1 -0
- xcoll/beam_elements/transparent.py +83 -0
- xcoll/colldb.py +15 -6
- xcoll/general.py +1 -1
- xcoll/headers/particle_states.py +51 -0
- xcoll/initial_distribution.py +129 -103
- xcoll/interaction_record/interaction_record.py +2 -1
- xcoll/interaction_record/interaction_types.py +2 -2
- xcoll/line_tools.py +163 -74
- xcoll/lossmap.py +519 -127
- xcoll/plot.py +109 -0
- xcoll/rf_sweep.py +6 -0
- xcoll/scattering_routines/engine.py +600 -0
- xcoll/scattering_routines/environment.py +297 -0
- xcoll/scattering_routines/everest/amorphous.h +95 -71
- xcoll/scattering_routines/everest/{channeling.h → channelling.h} +121 -112
- xcoll/scattering_routines/everest/constants.h +1 -1
- xcoll/scattering_routines/everest/crystal_parameters.h +9 -9
- xcoll/scattering_routines/everest/everest.h +8 -3
- xcoll/scattering_routines/everest/everest.py +2 -1
- xcoll/scattering_routines/everest/ionisation_loss.h +141 -0
- xcoll/scattering_routines/everest/jaw.h +19 -24
- xcoll/scattering_routines/everest/materials.py +2 -0
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
- xcoll/scattering_routines/everest/nuclear_interaction.h +35 -19
- xcoll/scattering_routines/everest/properties.h +4 -73
- xcoll/xaux.py +73 -0
- {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/METADATA +5 -5
- xcoll-0.6.0.dist-info/RECORD +135 -0
- xcoll/_manager.py +0 -22
- xcoll/headers/particle_states.h +0 -25
- xcoll/install.py +0 -35
- xcoll/scattering_routines/geant4/collimasim/.git +0 -1
- xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
- xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
- xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
- xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
- xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
- xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
- xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
- xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
- xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
- 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 +0 -427
- 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 +0 -427
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
- 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 +0 -279
- 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 +0 -143
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
- xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
- xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -763
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -118
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -556
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -24
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
- xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +0 -25
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +0 -5
- xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +0 -99
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +0 -78
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +0 -88
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +0 -96
- xcoll-0.5.11.dist-info/RECORD +0 -413
- {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/LICENSE +0 -0
- {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/NOTICE +0 -0
- {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/WHEEL +0 -0
xcoll/beam_elements/monitor.py
CHANGED
|
@@ -57,6 +57,7 @@ class EmittanceMonitor(xt.BeamElement):
|
|
|
57
57
|
behaves_like_drift = True
|
|
58
58
|
allow_loss_refinement = True
|
|
59
59
|
|
|
60
|
+
_noexpr_fields = {'name', 'line'}
|
|
60
61
|
_extra_c_sources = [
|
|
61
62
|
xt._pkg_root.joinpath('headers/atomicadd.h'),
|
|
62
63
|
_pkg_root.joinpath('beam_elements/elements_src/emittance_monitor.h')
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xcoll package. #
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
|
|
6
|
+
import xtrack as xt
|
|
7
|
+
import xobjects as xo
|
|
8
|
+
from .base import BaseCollimator, BaseCrystal, InvalidXcoll
|
|
9
|
+
from ..scattering_routines.geometry import XcollGeometry
|
|
10
|
+
from ..general import _pkg_root
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TransparentCollimator(BaseCollimator):
|
|
14
|
+
_xofields = { **BaseCollimator._xofields,
|
|
15
|
+
'_tracking': xo.Int8
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
isthick = True
|
|
19
|
+
needs_rng = False
|
|
20
|
+
allow_track = True
|
|
21
|
+
allow_double_sided = True
|
|
22
|
+
behaves_like_drift = True
|
|
23
|
+
allow_rot_and_shift = False
|
|
24
|
+
allow_loss_refinement = True
|
|
25
|
+
skip_in_loss_location_refinement = True
|
|
26
|
+
|
|
27
|
+
_noexpr_fields = BaseCollimator._noexpr_fields
|
|
28
|
+
_skip_in_to_dict = BaseCollimator._skip_in_to_dict
|
|
29
|
+
_store_in_to_dict = BaseCollimator._store_in_to_dict
|
|
30
|
+
_internal_record_class = BaseCollimator._internal_record_class
|
|
31
|
+
|
|
32
|
+
_depends_on = [BaseCollimator, XcollGeometry]
|
|
33
|
+
|
|
34
|
+
_extra_c_sources = [
|
|
35
|
+
_pkg_root.joinpath('beam_elements','elements_src','transparent_collimator.h')
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
def __init__(self, **kwargs):
|
|
39
|
+
if '_xobject' not in kwargs:
|
|
40
|
+
kwargs.setdefault('_tracking', True)
|
|
41
|
+
super().__init__(**kwargs)
|
|
42
|
+
if not isinstance(self._context, xo.ContextCpu):
|
|
43
|
+
raise ValueError('TransparentCollimator is currently not supported on GPU.')
|
|
44
|
+
|
|
45
|
+
def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
|
|
46
|
+
return InvalidXcoll(length=-self.length, _context=_context, _buffer=_buffer, _offset=_offset)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class TransparentCrystal(BaseCrystal):
|
|
50
|
+
_xofields = { **BaseCrystal._xofields,
|
|
51
|
+
'_tracking': xo.Int8
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
isthick = True
|
|
55
|
+
needs_rng = False
|
|
56
|
+
allow_track = True
|
|
57
|
+
allow_double_sided = False
|
|
58
|
+
behaves_like_drift = True
|
|
59
|
+
allow_rot_and_shift = False
|
|
60
|
+
allow_loss_refinement = True
|
|
61
|
+
skip_in_loss_location_refinement = True
|
|
62
|
+
|
|
63
|
+
_noexpr_fields = BaseCrystal._noexpr_fields
|
|
64
|
+
_skip_in_to_dict = BaseCrystal._skip_in_to_dict
|
|
65
|
+
_store_in_to_dict = BaseCrystal._store_in_to_dict
|
|
66
|
+
_internal_record_class = BaseCrystal._internal_record_class
|
|
67
|
+
|
|
68
|
+
_depends_on = [BaseCrystal, XcollGeometry]
|
|
69
|
+
|
|
70
|
+
_extra_c_sources = [
|
|
71
|
+
_pkg_root.joinpath('beam_elements','elements_src','transparent_crystal.h')
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
def __init__(self, **kwargs):
|
|
75
|
+
if '_xobject' not in kwargs:
|
|
76
|
+
kwargs.setdefault('_tracking', True)
|
|
77
|
+
super().__init__(**kwargs)
|
|
78
|
+
if not isinstance(self._context, xo.ContextCpu):
|
|
79
|
+
raise ValueError('TransparentCrystal is currently not supported on GPU.')
|
|
80
|
+
|
|
81
|
+
def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
|
|
82
|
+
return InvalidXcoll(length=-self.length, _context=_context, _buffer=_buffer, _offset=_offset)
|
|
83
|
+
|
xcoll/colldb.py
CHANGED
|
@@ -547,18 +547,26 @@ class CollimatorDatabase:
|
|
|
547
547
|
print(f"Installing {name:20} as {cls.__name__}")
|
|
548
548
|
prop_dict = {kk: vv for kk, vv in self[name].items() \
|
|
549
549
|
if kk in cls._xofields or kk in cls._store_in_to_dict}
|
|
550
|
+
prop_dict['name'] = name
|
|
550
551
|
prop_dict.update(kwargs)
|
|
551
552
|
el = cls(**prop_dict)
|
|
552
553
|
el.emittance = [self.nemitt_x, self.nemitt_y]
|
|
554
|
+
if 'family' in self[name] and self[name]['family'].lower() != 'unknown':
|
|
555
|
+
if self[name]['family'] == name:
|
|
556
|
+
raise ValueError(f"Collimator {name} has the same name as its family!")
|
|
557
|
+
el.family = self[name]['family']
|
|
553
558
|
self._elements[name] = el
|
|
559
|
+
el.name = name
|
|
560
|
+
return el
|
|
554
561
|
|
|
555
562
|
def install_black_absorbers(self, line, *, names=None, families=None, verbose=False, need_apertures=True):
|
|
556
563
|
names = self._get_names_from_line(line, names, families)
|
|
557
564
|
for name in names:
|
|
558
|
-
if self[name]['bending_radius']
|
|
559
|
-
|
|
560
|
-
else:
|
|
565
|
+
if ('bending_radius' in self[name] and self[name]['bending_radius']) \
|
|
566
|
+
or ('bending_angle' in self[name] and self[name]['bending_angle']):
|
|
561
567
|
self._create_collimator(BlackCrystal, line, name, verbose=verbose)
|
|
568
|
+
else:
|
|
569
|
+
self._create_collimator(BlackAbsorber, line, name, verbose=verbose)
|
|
562
570
|
elements = [self._elements[name] for name in names]
|
|
563
571
|
line.collimators.install(names, elements, need_apertures=need_apertures)
|
|
564
572
|
|
|
@@ -566,11 +574,12 @@ class CollimatorDatabase:
|
|
|
566
574
|
names = self._get_names_from_line(line, names, families)
|
|
567
575
|
for name in names:
|
|
568
576
|
mat = SixTrack_to_xcoll(self[name]['material'])
|
|
569
|
-
if self[name]['bending_radius']
|
|
570
|
-
|
|
577
|
+
if ('bending_radius' in self[name] and self[name]['bending_radius']) \
|
|
578
|
+
or ('bending_angle' in self[name] and self[name]['bending_angle']):
|
|
579
|
+
self._create_collimator(EverestCrystal, line, name, material=mat[1],
|
|
571
580
|
verbose=verbose)
|
|
572
581
|
else:
|
|
573
|
-
self._create_collimator(
|
|
582
|
+
self._create_collimator(EverestCollimator, line, name, material=mat[0],
|
|
574
583
|
verbose=verbose)
|
|
575
584
|
elements = [self._elements[name] for name in names]
|
|
576
585
|
line.collimators.install(names, elements, need_apertures=need_apertures)
|
xcoll/general.py
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xcoll package. #
|
|
3
|
+
# Copyright (c) CERN, 2025. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
LOST_ON_EVEREST_BLOCK = -330
|
|
8
|
+
LOST_ON_EVEREST_COLL = -331
|
|
9
|
+
LOST_ON_EVEREST_CRYSTAL = -332
|
|
10
|
+
|
|
11
|
+
LOST_ON_FLUKA_BLOCK = -333
|
|
12
|
+
LOST_ON_FLUKA_COLL = -334
|
|
13
|
+
LOST_ON_FLUKA_CRYSTAL = -335
|
|
14
|
+
|
|
15
|
+
LOST_ON_GEANT4_BLOCK = -336
|
|
16
|
+
LOST_ON_GEANT4_COLL = -337
|
|
17
|
+
LOST_ON_GEANT4_CRYSTAL = -338
|
|
18
|
+
|
|
19
|
+
LOST_ON_ABSORBER = -340
|
|
20
|
+
|
|
21
|
+
MASSLESS_OR_NEUTRAL = -341
|
|
22
|
+
ACC_IONISATION_LOSS = -342 # Not a real particle, but accumulation of some ionisation losses that are not accounted for (per collimator)
|
|
23
|
+
VIRTUAL_ENERGY = -343 # Not a real particle, but energy that is deposited
|
|
24
|
+
|
|
25
|
+
ERR_INVALID_TRACK = -390
|
|
26
|
+
ERR_NOT_IMPLEMENTED = -391
|
|
27
|
+
ERR_INVALID_XOFIELD = -392
|
|
28
|
+
ERR = -399
|
|
29
|
+
|
|
30
|
+
particle_states_src = f"""
|
|
31
|
+
#ifndef XCOLL_STATES_H
|
|
32
|
+
#define XCOLL_STATES_H
|
|
33
|
+
#define XC_LOST_ON_EVEREST_BLOCK {LOST_ON_EVEREST_BLOCK}
|
|
34
|
+
#define XC_LOST_ON_EVEREST_COLL {LOST_ON_EVEREST_COLL}
|
|
35
|
+
#define XC_LOST_ON_EVEREST_CRYSTAL {LOST_ON_EVEREST_CRYSTAL}
|
|
36
|
+
#define XC_LOST_ON_FLUKA_BLOCK {LOST_ON_FLUKA_BLOCK}
|
|
37
|
+
#define XC_LOST_ON_FLUKA_COLL {LOST_ON_FLUKA_COLL}
|
|
38
|
+
#define XC_LOST_ON_FLUKA_CRYSTAL {LOST_ON_FLUKA_CRYSTAL}
|
|
39
|
+
#define XC_LOST_ON_GEANT4_BLOCK {LOST_ON_GEANT4_BLOCK}
|
|
40
|
+
#define XC_LOST_ON_GEANT4_COLL {LOST_ON_GEANT4_COLL}
|
|
41
|
+
#define XC_LOST_ON_GEANT4_CRYSTAL {LOST_ON_GEANT4_CRYSTAL}
|
|
42
|
+
#define XC_LOST_ON_ABSORBER {LOST_ON_ABSORBER}
|
|
43
|
+
#define XC_MASSLESS_OR_NEUTRAL {MASSLESS_OR_NEUTRAL}
|
|
44
|
+
#define XC_ACC_IONISATION_LOSS {ACC_IONISATION_LOSS}
|
|
45
|
+
#define XC_VIRTUAL_ENERGY {VIRTUAL_ENERGY}
|
|
46
|
+
#define XC_ERR_INVALID_TRACK {ERR_INVALID_TRACK}
|
|
47
|
+
#define XC_ERR_NOT_IMPLEMENTED {ERR_NOT_IMPLEMENTED}
|
|
48
|
+
#define XC_ERR_INVALID_XOFIELD {ERR_INVALID_XOFIELD}
|
|
49
|
+
#define XC_ERR {ERR}
|
|
50
|
+
#endif /* XCOLL_STATES_H */
|
|
51
|
+
"""
|
xcoll/initial_distribution.py
CHANGED
|
@@ -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, 2025. #
|
|
4
4
|
# ######################################### #
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
@@ -10,34 +10,25 @@ import xtrack as xt
|
|
|
10
10
|
import xobjects as xo
|
|
11
11
|
import xpart as xp
|
|
12
12
|
|
|
13
|
-
from .beam_elements import collimator_classes,
|
|
13
|
+
from .beam_elements import collimator_classes, BaseCrystal
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', pencil_spread=1e-6,
|
|
17
17
|
impact_parameter=0, sigma_z=7.61e-2, twiss=None, longitudinal=None,
|
|
18
|
-
longitudinal_betatron_cut=None, tw=None,
|
|
19
|
-
|
|
20
|
-
Generate a pencil beam on a collimator.
|
|
21
|
-
"""
|
|
18
|
+
longitudinal_betatron_cut=None, _capacity=None, tw=None,
|
|
19
|
+
_longitudinal_coords=None, **kwargs):
|
|
20
|
+
"""Generate a pencil beam on a collimator."""
|
|
22
21
|
|
|
22
|
+
# Do some general checks
|
|
23
23
|
if not line._has_valid_tracker():
|
|
24
24
|
raise ValueError("Please build tracker before generating pencil distribution!")
|
|
25
|
-
|
|
26
25
|
coll = line[name]
|
|
27
|
-
|
|
28
26
|
if not isinstance(coll, tuple(collimator_classes)):
|
|
29
27
|
raise ValueError("Need to provide a valid collimator!")
|
|
30
|
-
|
|
31
28
|
if coll.optics is None:
|
|
32
29
|
raise ValueError("Need to assign optics to collimators before generating pencil distribution!")
|
|
33
|
-
|
|
34
30
|
num_particles = int(num_particles)
|
|
35
31
|
|
|
36
|
-
if coll.side == 'left':
|
|
37
|
-
side = '+'
|
|
38
|
-
if coll.side == 'right':
|
|
39
|
-
side = '-'
|
|
40
|
-
|
|
41
32
|
# Define the plane
|
|
42
33
|
angle = coll.angle
|
|
43
34
|
if abs(np.mod(angle-90,180)-90) < 1e-6:
|
|
@@ -49,6 +40,17 @@ def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', penci
|
|
|
49
40
|
else:
|
|
50
41
|
raise NotImplementedError("Pencil beam on a skew collimator not yet supported!")
|
|
51
42
|
|
|
43
|
+
if coll.side == 'left':
|
|
44
|
+
if side == '-':
|
|
45
|
+
raise ValueError("Cannot generate a pencil on the right jaw of a left-"
|
|
46
|
+
"sided collimator!")
|
|
47
|
+
side = '+'
|
|
48
|
+
if coll.side == 'right':
|
|
49
|
+
if side == '+':
|
|
50
|
+
raise ValueError("Cannot generate a pencil on the left jaw of a right-"
|
|
51
|
+
"sided collimator!")
|
|
52
|
+
side = '-'
|
|
53
|
+
|
|
52
54
|
if tw is not None:
|
|
53
55
|
warn("The argument tw is deprecated. Please use twiss instead.", FutureWarning)
|
|
54
56
|
if twiss is None:
|
|
@@ -57,79 +59,48 @@ def generate_pencil_on_collimator(line, name, num_particles, *, side='+-', penci
|
|
|
57
59
|
if twiss is None:
|
|
58
60
|
twiss = line.twiss()
|
|
59
61
|
|
|
60
|
-
# Is it converging or diverging?
|
|
61
|
-
# TODO: dispersion might change this
|
|
62
|
-
# TODO: this should be checked jaw by jaw (we are currently checking the left jaw - watch out for sign of tilt of right jaw)
|
|
63
|
-
# TODO: skew collimators
|
|
64
|
-
tilt = coll.tilt[0] if isinstance(coll.tilt, list) else coll.tilt
|
|
65
|
-
betatron_angle = coll.gap * coll.divergence
|
|
66
|
-
tolerance_tilt = 1e-12 # 0.1 urad tolerance on jaw tilt => we prioritise converging
|
|
67
|
-
is_converging = tilt + tolerance_tilt >= betatron_angle
|
|
68
|
-
print(f"Collimator {name} is {'con' if is_converging else 'di'}verging.")
|
|
69
|
-
|
|
70
|
-
beam_sizes = twiss.get_beam_covariance(nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y)
|
|
71
|
-
if is_converging:
|
|
72
|
-
# pencil at front of jaw
|
|
73
|
-
sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][0]
|
|
74
|
-
sigma_transv = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{transv_plane}'][0]
|
|
75
|
-
tw_at_s = twiss.rows[name]
|
|
76
|
-
at_element = name
|
|
77
|
-
else:
|
|
78
|
-
# pencil at back of jaw
|
|
79
|
-
sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][1]
|
|
80
|
-
sigma_transv = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{transv_plane}'][1]
|
|
81
|
-
tw_at_s = twiss.rows[f'{name}>>1']
|
|
82
|
-
at_element = line.element_names[line.element_names.index(name)+1]
|
|
83
|
-
|
|
84
|
-
dr_sigmas = pencil_spread/sigma
|
|
85
|
-
|
|
86
|
-
# Generate 4D coordinates
|
|
87
|
-
# TODO: there is some looping in the calculation here and in xpart. Can it be improved?
|
|
88
|
-
if side == '+-':
|
|
89
|
-
num_plus = int(num_particles/2)
|
|
90
|
-
num_min = int(num_particles - num_plus)
|
|
91
|
-
coords_plus = _generate_4D_pencil_one_jaw(line, name, num_plus, plane, '+', impact_parameter, dr_sigmas, at_element, is_converging, tw_at_s)
|
|
92
|
-
coords_min = _generate_4D_pencil_one_jaw(line, name, num_min, plane, '-', impact_parameter, dr_sigmas, at_element, is_converging, tw_at_s)
|
|
93
|
-
coords = [ [*c_plus, *c_min] for c_plus, c_min in zip(coords_plus, coords_min)]
|
|
94
|
-
else:
|
|
95
|
-
coords = _generate_4D_pencil_one_jaw(line, name, num_particles, plane, side, impact_parameter, dr_sigmas, at_element, is_converging, tw_at_s)
|
|
96
|
-
pencil = coords[0]
|
|
97
|
-
p_pencil = coords[1]
|
|
98
|
-
transverse_norm = coords[2]
|
|
99
|
-
p_transverse_norm = coords[3]
|
|
100
|
-
|
|
101
62
|
# Longitudinal plane
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
delta =
|
|
105
|
-
|
|
106
|
-
elif longitudinal == 'matched_dispersion':
|
|
107
|
-
raise NotImplementedError
|
|
108
|
-
# if longitudinal_betatron_cut is None:
|
|
109
|
-
# cut = 0
|
|
110
|
-
# else:
|
|
111
|
-
# cut = np.random.uniform(-longitudinal_betatron_cut, longitudinal_betatron_cut,
|
|
112
|
-
# num_particles)
|
|
113
|
-
# delta = generate_delta_from_dispersion(line, name, plane=plane, position_mm=pencil,
|
|
114
|
-
# nemitt_x=nemitt_x, nemitt_y=nemitt_y, twiss=tw,
|
|
115
|
-
# betatron_cut=cut, match_at_front=is_converging)
|
|
116
|
-
# zeta = 0
|
|
117
|
-
elif longitudinal == 'bucket':
|
|
118
|
-
zeta, delta = xp.generate_longitudinal_coordinates(
|
|
119
|
-
num_particles=num_particles, distribution='gaussian', sigma_z=sigma_z, line=line
|
|
120
|
-
)
|
|
121
|
-
elif not hasattr(longitudinal, '__iter__'):
|
|
122
|
-
raise ValueError
|
|
123
|
-
elif len(longitudinal) != 2:
|
|
124
|
-
raise ValueError
|
|
125
|
-
elif isinstance(longitudinal, str):
|
|
126
|
-
raise ValueError
|
|
127
|
-
elif isinstance(longitudinal, dict):
|
|
128
|
-
zeta = longitudinal['zeta']
|
|
129
|
-
delta = longitudinal['delta']
|
|
63
|
+
if _longitudinal_coords:
|
|
64
|
+
zeta = _longitudinal_coords[0]
|
|
65
|
+
delta = _longitudinal_coords[1]
|
|
66
|
+
|
|
130
67
|
else:
|
|
131
|
-
zeta = longitudinal
|
|
132
|
-
|
|
68
|
+
zeta, delta = _generate_longitudinal_dist(line, num_particles, sigma_z, longitudinal)
|
|
69
|
+
|
|
70
|
+
# Generate 4D coordinates
|
|
71
|
+
# TODO: there is some looping in the calculation here and in xpart. Can it be improved?
|
|
72
|
+
if side == '+-':
|
|
73
|
+
num_plus = int(num_particles/2)
|
|
74
|
+
num_min = int(num_particles - num_plus)
|
|
75
|
+
zeta_plus = zeta[:num_plus] if hasattr(zeta, '__iter__') else zeta
|
|
76
|
+
zeta_min = zeta[num_plus:] if hasattr(zeta, '__iter__') else zeta
|
|
77
|
+
delta_plus = delta[:num_plus] if hasattr(delta, '__iter__') else delta
|
|
78
|
+
delta_min = delta[num_plus:] if hasattr(delta, '__iter__') else delta
|
|
79
|
+
if _capacity:
|
|
80
|
+
_capacity_plus = int(_capacity/2)
|
|
81
|
+
_capacity_min = int(_capacity - _capacity_plus)
|
|
82
|
+
else:
|
|
83
|
+
_capacity_plus = None
|
|
84
|
+
_capacity_min = None
|
|
85
|
+
part_plus = generate_pencil_on_collimator(line=line, name=name, num_particles=num_plus,
|
|
86
|
+
impact_parameter=impact_parameter, _capacity=_capacity_plus,
|
|
87
|
+
side='+', pencil_spread=pencil_spread, twiss=twiss,
|
|
88
|
+
_longitudinal_coords=[zeta_plus, delta_plus],
|
|
89
|
+
**kwargs)
|
|
90
|
+
part_min = generate_pencil_on_collimator(line=line, name=name, num_particles=num_min,
|
|
91
|
+
impact_parameter=impact_parameter, _capacity=_capacity_min,
|
|
92
|
+
side='-', pencil_spread=pencil_spread, twiss=twiss,
|
|
93
|
+
_longitudinal_coords=[zeta_min, delta_min],
|
|
94
|
+
**kwargs)
|
|
95
|
+
|
|
96
|
+
part = xt.Particles.merge([part_plus, part_min])
|
|
97
|
+
part.start_tracking_at_element = part_plus.start_tracking_at_element
|
|
98
|
+
assert part.start_tracking_at_element == part_min.start_tracking_at_element
|
|
99
|
+
return part
|
|
100
|
+
|
|
101
|
+
pencil, p_pencil, transverse_norm, p_transverse_norm, is_converging, at_element = \
|
|
102
|
+
_generate_4D_pencil_one_jaw(line, name, num_particles, plane, side,
|
|
103
|
+
impact_parameter, pencil_spread, twiss, **kwargs)
|
|
133
104
|
|
|
134
105
|
# Build the particles
|
|
135
106
|
if plane == 'x':
|
|
@@ -183,42 +154,97 @@ def generate_delta_from_dispersion(line, at_element, *, plane, position_mm, nemi
|
|
|
183
154
|
|
|
184
155
|
|
|
185
156
|
def _generate_4D_pencil_one_jaw(line, name, num_particles, plane, side, impact_parameter,
|
|
186
|
-
|
|
157
|
+
pencil_spread, twiss=None, _capacity=None, **kwargs):
|
|
187
158
|
coll = line[name]
|
|
159
|
+
beam_sizes = twiss.get_beam_covariance(nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y)
|
|
188
160
|
|
|
161
|
+
# Is it converging or diverging?
|
|
162
|
+
# TODO: dispersion might change this
|
|
163
|
+
# TODO: skew collimators
|
|
164
|
+
tolerance_tilt = 1e-12 # 0.1 urad tolerance on jaw tilt => we prioritise converging
|
|
165
|
+
divergence = coll.divergence
|
|
189
166
|
if side == '+':
|
|
190
|
-
if
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
pencil_pos = coll.jaw_LU + impact_parameter
|
|
167
|
+
if isinstance(coll, BaseCrystal):
|
|
168
|
+
# A pencil on the crystal should always be upstream
|
|
169
|
+
is_converging = True
|
|
170
|
+
pencil_pos = coll.jaw_U + impact_parameter
|
|
195
171
|
else:
|
|
196
|
-
|
|
197
|
-
|
|
172
|
+
betatron_angle = coll.gap_L * divergence
|
|
173
|
+
is_converging = coll.tilt_L + tolerance_tilt >= betatron_angle
|
|
174
|
+
print(f"Left jaw of collimator {name} is {'con' if is_converging else 'di'}verging.")
|
|
175
|
+
if is_converging:
|
|
176
|
+
pencil_pos = coll.jaw_LU + impact_parameter
|
|
198
177
|
else:
|
|
199
178
|
pencil_pos = coll.jaw_LD + impact_parameter
|
|
200
179
|
elif side == '-':
|
|
201
|
-
if
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
pencil_pos = coll.jaw_RU - impact_parameter
|
|
180
|
+
if isinstance(coll, BaseCrystal):
|
|
181
|
+
# A pencil on the crystal should always be upstream
|
|
182
|
+
is_converging = True
|
|
183
|
+
pencil_pos = coll.jaw_U - impact_parameter
|
|
206
184
|
else:
|
|
207
|
-
|
|
208
|
-
|
|
185
|
+
betatron_angle = coll.gap_R * divergence
|
|
186
|
+
is_converging = coll.tilt_R - tolerance_tilt <= betatron_angle
|
|
187
|
+
print(f"Right jaw of collimator {name} is {'con' if is_converging else 'di'}verging.")
|
|
188
|
+
if is_converging:
|
|
189
|
+
pencil_pos = coll.jaw_RU - impact_parameter
|
|
209
190
|
else:
|
|
210
191
|
pencil_pos = coll.jaw_RD - impact_parameter
|
|
192
|
+
else:
|
|
193
|
+
raise ValueError(f"Sinde {side} not supported in _generate_4D_pencil_one_jaw!")
|
|
194
|
+
|
|
195
|
+
if is_converging:
|
|
196
|
+
# pencil at front of jaw
|
|
197
|
+
sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][0]
|
|
198
|
+
tw_at_s = twiss.rows[name]
|
|
199
|
+
at_element = name
|
|
200
|
+
else:
|
|
201
|
+
# pencil at back of jaw
|
|
202
|
+
sigma = beam_sizes.rows[name:f'{name}>>1'][f'sigma_{plane}'][1]
|
|
203
|
+
tw_at_s = twiss.rows[f'{name}>>1']
|
|
204
|
+
at_element = line.element_names[line.element_names.index(name)+1]
|
|
205
|
+
|
|
206
|
+
dr_sigmas = pencil_spread/sigma
|
|
211
207
|
|
|
212
208
|
# Collimator plane: generate pencil distribution
|
|
213
209
|
pencil, p_pencil = xp.generate_2D_pencil_with_absolute_cut(
|
|
214
210
|
num_particles, plane=plane, absolute_cut=pencil_pos, line=line,
|
|
215
211
|
dr_sigmas=dr_sigmas, nemitt_x=coll.nemitt_x, nemitt_y=coll.nemitt_y,
|
|
216
|
-
at_element=at_element, side=side, twiss=tw_at_s
|
|
212
|
+
at_element=at_element, side=side, twiss=tw_at_s, **kwargs
|
|
217
213
|
)
|
|
218
214
|
|
|
219
215
|
# Other plane: generate gaussian distribution in normalized coordinates
|
|
220
216
|
transverse_norm = np.random.normal(size=num_particles)
|
|
221
217
|
p_transverse_norm = np.random.normal(size=num_particles)
|
|
222
218
|
|
|
223
|
-
return
|
|
219
|
+
return pencil, p_pencil, transverse_norm, p_transverse_norm, is_converging, at_element
|
|
224
220
|
|
|
221
|
+
|
|
222
|
+
def _generate_longitudinal_dist(line, num_particles, sigma_z, longitudinal):
|
|
223
|
+
# TODO: make this more general, make this better
|
|
224
|
+
if longitudinal is None:
|
|
225
|
+
return 0, 0
|
|
226
|
+
elif longitudinal == 'matched_dispersion':
|
|
227
|
+
raise NotImplementedError
|
|
228
|
+
# if longitudinal_betatron_cut is None:
|
|
229
|
+
# cut = 0
|
|
230
|
+
# else:
|
|
231
|
+
# cut = np.random.uniform(-longitudinal_betatron_cut, longitudinal_betatron_cut,
|
|
232
|
+
# num_particles)
|
|
233
|
+
# delta = generate_delta_from_dispersion(line, name, plane=plane, position_mm=pencil,
|
|
234
|
+
# nemitt_x=nemitt_x, nemitt_y=nemitt_y, twiss=tw,
|
|
235
|
+
# betatron_cut=cut, match_at_front=is_converging)
|
|
236
|
+
# zeta = 0
|
|
237
|
+
elif longitudinal == 'bucket':
|
|
238
|
+
return xp.generate_longitudinal_coordinates(
|
|
239
|
+
num_particles=num_particles, distribution='gaussian', sigma_z=sigma_z, line=line
|
|
240
|
+
)
|
|
241
|
+
elif not hasattr(longitudinal, '__iter__'):
|
|
242
|
+
raise ValueError
|
|
243
|
+
elif len(longitudinal) != 2:
|
|
244
|
+
raise ValueError
|
|
245
|
+
elif isinstance(longitudinal, str):
|
|
246
|
+
raise ValueError
|
|
247
|
+
elif isinstance(longitudinal, dict):
|
|
248
|
+
return longitudinal['zeta'], longitudinal['delta']
|
|
249
|
+
else:
|
|
250
|
+
return longitudinal[0], longitudinal[1]
|
|
@@ -8,6 +8,7 @@ import xtrack as xt
|
|
|
8
8
|
|
|
9
9
|
from .interaction_types import source, interactions, shortcuts, is_point
|
|
10
10
|
from ..general import _pkg_root
|
|
11
|
+
from ..headers.particle_states import particle_states_src
|
|
11
12
|
|
|
12
13
|
import numpy as np
|
|
13
14
|
import pandas as pd
|
|
@@ -53,7 +54,7 @@ class InteractionRecord(xt.BeamElement):
|
|
|
53
54
|
|
|
54
55
|
_extra_c_sources = [
|
|
55
56
|
source,
|
|
56
|
-
|
|
57
|
+
particle_states_src,
|
|
57
58
|
_pkg_root.joinpath('interaction_record','interaction_record_src','interaction_record.h')
|
|
58
59
|
]
|
|
59
60
|
|
|
@@ -20,8 +20,8 @@ source = r'''
|
|
|
20
20
|
#define XC_PP_ELASTIC 15 // PP // point (no children)
|
|
21
21
|
#define XC_SINGLE_DIFFRACTIVE 16 // SD // point (no children)
|
|
22
22
|
#define XC_COULOMB 17 // C // point (no children)
|
|
23
|
-
#define
|
|
24
|
-
#define
|
|
23
|
+
#define XC_CHANNELLING 100 // CH // continuous
|
|
24
|
+
#define XC_DECHANNELLING 101 // DCH // point (no children)
|
|
25
25
|
#define XC_VOLUME_REFLECTION_TRANS_CH 102 // VRCH // point (no children) Transition region around +-xpcrit
|
|
26
26
|
#define XC_VOLUME_REFLECTION 103 // VR // point (no children)
|
|
27
27
|
#define XC_VOLUME_REFLECTION_TRANS_MCS 104 // VRAM // point (no children) Transition region around t_P
|