xcoll 0.4.0__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 +2 -1
- xcoll/beam_elements/__init__.py +7 -1
- xcoll/beam_elements/absorber.py +2 -2
- xcoll/beam_elements/base.py +105 -67
- xcoll/beam_elements/blowup.py +198 -0
- xcoll/beam_elements/{collimators_src → elements_src}/black_absorber.h +21 -3
- xcoll/beam_elements/{collimators_src → elements_src}/black_crystal.h +20 -2
- 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 +19 -2
- xcoll/beam_elements/{collimators_src → elements_src}/everest_collimator.h +19 -3
- xcoll/beam_elements/{collimators_src → elements_src}/everest_crystal.h +30 -9
- xcoll/beam_elements/everest.py +5 -6
- xcoll/beam_elements/monitor.py +428 -0
- xcoll/colldb.py +103 -74
- xcoll/general.py +4 -4
- xcoll/initial_distribution.py +18 -6
- xcoll/install.py +3 -1
- xcoll/interaction_record/interaction_record.py +126 -80
- xcoll/interaction_record/interaction_record_src/interaction_record.h +43 -43
- xcoll/line_tools.py +8 -9
- xcoll/lossmap.py +48 -38
- xcoll/scattering_routines/everest/amorphous.h +4 -11
- xcoll/scattering_routines/everest/channeling.h +3 -8
- xcoll/scattering_routines/everest/everest.h +4 -1
- xcoll/scattering_routines/everest/jaw.h +4 -3
- xcoll/scattering_routines/everest/materials.py +35 -15
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
- xcoll/scattering_routines/everest/nuclear_interaction.h +1 -1
- 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/collimator_geometry.h +9 -10
- xcoll/scattering_routines/geometry/crystal_geometry.h +9 -6
- {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/METADATA +1 -1
- xcoll-0.5.0.dist-info/RECORD +413 -0
- xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
- xcoll-0.4.0.dist-info/RECORD +0 -126
- {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/LICENSE +0 -0
- {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/NOTICE +0 -0
- {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/WHEEL +0 -0
xcoll/__init__.py
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
from .general import _pkg_root, __version__, citation
|
|
7
7
|
|
|
8
|
-
from .beam_elements import BlackAbsorber, BlackCrystal, EverestBlock, EverestCollimator, EverestCrystal,
|
|
8
|
+
from .beam_elements import BlackAbsorber, BlackCrystal, EverestBlock, EverestCollimator, EverestCrystal, \
|
|
9
|
+
BlowUp, EmittanceMonitor, collimator_classes, crystal_classes, element_classes
|
|
9
10
|
from .install import install_elements
|
|
10
11
|
from .line_tools import assign_optics_to_collimators, open_collimators, send_to_parking, enable_scattering, disable_scattering
|
|
11
12
|
from .scattering_routines.everest import materials, Material, CrystalMaterial
|
xcoll/beam_elements/__init__.py
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
from .base import BaseBlock, BaseCollimator, BaseCrystal
|
|
7
7
|
from .absorber import BlackAbsorber, BlackCrystal
|
|
8
8
|
from .everest import EverestBlock, EverestCollimator, EverestCrystal
|
|
9
|
+
from .blowup import BlowUp
|
|
10
|
+
from .monitor import EmittanceMonitor
|
|
9
11
|
|
|
10
12
|
block_classes = tuple(v for v in globals().values()
|
|
11
13
|
if isinstance(v, type) and issubclass(v, BaseBlock) and v != BaseBlock)
|
|
@@ -15,4 +17,8 @@ collimator_classes = tuple(v for v in globals().values()
|
|
|
15
17
|
and v != BaseCollimator and v != BaseCrystal)
|
|
16
18
|
crystal_classes = tuple(v for v in globals().values()
|
|
17
19
|
if isinstance(v, type) and issubclass(v, BaseCrystal) and v != BaseCrystal)
|
|
18
|
-
|
|
20
|
+
|
|
21
|
+
element_classes = block_classes + collimator_classes + (BlowUp, EmittanceMonitor)
|
|
22
|
+
|
|
23
|
+
_all_collimator_classes = collimator_classes
|
|
24
|
+
_all_crystal_classes = crystal_classes
|
xcoll/beam_elements/absorber.py
CHANGED
|
@@ -23,7 +23,7 @@ class BlackAbsorber(BaseCollimator):
|
|
|
23
23
|
_depends_on = [BaseCollimator, XcollGeometry]
|
|
24
24
|
|
|
25
25
|
_extra_c_sources = [
|
|
26
|
-
_pkg_root.joinpath('beam_elements','
|
|
26
|
+
_pkg_root.joinpath('beam_elements','elements_src','black_absorber.h')
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
_skip_in_to_dict = BaseCollimator._skip_in_to_dict
|
|
@@ -54,7 +54,7 @@ class BlackCrystal(BaseCrystal):
|
|
|
54
54
|
_depends_on = [BaseCrystal, XcollGeometry]
|
|
55
55
|
|
|
56
56
|
_extra_c_sources = [
|
|
57
|
-
_pkg_root.joinpath('beam_elements','
|
|
57
|
+
_pkg_root.joinpath('beam_elements','elements_src','black_crystal.h')
|
|
58
58
|
]
|
|
59
59
|
|
|
60
60
|
_skip_in_to_dict = BaseCrystal._skip_in_to_dict
|
xcoll/beam_elements/base.py
CHANGED
|
@@ -10,7 +10,6 @@ import xtrack as xt
|
|
|
10
10
|
|
|
11
11
|
from ..interaction_record import InteractionRecord
|
|
12
12
|
from ..general import _pkg_root
|
|
13
|
-
from ..scattering_routines.geometry import XcollGeometry
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
OPEN_JAW = 3.
|
|
@@ -46,10 +45,9 @@ class InvalidXcoll(xt.BeamElement):
|
|
|
46
45
|
|
|
47
46
|
class BaseBlock(xt.BeamElement):
|
|
48
47
|
_xofields = {
|
|
49
|
-
'length':
|
|
50
|
-
'active':
|
|
51
|
-
'
|
|
52
|
-
'record_scatterings': xo.Int8
|
|
48
|
+
'length': xo.Float64,
|
|
49
|
+
'active': xo.Int8,
|
|
50
|
+
'_record_interactions': xo.Int8
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
isthick = True
|
|
@@ -57,6 +55,9 @@ class BaseBlock(xt.BeamElement):
|
|
|
57
55
|
behaves_like_drift = True
|
|
58
56
|
skip_in_loss_location_refinement = True
|
|
59
57
|
|
|
58
|
+
_skip_in_to_dict = ['_record_interactions']
|
|
59
|
+
_store_in_to_dict = ['record_impacts', 'record_exits', 'record_scatterings']
|
|
60
|
+
|
|
60
61
|
_depends_on = [InvalidXcoll]
|
|
61
62
|
|
|
62
63
|
_internal_record_class = InteractionRecord
|
|
@@ -68,14 +69,61 @@ class BaseBlock(xt.BeamElement):
|
|
|
68
69
|
instance = super().__new__(cls)
|
|
69
70
|
return instance
|
|
70
71
|
|
|
72
|
+
def __init__(self, **kwargs):
|
|
73
|
+
if '_xobject' not in kwargs:
|
|
74
|
+
kwargs.setdefault('active', True)
|
|
75
|
+
super().__init__(**kwargs)
|
|
76
|
+
|
|
71
77
|
def enable_scattering(self):
|
|
72
78
|
if hasattr(self, '_tracking'):
|
|
79
|
+
if hasattr(self, 'optics') and self.optics is None and \
|
|
80
|
+
(hasattr(self, '_gap_L_set_manually') and self._gap_L_set_manually() \
|
|
81
|
+
or hasattr(self, '_gap_R_set_manually') and self._gap_R_set_manually()):
|
|
82
|
+
raise ValueError("Gap set but optics not yet assigned! "
|
|
83
|
+
+ "Cannot enable scattering.")
|
|
73
84
|
self._tracking = True
|
|
74
85
|
|
|
75
86
|
def disable_scattering(self):
|
|
76
87
|
if hasattr(self, '_tracking'):
|
|
77
88
|
self._tracking = False
|
|
78
89
|
|
|
90
|
+
@property
|
|
91
|
+
def record_impacts(self):
|
|
92
|
+
return bool(self._record_interactions % 2)
|
|
93
|
+
|
|
94
|
+
@record_impacts.setter
|
|
95
|
+
def record_impacts(self, val):
|
|
96
|
+
if val and not self.record_impacts:
|
|
97
|
+
self._record_interactions += 1
|
|
98
|
+
elif not val and self.record_impacts:
|
|
99
|
+
self._record_interactions -= 1
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def record_exits(self):
|
|
103
|
+
return bool((self._record_interactions >> 1) % 2)
|
|
104
|
+
|
|
105
|
+
@record_exits.setter
|
|
106
|
+
def record_exits(self, val):
|
|
107
|
+
if val and not self.record_exits:
|
|
108
|
+
self._record_interactions += 2
|
|
109
|
+
elif not val and self.record_exits:
|
|
110
|
+
self._record_interactions -= 2
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def record_scatterings(self):
|
|
114
|
+
return bool((self._record_interactions >> 2) % 2)
|
|
115
|
+
|
|
116
|
+
@record_scatterings.setter
|
|
117
|
+
def record_scatterings(self, val):
|
|
118
|
+
if val and not self.record_scatterings:
|
|
119
|
+
self._record_interactions += 4
|
|
120
|
+
elif not val and self.record_scatterings:
|
|
121
|
+
self._record_interactions -= 4
|
|
122
|
+
|
|
123
|
+
def _verify_consistency(self):
|
|
124
|
+
assert isinstance(self.active, bool) or self.active in [0, 1]
|
|
125
|
+
assert self._record_interactions in list(range(8))
|
|
126
|
+
|
|
79
127
|
def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
|
|
80
128
|
return InvalidXcoll(length=-self.length,
|
|
81
129
|
_context=_context, _buffer=_buffer, _offset=_offset)
|
|
@@ -119,8 +167,8 @@ class BaseCollimator(BaseBlock):
|
|
|
119
167
|
skip_in_loss_location_refinement = BaseBlock.skip_in_loss_location_refinement
|
|
120
168
|
allow_double_sided = True
|
|
121
169
|
|
|
122
|
-
_skip_in_to_dict = [f for f in _xofields if f.startswith('_')]
|
|
123
|
-
_store_in_to_dict = ['angle', 'jaw', 'tilt', 'gap', 'side', 'align', 'emittance']
|
|
170
|
+
_skip_in_to_dict = [*BaseBlock._skip_in_to_dict, *[f for f in _xofields if f.startswith('_')]]
|
|
171
|
+
_store_in_to_dict = [*BaseBlock._store_in_to_dict, 'angle', 'jaw', 'tilt', 'gap', 'side', 'align', 'emittance']
|
|
124
172
|
|
|
125
173
|
_depends_on = [BaseBlock]
|
|
126
174
|
|
|
@@ -203,9 +251,6 @@ class BaseCollimator(BaseBlock):
|
|
|
203
251
|
# Set others
|
|
204
252
|
to_assign['align'] = kwargs.pop('align', 'upstream')
|
|
205
253
|
to_assign['emittance'] = kwargs.pop('emittance', None)
|
|
206
|
-
kwargs.setdefault('active', True)
|
|
207
|
-
kwargs.setdefault('record_touches', False)
|
|
208
|
-
kwargs.setdefault('record_scatterings', False)
|
|
209
254
|
|
|
210
255
|
super().__init__(**kwargs)
|
|
211
256
|
# Careful: non-xofields are not passed correctly between copy's / to_dict. This messes with flags etc..
|
|
@@ -259,7 +304,7 @@ class BaseCollimator(BaseBlock):
|
|
|
259
304
|
|
|
260
305
|
@property
|
|
261
306
|
def angle_R(self):
|
|
262
|
-
return round(np.rad2deg(np.arctan2(self.
|
|
307
|
+
return round(np.rad2deg(np.arctan2(self._sin_zR, self._cos_zR)), 10)
|
|
263
308
|
|
|
264
309
|
@angle_R.setter
|
|
265
310
|
def angle_R(self, angle_R):
|
|
@@ -336,7 +381,7 @@ class BaseCollimator(BaseBlock):
|
|
|
336
381
|
diff = val - (self._jaw_LU + self._jaw_LD) / 2
|
|
337
382
|
self._jaw_LU += diff
|
|
338
383
|
self._jaw_LD += diff
|
|
339
|
-
self._update_gaps()
|
|
384
|
+
self._update_gaps(only_L=True)
|
|
340
385
|
|
|
341
386
|
@property
|
|
342
387
|
def jaw_R(self):
|
|
@@ -351,11 +396,11 @@ class BaseCollimator(BaseBlock):
|
|
|
351
396
|
print("Warning: Ignored value for jaw_R (left-sided collimator).")
|
|
352
397
|
if val is None:
|
|
353
398
|
val = -OPEN_JAW
|
|
354
|
-
self._gap_R = OPEN_GAP
|
|
399
|
+
self._gap_R = -OPEN_GAP
|
|
355
400
|
diff = val - (self._jaw_RU + self._jaw_RD) / 2
|
|
356
401
|
self._jaw_RU += diff
|
|
357
402
|
self._jaw_RD += diff
|
|
358
|
-
self._update_gaps()
|
|
403
|
+
self._update_gaps(only_R=True)
|
|
359
404
|
|
|
360
405
|
@property
|
|
361
406
|
def jaw_LU(self):
|
|
@@ -372,7 +417,7 @@ class BaseCollimator(BaseBlock):
|
|
|
372
417
|
raise ValueError("Cannot set corner to None! Use open_jaws() or set jaw_L to None.")
|
|
373
418
|
self._jaw_LU = val
|
|
374
419
|
self._update_tilts() # Extra, to update tilts which are also in C for efficiency
|
|
375
|
-
self._update_gaps()
|
|
420
|
+
self._update_gaps(only_L=True)
|
|
376
421
|
|
|
377
422
|
@property
|
|
378
423
|
def jaw_LD(self):
|
|
@@ -389,7 +434,7 @@ class BaseCollimator(BaseBlock):
|
|
|
389
434
|
raise ValueError("Cannot set corner to None! Use open_jaws() or set jaw_L to None.")
|
|
390
435
|
self._jaw_LD = val
|
|
391
436
|
self._update_tilts() # Extra, to update tilts which are also in C for efficiency
|
|
392
|
-
self._update_gaps()
|
|
437
|
+
self._update_gaps(only_L=True)
|
|
393
438
|
|
|
394
439
|
@property
|
|
395
440
|
def jaw_RU(self):
|
|
@@ -406,7 +451,7 @@ class BaseCollimator(BaseBlock):
|
|
|
406
451
|
raise ValueError("Cannot set corner to None! Use open_jaws() or set jaw_R to None.")
|
|
407
452
|
self._jaw_RU = val
|
|
408
453
|
self._update_tilts() # Extra, to update tilts which are also in C for efficiency
|
|
409
|
-
self._update_gaps()
|
|
454
|
+
self._update_gaps(only_R=True)
|
|
410
455
|
|
|
411
456
|
@property
|
|
412
457
|
def jaw_RD(self):
|
|
@@ -423,7 +468,23 @@ class BaseCollimator(BaseBlock):
|
|
|
423
468
|
raise ValueError("Cannot set corner to None! Use open_jaws() or set jaw_R to None.")
|
|
424
469
|
self._jaw_RD = val
|
|
425
470
|
self._update_tilts() # Extra, to update tilts which are also in C for efficiency
|
|
426
|
-
self._update_gaps()
|
|
471
|
+
self._update_gaps(only_R=True)
|
|
472
|
+
|
|
473
|
+
@property
|
|
474
|
+
def jaw_s_LU(self):
|
|
475
|
+
return self.length/2 * (1 - self._cos_yL)
|
|
476
|
+
|
|
477
|
+
@property
|
|
478
|
+
def jaw_s_LD(self):
|
|
479
|
+
return self.length/2 * (1 + self._cos_yL)
|
|
480
|
+
|
|
481
|
+
@property
|
|
482
|
+
def jaw_s_RU(self):
|
|
483
|
+
return self.length/2 * (1 - self._cos_yR)
|
|
484
|
+
|
|
485
|
+
@property
|
|
486
|
+
def jaw_s_RD(self):
|
|
487
|
+
return self.length/2 * (1 + self._cos_yR)
|
|
427
488
|
|
|
428
489
|
def open_jaws(self, keep_tilts=False):
|
|
429
490
|
self.jaw_L = None
|
|
@@ -441,12 +502,12 @@ class BaseCollimator(BaseBlock):
|
|
|
441
502
|
self._cos_yR = np.sqrt(1 - self._sin_yR**2)
|
|
442
503
|
self._tan_yR = self._sin_yR / self._cos_yR
|
|
443
504
|
|
|
444
|
-
def _update_gaps(self):
|
|
505
|
+
def _update_gaps(self, only_L=False, only_R=False):
|
|
445
506
|
# If we had set a value for the gap manually, this needs to be updated
|
|
446
507
|
# as well after setting the jaw
|
|
447
|
-
if self._gap_L_set_manually():
|
|
508
|
+
if self._gap_L_set_manually() and not only_R:
|
|
448
509
|
self._gap_L = self.gap_L
|
|
449
|
-
if self._gap_R_set_manually():
|
|
510
|
+
if self._gap_R_set_manually() and not only_L:
|
|
450
511
|
self._gap_R = self.gap_R
|
|
451
512
|
|
|
452
513
|
|
|
@@ -536,8 +597,8 @@ class BaseCollimator(BaseBlock):
|
|
|
536
597
|
|
|
537
598
|
def assign_optics(self, *, nemitt_x=None, nemitt_y=None, beta_gamma_rel=None, name=None, twiss=None,
|
|
538
599
|
twiss_upstream=None, twiss_downstream=None):
|
|
539
|
-
from xcoll import
|
|
540
|
-
if not isinstance(self,
|
|
600
|
+
from xcoll.beam_elements import _all_collimator_classes
|
|
601
|
+
if not isinstance(self, _all_collimator_classes):
|
|
541
602
|
raise ValueError("Please install collimator before assigning optics.")
|
|
542
603
|
if nemitt_x is None:
|
|
543
604
|
if self.nemitt_x is None:
|
|
@@ -587,8 +648,8 @@ class BaseCollimator(BaseBlock):
|
|
|
587
648
|
@nemitt_x.setter
|
|
588
649
|
def nemitt_x(self, val):
|
|
589
650
|
if val is None:
|
|
590
|
-
|
|
591
|
-
|
|
651
|
+
val = 0
|
|
652
|
+
elif val <= 0:
|
|
592
653
|
raise ValueError(f"The field `nemitt_x` should be positive, but got {val}.")
|
|
593
654
|
self._nemitt_x = val
|
|
594
655
|
self._apply_optics()
|
|
@@ -602,12 +663,11 @@ class BaseCollimator(BaseBlock):
|
|
|
602
663
|
@nemitt_y.setter
|
|
603
664
|
def nemitt_y(self, val):
|
|
604
665
|
if val is None:
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
self._apply_optics()
|
|
666
|
+
val = 0
|
|
667
|
+
elif val <= 0:
|
|
668
|
+
raise ValueError(f"The field `nemitt_y` should be positive, but got {val}.")
|
|
669
|
+
self._nemitt_y = val
|
|
670
|
+
self._apply_optics()
|
|
611
671
|
|
|
612
672
|
@property
|
|
613
673
|
def emittance(self):
|
|
@@ -645,7 +705,7 @@ class BaseCollimator(BaseBlock):
|
|
|
645
705
|
sigma_L = np.sqrt((sigma_x*self._cos_zL)**2 + (sigma_y*self._sin_zL)**2)
|
|
646
706
|
sigma_R = np.sqrt((sigma_x*self._cos_zR)**2 + (sigma_y*self._sin_zR)**2)
|
|
647
707
|
return [sigma_L, sigma_R], [sigma_x, sigma_y]
|
|
648
|
-
else:
|
|
708
|
+
else: # crystal
|
|
649
709
|
sigma = np.sqrt((sigma_x*self._cos_z)**2 + (sigma_y*self._sin_z)**2)
|
|
650
710
|
return sigma, [sigma_x, sigma_y]
|
|
651
711
|
|
|
@@ -658,7 +718,7 @@ class BaseCollimator(BaseBlock):
|
|
|
658
718
|
co_L = x*self._cos_zL + y*self._sin_zL
|
|
659
719
|
co_R = x*self._cos_zR + y*self._sin_zR
|
|
660
720
|
return [co_L, co_R], [x, y]
|
|
661
|
-
else:
|
|
721
|
+
else: # crystal
|
|
662
722
|
co = x*self._cos_z + y*self._sin_z
|
|
663
723
|
return co, [x, y]
|
|
664
724
|
|
|
@@ -755,10 +815,10 @@ class BaseCollimator(BaseBlock):
|
|
|
755
815
|
if val is None:
|
|
756
816
|
val = OPEN_GAP
|
|
757
817
|
self.jaw_L = None
|
|
758
|
-
|
|
818
|
+
elif val <= 0:
|
|
759
819
|
raise ValueError(f"The field `gap_L` should be positive, but got {val}.")
|
|
760
820
|
self._gap_L = val
|
|
761
|
-
self._apply_optics()
|
|
821
|
+
self._apply_optics(only_L=True)
|
|
762
822
|
|
|
763
823
|
@property
|
|
764
824
|
def gap_R(self):
|
|
@@ -775,10 +835,10 @@ class BaseCollimator(BaseBlock):
|
|
|
775
835
|
if val is None:
|
|
776
836
|
val = -OPEN_GAP
|
|
777
837
|
self.jaw_R = None
|
|
778
|
-
|
|
838
|
+
elif val >= 0:
|
|
779
839
|
raise ValueError(f"The field `gap_R` should be negative, but got {val}.")
|
|
780
840
|
self._gap_R = val
|
|
781
|
-
self._apply_optics()
|
|
841
|
+
self._apply_optics(only_R=True)
|
|
782
842
|
|
|
783
843
|
@property
|
|
784
844
|
def gap_LU(self):
|
|
@@ -806,12 +866,12 @@ class BaseCollimator(BaseBlock):
|
|
|
806
866
|
def _gap_R_set_manually(self):
|
|
807
867
|
return not np.isclose(self._gap_R, -OPEN_GAP)
|
|
808
868
|
|
|
809
|
-
def _apply_optics(self):
|
|
869
|
+
def _apply_optics(self, only_L=False, only_R=False):
|
|
810
870
|
if self.optics_ready():
|
|
811
871
|
# Only if we have set a value for the gap manually, this needs to be updated
|
|
812
|
-
if self._gap_L_set_manually():
|
|
872
|
+
if self._gap_L_set_manually() and not only_R:
|
|
813
873
|
self.jaw_L = self._gap_L * self.sigma[0][0] + self.co[0][0]
|
|
814
|
-
if self._gap_R_set_manually():
|
|
874
|
+
if self._gap_R_set_manually() and not only_L:
|
|
815
875
|
self.jaw_R = self._gap_R * self.sigma[0][1] + self.co[0][1]
|
|
816
876
|
|
|
817
877
|
|
|
@@ -862,17 +922,8 @@ class BaseCollimator(BaseBlock):
|
|
|
862
922
|
# Methods
|
|
863
923
|
# =======
|
|
864
924
|
|
|
865
|
-
def enable_scattering(self):
|
|
866
|
-
if hasattr(self, '_tracking'):
|
|
867
|
-
if self.optics is None:
|
|
868
|
-
raise ValueError("Optics not assigned! Cannot enable scattering.")
|
|
869
|
-
self._tracking = True
|
|
870
|
-
|
|
871
|
-
def disable_scattering(self):
|
|
872
|
-
if hasattr(self, '_tracking'):
|
|
873
|
-
self._tracking = False
|
|
874
|
-
|
|
875
925
|
def _verify_consistency(self):
|
|
926
|
+
BaseBlock._verify_consistency(self)
|
|
876
927
|
# Verify angles
|
|
877
928
|
if abs(self.angle_L - self.angle_R) >= 90.:
|
|
878
929
|
raise ValueError("Angles of both jaws differ more than 90 degrees!")
|
|
@@ -908,9 +959,6 @@ class BaseCollimator(BaseBlock):
|
|
|
908
959
|
# Verify bools
|
|
909
960
|
assert self._side in [-1, 1, 0]
|
|
910
961
|
assert isinstance(self._jaws_parallel, bool) or self._jaws_parallel in [0, 1]
|
|
911
|
-
assert isinstance(self.active, bool) or self.active in [0, 1]
|
|
912
|
-
assert isinstance(self.record_touches, bool) or self.record_touches in [0, 1]
|
|
913
|
-
assert isinstance(self.record_scatterings, bool) or self.record_scatterings in [0, 1]
|
|
914
962
|
|
|
915
963
|
def jaw_func(self, pos):
|
|
916
964
|
positions = ['LU', 'RU', 'LD', 'RD']
|
|
@@ -964,8 +1012,8 @@ class BaseCrystal(BaseBlock):
|
|
|
964
1012
|
skip_in_loss_location_refinement = BaseBlock.skip_in_loss_location_refinement
|
|
965
1013
|
allow_double_sided = False
|
|
966
1014
|
|
|
967
|
-
_skip_in_to_dict = [f for f in _xofields if f.startswith('_')]
|
|
968
|
-
_store_in_to_dict = ['angle', 'jaw', 'tilt', 'gap', 'side', 'align', 'emittance',
|
|
1015
|
+
_skip_in_to_dict = [*BaseBlock._skip_in_to_dict, *[f for f in _xofields if f.startswith('_')]]
|
|
1016
|
+
_store_in_to_dict = [*BaseBlock._store_in_to_dict, 'angle', 'jaw', 'tilt', 'gap', 'side', 'align', 'emittance',
|
|
969
1017
|
'bending_radius', 'bending_angle']
|
|
970
1018
|
|
|
971
1019
|
_depends_on = [BaseCollimator]
|
|
@@ -1026,8 +1074,6 @@ class BaseCrystal(BaseBlock):
|
|
|
1026
1074
|
to_assign['align'] = kwargs.pop('align', 'upstream')
|
|
1027
1075
|
to_assign['emittance'] = kwargs.pop('emittance', None)
|
|
1028
1076
|
kwargs.setdefault('active', True)
|
|
1029
|
-
kwargs.setdefault('record_touches', False)
|
|
1030
|
-
kwargs.setdefault('record_scatterings', False)
|
|
1031
1077
|
|
|
1032
1078
|
# Set crystal specific
|
|
1033
1079
|
if 'bending_angle' in kwargs:
|
|
@@ -1299,13 +1345,8 @@ class BaseCrystal(BaseBlock):
|
|
|
1299
1345
|
# Methods
|
|
1300
1346
|
# =======
|
|
1301
1347
|
|
|
1302
|
-
def enable_scattering(self):
|
|
1303
|
-
BaseCollimator.enable_scattering(self)
|
|
1304
|
-
|
|
1305
|
-
def disable_scattering(self):
|
|
1306
|
-
BaseCollimator.disable_scattering(self)
|
|
1307
|
-
|
|
1308
1348
|
def _verify_consistency(self):
|
|
1349
|
+
BaseBlock._verify_consistency(self)
|
|
1309
1350
|
# Verify angles
|
|
1310
1351
|
ang = abs(np.arccos(self._cos_z))
|
|
1311
1352
|
ang = np.pi - ang if ang > np.pi/2 else ang
|
|
@@ -1315,10 +1356,7 @@ class BaseCrystal(BaseBlock):
|
|
|
1315
1356
|
assert np.isclose(ang, abs(np.arcsin(self._sin_y)))
|
|
1316
1357
|
assert np.isclose(self._sin_y/self._cos_y, self._tan_y)
|
|
1317
1358
|
# Verify bools
|
|
1318
|
-
assert self._side in [-1, 1
|
|
1319
|
-
assert isinstance(self.active, bool) or self.active in [0, 1]
|
|
1320
|
-
assert isinstance(self.record_touches, bool) or self.record_touches in [0, 1]
|
|
1321
|
-
assert isinstance(self.record_scatterings, bool) or self.record_scatterings in [0, 1]
|
|
1359
|
+
assert self._side in [-1, 1]
|
|
1322
1360
|
# Crystal specific
|
|
1323
1361
|
assert np.isclose(self._bending_angle, np.arcsin(self.length/self._bending_radius))
|
|
1324
1362
|
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xcoll Package. #
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
import xobjects as xo
|
|
9
|
+
import xtrack as xt
|
|
10
|
+
|
|
11
|
+
from ..general import _pkg_root
|
|
12
|
+
from .base import InvalidXcoll
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BlowUp(InvalidXcoll):
|
|
16
|
+
_xofields = {
|
|
17
|
+
'_plane': xo.Int8,
|
|
18
|
+
'start_at_turn': xo.Int64,
|
|
19
|
+
'stop_at_turn': xo.Int64,
|
|
20
|
+
'use_individual_kicks': xo.Int8,
|
|
21
|
+
'_max_kick': xo.Float64,
|
|
22
|
+
'_rans': xo.Float64[:],
|
|
23
|
+
'_calibration': xo.Float64,
|
|
24
|
+
'_active': xo.Int8,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
isthick = False
|
|
28
|
+
behaves_like_drift = False
|
|
29
|
+
allow_track = True
|
|
30
|
+
needs_rng = True
|
|
31
|
+
skip_in_loss_location_refinement = True
|
|
32
|
+
allow_loss_refinement = False
|
|
33
|
+
|
|
34
|
+
_skip_in_to_dict = ['_max_kick', '_plane', '_calibration', '_active']
|
|
35
|
+
_store_in_to_dict = ['amplitude', 'plane', 'calibration']
|
|
36
|
+
|
|
37
|
+
_depends_on = [InvalidXcoll, xt.RandomUniform]
|
|
38
|
+
|
|
39
|
+
_extra_c_sources = [
|
|
40
|
+
_pkg_root.joinpath('beam_elements','elements_src','blowup.h')
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
def __init__(self, **kwargs):
|
|
44
|
+
to_assign = {}
|
|
45
|
+
if '_xobject' not in kwargs:
|
|
46
|
+
start_at_turn = int(kwargs.get('start_at_turn', 0))
|
|
47
|
+
stop_at_turn = int(kwargs.get('stop_at_turn', start_at_turn+1))
|
|
48
|
+
kwargs['start_at_turn'] = start_at_turn
|
|
49
|
+
kwargs['stop_at_turn'] = stop_at_turn
|
|
50
|
+
kwargs['_rans'] = 2*np.random.uniform(size=stop_at_turn-start_at_turn) - 1
|
|
51
|
+
if 'plane' in kwargs:
|
|
52
|
+
to_assign['plane'] = kwargs.pop('plane')
|
|
53
|
+
to_assign['calibration'] = kwargs.pop('calibration', 1.)
|
|
54
|
+
to_assign['amplitude'] = kwargs.pop('amplitude', 1)
|
|
55
|
+
kwargs['_calibration'] = 1.
|
|
56
|
+
super().__init__(**kwargs)
|
|
57
|
+
for key, val in to_assign.items():
|
|
58
|
+
setattr(self, key, val)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def install(cls, line, name, *, at_s=None, at=None, need_apertures=True, aperture=None, s_tol=1.e-6, **kwargs):
|
|
63
|
+
self = cls(**kwargs)
|
|
64
|
+
line.insert_element(element=self, name=name, at_s=at_s, at=at, s_tol=s_tol)
|
|
65
|
+
self._name = name
|
|
66
|
+
self._line = line
|
|
67
|
+
if need_apertures:
|
|
68
|
+
if aperture is not None:
|
|
69
|
+
aper_upstream = aperture.copy()
|
|
70
|
+
aper_downstream = aperture.copy()
|
|
71
|
+
else:
|
|
72
|
+
idx = line.element_names.index(name)
|
|
73
|
+
while True:
|
|
74
|
+
if xt.line._is_aperture(line.elements[idx], line):
|
|
75
|
+
aper_upstream = line.elements[idx].copy()
|
|
76
|
+
break
|
|
77
|
+
idx -= 1
|
|
78
|
+
idx = line.element_names.index(name)
|
|
79
|
+
while True:
|
|
80
|
+
if xt.line._is_aperture(line.elements[idx], line):
|
|
81
|
+
aper_downstream = line.elements[idx].copy()
|
|
82
|
+
break
|
|
83
|
+
idx += 1
|
|
84
|
+
line.insert_element(element=aper_upstream, name=f'{name}_aper_upstream', at=name, s_tol=s_tol)
|
|
85
|
+
idx = line.element_names.index(name) + 1
|
|
86
|
+
line.insert_element(element=aper_downstream, name=f'{name}_aper_downstream', at=idx, s_tol=s_tol)
|
|
87
|
+
return self
|
|
88
|
+
|
|
89
|
+
def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
|
|
90
|
+
return xt.Marker(_context=_context, _buffer=_buffer, _offset=_offset)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def plane(self):
|
|
95
|
+
if self._plane == 1:
|
|
96
|
+
return 'H'
|
|
97
|
+
elif self._plane == -1:
|
|
98
|
+
return 'V'
|
|
99
|
+
else:
|
|
100
|
+
raise ValueError("The plane of the BlowUp is not recognized.")
|
|
101
|
+
|
|
102
|
+
@plane.setter
|
|
103
|
+
def plane(self, val):
|
|
104
|
+
if val.lower() == 'h':
|
|
105
|
+
self._plane = 1
|
|
106
|
+
elif val.lower() == 'v':
|
|
107
|
+
self._plane = -1
|
|
108
|
+
else:
|
|
109
|
+
raise ValueError("The plane of the BlowUp must be either 'H' or 'V'.")
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def amplitude(self):
|
|
113
|
+
return (self._max_kick / self.calibration)**2
|
|
114
|
+
|
|
115
|
+
@amplitude.setter
|
|
116
|
+
def amplitude(self, val):
|
|
117
|
+
if val< 0:
|
|
118
|
+
raise ValueError("The amplitude cannot be negative!")
|
|
119
|
+
self._max_kick = np.sqrt(val) * self.calibration
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def calibration(self):
|
|
123
|
+
return self._calibration
|
|
124
|
+
|
|
125
|
+
@calibration.setter
|
|
126
|
+
def calibration(self, val):
|
|
127
|
+
if val< 0:
|
|
128
|
+
raise ValueError("The calibration cannot be negative!")
|
|
129
|
+
previous_amplitude = self.amplitude
|
|
130
|
+
self._calibration = val
|
|
131
|
+
self.amplitude = previous_amplitude
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def name(self):
|
|
135
|
+
if not hasattr(self, '_name'):
|
|
136
|
+
raise ValueError("Name not set! Install the blow-up using xc.BlowUp.install() "
|
|
137
|
+
"or manually set the name after installation.")
|
|
138
|
+
return self._name
|
|
139
|
+
|
|
140
|
+
@name.setter
|
|
141
|
+
def name(self, val):
|
|
142
|
+
self._name = val
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
def line(self):
|
|
146
|
+
if not hasattr(self, '_line'):
|
|
147
|
+
raise ValueError("Line not set! Install the blow-up using xc.BlowUp.install() "
|
|
148
|
+
"or manually set the line after installation.")
|
|
149
|
+
return self._line
|
|
150
|
+
|
|
151
|
+
@line.setter
|
|
152
|
+
def line(self, val):
|
|
153
|
+
self._line = val
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def calibrate_by_emittance(self, nemitt, *, twiss=None, beta_gamma_rel=None):
|
|
157
|
+
# The emittance gained per turn of blow up can be calculated as follows:
|
|
158
|
+
# <px^2> = gamma * eps
|
|
159
|
+
# gamma * eps = <px^2> = <(px0 + dpx)^2>
|
|
160
|
+
# where px0 is the initial momentum and dpx is the kick, and eps0 and eps
|
|
161
|
+
# are the geometric emittance before resp. after the kick, and gamma is the
|
|
162
|
+
# Courant-Snyder parameter.
|
|
163
|
+
# If each particle gets another random kick, we can write:
|
|
164
|
+
# <(px0 + dpx)^2> = <px0^2> + 2<px0 dpx> + <dpx^2>
|
|
165
|
+
# = gamma * eps0 + 2<px0 dpx> + 1/3 dpx_max^2 (variance of uniform distribution is 1/12(b-a)^2)
|
|
166
|
+
# The covariance can be estimated with an upper bound:
|
|
167
|
+
# 0 <= 2<px0 dpx> <= 2*sqrt(<px0^2> <dpx^2>)
|
|
168
|
+
# = 2/sqrt(3) * sqrt(gamma * eps0) * dpx_max
|
|
169
|
+
# So that we finally get for the emittance growth after one turn of blow-up:
|
|
170
|
+
# deps = (eps-eps0)/eps0 = [dPM^2, dPM^2 + 2dPM] (dPM = dpx_max/sqrt(3 * gamma * eps0))
|
|
171
|
+
# Or, to get an emittance growth of deps, we need:
|
|
172
|
+
# dpx_max = [sqrt(3* gamma * eps0 * deps), sqrt(3 * gamma * eps0)*(sqrt(1+deps) -1)]
|
|
173
|
+
# If all particles get the same kick, we can write:
|
|
174
|
+
# <(px0 + dpx)^2> = <px0^2> + 2<px0> dpx
|
|
175
|
+
# However, now things get a bit more complicated. At the start <px0> is the closed orbit,
|
|
176
|
+
# but when the bunch has had a kick in the previous turn, the bunch is no longer centred
|
|
177
|
+
# around the closed orbit. We can write:
|
|
178
|
+
# deps = (eps-eps0)/eps0 = 2<px0> dpx/gamma/eps0
|
|
179
|
+
name = self.name
|
|
180
|
+
line = self.line
|
|
181
|
+
if beta_gamma_rel is None:
|
|
182
|
+
if not hasattr(line, 'particle_ref'):
|
|
183
|
+
raise ValueError("The provided line has no reference particle. Use the argument `beta_gamma_rel`")
|
|
184
|
+
beta_gamma_rel = line.particle_ref.gamma0[0]*line.particle_ref.beta0[0]
|
|
185
|
+
if twiss is None:
|
|
186
|
+
twiss = line.twiss()
|
|
187
|
+
gamma = twiss.rows[name][f"gam{'x' if self.plane == 'H' else 'y'}"][0]
|
|
188
|
+
# Asumming a Gaussian beam, we will have shifted all beam beyond 5 sigma with an emittance growth
|
|
189
|
+
# of around a factor 60. In practive, a ~50x increase is enough due to the covariance terms.
|
|
190
|
+
# We want to do this slowly, over 1000 turns.
|
|
191
|
+
deps = 50/1000
|
|
192
|
+
self.calibration = np.sqrt(3*gamma*nemitt/beta_gamma_rel*deps)
|
|
193
|
+
|
|
194
|
+
def activate(self):
|
|
195
|
+
self._active = True
|
|
196
|
+
|
|
197
|
+
def deactivate(self):
|
|
198
|
+
self._active = False
|
|
@@ -7,6 +7,22 @@
|
|
|
7
7
|
#define XCOLL_ABSORBER_H
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
/*gpufun*/
|
|
11
|
+
int8_t BlackAbsorberData_get_record_impacts(BlackAbsorberData el){
|
|
12
|
+
return BlackAbsorberData_get__record_interactions(el) % 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*gpufun*/
|
|
16
|
+
int8_t BlackAbsorberData_get_record_exits(BlackAbsorberData el){
|
|
17
|
+
return (BlackAbsorberData_get__record_interactions(el) >> 1) % 2;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*gpufun*/
|
|
21
|
+
int8_t BlackAbsorberData_get_record_scatterings(BlackAbsorberData el){
|
|
22
|
+
return (BlackAbsorberData_get__record_interactions(el) >> 2) % 2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
10
26
|
/*gpufun*/
|
|
11
27
|
CollimatorGeometry BlackAbsorber_init_geometry(BlackAbsorberData el, LocalParticle* part0, int8_t active){
|
|
12
28
|
CollimatorGeometry cg = (CollimatorGeometry) malloc(sizeof(CollimatorGeometry_));
|
|
@@ -46,10 +62,12 @@ CollimatorGeometry BlackAbsorber_init_geometry(BlackAbsorberData el, LocalPartic
|
|
|
46
62
|
// Impact table
|
|
47
63
|
cg->record = BlackAbsorberData_getp_internal_record(el, part0);
|
|
48
64
|
cg->record_index = NULL;
|
|
49
|
-
cg->
|
|
65
|
+
cg->record_impacts = 0;
|
|
66
|
+
cg->record_exits = 0;
|
|
50
67
|
if (cg->record){
|
|
51
68
|
cg->record_index = InteractionRecordData_getp__index(cg->record);
|
|
52
|
-
cg->
|
|
69
|
+
cg->record_impacts = BlackAbsorberData_get_record_impacts(el);
|
|
70
|
+
cg->record_exits = BlackAbsorberData_get_record_exits(el);
|
|
53
71
|
}
|
|
54
72
|
}
|
|
55
73
|
|
|
@@ -115,4 +133,4 @@ void BlackAbsorber_track_local_particle(BlackAbsorberData el, LocalParticle* par
|
|
|
115
133
|
BlackAbsorber_free(cg, active);
|
|
116
134
|
}
|
|
117
135
|
|
|
118
|
-
#endif /*
|
|
136
|
+
#endif /* XCOLL_ABSORBER_H */
|