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,144 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- import os
3
- import sys
4
- import subprocess
5
-
6
- from setuptools import setup, find_packages, Extension
7
- from setuptools.command.build_ext import build_ext
8
- from setuptools.command.develop import develop
9
-
10
- try:
11
- from setuptools.command.clean import clean
12
- except ImportError:
13
- from distutils.command.clean import clean
14
-
15
-
16
- # Setup file based on the cmake_example build from pybind11 by Dean Moldovan:
17
- # https://github.com/pybind/cmake_example
18
- # Package structure inspired by B. Jack https://www.benjack.io/2018/02/02/python-cpp-revisited.html
19
-
20
- # Convert distutils Windows platform specifiers to CMake -A arguments
21
- PLAT_TO_CMAKE = {
22
- "win32": "Win32",
23
- "win-amd64": "x64",
24
- "win-arm32": "ARM",
25
- "win-arm64": "ARM64",
26
- }
27
-
28
-
29
- # Custom install that cleans the build directory before installing
30
- class PreDevelopCommand(develop):
31
- """
32
- Pre-installation for development mode. Clean the build
33
- directory to prevent errors when re-building extensions
34
- """
35
- def run(self):
36
- c = clean(self.distribution)
37
- c.all = True
38
- c.finalize_options()
39
- c.run()
40
- develop.run(self)
41
-
42
-
43
- # A CMakeExtension needs a sourcedir instead of a file list.
44
- # The name must be the _single_ output extension from the CMake build.
45
- # If you need multiple extensions, see scikit-build.
46
- class CMakeExtension(Extension):
47
- def __init__(self, name, sourcedir=""):
48
- Extension.__init__(self, name, sources=[])
49
- self.sourcedir = os.path.abspath(sourcedir)
50
-
51
-
52
- class CMakeBuild(build_ext):
53
- def build_extension(self, ext):
54
- extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
55
-
56
- # required for auto-detection of auxiliary "native" libs
57
- if not extdir.endswith(os.path.sep):
58
- extdir += os.path.sep
59
-
60
- cfg = "Debug" if self.debug else "Release"
61
-
62
- # CMake lets you override the generator - we need to check this.
63
- # Can be set with Conda-Build, for example.
64
- cmake_generator = os.environ.get("CMAKE_GENERATOR", "")
65
-
66
- # Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON
67
- # EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code
68
- # from Python.
69
- cmake_args = [
70
- "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}".format(extdir),
71
- "-DPYTHON_EXECUTABLE={}".format(sys.executable),
72
- "-DEXAMPLE_VERSION_INFO={}".format(self.distribution.get_version()),
73
- "-DCMAKE_BUILD_TYPE={}".format(cfg), # not used on MSVC, but no harm
74
- ]
75
- build_args = []
76
-
77
- if self.compiler.compiler_type != "msvc":
78
- # Using Ninja-build since it a) is available as a wheel and b)
79
- # multithreads automatically. MSVC would require all variables be
80
- # exported for Ninja to pick it up, which is a little tricky to do.
81
- # Users can override the generator with CMAKE_GENERATOR in CMake
82
- # 3.15+.
83
- if not cmake_generator:
84
- cmake_args += ["-GNinja"]
85
-
86
- else:
87
-
88
- # Single config generators are handled "normally"
89
- single_config = any(x in cmake_generator for x in {"NMake", "Ninja"})
90
-
91
- # CMake allows an arch-in-generator style for backward compatibility
92
- contains_arch = any(x in cmake_generator for x in {"ARM", "Win64"})
93
-
94
- # Specify the arch if using MSVC generator, but only if it doesn't
95
- # contain a backward-compatibility arch spec already in the
96
- # generator name.
97
- if not single_config and not contains_arch:
98
- cmake_args += ["-A", PLAT_TO_CMAKE[self.plat_name]]
99
-
100
- # Multi-config generators have a different way to specify configs
101
- if not single_config:
102
- cmake_args += [
103
- "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}".format(cfg.upper(), extdir)
104
- ]
105
- build_args += ["--config", cfg]
106
-
107
- # Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level
108
- # across all generators.
109
- if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ:
110
- # self.parallel is a Python 3 only way to set parallel jobs by hand
111
- # using -j in the build_ext call, not supported by pip or PyPA-build.
112
- if hasattr(self, "parallel") and self.parallel:
113
- # CMake 3.12+ only.
114
- build_args += ["-j{}".format(self.parallel)]
115
-
116
- if not os.path.exists(self.build_temp):
117
- os.makedirs(self.build_temp)
118
-
119
- subprocess.check_call(
120
- ["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp
121
- )
122
- subprocess.check_call(
123
- ["cmake", "--build", "."] + build_args, cwd=self.build_temp
124
- )
125
-
126
-
127
- # The information here can also be placed in setup.cfg - better separation of
128
- # logic and declaration, and simpler if you include description/version in a file.
129
- setup(
130
- name="collimasim",
131
- version="0.0.1",
132
- author="Andrey Abramov, Laurie Nevay",
133
- author_email="andrey.abramov@cern.ch",
134
- description="Python bindings of BDSIM (Geant4) for collimation studies",
135
- long_description="",
136
- # tell setuptools to look for any packages under 'src'
137
- packages=find_packages('src'),
138
- # tell setuptools that all packages will be under the 'src' directory
139
- # and nowhere else
140
- package_dir={'':'src'},
141
- ext_modules=[CMakeExtension("collimasim.g4interface")],
142
- cmdclass={"build_ext": CMakeBuild, "develop": PreDevelopCommand},
143
- zip_safe=False,
144
- )
@@ -1,403 +0,0 @@
1
- #include "BDSPyATInterface.hh"
2
- #include <cstring>
3
- #include <BDSSamplerCustom.hh>
4
-
5
-
6
- PyATInterface::PyATInterface(const std::string& bdsimConfigFile,
7
- int referencePdgIdIn,
8
- double referenceEkIn,
9
- double relativeEnergyCutIn,
10
- int seedIn,
11
- bool batchMode):
12
- pdgID(referencePdgIdIn),
13
- referenceEk(referenceEkIn * CLHEP::GeV),
14
- relativeEnergyCut(relativeEnergyCutIn),
15
- seed(seedIn)
16
- {
17
- stp = new BDSBunchSixTrackLink();
18
- bds = new BDSIMLink(stp);
19
-
20
- std::string seedStr = std::to_string(seed);
21
- std::vector<std::string> arguments = {"--file=" + bdsimConfigFile,
22
- "--file=" + bdsimConfigFile,
23
- //"--vis_debug",
24
- "--output=none",
25
- "--seed=" + seedStr,
26
- "--outfile=output_" + seedStr};
27
-
28
- for(auto & argument : arguments)
29
- {
30
- argv.push_back(strdup(argument.c_str()));
31
- }
32
-
33
- if (batchMode)
34
- {
35
- std::string batch_flag = "--batch";
36
- argv.push_back(strdup(batch_flag.c_str()));
37
- }
38
-
39
- argv.push_back(nullptr);
40
-
41
- // absolute energy cut is in GeV
42
- double relEKCut = relativeEnergyCut;
43
- if (relEKCut < 1e-6) // defaults to 0 which means 0eV cut which is bad
44
- { relEKCut = 1.0; }
45
-
46
- // referenceEk is in GeV
47
- double minimumEK = relEKCut * (referenceEk);
48
-
49
- G4cout << "Minimum kinetic energy " << minimumEK << " MeV" << G4endl;
50
- auto data = argv.data();
51
- try
52
- { bds->Initialise(argv.size() - 1, &argv[0], true, minimumEK / CLHEP::GeV, false); } // minimumEk in GeV
53
- catch (const std::exception &e)
54
- {
55
- std::cout << e.what() << std::endl;
56
- exit(1);
57
- }
58
-
59
- /// Compute variables that will be used for coordinate transforms
60
- G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
61
- G4ParticleDefinition* particleDef = particleTable->FindParticle(pdgID);
62
- if (!particleDef)
63
- {throw BDSException("BDSBunchUserFile> Particle \"" + std::to_string(pdgID) + "\" not found");}
64
-
65
- BDSIonDefinition* ionDef = nullptr;
66
- if (BDS::IsIon(particleDef))
67
- {
68
- throw std::invalid_argument("Particle \"" + std::to_string(pdgID) + "\" is an ion and is not supported.");
69
- }
70
-
71
- referenceMass = particleDef->GetPDGMass();
72
- referenceEnergy = referenceEk + referenceMass;
73
- referenceMomentum = std::sqrt(referenceEnergy * referenceEnergy - referenceMass * referenceMass);
74
- beta0 = referenceMomentum / referenceEnergy;
75
-
76
- }
77
-
78
- PyATInterface::~PyATInterface()
79
- {
80
- delete bds;
81
- delete stp;
82
- }
83
-
84
-
85
- void PyATInterface::addCollimator(const std::string& name,
86
- const std::string& material,
87
- double lengthIn,
88
- double apertureIn,
89
- double rotationIn,
90
- double xOffsetIn,
91
- double yOffsetIn,
92
- double jawTiltLeft,
93
- double jawTiltRight,
94
- int side)
95
- {
96
-
97
- bool buildLeft = side == 0 || side == 1;
98
- bool buildRight = side == 0 || side == 2;
99
- double length = lengthIn * CLHEP::m;
100
- double aperture = apertureIn * CLHEP::m;
101
-
102
- bool isACrystal = false;
103
-
104
- bds->AddLinkCollimatorJaw(name,
105
- material,
106
- length,
107
- 0.5*aperture,
108
- 0.5*aperture,
109
- rotationIn,
110
- xOffsetIn,
111
- yOffsetIn,
112
- jawTiltLeft,
113
- jawTiltRight,
114
- buildLeft,
115
- buildRight,
116
- isACrystal,
117
- 0);
118
- }
119
-
120
-
121
- void PyATInterface::addParticle(const py::array_t<double>& coordiantes)
122
- {
123
- // Process the incoming numpy array
124
- py::buffer_info info = coordiantes.request();
125
- auto ptr = static_cast<double *>(info.ptr);
126
-
127
- auto x = (G4double) *ptr++;
128
- auto xp = (G4double) *ptr++;
129
- auto y = (G4double) *ptr++;
130
- auto yp = (G4double) *ptr++;
131
- auto deltap = (G4double) *ptr++;
132
- auto ct = (G4double) *ptr;
133
-
134
- if (!std::isfinite(x))
135
- {
136
- particleActiveState.push_back(false); // if the first coordinates is a NaN do not process the particle
137
- auto particle_coords = new PyATCoordinates{x, xp, y, yp, deltap, ct};
138
- pyATParticles.push_back(particle_coords);
139
- return;
140
- }
141
- else
142
- {
143
- particleActiveState.push_back(true);
144
- auto particle_coords = new PyATCoordinates{x, xp, y, yp, deltap, ct};
145
- pyATParticles.push_back(particle_coords);
146
- }
147
-
148
- G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
149
- G4ParticleDefinition* particleDef = particleTable->FindParticle(pdgID);
150
- if (!particleDef)
151
- {throw BDSException("BDSBunchUserFile> Particle \"" + std::to_string(pdgID) + "\" not found");}
152
-
153
- BDSIonDefinition* ionDef = nullptr;
154
- if (BDS::IsIon(particleDef))
155
- {
156
- throw std::invalid_argument("Particle \"" + std::to_string(pdgID) + "\" is an ion and is not supported.");
157
- }
158
-
159
- G4double mass = particleDef->GetPDGMass();
160
- G4double p = referenceMomentum * (G4double) deltap + referenceMomentum;
161
- G4double totalEnergy = std::sqrt(p * p + mass * mass);
162
- G4double t = - (G4double) ct * CLHEP::m / CLHEP::c_light; // this is time difference in ns TODO: how to treat the minus?
163
-
164
- G4double zp = BDSBunch::CalculateZp(xp,yp,1);
165
-
166
- BDSParticleCoordsFull coords = BDSParticleCoordsFull(x * CLHEP::m,
167
- y * CLHEP::m,
168
- 0,
169
- xp,
170
- yp,
171
- zp,
172
- t,
173
- 0,
174
- totalEnergy,
175
- 1);
176
-
177
- // Add the energy of the particle to a total count
178
- // This allows to calculate the differential between energy in and energy out,
179
- // which is an approximation of the energy lost in the collimator
180
- energyIn += totalEnergy;
181
-
182
- // Wrap in our class that calculates momentum and kinetic energy.
183
- // Requires that one of E, Ek, P be non-zero (only one).
184
-
185
- BDSParticleDefinition* particleDefinition = nullptr;
186
- try
187
- {
188
- particleDefinition = new BDSParticleDefinition(particleDef, totalEnergy * CLHEP::GeV, 0, 0, 1, ionDef);
189
- }
190
- catch (const BDSException& e)
191
- {// if we throw an exception the object is invalid for the delete on the next loop
192
- particleDefinition = nullptr; // reset back to nullptr for safe delete
193
- return;
194
- }
195
-
196
- if (particleDefinition)
197
- {
198
- maxParticleID++;
199
- int pyatID = maxParticleID; // Set the particle ID to the current particle count
200
- stp->AddParticle(particleDefinition, coords, pyatID, pyatID);
201
- auto part = stp->GetNextParticleLocal();
202
- bds->SetCurrentMaximumExternalParticleID(maxParticleID);
203
- }
204
- }
205
-
206
-
207
- void PyATInterface::collimate()
208
- {
209
- if (!stp->Size())
210
- {
211
- std::cout << "No particles loaded, skip processing" << std::endl;
212
- return;
213
- }
214
-
215
- bds->BeamOn((G4int)stp->Size());
216
- }
217
-
218
-
219
- void PyATInterface::selectCollimator(const std::string& collimatorName)
220
- {
221
- currentCollimatorName = collimatorName;
222
- // This doesn't throw an error if the element doesn't exist
223
- bds->SelectLinkElement(collimatorName);
224
-
225
- // Check if the element exists by querying the index: -1 means it doesn't exist
226
- if (bds->GetLinkIndex(collimatorName) == -1)
227
- {throw std::runtime_error("Element not found " + collimatorName);}
228
- }
229
-
230
-
231
- void PyATInterface::clearData()
232
- {
233
- bds->ClearSamplerHits();
234
- stp->ClearParticles();
235
- currentCollimatorName.clear();
236
-
237
- for (auto part : pyATParticles)
238
- {
239
- delete part;
240
- }
241
-
242
- std::vector<PyATCoordinates*>().swap(pyATParticles);
243
- std::vector<bool>().swap(particleActiveState);
244
-
245
- maxParticleID = 0;
246
-
247
- energyIn = 0.0;
248
- energyOut = 0.0;
249
- processingDone = false;
250
- }
251
-
252
-
253
- double PyATInterface::GetEnergyDifferential()
254
- {
255
- if (!processingDone)
256
- {throw std::runtime_error("The energy differential can only be computed when the processing is complete");}
257
-
258
- return (energyIn - energyOut) / CLHEP::GeV;
259
- }
260
-
261
- py::array_t<double> PyATInterface::collimateReturn()
262
- {
263
- // Access the sampler hits - particles reaching the planes for transport back
264
- const BDSHitsCollectionSamplerLink* hits = bds->SamplerHits();
265
-
266
- size_t hitsCount = hits ? hits->GetSize() : 0;
267
-
268
- // Count the number of secondary particles
269
- size_t secondaryCount = 0;
270
- for (size_t i = 0; i < hitsCount; i++)
271
- {
272
- auto hit = (*hits)[i];
273
- if (hit->externalParticleID != hit->externalParentID) { secondaryCount++; }
274
- }
275
-
276
- // The output arrays has slots for all primary particles, regardless if lost or not, and for secondary particles
277
- size_t output_size = particleActiveState.size() + secondaryCount;
278
-
279
- // Prepare the numpy array that will be returned
280
- auto result = py::array(py::buffer_info(
281
- nullptr, /* Pointer to data (nullptr -> ask NumPy to allocate!) */
282
- sizeof(double), /* Size of one item */
283
- py::format_descriptor<double>::value, /* Buffer format */
284
- 2, /* How many dimensions? */
285
- { 6, (int) output_size }, /* Number of elements for each dimension */
286
- { sizeof(double), 6 * sizeof(double) } /* Strides for each dimension */
287
- ));
288
-
289
- auto buf = result.request();
290
-
291
- auto *array_ptr = (double *) buf.ptr;
292
-
293
- // Loop through the particles in the *original* bunch - the primaries
294
- size_t hits_index = 0;
295
- size_t secondary_write_offset = particleActiveState.size();
296
-
297
- bool prim_survied = false;
298
- double sum_deltaplusone_sec = 0.0;
299
-
300
-
301
- for (size_t i=0; i < particleActiveState.size(); i++)
302
- {
303
- auto original_coordinates = pyATParticles.at(i);
304
- if (!particleActiveState.at(i))
305
- {
306
- // The particle was inactive coming in - keep the original coordinates
307
- array_ptr[i*6] = original_coordinates->x;
308
- array_ptr[i*6 + 1] = original_coordinates->px;
309
- array_ptr[i*6 + 2] = original_coordinates->y;
310
- array_ptr[i*6 + 3] = original_coordinates->py;
311
- array_ptr[i*6 + 4] = original_coordinates->deltap;
312
- array_ptr[i*6 + 5] = original_coordinates->ct;
313
- continue;
314
- }
315
-
316
- auto part = stp->GetNextParticle(); // Advance through the bunch
317
- auto prim_part_id = stp->CurrentExternalParticleID(); // Get the ID of the primary particle
318
-
319
- // Now start looping over the hits - the particles to be returned to the tracker
320
- // These can be primary or secondary particles. Each primary can produce 0, 1, or 2+ products
321
- // The products need to be sorted to keep the array order - surviving primary particles are all
322
- // filled in first. If a primary didn't survive, make its coords NaNs to keep the array structure.
323
- // The hits are ordered by primary event, so just need one loop.
324
- while (hits_index < hitsCount)
325
- {
326
- BDSHitSamplerLink* hit = (*hits)[hits_index];
327
-
328
- if (hit->externalParentID != prim_part_id) { // The hits corresponding to the current primary are exhausted
329
- break;
330
- }
331
-
332
- const BDSParticleCoordsFull &coords = hit->coords;
333
-
334
- double mass = hit-> mass;
335
- double E = coords.totalEnergy;
336
-
337
- energyOut += E; // Update the tally of outgoing energy for computation of energy lost
338
-
339
- double p = std::sqrt(E * E - mass * mass);
340
-
341
- double deltap = (p - referenceMomentum) / referenceMomentum;
342
-
343
- double collLength = bds->GetArcLengthOfLinkElement(currentCollimatorName);
344
- /// Need to compensate for the geometry construction in BDSIM
345
- /// There is a safety margin that is added to the collimator legnth
346
- double collMargin = 2.5 * BDSSamplerCustom::ChordLength();
347
-
348
- //double ct = (collLength + collMargin) / beta0 - CLHEP::c_light * coords.T;
349
- double ct = CLHEP::c_light * ((collLength + collMargin) / (CLHEP::c_light * beta0) - coords.T);
350
-
351
- auto track_id = hit->externalParticleID;
352
-
353
- size_t out_index; // The index of the slot to populate in the output array
354
-
355
- if (track_id == hit->externalParentID){
356
- // This is a primary particle as its parent is itself
357
- prim_survied = true;
358
- out_index = i;
359
- }
360
- else
361
- {
362
- // Secondary particles are populated in the array slots after all the primary particles
363
- out_index = secondary_write_offset;
364
- secondary_write_offset++;
365
- }
366
-
367
- array_ptr[out_index*6] = coords.x / CLHEP::m;
368
- array_ptr[out_index*6 + 1] = coords.xp;
369
- array_ptr[out_index*6 + 2] = coords.y / CLHEP::m;
370
- array_ptr[out_index*6 + 3] = coords.yp;
371
- array_ptr[out_index*6 + 4] = deltap;
372
- array_ptr[out_index*6 + 5] = ct / CLHEP::m;
373
-
374
- // Accumulate the delta of the secondary particles to correct the delta of the
375
- // lost primary particle
376
- sum_deltaplusone_sec += (deltap + 1);
377
-
378
- hits_index++;
379
- }
380
-
381
- if (!prim_survied) // The primary didn't survive - populate with NaNs
382
- {
383
- double delta_lost = original_coordinates->deltap - sum_deltaplusone_sec;
384
-
385
- array_ptr[i*6] = original_coordinates->x;
386
- array_ptr[i*6 + 1] = original_coordinates->px;
387
- array_ptr[i*6 + 2] = original_coordinates->y;
388
- array_ptr[i*6 + 3] = original_coordinates->py;
389
-
390
- array_ptr[i*6 + 4] = delta_lost;
391
- // array_ptr[i*6 + 5] = std::numeric_limits<double>::infinity(); //std::nan(""); // This marks the particle as lost;
392
- array_ptr[i*6 + 5] = std::nan(""); // This marks the particle as lost;
393
- }
394
-
395
- prim_survied = false; // reset for next particle
396
- sum_deltaplusone_sec = 0;
397
-
398
- }
399
-
400
- processingDone = true; // Mark the processing as completed, enabling access to energy lost at the collimator
401
-
402
- return result;
403
- }
@@ -1,100 +0,0 @@
1
- #include "BDSBunchSixTrackLink.hh"
2
- #include "BDSException.hh"
3
- #include "BDSIMLink.hh"
4
- #include "BDSIonDefinition.hh"
5
- #include "BDSParticleCoordsFull.hh"
6
- #include "BDSParticleDefinition.hh"
7
- #include "BDSPhysicsUtilities.hh"
8
-
9
- #include "G4Electron.hh"
10
- #include "G4GenericIon.hh"
11
- #include "G4IonTable.hh"
12
- #include "G4ParticleDefinition.hh"
13
- #include "G4ParticleTable.hh"
14
- #include "G4Types.hh"
15
-
16
- #include "CLHEP/Units/PhysicalConstants.h"
17
- #include "CLHEP/Units/SystemOfUnits.h"
18
-
19
- #include <algorithm>
20
- #include <cmath>
21
- #include <iostream>
22
- #include <set>
23
- #include <string>
24
- #include <vector>
25
-
26
- #include <pybind11/pybind11.h>
27
- #include <pybind11/numpy.h>
28
-
29
- namespace py = pybind11;
30
-
31
- // The struct is only used for inactive particle coodrinates for now
32
- struct PyATCoordinates{
33
- double x;
34
- double px;
35
- double y;
36
- double py;
37
- double deltap;
38
- double ct;
39
- };
40
-
41
- class PyATInterface
42
- {
43
- public:
44
- PyATInterface() = delete; // No default constructor
45
-
46
- PyATInterface(const std::string& bdsimConfigFile,
47
- int referencePdgIdIn,
48
- double referenceMomentum,
49
- double relativeEnergyCutIn,
50
- int seedIn,
51
- bool batchMode);
52
-
53
- virtual ~PyATInterface();
54
-
55
- void addCollimator(const std::string& name,
56
- const std::string& material,
57
- double lengthIn,
58
- double apertureIn,
59
- double rotationIn,
60
- double xOffsetIn,
61
- double yOffsetIn,
62
- double jawTiltLeft,
63
- double jawTiltRight,
64
- int side);
65
-
66
- void addParticle(const py::array_t<double>& coordiantes);
67
-
68
- void collimate();
69
- void clearData();
70
- void selectCollimator(const std::string& name);
71
- double GetEnergyDifferential();
72
-
73
- py::array_t<double> collimateReturn();
74
-
75
- private:
76
- BDSIMLink* bds = nullptr;
77
- BDSBunchSixTrackLink* stp = nullptr;
78
- std::vector<char *> argv;
79
- std::vector<bool> particleActiveState;
80
-
81
- std::vector<PyATCoordinates*> pyATParticles;
82
-
83
- long long int pdgID = 0;
84
- double referenceEk = 0.0;
85
- double relativeEnergyCut = 0.0;
86
- int seed = 0;
87
-
88
- G4double referenceMass = 0.0;
89
- G4double referenceMomentum = 0.0;
90
- G4double referenceEnergy = 0.0;
91
- G4double beta0 = 0.0; // relativistic beta for the primary particle
92
-
93
- G4double energyIn = 0.0;
94
- G4double energyOut = 0.0;
95
-
96
- std::string currentCollimatorName;
97
- int maxParticleID = 0;
98
-
99
- bool processingDone = false;
100
- };