20 void BeamShape::init( Settings& settings, Rndm* rndmPtrIn) {
26 allowMomentumSpread = settings.flag(
"Beams:allowMomentumSpread");
27 allowVertexSpread = settings.flag(
"Beams:allowVertexSpread");
30 sigmaPxA = settings.parm(
"Beams:sigmaPxA");
31 sigmaPyA = settings.parm(
"Beams:sigmaPyA");
32 sigmaPzA = settings.parm(
"Beams:sigmaPzA");
33 maxDevA = settings.parm(
"Beams:maxDevA");
36 sigmaPxB = settings.parm(
"Beams:sigmaPxB");
37 sigmaPyB = settings.parm(
"Beams:sigmaPyB");
38 sigmaPzB = settings.parm(
"Beams:sigmaPzB");
39 maxDevB = settings.parm(
"Beams:maxDevB");
42 sigmaVertexX = settings.parm(
"Beams:sigmaVertexX");
43 sigmaVertexY = settings.parm(
"Beams:sigmaVertexY");
44 sigmaVertexZ = settings.parm(
"Beams:sigmaVertexZ");
45 maxDevVertex = settings.parm(
"Beams:maxDevVertex");
46 sigmaTime = settings.parm(
"Beams:sigmaTime");
47 maxDevTime = settings.parm(
"Beams:maxDevTime");
50 offsetX = settings.parm(
"Beams:offsetVertexX");
51 offsetY = settings.parm(
"Beams:offsetVertexY");
52 offsetZ = settings.parm(
"Beams:offsetVertexZ");
53 offsetT = settings.parm(
"Beams:offsetTime");
61 void BeamShape::pick() {
64 deltaPxA = deltaPyA = deltaPzA = deltaPxB = deltaPyB = deltaPzB
65 = vertexX = vertexY = vertexZ = vertexT = 0.;
68 if (allowMomentumSpread) {
69 double totalDev, gauss;
73 gauss = rndmPtr->gauss();
74 deltaPxA = sigmaPxA * gauss;
75 totalDev += gauss * gauss;
78 gauss = rndmPtr->gauss();
79 deltaPyA = sigmaPyA * gauss;
80 totalDev += gauss * gauss;
83 gauss = rndmPtr->gauss();
84 deltaPzA = sigmaPzA * gauss;
85 totalDev += gauss * gauss;
87 }
while (totalDev > maxDevA * maxDevA);
93 gauss = rndmPtr->gauss();
94 deltaPxB = sigmaPxB * gauss;
95 totalDev += gauss * gauss;
98 gauss = rndmPtr->gauss();
99 deltaPyB = sigmaPyB * gauss;
100 totalDev += gauss * gauss;
103 gauss = rndmPtr->gauss();
104 deltaPzB = sigmaPzB * gauss;
105 totalDev += gauss * gauss;
107 }
while (totalDev > maxDevB * maxDevB);
111 if (allowVertexSpread) {
112 double totalDev, gauss;
115 if (sigmaVertexX > 0.) {
116 gauss = rndmPtr->gauss();
117 vertexX = sigmaVertexX * gauss;
118 totalDev += gauss * gauss;
120 if (sigmaVertexY > 0.) {
121 gauss = rndmPtr->gauss();
122 vertexY = sigmaVertexY * gauss;
123 totalDev += gauss * gauss;
125 if (sigmaVertexZ > 0.) {
126 gauss = rndmPtr->gauss();
127 vertexZ = sigmaVertexZ * gauss;
128 totalDev += gauss * gauss;
130 }
while (totalDev > maxDevVertex * maxDevVertex);
133 if (sigmaTime > 0.) {
134 do gauss = rndmPtr->gauss();
135 while (abs(gauss) > maxDevTime);
136 vertexT = sigmaTime * gauss;