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.

Files changed (324) hide show
  1. xcoll/__init__.py +2 -1
  2. xcoll/beam_elements/__init__.py +7 -1
  3. xcoll/beam_elements/absorber.py +2 -2
  4. xcoll/beam_elements/base.py +105 -67
  5. xcoll/beam_elements/blowup.py +198 -0
  6. xcoll/beam_elements/{collimators_src → elements_src}/black_absorber.h +21 -3
  7. xcoll/beam_elements/{collimators_src → elements_src}/black_crystal.h +20 -2
  8. xcoll/beam_elements/elements_src/blowup.h +42 -0
  9. xcoll/beam_elements/elements_src/emittance_monitor.h +109 -0
  10. xcoll/beam_elements/{collimators_src → elements_src}/everest_block.h +19 -2
  11. xcoll/beam_elements/{collimators_src → elements_src}/everest_collimator.h +19 -3
  12. xcoll/beam_elements/{collimators_src → elements_src}/everest_crystal.h +30 -9
  13. xcoll/beam_elements/everest.py +5 -6
  14. xcoll/beam_elements/monitor.py +428 -0
  15. xcoll/colldb.py +103 -74
  16. xcoll/general.py +4 -4
  17. xcoll/initial_distribution.py +18 -6
  18. xcoll/install.py +3 -1
  19. xcoll/interaction_record/interaction_record.py +126 -80
  20. xcoll/interaction_record/interaction_record_src/interaction_record.h +43 -43
  21. xcoll/line_tools.py +8 -9
  22. xcoll/lossmap.py +48 -38
  23. xcoll/scattering_routines/everest/amorphous.h +4 -11
  24. xcoll/scattering_routines/everest/channeling.h +3 -8
  25. xcoll/scattering_routines/everest/everest.h +4 -1
  26. xcoll/scattering_routines/everest/jaw.h +4 -3
  27. xcoll/scattering_routines/everest/materials.py +35 -15
  28. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
  29. xcoll/scattering_routines/everest/nuclear_interaction.h +1 -1
  30. xcoll/scattering_routines/everest/properties.h +6 -1
  31. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  32. xcoll/scattering_routines/geant4/collimasim/.git +1 -0
  33. xcoll/scattering_routines/geant4/collimasim/.gitignore +12 -0
  34. xcoll/scattering_routines/geant4/collimasim/.gitmodules +3 -0
  35. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +26 -0
  36. xcoll/scattering_routines/geant4/collimasim/README.md +21 -0
  37. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +20 -0
  38. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +35 -0
  39. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +10 -0
  40. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +59 -0
  41. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +26 -0
  42. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +37 -0
  43. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +19 -0
  44. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +65 -0
  45. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +73 -0
  46. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +1 -0
  47. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +9 -0
  48. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +386 -0
  49. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +45 -0
  50. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
  51. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +16 -0
  52. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +8 -0
  53. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +3 -0
  54. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +19 -0
  55. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +969 -0
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +84 -0
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +48 -0
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +16 -0
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +103 -0
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +45 -0
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +151 -0
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +3 -0
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +297 -0
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +29 -0
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +6 -0
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +180 -0
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +23 -0
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +192 -0
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +11 -0
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +81 -0
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +93 -0
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +310 -0
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +109 -0
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +43 -0
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +171 -0
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +251 -0
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +305 -0
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +1297 -0
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +262 -0
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +396 -0
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +568 -0
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +337 -0
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +13 -0
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +463 -0
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +286 -0
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +174 -0
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +308 -0
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +91 -0
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +95 -0
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +2050 -0
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +542 -0
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +8 -0
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +648 -0
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +381 -0
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +343 -0
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +48 -0
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +105 -0
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +72 -0
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +130 -0
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +96 -0
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +8 -0
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +548 -0
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +605 -0
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +144 -0
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +1432 -0
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +213 -0
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +2 -0
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +65 -0
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +709 -0
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +1021 -0
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +104 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +346 -0
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +467 -0
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +978 -0
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +55 -0
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +606 -0
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +284 -0
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +163 -0
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +121 -0
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +193 -0
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +275 -0
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +1741 -0
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +163 -0
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +65 -0
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +2497 -0
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +1879 -0
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +103 -0
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +375 -0
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +747 -0
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +88 -0
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +11 -0
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +52 -0
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +12 -0
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +6 -0
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +21 -0
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +482 -0
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +63 -0
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +41 -0
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +56 -0
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +155 -0
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +503 -0
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +208 -0
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +275 -0
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +73 -0
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +33 -0
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +279 -0
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +143 -0
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +85 -0
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +179 -0
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +151 -0
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +91 -0
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +85 -0
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +19 -0
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +12 -0
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +26 -0
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +25 -0
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +216 -0
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +163 -0
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +286 -0
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +536 -0
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +107 -0
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +248 -0
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +227 -0
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +202 -0
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +84 -0
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +210 -0
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +550 -0
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +473 -0
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +84 -0
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +21 -0
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +6 -0
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +41 -0
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +35 -0
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +41 -0
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +10 -0
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +165 -0
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +53 -0
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +238 -0
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +126 -0
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +141 -0
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +117 -0
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +41 -0
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +50 -0
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +69 -0
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +42 -0
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +348 -0
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +771 -0
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +47 -0
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +22 -0
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +23 -0
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +326 -0
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +15 -0
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +148 -0
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +272 -0
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +119 -0
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +51 -0
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +5 -0
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +285 -0
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +12 -0
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +265 -0
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +397 -0
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +520 -0
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +49 -0
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +94 -0
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +125 -0
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +331 -0
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +153 -0
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +284 -0
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +107 -0
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +257 -0
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +412 -0
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +517 -0
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +102 -0
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +92 -0
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +233 -0
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +360 -0
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +472 -0
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +593 -0
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +524 -0
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +441 -0
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +103 -0
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +267 -0
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +73 -0
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +59 -0
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +235 -0
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +146 -0
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +189 -0
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +82 -0
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +560 -0
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +651 -0
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +500 -0
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +253 -0
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +452 -0
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +318 -0
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +342 -0
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +291 -0
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +131 -0
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +318 -0
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +144 -0
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +29 -0
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +66 -0
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +44 -0
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +22 -0
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +9 -0
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +510 -0
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +408 -0
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +117 -0
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +70 -0
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +86 -0
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +257 -0
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +44 -0
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +23 -0
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +39 -0
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +64 -0
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +402 -0
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +233 -0
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +276 -0
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +214 -0
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +3 -0
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +65 -0
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +41 -0
  275. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +8 -0
  276. xcoll/scattering_routines/geant4/collimasim/setup.py +144 -0
  277. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +403 -0
  278. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +100 -0
  279. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +763 -0
  280. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +118 -0
  281. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +8 -0
  282. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +63 -0
  283. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +142 -0
  284. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +556 -0
  285. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +6 -0
  286. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +24 -0
  287. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +1 -0
  288. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +1 -0
  289. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +1 -0
  290. xcoll/scattering_routines/geant4/collimasim/tests/README.md +25 -0
  291. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +25 -0
  292. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +18 -0
  293. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +68 -0
  294. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +15 -0
  295. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +110 -0
  296. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +7 -0
  297. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +3 -0
  298. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +54 -0
  299. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +3 -0
  300. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +3 -0
  301. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +5 -0
  302. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +51 -0
  303. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +65 -0
  304. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +59 -0
  305. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +102 -0
  306. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +75 -0
  307. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +74 -0
  308. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +84 -0
  309. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +159 -0
  310. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +99 -0
  311. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +78 -0
  312. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +88 -0
  313. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +80 -0
  314. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +97 -0
  315. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +96 -0
  316. xcoll/scattering_routines/geometry/collimator_geometry.h +9 -10
  317. xcoll/scattering_routines/geometry/crystal_geometry.h +9 -6
  318. {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/METADATA +1 -1
  319. xcoll-0.5.0.dist-info/RECORD +413 -0
  320. xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
  321. xcoll-0.4.0.dist-info/RECORD +0 -126
  322. {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/LICENSE +0 -0
  323. {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/NOTICE +0 -0
  324. {xcoll-0.4.0.dist-info → xcoll-0.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,68 @@
1
+ # Database for cleaning insertion collimators. Prepared: 23 Jun 2021
2
+ 6
3
+
4
+ #
5
+ TCP.A.B1
6
+ tcp.a.b1
7
+ 10
8
+ C
9
+ 0.6
10
+ 0
11
+ 0.0000000000000000
12
+ 647.6350305671534
13
+ 53.02571504616053
14
+
15
+ #
16
+ TCP.B.B1
17
+ tcp.b.b1
18
+ 80
19
+ C
20
+ 0.6
21
+ 1.5707963267948966
22
+ 0.0000000000000000
23
+ 603.3821034080673
24
+ 58.54786181209406
25
+
26
+ #
27
+ TCS.B1.B1
28
+ tcs.b1.b1
29
+ 89.5
30
+ C
31
+ 1.0
32
+ 1.5707963267948966
33
+ 0.0000000000000000
34
+ 290.63093200994945
35
+ 154.51051797015745
36
+
37
+ #
38
+ TCS.A1.B1
39
+ tcs.a1.b1
40
+ 11.5
41
+ C
42
+ 1.0
43
+ 0
44
+ 0.0000000000000000
45
+ 73.34173975049991
46
+ 390.8874328919145
47
+
48
+ #
49
+ TCS.A2.B1
50
+ tcs.a2.b1
51
+ 11.5
52
+ C
53
+ 1.0
54
+ 0
55
+ 0.0000000000000000
56
+ 465.66698081057984
57
+ 488.78492630379634
58
+
59
+ #
60
+ TCS.B2.B1
61
+ tcs.b2.b1
62
+ 89.5
63
+ C
64
+ 1.0
65
+ 1.5707963267948966
66
+ 0.0000000000000000
67
+ 1783.19687950021
68
+ 362.409353541563
@@ -0,0 +1,15 @@
1
+ # Automatically converted collimator DB from old format file 'CollDB_HL.data'
2
+ # Families
3
+ NSIG_FAM dummy 5.000000 PRIMARY
4
+ #
5
+ # Collimators
6
+ # name opening/fam mat. length[m] angle[deg] offset[m]
7
+ coll_open 90 W 10.00000 0.000000 0.000000
8
+ coll_skew dummy W 0.60000 45.000000 0.000000
9
+ coll_skew_tilted dummy W 0.60000 45.000000 0.000000
10
+ #
11
+
12
+ #ONESIDED dummy1 1
13
+ TILTED coll_skew_tilted 4 -9
14
+ # Additional Collimator Settings
15
+ SETTINGS
@@ -0,0 +1,110 @@
1
+ %YAML 1.2
2
+ ---
3
+ # Each collimator is a dictionary, with the following set of keys:
4
+ # required keys:
5
+ # gap [sigma], length [m], angle [deg], material [BE/AL/CU/W/PB/C/C2/Si/Ge/MoGR/CuCD/Mo/Glid/Iner/VA/BL], stage
6
+ # (a gap equal to 'null' disables the collimator from tracking)
7
+ # optional keys:
8
+ # offset [m], onesided [left/right], tilt [deg] (or tilt_left and tilt_right if different for each jaw)
9
+ # special keys:
10
+ # active [bool] : Whether or not a collimator is still active in operation. If false, the gap is set to null.
11
+ # The difference with just manually setting the gap to 'null' is mainly semantic: these are collimators that are in principle no longer used but still present in the machine.
12
+ # crystal [strip/quasi-mosaic] : Use when the collimator is a crystal of the specified type.
13
+ # It allows for some extra keys: bend [m], xdim [m], ydim [m], miscut [deg], thick [m] (the thickness of the amorphous layer)
14
+ #
15
+ # For ease of use, the collimators can be collected in families using standard YAML syntax.
16
+ # Each family contains the keys for which all members have the same value (though keys can be overwritten again in the individual collimators).
17
+ #
18
+ # YAML syntax refresher:
19
+ # - indentation matters (spaces, no tabs)
20
+ # - comments are preceded with #
21
+ # - lists are represented by one item per line preceded with a dash, or in inline format as [ , ... ]
22
+ # - dictoraries are represented by one "key : value" per line, or in inline format as { key : value , ... }
23
+ # - the & represents a unique name tag
24
+ # - the * dereferences the named element
25
+ # - the merge operator << merges the subsequent element with the surrounding container (giving higher priority to the other elements in the container than those in the merged element, as to allow overwriting)
26
+ Families:
27
+ # Momentum cleaning
28
+ - &TCP3 { gap: 15, stage: primary, material: C, length: 0.6 }
29
+ - &TCSG3 { gap: 18, stage: secondary, material: C, length: 1 }
30
+ - &TCLA3 { gap: 20, stage: tertiary, material: Iner, length: 1 }
31
+ # Betatron cleaning
32
+ - &TCP7 { gap: 5, stage: primary, material: C, length: 0.6 }
33
+ - &TCSG7 { gap: 6.5, stage: secondary, material: C, length: 1 }
34
+ - &TCLA7 { gap: 10, stage: tertiary, material: Iner, length: 1 }
35
+ - &CRY7 { gap: null, stage: special, material: Si, length: 0.004, onesided: left, crystal: strip }
36
+ # Injection protection
37
+ - &TCLI { gap: null, stage: tertiary, material: C, length: 1, angle: 90 }
38
+ - &TDI { gap: null, stage: tertiary, material: CU, length: 1.565, angle: 90 }
39
+ # Dump protection
40
+ - &TCDQ { gap: 7.3, stage: tertiary, material: C, length: 3, angle: 0, onesided: left }
41
+ - &TCSP { gap: 7.3, stage: secondary, material: C, length: 1, angle: 0 }
42
+ # Physics background minimalisation
43
+ - &TCT15 { gap: 8.5, stage: tertiary, material: Iner, length: 1 }
44
+ - &TCT2 { gap: 37, stage: tertiary, material: Iner, length: 1 }
45
+ - &TCT8 { gap: 15, stage: tertiary, material: Iner, length: 1 }
46
+ # Physics debris
47
+ - &TCL4 { gap: 17, stage: tertiary, material: CU, length: 1, angle: 0 }
48
+ - &TCL5 { gap: 42, stage: tertiary, material: CU, length: 1, angle: 0 }
49
+ - &TCL6 { gap: 20, stage: tertiary, material: Iner, length: 1, angle: 0 }
50
+ # Physics debris in ALICE (only for ions)
51
+ - &TCLD { gap: null, stage: tertiary, material: Iner, length: 0.6, angle: 0 }
52
+
53
+ Collimators:
54
+ tcl.4r1.b1: { <<: *TCL4 }
55
+ tcl.5r1.b1: { <<: *TCL5 }
56
+ tcl.6r1.b1: { <<: *TCL6 }
57
+ tctph.4l2.b1: { <<: *TCT2, angle: 0 }
58
+ tctpv.4l2.b1: { <<: *TCT2, angle: 90 }
59
+ tdisa.a4l2.b1: { <<: *TDI }
60
+ tdisb.a4l2.b1: { <<: *TDI }
61
+ tdisc.a4l2.b1: { <<: *TDI }
62
+ tclia.4r2: { <<: *TCLI }
63
+ tclib.6r2.b1: { <<: *TCLI }
64
+ tcld.a11r2.b1: { <<: *TCLD }
65
+ tcp.6l3.b1: { <<: *TCP3, angle: 0 }
66
+ tcsg.5l3.b1: { <<: *TCSG3, angle: 0 }
67
+ tcsg.4r3.b1: { <<: *TCSG3, angle: 0 }
68
+ tcsg.a5r3.b1: { <<: *TCSG3, angle: 170.7 }
69
+ tcsg.b5r3.b1: { <<: *TCSG3, angle: 10.8 }
70
+ tcla.a5r3.b1: { <<: *TCLA3, angle: 90 }
71
+ tcla.b5r3.b1: { <<: *TCLA3, angle: 0 }
72
+ tcla.6r3.b1: { <<: *TCLA3, angle: 0 }
73
+ tcla.7r3.b1: { <<: *TCLA3, angle: 0 }
74
+ tctph.4l5.b1: { <<: *TCT15, angle: 0 }
75
+ tctpv.4l5.b1: { <<: *TCT15, angle: 90 }
76
+ tcl.4r5.b1: { <<: *TCL4, }
77
+ tcl.5r5.b1: { <<: *TCL5, }
78
+ tcl.6r5.b1: { <<: *TCL6, }
79
+ tcdqa.a4r6.b1: { <<: *TCDQ }
80
+ tcdqa.c4r6.b1: { <<: *TCDQ }
81
+ tcdqa.b4r6.b1: { <<: *TCDQ }
82
+ tcsp.a4r6.b1: { <<: *TCSP }
83
+ tcp.d6l7.b1: { <<: *TCP7, angle: 90, material: MoGR }
84
+ tcp.c6l7.b1: { <<: *TCP7, angle: 0, material: MoGR }
85
+ tcp.b6l7.b1: { <<: *TCP7, angle: 127.5 }
86
+ tcsg.a6l7.b1: { <<: *TCSG7, angle: 141.1 }
87
+ tcpcv.a6l7.b1: { <<: *CRY7, angle: 90, bend: 85.10, xdim: 5.0e-3, ydim: 30.0e-3 }
88
+ tcsg.b5l7.b1: { <<: *TCSG7, angle: 143.5 }
89
+ tcsg.a5l7.b1: { <<: *TCSG7, angle: 40.7 }
90
+ tcsg.d4l7.b1: { <<: *TCSG7, angle: 90, material: MoGR }
91
+ tcpch.a4l7.b1: { <<: *CRY7, angle: 0, bend: 61.54, xdim: 2.0e-3, ydim: 50.0e-3 }
92
+ tcsg.b4l7.b1: { <<: *TCSG7, angle: 0, active: false }
93
+ tcspm.b4l7.b1: { <<: *TCSG7, angle: 0, material: MoGR }
94
+ tcsg.a4l7.b1: { <<: *TCSG7, angle: 134.6 }
95
+ tcsg.a4r7.b1: { <<: *TCSG7, angle: 46.3 }
96
+ tcsg.b5r7.b1: { <<: *TCSG7, angle: 141.5 }
97
+ tcsg.d5r7.b1: { <<: *TCSG7, angle: 51.4 }
98
+ tcsg.e5r7.b1: { <<: *TCSG7, angle: 130.5, active: false }
99
+ tcspm.e5r7.b1: { <<: *TCSG7, angle: 130.5, material: MoGR }
100
+ tcsg.6r7.b1: { <<: *TCSG7, angle: 0.5, active: false }
101
+ tcspm.6r7.b1: { <<: *TCSG7, angle: 0.5, material: MoGR }
102
+ tcla.a6r7.b1: { <<: *TCLA7, angle: 90 }
103
+ tcla.b6r7.b1: { <<: *TCLA7, angle: 0 }
104
+ tcla.c6r7.b1: { <<: *TCLA7, angle: 90 }
105
+ tcla.d6r7.b1: { <<: *TCLA7, angle: 0 }
106
+ tcla.a7r7.b1: { <<: *TCLA7, angle: 0 }
107
+ tctph.4l8.b1: { <<: *TCT8, angle: 0 }
108
+ tctpv.4l8.b1: { <<: *TCT8, angle: 90 }
109
+ tctph.4l1.b1: { <<: *TCT15, angle: 0 }
110
+ tctpv.4l1.b1: { <<: *TCT15, angle: 90 }
@@ -0,0 +1,7 @@
1
+ # ID name angle[rad] betax[m] betay[m] halfgap[m] Material Length[m] sigx[m] sigy[m] tilt1[rad] tilt2[rad] nsig
2
+ 1 TCP.A.B1 0.0000000000E+00 6.5281394752E+02 4.9010585945E+01 9.7627267068E-03 C 6.00000E-01 9.76273E-04 2.67499E-04 0.00000E+00 0.00000E+00 1.00000E+01
3
+ 2 TCP.B.B1 1.5707963268E+00 6.0822524919E+02 5.4577427992E+01 1.0064576620E-03 C 6.00000E-01 9.42342E-04 2.82282E-04 0.00000E+00 0.00000E+00 8.00000E+01
4
+ 3 TCS.B1.B1 1.5707963268E+00 2.9420397502E+02 1.5419706861E+02 1.8926054435E-03 C 1.00000E+00 6.55391E-04 4.74476E-04 0.00000E+00 0.00000E+00 8.95000E+01
5
+ 4 TCS.A1.B1 0.0000000000E+00 7.4276568013E+01 4.0505123230E+02 3.7870424602E-03 C 1.00000E+00 3.29308E-04 7.69009E-04 0.00000E+00 0.00000E+00 1.15000E+01
6
+ 5 TCS.A2.B1 0.0000000000E+00 4.6957457165E+02 4.6632571321E+02 9.5219642278E-03 C 1.00000E+00 8.27997E-04 8.25128E-04 0.00000E+00 0.00000E+00 1.15000E+01
7
+ 6 TCS.B2.B1 1.5707963268E+00 1.7829042624E+03 3.3656446316E+02 2.7961222487E-03 C 1.00000E+00 1.61339E-03 7.00988E-04 0.00000E+00 0.00000E+00 8.95000E+01
@@ -0,0 +1,3 @@
1
+ # ID name angle[rad] betax[m] betay[m] halfgap[m] Material Length[m] sigx[m] sigy[m] tilt1[rad] tilt2[rad] nsig
2
+ 1 DUMMY1 0.0000000000E+00 0.0000E+00 0.0000E+00 0.5 C 10 0.0000E_00 0.0000E00 0.00000E+00 0.00000E+00 0.00000E+00
3
+ 2 DUMMY2 0.0000000000E+00 0.0000E+00 0.0000E+00 0.5 C 10 0.0000E_00 0.0000E00 0.00000E+00 0.00000E+00 0.00000E+00
@@ -0,0 +1,54 @@
1
+ @ NAME %05s "TWISS"
2
+ @ TYPE %05s "TWISS"
3
+ @ SEQUENCE %04s "RING"
4
+ @ PARTICLE %08s "POSITRON"
5
+ @ MASS %le 0.000510998950000
6
+ @ CHARGE %le 1.000000000000000
7
+ @ ENERGY %le 182.500000000715403
8
+ @ PC %le 182.500000000000000
9
+ @ GAMMA %le 357143.591000950953458
10
+ @ KBUNCH %le 16640.000000000000000
11
+ @ BCURRENT %le 0.000083528805847
12
+ @ SIGE %le 0.001000000000000
13
+ @ SIGT %le 1.000000000000000
14
+ @ NPART %le 170000000000.000030517578125
15
+ @ EX %le 0.000000001460000
16
+ @ EY %le 0.000000000002900
17
+ @ ET %le 0.001000000000000
18
+ @ BV_FLAG %le 1.000000000000000
19
+ @ LENGTH %le 97756.072632636380149
20
+ @ ALFA %le 0.000007256715763
21
+ @ ORBIT5 %le -0.000000000000000
22
+ @ GAMMATR %le 371.218783908525609
23
+ @ Q1 %le 389.088569617840676
24
+ @ Q2 %le 390.213002389969859
25
+ @ DQ1 %le -1.845008895784288
26
+ @ DQ2 %le 1.533678430906169
27
+ @ DXMAX %le 0.544565677826365
28
+ @ DYMAX %le -0.000000000000000
29
+ @ XCOMAX %le 0.000000000000000
30
+ @ YCOMAX %le 0.000000000000000
31
+ @ BETXMAX %le 2039.398467490436815
32
+ @ BETYMAX %le 6519.403287053469285
33
+ @ XCORMS %le 0.000000000000000
34
+ @ YCORMS %le 0.000000000000000
35
+ @ DXRMS %le 0.123614301552443
36
+ @ DYRMS %le 0.000000000000000
37
+ @ DELTAP %le 0.000000000000000
38
+ @ SYNCH_1 %le 0.000000000000000
39
+ @ SYNCH_2 %le 0.000000000000000
40
+ @ SYNCH_3 %le 0.000000000000000
41
+ @ SYNCH_4 %le 0.000000000000000
42
+ @ SYNCH_5 %le 0.000000000000000
43
+ @ TITLE %08s "no-title"
44
+ @ ORIGIN %16s "5.07.00 Linux 64"
45
+ @ DATE %08s "23/06/21"
46
+ @ TIME %08s "16.08.47"
47
+ * NAME KEYWORD S L KS KSL K0L K1L K2L K3L K4L K1S K2S K3S K4S HKICK VKICK BETX BETY ALFX ALFY MUX MUY DX DY DPX DPY R11 R12 R22 R21 X PX Y PY T PT DELTAP VOLT LAG HARMON FREQ E1 E2 APERTYPE APER_1 APER_2 APER_3 APER_4 TILT ANGLE ASSEMBLY_ID MECH_SEP
48
+ $ %s %s %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %s %le %le %le %le %le %le %d %le
49
+ "TCP.A.B1" "COLLIMATOR" 42541.376398806176439 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 652.813947518136274 49.010585945401552 4.541691920251642 -0.493263766065989 173.086386348444279 173.850167284495114 0.023338170729623 0.000000000000000 0.000666633297901 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
50
+ "TCP.B.B1" "COLLIMATOR" 42546.376398806176439 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 608.225249188530825 54.577427992180525 4.376047745669433 -0.620104643289806 173.087649244941503 173.865577811466409 0.026671337219128 0.000000000000000 0.000666633297901 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
51
+ "TCS.B1.B1" "COLLIMATOR" 42589.196398806168872 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 294.203975019690972 154.197068613860750 2.957471034547644 -1.706369915834384 173.103787433333309 173.942868849018424 0.055216575035242 0.000000000000000 0.000666633297901 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
52
+ "TCS.A1.B1" "COLLIMATOR" 42641.986398806169746 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 74.276568013352502 405.051232303137340 1.208600064424512 -3.045555897563467 173.161906278398959 173.976742541729180 0.060001365420669 0.000000000000000 -0.000000035887419 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
53
+ "TCS.A2.B1" "COLLIMATOR" 42981.816398806171492 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 469.574571650545693 466.325713210186848 0.164867047878529 -1.845236100523997 173.504790441722747 174.220951873264738 0.069017034496271 0.000000000000000 -0.000506292509020 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
54
+ "TCS.B2.B1" "COLLIMATOR" 43287.656398806175275 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 1782.904262438686828 336.564463162150616 -6.796028267745501 2.699560767425571 173.588052793438322 174.285524754832295 -0.103874114678722 0.000000000000000 -0.000647935219349 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
@@ -0,0 +1,3 @@
1
+ beam, particle="e+", momentum=182.5*GeV;
2
+ !option, physicsList = "em";
3
+ option, physicsList = "g4FTFP_BERT";
@@ -0,0 +1,3 @@
1
+ beam, particle="e+", momentum=182.5*GeV;
2
+ option, physicsList = "em";
3
+ option, collimatorsAreInfiniteAbsorbers=1;
@@ -0,0 +1,5 @@
1
+ ! Dummy example - Pb208 at 450 Z GeV
2
+ beam, particle="ion 208 82", momentum=36900*GeV;
3
+ option, physicsList = "em decay muon hadronic_elastic ftfp_bert ion ion_elastic ion_em_dissociation";
4
+ option, minimumKineticEnergy=40*GeV;
5
+ option, physicsEnergyLimitHigh=600000;
@@ -0,0 +1,51 @@
1
+ @ NAME %05s "TWISS"
2
+ @ TYPE %05s "TWISS"
3
+ @ SEQUENCE %04s "RING"
4
+ @ PARTICLE %08s "POSITRON"
5
+ @ MASS %le 0.000510998950000
6
+ @ CHARGE %le 1.000000000000000
7
+ @ ENERGY %le 182.500000000715403
8
+ @ PC %le 182.500000000000000
9
+ @ GAMMA %le 357143.591000950953458
10
+ @ KBUNCH %le 16640.000000000000000
11
+ @ BCURRENT %le 0.000083528805847
12
+ @ SIGE %le 0.001000000000000
13
+ @ SIGT %le 1.000000000000000
14
+ @ NPART %le 170000000000.000030517578125
15
+ @ EX %le 0.000000001460000
16
+ @ EY %le 0.000000000002900
17
+ @ ET %le 0.001000000000000
18
+ @ BV_FLAG %le 1.000000000000000
19
+ @ LENGTH %le 97756.072632636380149
20
+ @ ALFA %le 0.000007256715763
21
+ @ ORBIT5 %le -0.000000000000000
22
+ @ GAMMATR %le 371.218783908525609
23
+ @ Q1 %le 389.088569617840676
24
+ @ Q2 %le 390.213002389969859
25
+ @ DQ1 %le -1.845008895784288
26
+ @ DQ2 %le 1.533678430906169
27
+ @ DXMAX %le 0.544565677826365
28
+ @ DYMAX %le -0.000000000000000
29
+ @ XCOMAX %le 0.000000000000000
30
+ @ YCOMAX %le 0.000000000000000
31
+ @ BETXMAX %le 2039.398467490436815
32
+ @ BETYMAX %le 6519.403287053469285
33
+ @ XCORMS %le 0.000000000000000
34
+ @ YCORMS %le 0.000000000000000
35
+ @ DXRMS %le 0.123614301552443
36
+ @ DYRMS %le 0.000000000000000
37
+ @ DELTAP %le 0.000000000000000
38
+ @ SYNCH_1 %le 0.000000000000000
39
+ @ SYNCH_2 %le 0.000000000000000
40
+ @ SYNCH_3 %le 0.000000000000000
41
+ @ SYNCH_4 %le 0.000000000000000
42
+ @ SYNCH_5 %le 0.000000000000000
43
+ @ TITLE %08s "no-title"
44
+ @ ORIGIN %16s "5.07.00 Linux 64"
45
+ @ DATE %08s "23/06/21"
46
+ @ TIME %08s "16.08.47"
47
+ * NAME KEYWORD S L KS KSL K0L K1L K2L K3L K4L K1S K2S K3S K4S HKICK VKICK BETX BETY ALFX ALFY MUX MUY DX DY DPX DPY R11 R12 R22 R21 X PX Y PY T PT DELTAP VOLT LAG HARMON FREQ E1 E2 APERTYPE APER_1 APER_2 APER_3 APER_4 TILT ANGLE ASSEMBLY_ID MECH_SEP
48
+ $ %s %s %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %le %s %le %le %le %le %le %le %d %le
49
+ "COLL_OPEN" "COLLIMATOR" 42531.376398806176439 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 1000000 1000000 4.541691920251642 -0.493263766065989 173.086386348444279 173.850167284495114 0.023338170729623 0.000000000000000 0.000666633297901 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
50
+ "COLL_SKEW" "COLLIMATOR" 42541.376398806176439 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 1000000 1000000 4.541691920251642 -0.493263766065989 173.086386348444279 173.850167284495114 0.023338170729623 0.000000000000000 0.000666633297901 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.2000000000000 0.000000000000000 0.30000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
51
+ "COLL_SKEW_TILTED" "COLLIMATOR" 42551.376398806176439 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 1000000 1000000 4.541691920251642 -0.493263766065989 173.086386348444279 173.850167284495114 0.023338170729623 0.000000000000000 0.000666633297901 0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 -0.000000000000000 0.2000000000000 0.000000000000000 0.30000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 "CIRCLE" 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0.000000000000000 0 0.000000000000000
@@ -0,0 +1,65 @@
1
+ import numpy as np
2
+
3
+ import collimasim
4
+
5
+
6
+ def test_pyat_object():
7
+ # Initialise a code interface - in this case the interface to pyAT
8
+ g4link = collimasim.PyATInterface(bdsimConfigFile="resources/settings.gmad", referencePdgId=-11, referenceEk=182.4994890018054,
9
+ relativeEnergyCut=0.001, seed=1993)
10
+
11
+ # Add collimators to the Geant4 model
12
+ # Collimators are made of block jaws and are prepared individually in cells, surrounded by a perfect absorber
13
+ # When a collimator is selected, the beam particles start at the beginning of the cell and are extracted at the end
14
+ g4link.addCollimator(name="TESTCOLL1", material="C", length=0.6, aperture=0.1, rotation=0, xOffset=0, yOffset=0, jawTiltLeft=0, jawTiltRight=0, side=0)
15
+ g4link.addCollimator("TESTCOLL2", "C", 0.6, 0.1, np.pi/2, 0, 0, 0, 0, 0)
16
+
17
+
18
+ # Define some test particles
19
+ #r = np.array([0.1, 0.001, 0.1, 0.001, 0, 0])
20
+ r = np.array([0.0, 0., 0.0, 0., 0., 0.])
21
+ r2 = np.array([0.051, 0., 0.051, 0., 0., 0.])
22
+ r3 = np.array([0.0, 0., 0., 0., 0., 0.])
23
+
24
+ # Add the particles to the model
25
+ g4link.addParticle(r)
26
+ g4link.addParticle(r2)
27
+ g4link.addParticle(r3)
28
+
29
+ # Select a collimator
30
+ g4link.selectCollimator("TESTCOLL1")
31
+
32
+ # Perform the Geant4 simulation
33
+ g4link.collimate()
34
+
35
+ # Collect the surviving particles - an n x 6 array where n is the number of surviving particles
36
+ arr_out = g4link.collimateReturn()
37
+
38
+ # For lost particles, all coordinates are NaN
39
+ # print(arr_out) # Debug
40
+ print(f"Pass {1}, Output size: {int(len(arr_out)/6)}, Active particles: {int(np.count_nonzero(~np.isnan(arr_out))/6)}")
41
+
42
+ # Repeat the collimator pass a few times
43
+ for k in range(10):
44
+ g4link.clearData()
45
+
46
+ # Add the particles to the model
47
+ for i in range(0, len(arr_out), 6):
48
+ g4link.addParticle(arr_out[i:i+6])
49
+
50
+ # Select a collimator
51
+ g4link.selectCollimator("TESTCOLL1")
52
+
53
+ # Perform the Geant4 simulation
54
+ g4link.collimate()
55
+
56
+ # Collect the surviving particles - an n x 6 array where n is the number of surviving particles
57
+ arr_out = g4link.collimateReturn()
58
+
59
+ # print(arr_out) # Debug
60
+ print(f"Pass {k+2}, Output size: {int(len(arr_out)/6)}, Active particles: {int(np.count_nonzero(~np.isnan(arr_out))/6)}")
61
+
62
+ assert int(np.count_nonzero(~np.isnan(arr_out))/6) == 1
63
+
64
+ if __name__ == "__main__":
65
+ test_pyat_object()
@@ -0,0 +1,59 @@
1
+ from at import elements, lattice_pass
2
+ from at import atpass, elements
3
+ from at.lattice import Lattice
4
+ from at import Element, lattice_pass
5
+ from at import set_shift, set_tilt
6
+
7
+ # It is assumed that the pyCollimatorPass module is in pyAT
8
+ from at.integrators import pyCollimatorPass
9
+
10
+ import numpy
11
+
12
+
13
+ def test_multiple_particles_collimator_pass():
14
+ # Initialise the Geant4 interface
15
+ pyCollimatorPass.initialise(bdsim_config_file="resources/settings.gmad",
16
+ collimator_info="resources/collgaps.dat",
17
+ reference_pdg_id=-11,
18
+ reference_Ek=182.4994890018054,
19
+ relative_energy_cut=0.3,
20
+ seed=1991)
21
+
22
+
23
+ # Prepare the collimators in the lattice. The pass method must be specified as
24
+ # pyCollimatorPass and the name must match a collimator defined in BDSIM
25
+ lattice = [
26
+ elements.Drift('drift_upstream', 0.6, PassMethod='pyDriftPass'),
27
+ elements.Element('TCP.A.B1', Length=0.6, PassMethod='pyCollimatorPass'),
28
+ elements.Element('TCP.B.B1', Length=0.6, PassMethod='pyCollimatorPass'),
29
+ elements.Drift('drift_downstream', 0.6)
30
+ ]
31
+
32
+ # Track 5 test particles
33
+ rin = numpy.zeros((6, 5))
34
+
35
+ rin[0, 0] = 9.762728e-3 # particle one offset in x
36
+ rin[2, 1] = 10e-3 # particle two offset in y
37
+ rin[2, 2] = 2e-3
38
+ rin[2, 3] = 0.5e-3
39
+ # The 5th particle is on the reference orbit
40
+
41
+ r_original = numpy.copy(rin)
42
+ r_out = lattice_pass(lattice, rin, nturns=1, refpts=range(len(lattice)))
43
+
44
+ columns=["x", "px", "y", "py", "delta", "ct"]
45
+ final_values = {}
46
+ for i, var in enumerate(columns):
47
+ final_values[var] = r_out[i, :, -1, -1]
48
+
49
+ print("final values:\n")
50
+ per_particle = list(zip(final_values['x'], final_values['y'], final_values['px'], final_values['py'], final_values['delta'], final_values['ct']))
51
+ for pp in per_particle:
52
+ print(pp)
53
+
54
+ assert(sum(numpy.isnan(r_out[0, :, -1, -1])) == 2) # Number of lost partciles
55
+
56
+
57
+ if __name__ == "__main__":
58
+ test_multiple_particles_collimator_pass()
59
+
@@ -0,0 +1,102 @@
1
+ import copy
2
+ from at import elements, lattice_pass
3
+ from at import atpass, elements
4
+ from at.lattice import Lattice
5
+ from at import Element, lattice_pass
6
+ from at import set_shift, set_tilt
7
+
8
+ # It is assumed that the pyCollimatorPass module is in pyAT
9
+ from at.integrators import pyCollimatorPass
10
+
11
+ import numpy
12
+
13
+ def make_particles():
14
+ numpy.random.seed(seed=1994)
15
+ n_part = 1000
16
+ rin = numpy.array([numpy.random.uniform(-1e-3, 1e-3, n_part),
17
+ numpy.random.uniform(-1e-5, 1e-5, n_part),
18
+ numpy.random.uniform(-1e-3, 1e-3, n_part),
19
+ numpy.random.uniform(-1e-5, 1e-5, n_part),
20
+ numpy.random.uniform(-1e-2, 1e-2, n_part),
21
+ #numpy.zeros(n_part),
22
+ numpy.random.uniform(-1e-4, 1e-4, n_part),
23
+ #numpy.zeros(n_part),
24
+ ])
25
+
26
+ return rin
27
+
28
+
29
+ def run_particles_g4(rin):
30
+ numpy.random.seed(seed=1994)
31
+
32
+ # Initialise the Geant4 interface
33
+ pyCollimatorPass.initialise(bdsim_config_file="resources/settings_black_absorber.gmad",
34
+ collimator_info="resources/collgaps_pyat_test.dat",
35
+ reference_pdg_id=-11,
36
+ reference_Ek=182.4994890018054,
37
+ relative_energy_cut=0.3,
38
+ seed=1991)
39
+
40
+
41
+ # Prepare the collimators in the lattice. The pass method must be specified as
42
+ # pyCollimatorPass and the name must match a collimator defined in BDSIM
43
+ lattice = [
44
+ elements.Element('DUMMY1', Length=10, PassMethod='pyCollimatorPass'),
45
+ ]
46
+
47
+ r_original = numpy.copy(rin)
48
+ r_out = lattice_pass(lattice, rin, nturns=1, refpts=range(len(lattice)))
49
+
50
+ columns=["x", "px", "y", "py", "delta", "ct"]
51
+ final_values = {}
52
+ for i, var in enumerate(columns):
53
+ #final_values[var] = r_out[i, :, -1, -1]
54
+ final_values[var] = rin[i]
55
+
56
+ return final_values
57
+
58
+ def run_particles_drift(rin):
59
+ lattice = [
60
+ elements.Drift('DRIFT1', 10),
61
+ ]
62
+
63
+ r_original = numpy.copy(rin)
64
+ r_out = lattice_pass(lattice, rin, nturns=1, refpts=range(len(lattice)))
65
+
66
+ #r_out_dr = lattice_pass(lattice2, r_original, nturns=1, refpts=range(len(lattice2)))
67
+
68
+ columns=["x", "px", "y", "py", "delta", "ct"]
69
+ final_values = {}
70
+ for i, var in enumerate(columns):
71
+ #final_values[var] = r_out[i, :, -1, -1]
72
+ final_values[var] = rin[i]
73
+
74
+ return final_values
75
+
76
+ def test_pyat_tracking():
77
+ rin = make_particles()
78
+ rin1 = copy.deepcopy(rin)
79
+ rin2 = copy.deepcopy(rin)
80
+
81
+ final_values_g4 = run_particles_g4(rin1)
82
+ final_values_dr = run_particles_drift(rin2)
83
+
84
+ # BDSIM tracks trough some geometry padding now, which is not corrected for now
85
+ # so use a bad tolerance of 1e-6 for all coordinates over 10 m of drift
86
+ # TODO: investigate
87
+
88
+ all_close = True
89
+ columns=["x", "px", "y", "py", "delta", "ct"]
90
+ for var in columns:
91
+ atol = 1e-6
92
+ rtol = 1e-5
93
+ var_close = numpy.all(numpy.isclose(final_values_dr[var], final_values_g4[var], atol=atol, rtol=rtol))
94
+ all_close &= var_close
95
+
96
+ print("Var {}: {}".format(var, var_close))
97
+
98
+ assert all_close
99
+
100
+
101
+ if __name__ == "__main__":
102
+ test_pyat_tracking()
@@ -0,0 +1,75 @@
1
+ import numpy as np
2
+ import xtrack as xt
3
+ import xpart as xp
4
+
5
+ import collimasim as cs
6
+
7
+
8
+ def test_object_creation():
9
+ N_part = 10
10
+ N_max_expected_products = 10
11
+
12
+ tot_num_part = N_part
13
+
14
+ particles = xp.Particles(
15
+ p0c = 185.e6,
16
+ x = np.zeros(tot_num_part),
17
+ y = np.zeros(tot_num_part),
18
+ zeta = np.zeros(tot_num_part),
19
+ px = np.zeros(tot_num_part),
20
+ py = np.zeros(tot_num_part),
21
+ delta = np.zeros(tot_num_part))
22
+
23
+ particles.num_particles = N_part
24
+
25
+ particles.x[1] = 0.3
26
+ particles.y[2] = 0.3
27
+
28
+ g4man = cs.Geant4CollimationManager(collimator_file="resources/CollDB_old_example.dat",
29
+ bdsim_config_file="resources/settings.gmad",
30
+ tfs_file="resources/collonly_twiss_file_example.tfs",
31
+ reference_pdg_id=-11,
32
+ reference_kinetic_energy=182.4994890018054e9,
33
+ emittance_norm=(0.000521429683675842, 1.0357164949725628e-06),
34
+ relative_energy_cut=0.001,
35
+ seed=1993,
36
+ batchMode=True)
37
+
38
+ coll1 = cs.Geant4Collimator(name="tcp.a.b1", g4manager=g4man)
39
+ coll2 = cs.Geant4Collimator(name="tcp.b.b1", g4manager=g4man)
40
+
41
+
42
+ print("Particle coordinates (x) before first collimator")
43
+ print (particles.delta)
44
+
45
+ prods = coll1.interact(particles)
46
+
47
+ print("Particle coordinates (x) after first collimator")
48
+ print (particles.x)
49
+
50
+ print("="*30)
51
+ print("Products:")
52
+ for crd in prods:
53
+ print(crd, ":", prods[crd])
54
+ print("="*30)
55
+
56
+ prods = coll2.interact(particles)
57
+
58
+ print("Particle coordinates (x) after second collimator")
59
+ print (particles.x)
60
+
61
+ print("="*30)
62
+ print("Products:")
63
+ for crd in prods:
64
+ print(crd, ":", prods[crd])
65
+ print("="*30)
66
+
67
+ assert len(prods['x']) == 10
68
+
69
+
70
+ def main():
71
+ test_object_creation()
72
+
73
+
74
+ if __name__ == '__main__':
75
+ main()