xcoll 0.3.6__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.
- xcoll/__init__.py +12 -4
- xcoll/beam_elements/__init__.py +7 -5
- xcoll/beam_elements/absorber.py +41 -7
- xcoll/beam_elements/base.py +1161 -244
- xcoll/beam_elements/collimators_src/black_absorber.h +118 -0
- xcoll/beam_elements/collimators_src/black_crystal.h +111 -0
- xcoll/beam_elements/collimators_src/everest_block.h +40 -28
- xcoll/beam_elements/collimators_src/everest_collimator.h +129 -50
- xcoll/beam_elements/collimators_src/everest_crystal.h +217 -73
- xcoll/beam_elements/everest.py +60 -113
- xcoll/colldb.py +250 -750
- xcoll/general.py +2 -2
- xcoll/headers/checks.h +1 -1
- xcoll/headers/particle_states.h +2 -2
- xcoll/initial_distribution.py +195 -0
- xcoll/install.py +177 -0
- xcoll/interaction_record/__init__.py +1 -0
- xcoll/interaction_record/interaction_record.py +252 -0
- xcoll/interaction_record/interaction_record_src/interaction_record.h +98 -0
- xcoll/{impacts → interaction_record}/interaction_types.py +11 -4
- xcoll/line_tools.py +83 -0
- xcoll/lossmap.py +209 -0
- xcoll/manager.py +2 -937
- xcoll/rf_sweep.py +1 -1
- xcoll/scattering_routines/everest/amorphous.h +239 -0
- xcoll/scattering_routines/everest/channeling.h +245 -0
- xcoll/scattering_routines/everest/crystal_parameters.h +137 -0
- xcoll/scattering_routines/everest/everest.h +8 -30
- xcoll/scattering_routines/everest/everest.py +13 -10
- xcoll/scattering_routines/everest/jaw.h +27 -197
- xcoll/scattering_routines/everest/materials.py +2 -0
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +31 -10
- xcoll/scattering_routines/everest/nuclear_interaction.h +86 -0
- xcoll/scattering_routines/geometry/__init__.py +6 -0
- xcoll/scattering_routines/geometry/collimator_geometry.h +219 -0
- xcoll/scattering_routines/geometry/crystal_geometry.h +150 -0
- xcoll/scattering_routines/geometry/geometry.py +26 -0
- xcoll/scattering_routines/geometry/get_s.h +92 -0
- xcoll/scattering_routines/geometry/methods.h +111 -0
- xcoll/scattering_routines/geometry/objects.h +154 -0
- xcoll/scattering_routines/geometry/rotation.h +23 -0
- xcoll/scattering_routines/geometry/segments.h +226 -0
- xcoll/scattering_routines/geometry/sort.h +184 -0
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/METADATA +1 -1
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/RECORD +48 -33
- xcoll/beam_elements/collimators_src/absorber.h +0 -141
- xcoll/collimator_settings.py +0 -457
- xcoll/impacts/__init__.py +0 -1
- xcoll/impacts/impacts.py +0 -102
- xcoll/impacts/impacts_src/impacts.h +0 -99
- xcoll/scattering_routines/everest/crystal.h +0 -1302
- xcoll/scattering_routines/everest/scatter.h +0 -169
- xcoll/scattering_routines/everest/scatter_crystal.h +0 -260
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/LICENSE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/NOTICE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.4.0.dist-info}/WHEEL +0 -0
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
// copyright ############################### #
|
|
2
|
-
// This file is part of the Xcoll Package. #
|
|
3
|
-
// Copyright (c) CERN, 2023. #
|
|
4
|
-
// ######################################### #
|
|
5
|
-
|
|
6
|
-
#ifndef XCOLL_EVEREST_SCAT_H
|
|
7
|
-
#define XCOLL_EVEREST_SCAT_H
|
|
8
|
-
#include <math.h>
|
|
9
|
-
#include <stdlib.h>
|
|
10
|
-
#include <stdio.h>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/*gpufun*/
|
|
14
|
-
void scatter(EverestData restrict everest, LocalParticle* part, double length){
|
|
15
|
-
|
|
16
|
-
// geometry values
|
|
17
|
-
double aperture = everest->coll->aperture;
|
|
18
|
-
double offset = everest->coll->offset;
|
|
19
|
-
double tilt_L = everest->coll->tilt_L;
|
|
20
|
-
double tilt_R = everest->coll->tilt_R;
|
|
21
|
-
double side = everest->coll->side;
|
|
22
|
-
|
|
23
|
-
// Store initial coordinates for updating later
|
|
24
|
-
double const rpp_in = LocalParticle_get_rpp(part);
|
|
25
|
-
double const rvv_in = LocalParticle_get_rvv(part);
|
|
26
|
-
double const e0 = LocalParticle_get_energy0(part) / 1e9; // Reference energy in GeV
|
|
27
|
-
double const beta0 = LocalParticle_get_beta0(part);
|
|
28
|
-
double const ptau_in = LocalParticle_get_ptau(part);
|
|
29
|
-
double const x_in = LocalParticle_get_x(part);
|
|
30
|
-
double const px_in = LocalParticle_get_px(part);
|
|
31
|
-
double const y_in = LocalParticle_get_y(part);
|
|
32
|
-
double const py_in = LocalParticle_get_py(part);
|
|
33
|
-
double p0 = LocalParticle_get_p0c(part) / 1e9;
|
|
34
|
-
|
|
35
|
-
// TODO: missing correction due to m/m0 (but also wrong in xpart...)
|
|
36
|
-
double energy = p0*ptau_in + e0; // energy, not momentum, in GeV
|
|
37
|
-
|
|
38
|
-
// Status flags
|
|
39
|
-
int is_hit = 0;
|
|
40
|
-
int is_abs = 0;
|
|
41
|
-
|
|
42
|
-
double x = LocalParticle_get_x(part);
|
|
43
|
-
|
|
44
|
-
// For one-sided collimators consider only positive X. For negative X jump to the next particle
|
|
45
|
-
if (side==0 || (side==1 && x>=0.) || (side==2 && x<=0.)) {
|
|
46
|
-
|
|
47
|
-
double mirror = 1;
|
|
48
|
-
double tiltangle = tilt_L;
|
|
49
|
-
if (x < 0) {
|
|
50
|
-
mirror = -1;
|
|
51
|
-
tiltangle = -tilt_R;
|
|
52
|
-
LocalParticle_scale_x(part, mirror);
|
|
53
|
-
LocalParticle_scale_px(part, mirror);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Shift with opening and offset
|
|
57
|
-
LocalParticle_add_to_x(part, -aperture/2. - mirror*offset);
|
|
58
|
-
|
|
59
|
-
// Include collimator tilt
|
|
60
|
-
double rot_shift = YRotation_single_particle_rotate_only(part, 0., tiltangle);
|
|
61
|
-
Drift_single_particle_4d(part, -rot_shift);
|
|
62
|
-
|
|
63
|
-
// Check if/where particle hits collimator
|
|
64
|
-
double zlm;
|
|
65
|
-
x = LocalParticle_get_x(part);
|
|
66
|
-
double xp = LocalParticle_get_px(part)*rpp_in;
|
|
67
|
-
if (x >= 0.) { // hit at front
|
|
68
|
-
zlm = length;
|
|
69
|
-
// val_part_impact = x;
|
|
70
|
-
// store these in impact table, as interaction type 'hitting collimator' or something like that.
|
|
71
|
-
// val_part_indiv = xp;
|
|
72
|
-
} else if (xp <= 0.) { // no hit
|
|
73
|
-
zlm = 0.;
|
|
74
|
-
Drift_single_particle_4d(part, length);
|
|
75
|
-
} else { // hit from side
|
|
76
|
-
double s = -x/xp;
|
|
77
|
-
if (s < length) {
|
|
78
|
-
zlm = length - s;
|
|
79
|
-
Drift_single_particle_4d(part, s);
|
|
80
|
-
// val_part_impact = 0.;
|
|
81
|
-
// val_part_indiv = xp;
|
|
82
|
-
} else {
|
|
83
|
-
zlm = 0.;
|
|
84
|
-
Drift_single_particle_4d(part, length);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Now do the scattering part
|
|
89
|
-
if (zlm > 0.) {
|
|
90
|
-
is_hit = 1;
|
|
91
|
-
|
|
92
|
-
double* jaw_result = jaw(everest, part, energy, zlm, 1);
|
|
93
|
-
|
|
94
|
-
energy = jaw_result[0];
|
|
95
|
-
if (jaw_result[1] == 1){
|
|
96
|
-
is_abs = 1;
|
|
97
|
-
}
|
|
98
|
-
double s_out = jaw_result[2];
|
|
99
|
-
free(jaw_result);
|
|
100
|
-
|
|
101
|
-
if (is_abs != 1) {
|
|
102
|
-
// Do the rest drift, if particle left collimator early
|
|
103
|
-
Drift_single_particle_4d(part, zlm-s_out);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Transform back to particle coordinates with opening and offset
|
|
108
|
-
// Include collimator tilt
|
|
109
|
-
rot_shift = YRotation_single_particle_rotate_only(part, length, -tiltangle);
|
|
110
|
-
Drift_single_particle_4d(part, length-rot_shift);
|
|
111
|
-
|
|
112
|
-
// Transform back to particle coordinates with opening and offset
|
|
113
|
-
LocalParticle_add_to_x(part, aperture/2. + mirror*offset);
|
|
114
|
-
|
|
115
|
-
// Now mirror at the horizontal axis for negative X offset
|
|
116
|
-
if (mirror < 0) {
|
|
117
|
-
LocalParticle_scale_x(part, mirror);
|
|
118
|
-
LocalParticle_scale_px(part, mirror);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
} else {
|
|
122
|
-
Drift_single_particle_4d(part, length);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Cannot assign energy directly to LocalParticle as it would update dependent variables, but needs to be corrected first!
|
|
126
|
-
|
|
127
|
-
// Update energy ---------------------------------------------------
|
|
128
|
-
// Only particles that hit the jaw and survived need to be updated
|
|
129
|
-
if (is_hit>0 && is_abs==0){
|
|
130
|
-
double ptau_out = (energy - e0) / (e0 * beta0);
|
|
131
|
-
LocalParticle_update_ptau(part, ptau_out);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Update 4D coordinates -------------------------------------------
|
|
135
|
-
// Absorbed particles get their coordinates set to the entrance of collimator
|
|
136
|
-
if (is_abs>0){
|
|
137
|
-
LocalParticle_set_x(part, x_in);
|
|
138
|
-
LocalParticle_set_px(part, px_in);
|
|
139
|
-
LocalParticle_set_y(part, y_in);
|
|
140
|
-
LocalParticle_set_py(part, py_in);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Update longitudinal coordinate zeta -----------------------------
|
|
144
|
-
// Absorbed particles keep coordinates at the entrance of collimator, others need correcting:
|
|
145
|
-
// Non-hit particles are just drifting (zeta not yet drifted in K2, so do here)
|
|
146
|
-
if (is_hit==0){
|
|
147
|
-
LocalParticle_add_to_zeta(part, drift_zeta_single(rvv_in, px_in*rpp_in, py_in*rpp_in, length) );
|
|
148
|
-
}
|
|
149
|
-
// Hit and survived particles need correcting:
|
|
150
|
-
if (is_hit>0 && is_abs==0){
|
|
151
|
-
double px = LocalParticle_get_px(part);
|
|
152
|
-
double py = LocalParticle_get_py(part);
|
|
153
|
-
double rvv = LocalParticle_get_rvv(part);
|
|
154
|
-
double rpp = LocalParticle_get_rpp(part);
|
|
155
|
-
// First we drift half the length with the old angles:
|
|
156
|
-
LocalParticle_add_to_zeta(part, drift_zeta_single(rvv_in, px_in*rpp_in, py_in*rpp_in, length/2) );
|
|
157
|
-
// then half the length with the new angles:
|
|
158
|
-
LocalParticle_add_to_zeta(part, drift_zeta_single(rvv, px*rpp, py*rpp, length/2) );
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Update state ----------------------------------------------------
|
|
162
|
-
if (is_abs > 0){
|
|
163
|
-
LocalParticle_set_state(part, XC_LOST_ON_EVEREST_COLL);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
#endif /* XCOLL_EVEREST_SCAT_H */
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
// copyright ############################### #
|
|
2
|
-
// This file is part of the Xcoll Package. #
|
|
3
|
-
// Copyright (c) CERN, 2023. #
|
|
4
|
-
// ######################################### #
|
|
5
|
-
|
|
6
|
-
#ifndef XCOLL_EVEREST_SCAT_CRY_H
|
|
7
|
-
#define XCOLL_EVEREST_SCAT_CRY_H
|
|
8
|
-
#include <math.h>
|
|
9
|
-
#include <stdlib.h>
|
|
10
|
-
#include <stdio.h>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/*gpufun*/
|
|
14
|
-
void scatter_cry(LocalParticle* part, double length, CrystalMaterialData material, RandomRutherfordData rng,
|
|
15
|
-
double cRot, double sRot, double c_aperture, double c_offset, int side, double cry_tilt,
|
|
16
|
-
double cry_rcurv, double cry_bend, double cry_alayer, double cry_xmax, double cry_ymax,
|
|
17
|
-
double cry_orient, double cry_miscut, CollimatorImpactsData record, RecordIndex record_index){
|
|
18
|
-
|
|
19
|
-
// Store initial coordinates for updating later
|
|
20
|
-
double const rpp_in = LocalParticle_get_rpp(part);
|
|
21
|
-
double const rvv_in = LocalParticle_get_rvv(part);
|
|
22
|
-
double const e0 = LocalParticle_get_energy0(part) / 1e9; // Reference energy in GeV
|
|
23
|
-
double const beta0 = LocalParticle_get_beta0(part);
|
|
24
|
-
double const ptau_in = LocalParticle_get_ptau(part);
|
|
25
|
-
double const x_in2 = LocalParticle_get_x(part);
|
|
26
|
-
double const px_in2 = LocalParticle_get_px(part);
|
|
27
|
-
double const y_in2 = LocalParticle_get_y(part);
|
|
28
|
-
double const py_in2 = LocalParticle_get_py(part);
|
|
29
|
-
double p0 = LocalParticle_get_p0c(part) / 1e9;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
double x_in = LocalParticle_get_x(part);
|
|
33
|
-
double xp_in = LocalParticle_get_px(part)*rpp_in;
|
|
34
|
-
double y_in = LocalParticle_get_y(part);
|
|
35
|
-
double yp_in = LocalParticle_get_py(part)*rpp_in;
|
|
36
|
-
double s_in = 0; // s at start of collimator
|
|
37
|
-
|
|
38
|
-
// TODO: missing correction due to m/m0 (but also wrong in xpart...)
|
|
39
|
-
double p_in = p0*ptau_in + e0; // energy, not momentum, in GeV
|
|
40
|
-
|
|
41
|
-
// Status flags
|
|
42
|
-
int val_part_hit = 0;
|
|
43
|
-
int val_part_abs = 0;
|
|
44
|
-
int val_part_impact = -1;
|
|
45
|
-
double val_part_indiv = -1.;
|
|
46
|
-
// double val_part_linteract = -1.;
|
|
47
|
-
|
|
48
|
-
p0 = e0;
|
|
49
|
-
double x0 = 0;
|
|
50
|
-
double xp0 = 0;
|
|
51
|
-
double nhit = 0;
|
|
52
|
-
double nabs = 0;
|
|
53
|
-
double nnuc0 = 0;
|
|
54
|
-
double ien0 = 0;
|
|
55
|
-
double nnuc1 = 0;
|
|
56
|
-
double ien1 = 0;
|
|
57
|
-
double iProc = 0;
|
|
58
|
-
double n_chan = 0;
|
|
59
|
-
double n_VR = 0;
|
|
60
|
-
double n_amorphous = 0;
|
|
61
|
-
double s_imp = 0;
|
|
62
|
-
|
|
63
|
-
double x = x_in;
|
|
64
|
-
double xp = xp_in;
|
|
65
|
-
double z = y_in;
|
|
66
|
-
double zp = yp_in;
|
|
67
|
-
double p = p_in;
|
|
68
|
-
|
|
69
|
-
double mirror = 1.;
|
|
70
|
-
|
|
71
|
-
// TODO: use xtrack C-code for rotation element
|
|
72
|
-
|
|
73
|
-
// Transform particle coordinates to get into collimator coordinate system
|
|
74
|
-
// First do rotation into collimator frame
|
|
75
|
-
double const cRRot = cRot;
|
|
76
|
-
double const sRRot = -sRot;
|
|
77
|
-
x = x_in*cRot + sRot*y_in;
|
|
78
|
-
z = y_in*cRot - sRot*x_in;
|
|
79
|
-
xp = xp_in*cRot + sRot*yp_in;
|
|
80
|
-
zp = yp_in*cRot - sRot*xp_in;
|
|
81
|
-
|
|
82
|
-
// Output variables
|
|
83
|
-
double x_out = x_in;
|
|
84
|
-
double y_out = y_in;
|
|
85
|
-
double xp_out = xp_in;
|
|
86
|
-
double yp_out = yp_in;
|
|
87
|
-
double p_out = p_in;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// For one-sided collimators consider only positive X. For negative X jump to the next particle
|
|
91
|
-
if (side==0 || (side==1 && x>=0.) || (side==2 && x<=0.)) {
|
|
92
|
-
// Log input energy + nucleons as per the FLUKA coupling
|
|
93
|
-
nnuc0 = nnuc0 + 1.;
|
|
94
|
-
ien0 = ien0 + p_in * 1.0e3;
|
|
95
|
-
|
|
96
|
-
// Now mirror at the horizontal axis for negative X offset
|
|
97
|
-
if (x < 0) {
|
|
98
|
-
mirror = -1;
|
|
99
|
-
} else {
|
|
100
|
-
mirror = 1;
|
|
101
|
-
}
|
|
102
|
-
x = mirror*x;
|
|
103
|
-
xp = mirror*xp;
|
|
104
|
-
|
|
105
|
-
// Shift with opening and offset
|
|
106
|
-
x = (x - c_aperture/2.) - mirror*c_offset;
|
|
107
|
-
|
|
108
|
-
// particle passing above the jaw are discarded => take new event
|
|
109
|
-
// entering by the face, shorten the length (zlm) and keep track of
|
|
110
|
-
// entrance longitudinal coordinate (keeps) for histograms
|
|
111
|
-
|
|
112
|
-
// The definition is that the collimator jaw is at x>=0.
|
|
113
|
-
|
|
114
|
-
// 1) Check whether particle hits the collimator
|
|
115
|
-
int isimp = 0;
|
|
116
|
-
double s = 0.;
|
|
117
|
-
double zlm = -1*length;
|
|
118
|
-
|
|
119
|
-
double* crystal_result = crystal(rng, part, x,
|
|
120
|
-
xp,
|
|
121
|
-
z,
|
|
122
|
-
zp,
|
|
123
|
-
s,
|
|
124
|
-
p,
|
|
125
|
-
x0,
|
|
126
|
-
xp0,
|
|
127
|
-
zlm,
|
|
128
|
-
s_imp,
|
|
129
|
-
isimp,
|
|
130
|
-
val_part_hit,
|
|
131
|
-
val_part_abs,
|
|
132
|
-
val_part_impact,
|
|
133
|
-
val_part_indiv,
|
|
134
|
-
length,
|
|
135
|
-
material,
|
|
136
|
-
nhit,
|
|
137
|
-
nabs,
|
|
138
|
-
cry_tilt,
|
|
139
|
-
cry_rcurv,
|
|
140
|
-
cry_bend,
|
|
141
|
-
cry_alayer,
|
|
142
|
-
cry_xmax,
|
|
143
|
-
cry_ymax,
|
|
144
|
-
cry_orient,
|
|
145
|
-
cry_miscut,
|
|
146
|
-
iProc,
|
|
147
|
-
n_chan,
|
|
148
|
-
n_VR,
|
|
149
|
-
n_amorphous
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
val_part_hit = crystal_result[0];
|
|
153
|
-
val_part_abs = crystal_result[1];
|
|
154
|
-
val_part_impact = crystal_result[2];
|
|
155
|
-
val_part_indiv = crystal_result[3];
|
|
156
|
-
nhit = crystal_result[4];
|
|
157
|
-
nabs = crystal_result[5];
|
|
158
|
-
s_imp = crystal_result[6];
|
|
159
|
-
isimp = crystal_result[7];
|
|
160
|
-
s = crystal_result[8];
|
|
161
|
-
zlm = crystal_result[9];
|
|
162
|
-
x = crystal_result[10];
|
|
163
|
-
xp = crystal_result[11];
|
|
164
|
-
x0 = crystal_result[12];
|
|
165
|
-
xp0 = crystal_result[13];
|
|
166
|
-
z = crystal_result[14];
|
|
167
|
-
zp = crystal_result[15];
|
|
168
|
-
p = crystal_result[16];
|
|
169
|
-
iProc = crystal_result[17];
|
|
170
|
-
n_chan = crystal_result[18];
|
|
171
|
-
n_VR = crystal_result[19];
|
|
172
|
-
n_amorphous = crystal_result[20];
|
|
173
|
-
|
|
174
|
-
free(crystal_result);
|
|
175
|
-
|
|
176
|
-
if (nabs != 0.) {
|
|
177
|
-
val_part_abs = 1.;
|
|
178
|
-
// val_part_linteract = zlm;
|
|
179
|
-
}
|
|
180
|
-
s_imp = (s - length) + s_imp;
|
|
181
|
-
|
|
182
|
-
// Transform back to particle coordinates with opening and offset
|
|
183
|
-
x = (x + c_aperture/2) + mirror*c_offset;
|
|
184
|
-
|
|
185
|
-
// Now mirror at the horizontal axis for negative X offset
|
|
186
|
-
x = mirror * x;
|
|
187
|
-
xp = mirror * xp;
|
|
188
|
-
|
|
189
|
-
// Last do rotation into collimator frame
|
|
190
|
-
x_out = x*cRRot + z*sRRot;
|
|
191
|
-
y_out = z*cRRot - x*sRRot;
|
|
192
|
-
xp_out = xp*cRRot + zp*sRRot;
|
|
193
|
-
yp_out = zp*cRRot - xp*sRRot;
|
|
194
|
-
|
|
195
|
-
// Log output energy + nucleons as per the FLUKA coupling
|
|
196
|
-
// Do not log dead particles
|
|
197
|
-
nnuc1 = nnuc1 + 1; // outcoming nucleons
|
|
198
|
-
ien1 = ien1 + p_out * 1e3; // outcoming energy
|
|
199
|
-
|
|
200
|
-
p_out = p;
|
|
201
|
-
s_in = s_in + s;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
LocalParticle_set_x(part, x_out);
|
|
205
|
-
LocalParticle_set_px(part, xp_out/rpp_in);
|
|
206
|
-
LocalParticle_set_y(part, y_out);
|
|
207
|
-
LocalParticle_set_py(part, yp_out/rpp_in);
|
|
208
|
-
|
|
209
|
-
double energy_out = p_out; // Cannot assign energy directly to LocalParticle as it would update dependent variables, but needs to be corrected first!
|
|
210
|
-
|
|
211
|
-
// Update energy ---------------------------------------------------
|
|
212
|
-
// Only particles that hit the jaw and survived need to be updated
|
|
213
|
-
if (val_part_hit>0 && val_part_abs==0){
|
|
214
|
-
double ptau_out = (energy_out - e0) / (e0 * beta0);
|
|
215
|
-
LocalParticle_update_ptau(part, ptau_out);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Update 4D coordinates -------------------------------------------
|
|
219
|
-
// Absorbed particles get their coordinates set to the entrance of collimator
|
|
220
|
-
if (val_part_abs>0){
|
|
221
|
-
LocalParticle_set_x(part, x_in2);
|
|
222
|
-
LocalParticle_set_px(part, px_in2);
|
|
223
|
-
LocalParticle_set_y(part, y_in2);
|
|
224
|
-
LocalParticle_set_py(part, py_in2);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Update longitudinal coordinate zeta -----------------------------
|
|
228
|
-
// Absorbed particles keep coordinates at the entrance of collimator, others need correcting:
|
|
229
|
-
// Non-hit particles are just drifting (zeta not yet drifted in K2, so do here)
|
|
230
|
-
if (val_part_hit==0){
|
|
231
|
-
LocalParticle_add_to_zeta(part, drift_zeta_single(rvv_in, px_in2*rpp_in, py_in2*rpp_in, length) );
|
|
232
|
-
}
|
|
233
|
-
// Hit and survived particles need correcting:
|
|
234
|
-
if (val_part_hit>0 && val_part_abs==0){
|
|
235
|
-
double px = LocalParticle_get_px(part);
|
|
236
|
-
double py = LocalParticle_get_py(part);
|
|
237
|
-
double rvv = LocalParticle_get_rvv(part);
|
|
238
|
-
double rpp = LocalParticle_get_rpp(part);
|
|
239
|
-
// First we drift half the length with the old angles:
|
|
240
|
-
LocalParticle_add_to_zeta(part, drift_zeta_single(rvv_in, px_in2*rpp_in, py_in2*rpp_in, length/2) );
|
|
241
|
-
// then half the length with the new angles:
|
|
242
|
-
LocalParticle_add_to_zeta(part, drift_zeta_single(rvv, px*rpp, py*rpp, length/2) );
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Update s --------------------------------------------------------
|
|
246
|
-
// TODO: move absorbed particles to last impact location
|
|
247
|
-
if (val_part_abs==0){
|
|
248
|
-
LocalParticle_add_to_s(part, length);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// Update state ----------------------------------------------------
|
|
252
|
-
if (val_part_abs > 0){
|
|
253
|
-
LocalParticle_set_state(part, XC_LOST_ON_EVEREST_CRYSTAL);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return;
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
#endif /* XCOLL_EVEREST_SCAT_CRY_H */
|
|
File without changes
|
|
File without changes
|
|
File without changes
|