xcoll 0.3.3__py3-none-any.whl → 0.3.5__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 (317) hide show
  1. xcoll/beam_elements/__init__.py +5 -0
  2. xcoll/beam_elements/absorber.py +2 -1
  3. xcoll/beam_elements/base.py +32 -17
  4. xcoll/beam_elements/collimators_src/absorber.h +5 -0
  5. xcoll/beam_elements/everest.py +14 -25
  6. xcoll/colldb.py +50 -27
  7. xcoll/general.py +1 -1
  8. xcoll/headers/checks.h +7 -1
  9. xcoll/impacts/impacts.py +2 -1
  10. xcoll/impacts/impacts_src/impacts.h +1 -6
  11. xcoll/manager.py +5 -5
  12. xcoll/rf_sweep.py +90 -19
  13. xcoll/scattering_routines/everest/__init__.py +5 -0
  14. xcoll/scattering_routines/everest/everest.py +1 -1
  15. xcoll/scattering_routines/fluka/build_fluka_input.py +58 -0
  16. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  17. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
  18. xcoll/scattering_routines/fluka/flukaio/src/Connection.d +68 -48
  19. xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
  20. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +46 -37
  21. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
  22. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +28 -25
  23. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
  24. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +67 -47
  25. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
  26. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +39 -33
  27. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
  28. xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +66 -47
  29. xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
  30. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/METADATA +3 -2
  31. xcoll-0.3.5.dist-info/NOTICE +2 -0
  32. xcoll-0.3.5.dist-info/RECORD +111 -0
  33. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/WHEEL +1 -1
  34. xcoll/beam_elements/collimators_src/base_block.h +0 -14
  35. xcoll/beam_elements/collimators_src/base_collimator.h +0 -14
  36. xcoll/beam_elements/collimators_src/invalid_collimator.h +0 -15
  37. xcoll/install_collimators.py +0 -180
  38. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  39. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  40. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  41. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  42. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  43. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  44. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  45. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  46. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  47. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  48. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  49. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  50. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  51. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  52. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  53. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  54. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  55. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  281. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  282. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  283. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  284. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  285. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -662
  286. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -110
  287. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  288. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  289. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  290. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -475
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -20
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  296. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  297. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  298. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  299. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  300. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  301. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  302. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  303. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  304. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  307. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  308. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  309. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  310. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  311. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  312. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  313. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  314. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  315. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  316. xcoll-0.3.3.dist-info/RECORD +0 -391
  317. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/LICENSE +0 -0
@@ -1,662 +0,0 @@
1
- #include "BDSXtrackInterface.hh"
2
- #include <cstring>
3
- #include <cmath>
4
- #include <BDSSamplerCustom.hh>
5
-
6
-
7
- BDSParticleDefinition* PrepareBDSParticleDefition(long long int pdgIDIn, double momentumIn, double kineticEnergyIn)
8
- {
9
- G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
10
- G4ParticleDefinition* particleDef = particleTable->FindParticle(pdgIDIn);
11
- if (!particleDef)
12
- {throw BDSException("BDSBunchUserFile> Particle \"" + std::to_string(pdgIDIn) + "\" not found");}
13
-
14
- BDSIonDefinition* ionDef = nullptr;
15
- if (BDS::IsIon(particleDef))
16
- {
17
- throw BDSException("BDSBunchUserFile> Particle \"" + std::to_string(pdgIDIn) + "\" is an ion and is not supported.");
18
- }
19
-
20
- // Wrap in our class that calculates momentum and kinetic energy.
21
- // Requires that one of E, Ek, P be non-zero (only one).
22
- BDSParticleDefinition* particleDefinition = nullptr;
23
-
24
- // This should throw an error if both the kintetic energy and the momentum are set
25
- particleDefinition = new BDSParticleDefinition(particleDef, 0, kineticEnergyIn, momentumIn, 1, ionDef);
26
-
27
- return particleDefinition;
28
- }
29
-
30
-
31
- XtrackInterface::XtrackInterface(const std::string& bdsimConfigFile,
32
- int referencePdgIdIn,
33
- double referenceEkIn,
34
- double relativeEnergyCutIn,
35
- int seedIn,
36
- bool batchMode):
37
- relativeEnergyCut(relativeEnergyCutIn),
38
- seed(seedIn)
39
- {
40
- stp = new BDSBunchSixTrackLink();
41
- bds = new BDSIMLink(stp);
42
-
43
- std::string seedStr = std::to_string(seed);
44
- std::vector<std::string> arguments = {"--file=" + bdsimConfigFile,
45
- "--file=" + bdsimConfigFile,
46
- //"--vis_debug",
47
- "--output=none",
48
- "--seed=" + seedStr,
49
- "--outfile=output_" + seedStr};
50
-
51
- for(auto & argument : arguments)
52
- {
53
- argv.push_back(strdup(argument.c_str()));
54
- }
55
- if (batchMode)
56
- {
57
- std::string batch_flag = "--batch";
58
- argv.push_back(strdup(batch_flag.c_str()));
59
- }
60
- argv.push_back(nullptr);
61
-
62
- double referenceEk = referenceEkIn * CLHEP::GeV;
63
-
64
- double relEKCut = relativeEnergyCut;
65
- if (relEKCut < 1e-6) // defaults to 0 which means 0eV cut which is bad
66
- { relEKCut = 1.0; }
67
-
68
- double minimumEK = relEKCut * (referenceEk);
69
-
70
- G4cout << "Minimum kinetic energy " << minimumEK << " MeV" << G4endl;
71
- auto data = argv.data();
72
- try
73
- { bds->Initialise(argv.size() - 1, &argv[0], true, minimumEK / CLHEP::GeV, false); } // minimumEk in GeV
74
- catch (const std::exception &e)
75
- {
76
- std::cout << e.what() << std::endl;
77
- exit(1);
78
- }
79
-
80
- refParticleDefinition = PrepareBDSParticleDefition(referencePdgIdIn, 0, referenceEk);
81
- }
82
-
83
-
84
- XtrackInterface::~XtrackInterface()
85
- {
86
- delete bds;
87
- delete stp;
88
-
89
- delete refParticleDefinition;
90
- }
91
-
92
-
93
- void XtrackInterface::addCollimator(const std::string& name,
94
- const std::string& material,
95
- double lengthIn,
96
- double apertureLeftIn,
97
- double apertureRightIn,
98
- double rotationIn,
99
- double xOffsetIn,
100
- double yOffsetIn,
101
- double jawTiltLeft,
102
- double jawTiltRight,
103
- int side)
104
- {
105
-
106
- bool buildLeft = side == 0 || side == 1;
107
- bool buildRight = side == 0 || side == 2;
108
-
109
- bool isACrystal = false;
110
-
111
- bds->AddLinkCollimatorJaw(name,
112
- material,
113
- lengthIn * CLHEP::m,
114
- apertureLeftIn * CLHEP::m,
115
- apertureRightIn * CLHEP::m,
116
- rotationIn * CLHEP::rad,
117
- xOffsetIn * CLHEP::m,
118
- yOffsetIn * CLHEP::m,
119
- jawTiltLeft * CLHEP::rad,
120
- jawTiltRight * CLHEP::rad,
121
- buildLeft,
122
- buildRight,
123
- isACrystal,
124
- 0);
125
- }
126
-
127
-
128
- void XtrackInterface::addParticle(double xIn,
129
- double yIn,
130
- double pxIn,
131
- double pyIn,
132
- double ctIn,
133
- double deltapIn,
134
- double sIn,
135
- int64_t trackidIn
136
- )
137
- {
138
-
139
- G4double p = refParticleDefinition->Momentum() * (G4double) deltapIn + refParticleDefinition->Momentum();
140
-
141
- // For now, use the pdgID from the reference particle definition, which is stored as a data member
142
- // In general, each particle can be of different species
143
- auto partDef = PrepareBDSParticleDefition(refParticleDefinition->PDGID(), p, 0);
144
-
145
- G4double t = - (G4double) ctIn * CLHEP::m / (refParticleDefinition->Beta() * CLHEP::c_light); // this is time difference in ns
146
-
147
- auto x = (G4double) xIn;
148
- auto y = (G4double) yIn;
149
- auto px = (G4double) pxIn;
150
- auto py = (G4double) pyIn;
151
- auto s = (G4double) sIn;
152
- auto trackid = (G4int) trackidIn;
153
-
154
- G4double oneplusdelta = 1 + deltapIn;
155
- // G4double pz = std::sqrt(oneplusdelta*oneplusdelta - px*px - py*py);
156
- G4double xp = px / oneplusdelta;
157
- G4double yp = py / oneplusdelta;
158
-
159
- // Zp0 is 1 as here we assume no back-scatterd particles, e.g p>0
160
- G4double zp = BDSBunch::CalculateZp(xp, yp, 1);
161
-
162
- BDSParticleCoordsFull coords = BDSParticleCoordsFull(x * CLHEP::m,
163
- y * CLHEP::m,
164
- 0,
165
- xp,
166
- yp,
167
- zp,
168
- t,
169
- 0,
170
- partDef->TotalEnergy(),
171
- 1);
172
-
173
- stp->AddParticle(partDef, coords, trackid, trackid);
174
- }
175
-
176
-
177
- void XtrackInterface::addParticles(const py::list& coordinates)
178
- {
179
- // Obtain the arrays from the list and cast them to the correct array type
180
- py::array_t<double> x = py::cast<py::array>(coordinates[0]);
181
- py::array_t<double> y = py::cast<py::array>(coordinates[1]);
182
- py::array_t<double> px = py::cast<py::array>(coordinates[2]);
183
- py::array_t<double> py = py::cast<py::array>(coordinates[3]);
184
- py::array_t<double> zeta = py::cast<py::array>(coordinates[4]);
185
- py::array_t<double> delta = py::cast<py::array>(coordinates[5]);
186
- py::array_t<double> s = py::cast<py::array>(coordinates[6]);
187
- py::array_t<int64_t> trackid = py::cast<py::array>(coordinates[7]);
188
- py::array_t<int64_t> state = py::cast<py::array>(coordinates[8]);
189
- py::array_t<int64_t> at_element = py::cast<py::array>(coordinates[9]);
190
- py::array_t<int64_t> at_turn = py::cast<py::array>(coordinates[10]);
191
-
192
-
193
- // Obtain the buffers
194
- py::buffer_info x_buff = x.request();
195
- py::buffer_info y_buff = y.request();
196
- py::buffer_info px_buff = px.request();
197
- py::buffer_info py_buff = py.request();
198
- py::buffer_info zeta_buff = zeta.request();
199
- py::buffer_info delta_buff = delta.request();
200
- py::buffer_info s_buff = s.request();
201
- py::buffer_info id_buff = trackid.request();
202
- py::buffer_info state_buff = state.request();
203
- py::buffer_info at_element_buff = at_element.request();
204
- py::buffer_info at_turn_buff = at_turn.request();
205
-
206
- // Get the pointers for iteration
207
- auto x_ptr = static_cast<double *>(x_buff.ptr);
208
- auto y_ptr = static_cast<double *>(y_buff.ptr);
209
- auto px_ptr = static_cast<double *>(px_buff.ptr);
210
- auto py_ptr = static_cast<double *>(py_buff.ptr);
211
- auto zeta_ptr = static_cast<double *>(zeta_buff.ptr);
212
- auto delta_ptr = static_cast<double *>(delta_buff.ptr);
213
- auto s_ptr = static_cast<double *>(s_buff.ptr);
214
- auto trackid_ptr = static_cast<int64_t *>(id_buff.ptr);
215
- auto state_ptr = static_cast<int64_t *>(state_buff.ptr);
216
- auto at_element_ptr = static_cast<int64_t *>(at_element_buff.ptr);
217
- auto at_turn_ptr = static_cast<int64_t *>(at_turn_buff.ptr);
218
-
219
- long n = 1; // Get the number of elements in the array, assume all arrays have the same number of elements
220
- for (auto r: x_buff.shape) {
221
- n *= r;
222
- }
223
-
224
- for(int i=0; i < n; i++)
225
- {
226
- auto x_part = x_ptr[i];
227
- auto y_part = y_ptr[i];
228
- auto px_part = px_ptr[i];
229
- auto py_part = py_ptr[i];
230
- auto zeta_part = zeta_ptr[i];
231
- auto delta_part = delta_ptr[i];
232
- auto s_part = s_ptr[i];
233
- auto trackid_part = trackid_ptr[i];
234
- auto state_part = state_ptr[i];
235
- auto at_element_part = at_element_ptr[i];
236
- auto at_turn_part = at_turn_ptr[i];
237
-
238
- // The particles with state=0 are inactive and should not be processed at all, but need to keep track of them
239
- // The internal processing in BDSIM does not feature an active state check, so this must be done at a higher
240
- // level here
241
-
242
- if (state_part == 1) // State == 1 means that the particle is active
243
- {
244
- particleActiveState.push_back(true);
245
- addParticle(x_part, y_part, px_part, py_part, zeta_part, delta_part, s_part, trackid_part);
246
- maxParticleID = std::max(maxParticleID, trackid_part);
247
- bds->SetCurrentMaximumExternalParticleID(maxParticleID);
248
- }
249
- else
250
- {
251
- if (state_part == -999999999) // This is reserve memory for new particles, no need to process
252
- {
253
- break;
254
- }
255
- particleActiveState.push_back(false);
256
- }
257
-
258
- auto particle_coords = new XtrackCoordinates{x_part, y_part, px_part, py_part, zeta_part,
259
- delta_part, s_part, trackid_part, state_part,
260
- at_element_part, at_turn_part};
261
- xtrackParticles.push_back(particle_coords);
262
- }
263
- }
264
-
265
-
266
- void XtrackInterface::collimate()
267
- {
268
- bds->BeamOn((G4int)stp->Size());
269
- }
270
-
271
-
272
- void XtrackInterface::selectCollimator(const std::string& collimatorName)
273
- {
274
- currentCollimatorName = collimatorName;
275
- // This doesn't throw an error if the element doesn't exist
276
- bds->SelectLinkElement(collimatorName);
277
-
278
- // Check if the element exists by querying the index: -1 means it doesn't exist
279
- if (bds->GetLinkIndex(collimatorName) == -1)
280
- {throw std::runtime_error("Element not found " + collimatorName);}
281
- }
282
-
283
-
284
- void XtrackInterface::clearData()
285
- {
286
- bds->ClearSamplerHits();
287
- // A malloc error about freeing a pointer not allocated is thrown if the run is terminated after
288
- // the bunch is manually cleared. Consider using an alternative to vector.clear() in the BDSIM bunch class:
289
- // vector<T>().swap(x); // clear x reallocating (https://www.cplusplus.com/reference/vector/vector/clear/)
290
- // to ensure the pointer is still allocated after clearing
291
- stp->ClearParticles();
292
-
293
- for (auto part : xtrackParticles)
294
- {
295
- delete part;
296
- }
297
-
298
- std::vector<XtrackCoordinates*>().swap(xtrackParticles);
299
- std::vector<bool>().swap(particleActiveState);
300
- currentCollimatorName.clear();
301
-
302
- maxParticleID = 0;
303
-
304
- }
305
-
306
-
307
- py::dict XtrackInterface::collimateReturn(const py::list& coordinates)
308
- {
309
- // Prepare the buffers for modifying the primary particle coordinates in place
310
-
311
- // Obtain the arrays from the list and cast them to the correct array type
312
- py::array_t<double> x = py::cast<py::array>(coordinates[0]);
313
- py::array_t<double> y = py::cast<py::array>(coordinates[1]);
314
- py::array_t<double> px = py::cast<py::array>(coordinates[2]);
315
- py::array_t<double> py = py::cast<py::array>(coordinates[3]);
316
- py::array_t<double> zeta = py::cast<py::array>(coordinates[4]);
317
- py::array_t<double> delta = py::cast<py::array>(coordinates[5]);
318
- py::array_t<double> s = py::cast<py::array>(coordinates[6]);
319
- py::array_t<int64_t> trackid = py::cast<py::array>(coordinates[7]);
320
- py::array_t<int64_t> state = py::cast<py::array>(coordinates[8]);
321
- py::array_t<int64_t> at_element = py::cast<py::array>(coordinates[9]);
322
- py::array_t<int64_t> at_turn = py::cast<py::array>(coordinates[10]);
323
-
324
- // Obtain the buffers
325
- py::buffer_info x_buff = x.request();
326
- py::buffer_info y_buff = y.request();
327
- py::buffer_info px_buff = px.request();
328
- py::buffer_info py_buff = py.request();
329
- py::buffer_info zeta_buff = zeta.request();
330
- py::buffer_info delta_buff = delta.request();
331
- py::buffer_info s_buff = s.request();
332
- py::buffer_info id_buff = trackid.request();
333
- py::buffer_info state_buff = state.request();
334
- py::buffer_info at_element_buff = at_element.request();
335
- py::buffer_info at_turn_buff = at_turn.request();
336
-
337
- // Get the pointers for iteration
338
- auto x_ptr = static_cast<double *>(x_buff.ptr);
339
- auto y_ptr = static_cast<double *>(y_buff.ptr);
340
- auto px_ptr = static_cast<double *>(px_buff.ptr);
341
- auto py_ptr = static_cast<double *>(py_buff.ptr);
342
- auto zeta_ptr = static_cast<double *>(zeta_buff.ptr);
343
- auto delta_ptr = static_cast<double *>(delta_buff.ptr);
344
- auto s_ptr = static_cast<double *>(s_buff.ptr);
345
- auto trackid_ptr = static_cast<int64_t *>(id_buff.ptr);
346
- auto state_ptr = static_cast<int64_t *>(state_buff.ptr);
347
- auto at_element_ptr = static_cast<int64_t *>(at_element_buff.ptr);
348
- auto at_turn_ptr = static_cast<int64_t *>(at_turn_buff.ptr);
349
-
350
- // N.B book keeping needed
351
- // Note: Load and and transfer for surviving primaries
352
- // Secondaries inherit the element and turn of parent particle
353
- //auto at_element = static_cast<int64_t *>(at_element.ptr);
354
- //auto turn = static_cast<int64_t *>(turn.ptr);
355
-
356
-
357
- // Prepare the buffers for writing out the products
358
- // New numpy arrays are allocated for writing the products
359
-
360
- // Access the sampler hits - particles reaching the planes for transport back
361
- const BDSHitsCollectionSamplerLink* hits = bds->SamplerHits();
362
-
363
- //size_t hitsCount = hits ? hits->GetSize() : 0;
364
-
365
- size_t hitsCount = 0;
366
- if (hits)
367
- {
368
- hitsCount = hits->GetSize();
369
- }
370
- else
371
- {
372
- // There were no hits - check if there were any active particles at all coming in
373
- if (!stp->Size())
374
- {
375
- // A particle needs to be added to the bunch and the GetNextParticleLocal method
376
- // must be called to initialise the variables and ensure a safe deletion of the
377
- // underlying BDSBunch object. This will not be needed in the next release of BDSIM
378
- addParticle(0, 0, 0, 0, 0, 0, 0, 0);
379
- // The dummy particle added is never used, as the collimateReturn method terminates
380
- // the processing
381
- stp->GetNextParticleLocal();
382
- }
383
- }
384
-
385
-
386
- // Count the number of secondary particles
387
- size_t secondaryCount = 0;
388
- for (size_t i = 0; i < hitsCount; i++)
389
- {
390
- auto hit = (*hits)[i];
391
- if (hit->externalParticleID != hit->externalParentID) { secondaryCount++; }
392
- }
393
-
394
- // The output arrays has slots for all primary particles, regardless if lost or not, and for secondary particles
395
- size_t output_size = secondaryCount;
396
-
397
- // TODO: this is mostly default buffers, so there are probably simpler constructors to use
398
- // Prepare the numpy array that will be returned
399
- auto x_out = py::array(py::buffer_info(
400
- nullptr, /* Pointer to data (nullptr -> ask NumPy to allocate!) */
401
- sizeof(double), /* Size of one item */
402
- py::format_descriptor<double>::value, /* Buffer format */
403
- 1, /* How many dimensions? */
404
- { output_size }, /* Number of elements for each dimension */
405
- { sizeof(double) } /* Strides for each dimension */
406
- ));
407
-
408
- auto y_out = py::array(py::buffer_info(
409
- nullptr,
410
- sizeof(double),
411
- py::format_descriptor<double>::value,
412
- 1,
413
- { output_size },
414
- { sizeof(double) }
415
- ));
416
-
417
- auto px_out = py::array(py::buffer_info(
418
- nullptr,
419
- sizeof(double),
420
- py::format_descriptor<double>::value,
421
- 1,
422
- { output_size },
423
- { sizeof(double) }
424
- ));
425
-
426
- auto py_out = py::array(py::buffer_info(
427
- nullptr,
428
- sizeof(double),
429
- py::format_descriptor<double>::value,
430
- 1,
431
- { output_size },
432
- { sizeof(double) }
433
- ));
434
-
435
- auto zeta_out = py::array(py::buffer_info(
436
- nullptr,
437
- sizeof(double),
438
- py::format_descriptor<double>::value,
439
- 1,
440
- { output_size },
441
- { sizeof(double) }
442
- ));
443
-
444
- auto delta_out = py::array(py::buffer_info(
445
- nullptr,
446
- sizeof(double),
447
- py::format_descriptor<double>::value,
448
- 1,
449
- { output_size },
450
- { sizeof(double) }
451
- ));
452
-
453
- auto s_out = py::array(py::buffer_info(
454
- nullptr,
455
- sizeof(double),
456
- py::format_descriptor<double>::value,
457
- 1,
458
- { output_size },
459
- { sizeof(double) }
460
- ));
461
-
462
- auto trackid_out = py::array(py::buffer_info(
463
- nullptr,
464
- sizeof(int64_t),
465
- py::format_descriptor<int64_t>::value,
466
- 1,
467
- { output_size },
468
- { sizeof(int64_t) }
469
- ));
470
-
471
- auto state_out = py::array(py::buffer_info(
472
- nullptr,
473
- sizeof(int64_t),
474
- py::format_descriptor<int64_t>::value,
475
- 1,
476
- { output_size },
477
- { sizeof(int64_t) }
478
- ));
479
-
480
- auto at_element_out = py::array(py::buffer_info(
481
- nullptr,
482
- sizeof(int64_t),
483
- py::format_descriptor<int64_t>::value,
484
- 1,
485
- { output_size },
486
- { sizeof(int64_t) }
487
- ));
488
-
489
- auto at_turn_out = py::array(py::buffer_info(
490
- nullptr,
491
- sizeof(int64_t),
492
- py::format_descriptor<int64_t>::value,
493
- 1,
494
- { output_size },
495
- { sizeof(int64_t) }
496
- ));
497
-
498
- auto massratio_out = py::array(py::buffer_info(
499
- nullptr,
500
- sizeof(double),
501
- py::format_descriptor<double>::value,
502
- 1,
503
- { output_size },
504
- { sizeof(double) }
505
- ));
506
-
507
- auto chargeratio_out = py::array(py::buffer_info(
508
- nullptr,
509
- sizeof(double),
510
- py::format_descriptor<double>::value,
511
- 1,
512
- { output_size },
513
- { sizeof(double) }
514
- ));
515
-
516
- auto x_prod_buf = x_out.request();
517
- auto y_prod_buf = y_out.request();
518
- auto px_prod_buf = px_out.request();
519
- auto py_prod_buf = py_out.request();
520
- auto zeta_prod_buf = zeta_out.request();
521
- auto delta_prod_buf = delta_out.request();
522
- auto s_prod_buf = s_out.request();
523
- auto trackid_prod_buf = trackid_out.request();
524
- auto state_prod_buf = state_out.request();
525
- auto at_element_prod_buf = at_element_out.request();
526
- auto at_turn_prod_buf = at_turn_out.request();
527
- auto massratio_prod_buf = massratio_out.request();
528
- auto chargeratio_prod_buf = chargeratio_out.request();
529
-
530
- auto *x_prod_ptr = (double *) x_prod_buf.ptr;
531
- auto *y_prod_ptr = (double *) y_prod_buf.ptr;
532
- auto *px_prod_ptr = (double *) px_prod_buf.ptr;
533
- auto *py_prod_ptr = (double *) py_prod_buf.ptr;
534
- auto *zeta_prod_ptr = (double *) zeta_prod_buf.ptr;
535
- auto *delta_prod_ptr = (double *) delta_prod_buf.ptr;
536
- auto *s_prod_ptr = (double *) s_prod_buf.ptr;
537
- auto *trackid_prod_ptr = (int64_t *) trackid_prod_buf.ptr;
538
- auto *state_prod_ptr = (int64_t *) state_prod_buf.ptr;
539
- auto *at_element_prod_ptr = (int64_t *) at_element_prod_buf.ptr;
540
- auto *at_turn_prod_ptr = (int64_t *) at_turn_prod_buf.ptr;
541
- auto *massratio_prod_ptr = (double *) massratio_prod_buf.ptr;
542
- auto *chargeratio_prod_ptr = (double *) chargeratio_prod_buf.ptr;
543
-
544
- // Loop through the particles in the *original* bunch - the primaries
545
- size_t hits_index = 0;
546
- bool prim_survied = false;
547
- double sum_deltaplusone_sec = 0.0;
548
-
549
- size_t prod_write_index = 0;
550
-
551
- for (size_t i=0; i < particleActiveState.size(); i++){
552
- if (!particleActiveState.at(i)){
553
- continue; // This was an inactive particle that hasn't been processed, do not change it
554
- }
555
-
556
- auto xtrack_part = xtrackParticles.at(i); // Get the cached coordinates of the original xtrack particle
557
-
558
- auto part = stp->GetNextParticle(); // Advance through the bunch
559
- auto prim_part_id = stp->CurrentExternalParticleID(); // Get the ID of the primary particle
560
-
561
- // Now start looping over the hits - the particles to be returned to the tracker
562
- // These can be primary or secondary particles. Each primary can produce 0, 1, or 2+ products
563
- // The products need to be sorted to keep the array order - surviving primary particles are all
564
- // filled in first. If a primary didn't survive, keep the original coordinates and make it inactive.
565
- // The hits are ordered by primary event, so just need one loop.
566
- while (hits_index < hitsCount)
567
- {
568
- BDSHitSamplerLink* hit = (*hits)[hits_index];
569
-
570
- if (hit->externalParentID != prim_part_id) { // The hits corresponding to the current primary are exhausted
571
- break;
572
- }
573
-
574
- const BDSParticleCoordsFull &coords = hit->coords;
575
-
576
- double qratio = hit->charge / refParticleDefinition->Charge();
577
- double mratio = hit->mass / refParticleDefinition->Mass();
578
-
579
- double dp = (hit->momentum - refParticleDefinition->Momentum()) / refParticleDefinition->Momentum();
580
-
581
- double collLength = bds->GetArcLengthOfLinkElement(currentCollimatorName);
582
- /// Need to compensate for the geometry construction in BDSIM
583
- /// There is a safety margin that is added to the collimator legnth
584
- double collMargin = 2.5 * BDSSamplerCustom::ChordLength();
585
-
586
- //double zt = (collLength + collMargin) / beta0 - CLHEP::c_light * coords.T;
587
- double zt = refParticleDefinition->Beta() * CLHEP::c_light * ((collLength + collMargin) / (CLHEP::c_light * refParticleDefinition->Beta()) - coords.T);
588
-
589
- double oneplusdelta = 1 + dp;
590
-
591
- // double pz = (1 + dp) / std::sqrt(1 + std::pow(coords.xp, 2) + std::pow(coords.yp, 2));
592
- //double ps = (E - E0) / (beta0 * P0);
593
- //double sigma = coords.s - beta0* coords.T / CLHEP::s; // check this
594
-
595
- auto track_id = hit->externalParticleID;
596
- auto parent_id = hit->externalParentID;
597
-
598
- if (track_id == parent_id){
599
- // This is a primary particle as its parent is itself
600
- prim_survied = true;
601
-
602
- x_ptr[i] = coords.x / CLHEP::m;
603
- y_ptr[i] = coords.y / CLHEP::m;
604
- px_ptr[i] = coords.xp * oneplusdelta; // convert back to px proper
605
- py_ptr[i] = coords.yp * oneplusdelta;
606
- zeta_ptr[i] = zt / CLHEP::m;
607
- delta_ptr[i] = dp;
608
- s_ptr[i] = xtrack_part->s + collLength / CLHEP::m;
609
- //trackid_ptr[i] = track_id; // Don't touch the primary particle id
610
- state_ptr[i] = 1; // active
611
- }
612
- else
613
- {
614
- // Secondary particles are populated in newly allocated arrays
615
- x_prod_ptr[prod_write_index] = coords.x / CLHEP::m;
616
- y_prod_ptr[prod_write_index] = coords.y / CLHEP::m;
617
- px_prod_ptr[prod_write_index] = coords.xp * oneplusdelta; // convert back to px proper
618
- py_prod_ptr[prod_write_index] = coords.yp * oneplusdelta; // convert back to py proper;
619
- zeta_prod_ptr[prod_write_index] = zt / CLHEP::m;
620
- delta_prod_ptr[prod_write_index] = dp;
621
- s_prod_ptr[prod_write_index] = xtrack_part->s + collLength / CLHEP::m;
622
- trackid_prod_ptr[prod_write_index] = parent_id;
623
- state_prod_ptr[prod_write_index] = 1; // active
624
- at_element_prod_ptr[prod_write_index] = xtrack_part->at_element; // active
625
- at_turn_prod_ptr[prod_write_index] = xtrack_part->at_turn; // active
626
- massratio_prod_ptr[prod_write_index] = mratio;
627
- chargeratio_prod_ptr[prod_write_index] = qratio;
628
-
629
- sum_deltaplusone_sec += (dp + 1);
630
- prod_write_index++;
631
- }
632
-
633
- hits_index++;
634
- }
635
-
636
- if (!prim_survied) // Primary didn't survive - set inactive
637
- {
638
- state_ptr[i] = -333; // inactive
639
- // Correct the energy of the lost primary particle to account for the production of secondaries
640
- delta_ptr[i] = delta_ptr[i] - sum_deltaplusone_sec;
641
- }
642
- prim_survied = false; // reset for next particle
643
- sum_deltaplusone_sec = 0.0;
644
- }
645
-
646
- auto result = py::dict();
647
-
648
- result["s"] = s_out;
649
- result["x"] = x_out;
650
- result["px"] = px_out;
651
- result["y"] = y_out;
652
- result["py"] = py_out;
653
- result["zeta"] = zeta_out;
654
- result["delta"] = delta_out;
655
- result["at_element"] = at_element_out;
656
- result["at_turn"] = at_turn_out;
657
- result["mass_ratio"] = massratio_out;
658
- result["charge_ratio"] = chargeratio_out;
659
- result["parent_particle_id"] = trackid_out;
660
-
661
- return result;
662
- }