8 #include "Pythia8/BeamShape.h"
20 void BeamShape::init( Settings& settings, Rndm* rndmPtrIn) {
26 allowMomentumSpread = settings.flag(
"Beams:allowMomentumSpread");
27 allowVertexSpread = settings.flag(
"Beams:allowVertexSpread");
28 if (settings.flag(
"Beams:allowVariableEnergy")) allowMomentumSpread =
false;
31 sigmaPxA = settings.parm(
"Beams:sigmaPxA");
32 sigmaPyA = settings.parm(
"Beams:sigmaPyA");
33 sigmaPzA = settings.parm(
"Beams:sigmaPzA");
34 maxDevA = settings.parm(
"Beams:maxDevA");
37 sigmaPxB = settings.parm(
"Beams:sigmaPxB");
38 sigmaPyB = settings.parm(
"Beams:sigmaPyB");
39 sigmaPzB = settings.parm(
"Beams:sigmaPzB");
40 maxDevB = settings.parm(
"Beams:maxDevB");
43 sigmaVertexX = settings.parm(
"Beams:sigmaVertexX");
44 sigmaVertexY = settings.parm(
"Beams:sigmaVertexY");
45 sigmaVertexZ = settings.parm(
"Beams:sigmaVertexZ");
46 maxDevVertex = settings.parm(
"Beams:maxDevVertex");
47 sigmaTime = settings.parm(
"Beams:sigmaTime");
48 maxDevTime = settings.parm(
"Beams:maxDevTime");
51 offsetX = settings.parm(
"Beams:offsetVertexX");
52 offsetY = settings.parm(
"Beams:offsetVertexY");
53 offsetZ = settings.parm(
"Beams:offsetVertexZ");
54 offsetT = settings.parm(
"Beams:offsetTime");
62 void BeamShape::pick() {
65 deltaPxA = deltaPyA = deltaPzA = deltaPxB = deltaPyB = deltaPzB
66 = vertexX = vertexY = vertexZ = vertexT = 0.;
69 if (allowMomentumSpread) {
70 double totalDev, gauss;
74 gauss = rndmPtr->gauss();
75 deltaPxA = sigmaPxA * gauss;
76 totalDev += gauss * gauss;
79 gauss = rndmPtr->gauss();
80 deltaPyA = sigmaPyA * gauss;
81 totalDev += gauss * gauss;
84 gauss = rndmPtr->gauss();
85 deltaPzA = sigmaPzA * gauss;
86 totalDev += gauss * gauss;
88 }
while (totalDev > maxDevA * maxDevA);
94 gauss = rndmPtr->gauss();
95 deltaPxB = sigmaPxB * gauss;
96 totalDev += gauss * gauss;
99 gauss = rndmPtr->gauss();
100 deltaPyB = sigmaPyB * gauss;
101 totalDev += gauss * gauss;
104 gauss = rndmPtr->gauss();
105 deltaPzB = sigmaPzB * gauss;
106 totalDev += gauss * gauss;
108 }
while (totalDev > maxDevB * maxDevB);
112 if (allowVertexSpread) {
113 double totalDev, gauss;
116 if (sigmaVertexX > 0.) {
117 gauss = rndmPtr->gauss();
118 vertexX = sigmaVertexX * gauss;
119 totalDev += gauss * gauss;
121 if (sigmaVertexY > 0.) {
122 gauss = rndmPtr->gauss();
123 vertexY = sigmaVertexY * gauss;
124 totalDev += gauss * gauss;
126 if (sigmaVertexZ > 0.) {
127 gauss = rndmPtr->gauss();
128 vertexZ = sigmaVertexZ * gauss;
129 totalDev += gauss * gauss;
131 }
while (totalDev > maxDevVertex * maxDevVertex);
134 if (sigmaTime > 0.) {
135 do gauss = rndmPtr->gauss();
136 while (abs(gauss) > maxDevTime);
137 vertexT = sigmaTime * gauss;