12 #include "Pythia8/Pythia.h"
14 using namespace Pythia8;
43 void MyBeamShape::pick() {
46 deltaPxA = deltaPyA = deltaPzA = deltaPxB = deltaPyB = deltaPzB
47 = vertexX = vertexY = vertexZ = vertexT = 0.;
50 if (allowMomentumSpread) {
51 double totalDev, gauss;
55 gauss = rndmPtr->gauss();
56 deltaPxA = sigmaPxA * gauss;
57 totalDev += gauss * gauss;
60 gauss = rndmPtr->gauss();
61 deltaPyA = sigmaPyA * gauss;
62 totalDev += gauss * gauss;
64 }
while (totalDev > maxDevA * maxDevA);
69 deltaPzA = sigmaPzA * ( 1. - sqrt(rndmPtr->flat()) );
70 if (rndmPtr->flat() < 0.5) deltaPzA = -deltaPzA;
77 gauss = rndmPtr->gauss();
78 deltaPxB = sigmaPxB * gauss;
79 totalDev += gauss * gauss;
82 gauss = rndmPtr->gauss();
83 deltaPyB = sigmaPyB * gauss;
84 totalDev += gauss * gauss;
86 }
while (totalDev > maxDevB * maxDevB);
91 deltaPzB = sigmaPzB * ( 1. - sqrt(rndmPtr->flat()) );
92 if (rndmPtr->flat() < 0.5) deltaPzB = -deltaPzB;
97 if (allowVertexSpread) {
98 double totalDev, gauss;
101 if (sigmaVertexX > 0.) {
102 gauss = rndmPtr->gauss();
103 vertexX = sigmaVertexX * gauss;
104 totalDev += gauss * gauss;
106 if (sigmaVertexY > 0.) {
107 gauss = rndmPtr->gauss();
108 vertexY = sigmaVertexY * gauss;
109 totalDev += gauss * gauss;
111 }
while (totalDev > maxDevVertex * maxDevVertex);
116 if (sigmaVertexZ > 0.) {
117 vertexZ = sigmaVertexZ * ( 1. - sqrt(rndmPtr->flat()) );
118 if (rndmPtr->flat() < 0.5) vertexZ = -vertexZ;
122 vertexT = (2. * rndmPtr->flat() - 1.) * (sigmaVertexZ - abs(vertexZ));
163 void stupidRndm::init() {
175 double stupidRndm::flat() {
181 value -= double(
int(value));
182 if (value < 0.) value += 1.;
183 }
while (value <= 0. || value >= 1.);
199 Scaling(
int idBeamIn = 2212) :
PDF(idBeamIn) {}
204 void xfUpdate(
int id,
double x,
double Q2);
212 void Scaling::xfUpdate(
int,
double x,
double ) {
215 double dv = 4. * x * pow3(1. - x);
219 double gl = 2. * pow5(1. - x);
220 double sea = 0.4 * pow5(1. - x);
224 xu = uv + 0.18 * sea;
225 xd = dv + 0.18 * sea;
255 pythia.readString(
"HardQCD:all = on");
256 pythia.readString(
"PhaseSpace:pTHatMin = 20.");
260 pythia.readString(
"Beams:frameType = 3");
261 pythia.readString(
"Beams:pxA = 1.");
262 pythia.readString(
"Beams:pxB = 1.");
269 pythia.setBeamShapePtr( myBeamShape);
272 pythia.readString(
"Beams:allowMomentumSpread = on");
273 pythia.readString(
"Beams:sigmapxA = 0.1");
274 pythia.readString(
"Beams:sigmapyA = 0.1");
275 pythia.readString(
"Beams:sigmapzA = 5.");
276 pythia.readString(
"Beams:sigmapxB = 0.1");
277 pythia.readString(
"Beams:sigmapyB = 0.1");
278 pythia.readString(
"Beams:sigmapzB = 5.");
281 pythia.readString(
"Beams:allowVertexSpread = on");
282 pythia.readString(
"Beams:sigmaVertexX = 0.3");
283 pythia.readString(
"Beams:sigmaVertexY = 0.3");
284 pythia.readString(
"Beams:sigmaVertexZ = 50.");
289 pythia.readString(
"PartonLevel:all = off");
293 pythia.setRndmEnginePtr( badRndm);
298 pythia.setPDFPtr( pdfAPtr, pdfBPtr);
304 double eCMnom = pythia.info.eCM();
307 Hist eCM(
"center-of-mass energy deviation", 100, -20., 20.);
308 Hist pXsum(
"net pX offset", 100, -1.0, 1.0);
309 Hist pYsum(
"net pY offset", 100, -1.0, 1.0);
310 Hist pZsum(
"net pZ offset", 100, -10., 10.);
311 Hist pZind(
"individual abs(pZ) offset", 100, -10., 10.);
312 Hist vtxX(
"vertex x position", 100, -1.0, 1.0);
313 Hist vtxY(
"vertex y position", 100, -1.0, 1.0);
314 Hist vtxZ(
"vertex z position", 100, -100., 100.);
315 Hist vtxT(
"vertex time", 100, -100., 100.);
316 Hist vtxZT(
"vertex |x| + |t|", 100, 0., 100.);
320 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
321 if (!pythia.next()) {
325 pythia.process.list();
327 if (++iAbort < nAbort)
continue;
328 cout <<
" Event generation aborted prematurely, owing to error!\n";
333 double eCMnow = pythia.info.eCM();
334 eCM.fill( eCMnow - eCMnom);
335 pXsum.fill( pythia.process[0].px() - 2. );
336 pYsum.fill( pythia.process[0].py() );
337 pZsum.fill( pythia.process[0].pz() );
338 pZind.fill( pythia.process[1].pz() - 7000. );
339 pZind.fill( -pythia.process[2].pz() - 7000. );
340 vtxX.fill( pythia.process[0].xProd() );
341 vtxY.fill( pythia.process[0].yProd() );
342 vtxZ.fill( pythia.process[0].zProd() );
343 vtxT.fill( pythia.process[0].tProd() );
344 double absSum = abs(pythia.process[0].zProd())
345 + abs(pythia.process[0].tProd());
346 vtxZT.fill( absSum );
351 cout << eCM << pXsum << pYsum << pZsum << pZind
352 << vtxX << vtxY << vtxZ << vtxT << vtxZT;
355 Hist rndmDist(
"standard random number distribution", 100, 0., 1.);
356 Hist rndmCorr(
"standard random number correlation", 100, 0., 1.);
358 double rndmOld = pythia.rndm.flat();
359 for (
int i = 0; i < 100000; ++i) {
360 rndmNow = pythia.rndm.flat();
361 rndmDist.fill(rndmNow);
362 rndmCorr.fill( abs(rndmNow - rndmOld) );
365 cout << rndmDist << rndmCorr;
368 Hist rndmDist2(
"stupid random number distribution", 100, 0., 1.);
369 Hist rndmCorr2(
"stupid random number correlation", 100, 0., 1.);
370 rndmOld = pythia.rndm.flat();
371 for (
int i = 0; i < 100000; ++i) {
372 rndmNow = pythia.rndm.flat();
373 rndmDist2.fill(rndmNow);
374 rndmCorr2.fill( abs(rndmNow - rndmOld) );
377 cout << rndmDist2 << rndmCorr2;