xcoll 0.5.12__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of xcoll might be problematic. Click here for more details.

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