xcoll 0.3.5__py3-none-any.whl → 0.4.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.
Files changed (56) hide show
  1. xcoll/__init__.py +12 -4
  2. xcoll/beam_elements/__init__.py +7 -5
  3. xcoll/beam_elements/absorber.py +41 -7
  4. xcoll/beam_elements/base.py +1161 -244
  5. xcoll/beam_elements/collimators_src/black_absorber.h +118 -0
  6. xcoll/beam_elements/collimators_src/black_crystal.h +111 -0
  7. xcoll/beam_elements/collimators_src/everest_block.h +40 -28
  8. xcoll/beam_elements/collimators_src/everest_collimator.h +129 -50
  9. xcoll/beam_elements/collimators_src/everest_crystal.h +217 -73
  10. xcoll/beam_elements/everest.py +60 -113
  11. xcoll/colldb.py +250 -750
  12. xcoll/general.py +2 -2
  13. xcoll/headers/checks.h +1 -1
  14. xcoll/headers/particle_states.h +2 -2
  15. xcoll/initial_distribution.py +195 -0
  16. xcoll/install.py +177 -0
  17. xcoll/interaction_record/__init__.py +1 -0
  18. xcoll/interaction_record/interaction_record.py +252 -0
  19. xcoll/interaction_record/interaction_record_src/interaction_record.h +98 -0
  20. xcoll/{impacts → interaction_record}/interaction_types.py +11 -4
  21. xcoll/line_tools.py +83 -0
  22. xcoll/lossmap.py +209 -0
  23. xcoll/manager.py +2 -937
  24. xcoll/rf_sweep.py +1 -1
  25. xcoll/scattering_routines/everest/amorphous.h +239 -0
  26. xcoll/scattering_routines/everest/channeling.h +245 -0
  27. xcoll/scattering_routines/everest/crystal_parameters.h +137 -0
  28. xcoll/scattering_routines/everest/everest.h +8 -30
  29. xcoll/scattering_routines/everest/everest.py +13 -10
  30. xcoll/scattering_routines/everest/jaw.h +27 -197
  31. xcoll/scattering_routines/everest/materials.py +2 -0
  32. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +31 -10
  33. xcoll/scattering_routines/everest/nuclear_interaction.h +86 -0
  34. xcoll/scattering_routines/geometry/__init__.py +6 -0
  35. xcoll/scattering_routines/geometry/collimator_geometry.h +219 -0
  36. xcoll/scattering_routines/geometry/crystal_geometry.h +150 -0
  37. xcoll/scattering_routines/geometry/geometry.py +26 -0
  38. xcoll/scattering_routines/geometry/get_s.h +92 -0
  39. xcoll/scattering_routines/geometry/methods.h +111 -0
  40. xcoll/scattering_routines/geometry/objects.h +154 -0
  41. xcoll/scattering_routines/geometry/rotation.h +23 -0
  42. xcoll/scattering_routines/geometry/segments.h +226 -0
  43. xcoll/scattering_routines/geometry/sort.h +184 -0
  44. {xcoll-0.3.5.dist-info → xcoll-0.4.0.dist-info}/METADATA +1 -1
  45. {xcoll-0.3.5.dist-info → xcoll-0.4.0.dist-info}/RECORD +48 -33
  46. xcoll/beam_elements/collimators_src/absorber.h +0 -141
  47. xcoll/collimator_settings.py +0 -457
  48. xcoll/impacts/__init__.py +0 -1
  49. xcoll/impacts/impacts.py +0 -102
  50. xcoll/impacts/impacts_src/impacts.h +0 -99
  51. xcoll/scattering_routines/everest/crystal.h +0 -1302
  52. xcoll/scattering_routines/everest/scatter.h +0 -169
  53. xcoll/scattering_routines/everest/scatter_crystal.h +0 -260
  54. {xcoll-0.3.5.dist-info → xcoll-0.4.0.dist-info}/LICENSE +0 -0
  55. {xcoll-0.3.5.dist-info → xcoll-0.4.0.dist-info}/NOTICE +0 -0
  56. {xcoll-0.3.5.dist-info → xcoll-0.4.0.dist-info}/WHEEL +0 -0
@@ -1,36 +1,41 @@
1
1
  LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
2
  NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
3
- xcoll/__init__.py,sha256=XO53i_KKg6kaJfTCpmNJLy14tou4RMF9MDuXlH70iTQ,642
4
- xcoll/beam_elements/__init__.py,sha256=4ekQv_1Kxwqd0VSaPzMpVQ1V9RMX5tr-ycBBiTIFyRw,776
5
- xcoll/beam_elements/absorber.py,sha256=yxF-NhnQs_l7s-M_0AhdKzx0YVgvhujOAwQnAbVTSOs,1260
6
- xcoll/beam_elements/base.py,sha256=Nwgg2v1RdEEpByFG8AZgL7E6ecESbYm3mqnIfoh5SFQ,15785
7
- xcoll/beam_elements/collimators_src/absorber.h,sha256=ZsAzIZ3uWP15unMJyuxbuD5lVgFeWAwQsuyOj_ZSkjI,5502
8
- xcoll/beam_elements/collimators_src/everest_block.h,sha256=Gpr5wyFLtcaNgVj3auKgFWB-2KPP5cjbEWTfC3f9q1U,5596
9
- xcoll/beam_elements/collimators_src/everest_collimator.h,sha256=wsGIFBb-VMCRhxwK2G5k9SEX-6SzIgRX4XE5g_I2okg,6296
10
- xcoll/beam_elements/collimators_src/everest_crystal.h,sha256=pX9cmW5lfsUoszR14tXWU4Emu-0VwX4bbfg6Q6pxXR4,5164
11
- xcoll/beam_elements/everest.py,sha256=JxmREXln3p3c9XEcHp-DgDbXFzc9txiGrxvjOrDUacs,11369
12
- xcoll/colldb.py,sha256=_MywNPz9cDocGPsfXpBVkjADyAGGVFQQRUI4kxOQaOg,49476
13
- xcoll/collimator_settings.py,sha256=uj25cpSaM-EY7VM65OUq3Cxb8gedSmi-r9mpkP-ikrg,17015
14
- xcoll/general.py,sha256=GmSHLnkZaNMSyt8VDmfhSzW7HzQczo4nkfDZpQ3E8C0,525
15
- xcoll/headers/checks.h,sha256=3CLIa2etrJVKBfxdsHcS8NirqzVDHG9aCbrlMwkWuHw,1586
16
- xcoll/headers/particle_states.h,sha256=YxpS56_ZD8mhrqKTohcyVe3hbQZ6H9vspYHSVM6a5-U,844
17
- xcoll/impacts/__init__.py,sha256=yKQdIeLG2CT3qo-iZB6MODm-WHzkTmulgUvOAS41w7E,39
18
- xcoll/impacts/impacts.py,sha256=J7FfcxIprUMHyn5oZhmjhvBewXOp7kwJtErStOsAwJQ,3953
19
- xcoll/impacts/impacts_src/impacts.h,sha256=0eq4Z8xDPMJzN8yPF3lTkDsld6W54tbXmynZEbXCh4c,5950
20
- xcoll/impacts/interaction_types.py,sha256=iHbhC4beN1vZRWeHbALqSFo8lG10R7asc08BRpIqXx0,2493
21
- xcoll/manager.py,sha256=A7hCuSgS7sSFKoV26Nt8xc_GXUNOm-WRqsGftRoBMzA,45052
22
- xcoll/rf_sweep.py,sha256=_cnDb2d0_tfVrrwuubLOSyUHpMQHMvmSzYgd_-WfJg0,8936
3
+ xcoll/__init__.py,sha256=EN8qYpv6nXGTqJYF307Q8BivglN7YD_2JmZYQOvAceg,929
4
+ xcoll/beam_elements/__init__.py,sha256=NiOjiV5t266rFfJAbSrNY07GDSXbD3fSrulRJe3CnwU,981
5
+ xcoll/beam_elements/absorber.py,sha256=jDCSjaBUmflDVS4DlfimA-MJurFYaqVvUO8j0xXQzOQ,2508
6
+ xcoll/beam_elements/base.py,sha256=fW9QmzsKohXH5VivU55NefmJ82FJiHAN1wbkniD05b4,49646
7
+ xcoll/beam_elements/collimators_src/black_absorber.h,sha256=PBRqmr24jngZQ8UZlYsodGRT4018_k3qvWmvmMIpjFw,4478
8
+ xcoll/beam_elements/collimators_src/black_crystal.h,sha256=l5_9QrQgsau-0PfEaYV9m394-JMOMm9MsJNkl4WFUM8,4082
9
+ xcoll/beam_elements/collimators_src/everest_block.h,sha256=OhJ6M2qrqxCHUWRs9GgMOBr3E15pI2UyO_eHyqWGkSU,5970
10
+ xcoll/beam_elements/collimators_src/everest_collimator.h,sha256=hnn1zOsLXcBpNtVdQWWJHxmWmt2BhSF0wuqU8s7bO7g,9857
11
+ xcoll/beam_elements/collimators_src/everest_crystal.h,sha256=kaswVVR1a6STSaRihevk7J9XDDPevefAIpJLmCmk3k8,11822
12
+ xcoll/beam_elements/everest.py,sha256=nuqnIn8lOERD-lbdk-21aeh_OjEswioLbtCxqosxIu0,8405
13
+ xcoll/colldb.py,sha256=Eu-Vphi0FStulGCG9UG37dVULkybYwB9agEydjeLN-o,29822
14
+ xcoll/general.py,sha256=r0XT40A_S2MEDtXD8L10drQoXlfvHJR3oHULY_x4wKQ,525
15
+ xcoll/headers/checks.h,sha256=IMLhQMnh3t-t9UhVK-1hfS4GVgl2Mry69H_17By00M0,1582
16
+ xcoll/headers/particle_states.h,sha256=WCzeHAniEK7sX7HTwhoIgewioQ7SibGn01RLrhVI98k,840
17
+ xcoll/initial_distribution.py,sha256=Ibsyc8h6Sw4spaxjYVbKKuqQJUxXNhKci1eCmZEKK3M,7858
18
+ xcoll/install.py,sha256=oJ2oWMJTA1GiaU6XZrimG2MFPOvGF0Hr5-SfHIZ2184,7552
19
+ xcoll/interaction_record/__init__.py,sha256=UFoLiKa-z2oX7YoszP-7Vgdt1nM6kT382v1CaIu8_u0,50
20
+ xcoll/interaction_record/interaction_record.py,sha256=HasJDWRVQnMbptWFg4ElKuV2shcdtiRsJGweWiuWqvU,10733
21
+ xcoll/interaction_record/interaction_record_src/interaction_record.h,sha256=n3CSYiC_3hk52oAeNM9-Xg_aWXMNAwhi5E2ANxnXW28,5949
22
+ xcoll/interaction_record/interaction_types.py,sha256=_UGq-PBq30hj1lp29CpNTmmwzsP7tuCng8ZIAALnzCc,2894
23
+ xcoll/line_tools.py,sha256=vQi9fuUQOme2XkHEj47tqcFtL6jJ2-H06U4Gw7Vds64,3250
24
+ xcoll/lossmap.py,sha256=uzZpSe0R0UzvxDxauK5X2AegJapc7Q-Eg3B8WmmR8Js,7486
25
+ xcoll/manager.py,sha256=Uy58saX2836q_CZjNa5at611k38Za_L9jQSTqBQXooA,343
26
+ xcoll/rf_sweep.py,sha256=5ABhou9cZcLYQ8DSPYowPpLCea8zJQyhWgUa7JUHJIg,8936
23
27
  xcoll/scattering_routines/everest/__init__.py,sha256=yuCzolZkiL7mHaBXCKHRl66VxjKFB0t9Vyw9TtFv1Bo,286
28
+ xcoll/scattering_routines/everest/amorphous.h,sha256=9iYYsak-Z2UR1tCQjkSUs0LNPiFGkZ7nQnqXpbaZxqY,10424
29
+ xcoll/scattering_routines/everest/channeling.h,sha256=I-YUqzqihgYOgWJyGmpXMspF_Yv9M2QB1lWToyFVqYA,11313
24
30
  xcoll/scattering_routines/everest/constants.h,sha256=9Kus-RKyxsGdlxx9tfMWUz2H5Q-qy6y_F4kddIZzO30,1390
25
- xcoll/scattering_routines/everest/crystal.h,sha256=WlA_e9ePuVhc9fmMVdSXFBKvHrFvCQ5aG4d67iMrtuQ,54119
26
- xcoll/scattering_routines/everest/everest.h,sha256=p4yfzxRvh19N-V1vorf_CCIBotodV40Lcrzzy7339WM,3743
27
- xcoll/scattering_routines/everest/everest.py,sha256=zfKZXHvXM6ikoI2KUZ0_BWLCuxLZEvP1pgW5vFIgwQ4,1306
28
- xcoll/scattering_routines/everest/jaw.h,sha256=lmijUU7ih4veifVho3ehGe0DVyIYkDHMVIIclDNbZds,7308
29
- xcoll/scattering_routines/everest/materials.py,sha256=9ZhBd6-n2AsTbCxLhjPoU4pOcmKstl6gbeqLno1dY4c,9410
30
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h,sha256=0Euxsnc2BU8YqxYwfXZIiplNcnDzFq9HgWAoqGwuSAg,4518
31
+ xcoll/scattering_routines/everest/crystal_parameters.h,sha256=NjCYWbl3Gyv0OXKdeK7N3oisbMAkg4PnTmayGlRU9YI,5416
32
+ xcoll/scattering_routines/everest/everest.h,sha256=rfVm0q1PQwLoEadF7wiliBSWzOcto4BLwoU1DaHA-Sk,2658
33
+ xcoll/scattering_routines/everest/everest.py,sha256=oRxiuzCBvuEyxzxjOyV-AcgpqzMBa0iVUQqTyxkNUcw,1460
34
+ xcoll/scattering_routines/everest/jaw.h,sha256=hLofF1skic08_HTydiwkH2Ylo2pN_rHS6C_QgmWNL5c,2270
35
+ xcoll/scattering_routines/everest/materials.py,sha256=SaSx2jUImYkiwSgWCJj88ULeSD0y_pJhCgkck8omtTY,9524
36
+ xcoll/scattering_routines/everest/multiple_coulomb_scattering.h,sha256=HkS1Yjxqnb7mjhkfkj2zY325F1K9RWCprnZ4sEcSbLY,5400
37
+ xcoll/scattering_routines/everest/nuclear_interaction.h,sha256=Jr3uSDwGJNnsJIDr72JWbMsg4Zbm_wXW9180K5u9duA,3113
31
38
  xcoll/scattering_routines/everest/properties.h,sha256=aRqkX5ZpUeTnbygqFVsoIKwWyoB5VXzD5vq5d-xiI74,6585
32
- xcoll/scattering_routines/everest/scatter.h,sha256=jl-SAIpizYCbUfy1KAhuO00sA5BBhNBCIjueQ8bCxoQ,6333
33
- xcoll/scattering_routines/everest/scatter_crystal.h,sha256=BHBPNiMKynq1XNxIiWJXYxMwW2bhmmbmC8j7-Dy-SNs,9455
34
39
  xcoll/scattering_routines/fluka/build_fluka_input.py,sha256=NDPg191eVTcSrX3nEWdyg0LIWf-gCJI1YWo2NqW9xtU,2270
35
40
  xcoll/scattering_routines/fluka/flukaio/.git,sha256=5ZxurpwP1waJk2Zu2AstENGOp4rXU8-C-oU4CypmIVI,73
36
41
  xcoll/scattering_routines/fluka/flukaio/.gitignore,sha256=bhrpWiAnKChkcwIaIPX_zKxyG2nCtNzNgQAHnIJa8Fw,12
@@ -104,8 +109,18 @@ xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.h,sha256=0
104
109
  xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFortranFlukaIO.h,sha256=WxAjG2SPlWqMG38iHBM8GQwh5yp031jAGeyPi4y9G4c,330
105
110
  xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.c,sha256=JcgCWxbT-ZOeG0c9mz1kk3PfXjaazaUk2P_ROtoBKaY,1452
106
111
  xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.h,sha256=JTMU9FtCBJkitsnHp7kWKUbPSN4rviRfJgVHK26AuPY,906
107
- xcoll-0.3.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
108
- xcoll-0.3.5.dist-info/METADATA,sha256=yXWjT5kF0eQrDD9R-y6P8ncw3j6vgbfNbzITB1sq9SM,2709
109
- xcoll-0.3.5.dist-info/NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
110
- xcoll-0.3.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
111
- xcoll-0.3.5.dist-info/RECORD,,
112
+ xcoll/scattering_routines/geometry/__init__.py,sha256=dnq9E5n8TUIIAjooE3zXHFAh_QTlSzpI2pCiuJ17NAs,221
113
+ xcoll/scattering_routines/geometry/collimator_geometry.h,sha256=tfyZl9eVQKqJHGTveErCTpn-FO8EigCAgy3-NkWri2Q,7887
114
+ xcoll/scattering_routines/geometry/crystal_geometry.h,sha256=SVsUHz3AgERmYycVbkAHoNDAUNzAEiBkYHwMMI0SGUc,4887
115
+ xcoll/scattering_routines/geometry/geometry.py,sha256=wvvTWhF3mbZEowZu4oEi7QDxFwQxDrV88N3jkdXAjJ8,1102
116
+ xcoll/scattering_routines/geometry/get_s.h,sha256=1gss-BVzVzD5E4ebPtRUeq4t8eHIBofWA6a84EGTnt4,2947
117
+ xcoll/scattering_routines/geometry/methods.h,sha256=SUo6N7XWsGN9S6gg5RoGNEJ8mmbHuHKzaH9R4R_UDPQ,3747
118
+ xcoll/scattering_routines/geometry/objects.h,sha256=lNFEfqrSDnJuB6sKh59bbg52bGqOHqjt44jl4YlazmI,5499
119
+ xcoll/scattering_routines/geometry/rotation.h,sha256=AvNwcqAAlhjEUtSbTqi53BTvzR256gtfUYcM5jlXUco,701
120
+ xcoll/scattering_routines/geometry/segments.h,sha256=IAz4IWvarIIpX7Waph-Hh2j6o6n_2uCPmHxxQp8Q3yg,7667
121
+ xcoll/scattering_routines/geometry/sort.h,sha256=wNdQLwEn58jgeSG4B9x-jfm7vOjN4hnAlxZ3SG-SkWg,5763
122
+ xcoll-0.4.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
123
+ xcoll-0.4.0.dist-info/METADATA,sha256=7--PbyNsEcm2q1tjmu4HHEBdv6MzA9DLmyK_VlTqsxA,2709
124
+ xcoll-0.4.0.dist-info/NOTICE,sha256=6DO_E7WCdRKc42vUoVVBPGttvQi4mRt9fAcxj9u8zy8,74
125
+ xcoll-0.4.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
126
+ xcoll-0.4.0.dist-info/RECORD,,
@@ -1,141 +0,0 @@
1
- // copyright ############################### #
2
- // This file is part of the Xcoll Package. #
3
- // Copyright (c) CERN, 2024. #
4
- // ######################################### #
5
-
6
- #ifndef XCOLL_ABSORBER_H
7
- #define XCOLL_ABSORBER_H
8
-
9
- /*gpufun*/
10
- int64_t is_within_aperture(LocalParticle* part, double jaw_L, double jaw_R){
11
- double const x = LocalParticle_get_x(part);
12
- return (int64_t)((x > jaw_R) && (x < jaw_L) );
13
- }
14
-
15
- /*gpufun*/
16
- void BlackAbsorber_track_local_particle(BlackAbsorberData el, LocalParticle* part0){
17
-
18
- // Collimator active and length
19
- int8_t is_active = BlackAbsorberData_get_active(el);
20
- is_active *= BlackAbsorberData_get__tracking(el);
21
- double const inactive_front = BlackAbsorberData_get_inactive_front(el);
22
- double const inactive_back = BlackAbsorberData_get_inactive_back(el);
23
- double const active_length = BlackAbsorberData_get_active_length(el);
24
- // Collimator jaws
25
- double const jaw_L = BlackAbsorberData_get_jaw_L(el);
26
- double const jaw_R = BlackAbsorberData_get_jaw_R(el);
27
- double const sin_yL = BlackAbsorberData_get_sin_yL(el);
28
- double const sin_yR = BlackAbsorberData_get_sin_yR(el);
29
- double const jaw_LU = jaw_L - sin_yL*active_length/2.;
30
- double const jaw_LD = jaw_L + sin_yL*active_length/2.;
31
- double const jaw_RU = jaw_R - sin_yR*active_length/2.;
32
- double const jaw_RD = jaw_R + sin_yR*active_length/2.;
33
- // TODO: need shortening of active length!
34
- // Collimator reference frame
35
- double const sin_zL = BlackAbsorberData_get_sin_zL(el);
36
- double const cos_zL = BlackAbsorberData_get_cos_zL(el);
37
- double const sin_zR = BlackAbsorberData_get_sin_zR(el);
38
- double const cos_zR = BlackAbsorberData_get_cos_zR(el);
39
- if (fabs(sin_zL-sin_zR) > 1.e-10 || fabs(cos_zL-cos_zR) > 1.e-10 ){
40
- kill_all_particles(part0, XC_ERR_NOT_IMPLEMENTED);
41
- };
42
- double const dx = BlackAbsorberData_get_ref_x(el);
43
- double const dy = BlackAbsorberData_get_ref_y(el);
44
- // Impact table
45
- CollimatorImpactsData record = BlackAbsorberData_getp_internal_record(el, part0);
46
- RecordIndex record_index = NULL;
47
- if (record){
48
- record_index = CollimatorImpactsData_getp__index(record);
49
- }
50
-
51
- //start_per_particle_block (part0->part)
52
-
53
- double s_collimator = LocalParticle_get_s(part);
54
-
55
- // Go to collimator reference system (centered around orbit)
56
- XYShift_single_particle(part, dx, dy);
57
- SRotation_single_particle(part, sin_zL, cos_zL);
58
-
59
- int64_t is_alive = 1;
60
-
61
- if (!is_active){
62
-
63
- // If collimator not active, replace with drift
64
- Drift_single_particle(part, inactive_front+active_length+inactive_back);
65
-
66
- } else {
67
-
68
- int8_t is_tracking = assert_tracking(part, XC_ERR_INVALID_TRACK);
69
- if (is_tracking) {
70
-
71
- // Drift inactive length before jaw
72
- Drift_single_particle(part, inactive_front);
73
-
74
- // Store transversal coordinates for potential backtracking later
75
- double x_F = LocalParticle_get_x(part);
76
- // double y_F = LocalParticle_get_y(part);
77
-
78
- // Check if hit on the collimator jaw at the front
79
- is_alive = is_within_aperture(part, jaw_LU, jaw_RU);
80
-
81
- // Continue if the particle didn't hit the collimator
82
- if (is_alive){
83
-
84
- // Drift the jaw length
85
- Drift_single_particle(part, active_length);
86
-
87
- // Check if hit on the collimator jaw at the back
88
- is_alive = is_within_aperture(part, jaw_LD, jaw_RD);
89
-
90
- // TODO: is there a performance difference with nesting the ifs or not?
91
- // Continue if the particle didn't hit the collimator
92
- if (is_alive){
93
-
94
- // Drift inactive length after jaw
95
- Drift_single_particle(part, inactive_back);
96
-
97
- } else {
98
-
99
- // Backtrack to the particle position of impact
100
- // This should only be done if the particle did NOT hit the front jaw
101
- double x_B = LocalParticle_get_x(part);
102
- // double y_B = LocalParticle_get_y(part);
103
- double length;
104
-
105
- if (x_B > 0){ // Left jaw
106
- length = (jaw_LD - x_B) / (jaw_LD - jaw_LU - x_B + x_F) * active_length;
107
- } else if (x_B < 0){ // Right jaw
108
- length = (jaw_RD - x_B) / (jaw_RD - jaw_RU - x_B + x_F) * active_length;
109
- // TODO: check this
110
- // } else if (y_B > 0){ // Upper jaw
111
- // length = (y_B - jaw_U) / (y_B - y_F) * active_length;
112
- // } else if (y_B < 0){ // Lower jaw
113
- // length = (y_B - jaw_D) / (y_B - y_F) * active_length;
114
- } else {
115
- length = 0;
116
- }
117
- Drift_single_particle(part, -length);
118
-
119
- }
120
- }
121
- }
122
- }
123
-
124
- // Update dead particles
125
- if (!is_alive){
126
-
127
- LocalParticle_set_state(part, XC_LOST_ON_ABSORBER);
128
-
129
- // Record impact data
130
- CollimatorImpactsData_log(record, record_index, part, XC_ABSORBED);
131
- }
132
-
133
- // Move back from collimator reference system
134
- SRotation_single_particle(part, -sin_zL, cos_zL);
135
- XYShift_single_particle(part, -dx, -dy);
136
-
137
- //end_per_particle_block
138
-
139
- }
140
-
141
- #endif