10 #include "Pythia8/Pythia.h"
11 using namespace Pythia8;
20 void fillParticle(
int id,
double ee,
double thetaIn,
double phiIn,
27 double mm = pdt.mSel(
id);
28 double pp = sqrtpos(ee*ee - mm*mm);
37 double cThe, sThe, phi;
43 cThe = 2. * rndm.flat() - 1.;
44 sThe = sqrtpos(1. - cThe * cThe);
45 phi = 2. * M_PI * rndm.flat();
49 event.append(
id, 1, 0, 0, pp * sThe * cos(phi), pp * sThe * sin(phi),
67 double mm = pdt.m0(
id);
68 double pp = sqrtpos(ee*ee - mm*mm);
69 event.append(
id, 23, 101, 0, 0., 0., pp, ee, mm);
70 event.append( -
id, 23, 0, 101, 0., 0., -pp, ee, mm);
73 }
else if (type == 2) {
74 event.append( 21, 23, 101, 102, 0., 0., ee, ee);
75 event.append( 21, 23, 102, 101, 0., 0., -ee, ee);
78 }
else if (type == 3) {
79 event.append( 21, 23, 101, 102, 0., 0., ee, ee);
80 event.append( 21, 23, 102, 103, 0.8 * ee, 0., -0.6 * ee, ee);
81 event.append( 21, 23, 103, 101, -0.8 * ee, 0., -0.6 * ee, ee);
84 }
else if (type == 4 || type == 5) {
87 event.append( 1000022, -21, 0, 0, 2, 4, 0, 0,
88 0., 0., 1.01 * ee, 1.01 * ee);
91 double rt75 = sqrt(0.75);
92 event.append( 2, 23, 1, 0, 0, 0, 101, 0,
93 0., 0., 1.01 * ee, 1.01 * ee);
94 event.append( 2, 23, 1, 0, 0, 0, 102, 0,
95 rt75 * ee, 0., -0.5 * ee, ee );
96 event.append( 1, 23, 1, 0, 0, 0, 103, 0,
97 -rt75 * ee, 0., -0.5 * ee, ee );
101 int colNow[4] = {0, 101, 102, 103};
103 pQ[1] =
Vec4(0., 0., 1., 0.);
104 pQ[2] =
Vec4( rt75, 0., -0.5, 0.);
105 pQ[3] =
Vec4(-rt75, 0., -0.5, 0.);
108 double cosThetaMin =0.;
111 for (
int nglu = 0; nglu < 5; ++nglu) {
112 int iq = 1 + int( 2.99999 * rndm.flat() );
113 double px, py, pz, e, prod;
115 e = ee * rndm.flat();
116 double cThe = 2. * rndm.flat() - 1.;
117 double phi = 2. * M_PI * rndm.flat();
118 px = e * sqrt(1. - cThe*cThe) * cos(phi);
119 py = e * sqrt(1. - cThe*cThe) * sin(phi);
121 prod = ( px * pQ[iq].px() + py * pQ[iq].py() + pz * pQ[iq].pz() )
123 }
while (prod < cosThetaMin);
124 int colNew = 104 + nglu;
125 event.append( 21, 23, 1, 0, 0, 0, colNew, colNow[iq],
130 event[1].daughters(2, event.size() - 1);
135 }
else if (type >= 6) {
138 event.append( 2212, -12, 0, 0, 3, 5, 0, 0, 0., 0., ee, ee, 0.);
139 event.append(-2212, -12, 0, 0, 6, 8, 0, 0, 0., 0., ee, ee, 0.);
143 double cThe = cos(theta);
144 double sThe = sin(theta);
147 int acol = (type == 6) ? 103 : 106;
151 event.append( 2, 23, 1, 0, 0, 0, 101, 0,
152 ee * sThe, 0., ee * cThe, ee, 0.);
153 event.append( 1, 23, 1, 0, 0, 0, 102, 0,
154 -ee * sThe, 0., ee * cThe, ee, 0.);
155 event.append( 2, -21, 1, 0, 0, 0, 103, 0,
156 0., 0., ee , ee, 0.);
157 event.append( -2, 23, 2, 0, 0, 0, 0, 104,
158 ee * sThe, 0., -ee * cThe, ee, 0.);
159 event.append( -1, 23, 2, 0, 0, 0, 0, 105,
160 -ee * sThe, 0., -ee * cThe, ee, 0.);
161 event.append( -2, -21, 2, 0, 0, 0, 0, acol,
162 0., 0., -ee , ee, 0.);
166 event.append( 21, 23, 5, 8, 0, 0, 103, 106, 0., ee, 0., ee, 0.);
167 }
else if (type == 8) {
168 event.append( 21, 23, 5, 8, 0, 0, 103, 108, 0., ee, 0., ee, 0.);
169 event.append( 21, 23, 5, 8, 0, 0, 108, 106, 0.,-ee, 0., ee, 0.);
170 }
else if (type == 9) {
171 event.append( 21, 23, 5, 8, 0, 0, 103, 107, 0., ee, 0., ee, 0.);
172 event.append( 21, 23, 5, 8, 0, 0, 107, 108, ee, 0., 0., ee, 0.);
173 event.append( 21, 23, 5, 8, 0, 0, 108, 106, 0.,-ee, 0., ee, 0.);
174 }
else if (type == 10) {
175 event.append( 21, 23, 5, 8, 0, 0, 103, 107, 0., ee, 0., ee, 0.);
176 event.append( 21, 23, 5, 8, 0, 0, 107, 108, ee, 0., 0., ee, 0.);
177 event.append( 21, 23, 5, 8, 0, 0, 108, 109, 0.,-ee, 0., ee, 0.);
178 event.append( 21, 23, 5, 8, 0, 0, 109, 106,-ee, 0., 0., ee, 0.);
202 int idGun = (type == 0) ? 15 : 25;
203 double eeGun = (type == 0) ? 20. : 125.;
204 bool atRest = (type == 0) ?
false :
true;
215 Event&
event = pythia.event;
219 pythia.readString(
"ProcessLevel:all = off");
229 pythia.readString(
"Next:numberShowInfo = 0");
230 pythia.readString(
"Next:numberShowProcess = 0");
231 pythia.readString(
"Next:numberShowEvent = 0");
237 Hist epCons(
"deviation from energy-momentum conservation",100,0.,1e-4);
238 Hist chgCons(
"deviation from charge conservation",57,-9.5,9.5);
239 Hist nFinal(
"final particle multiplicity",100,-0.5,99.5);
240 Hist dnparticledp(
"dn/dp for particles",100,0.,ee);
241 Hist status85(
"multiplicity status code 85",50,-0.5,49.5);
242 Hist status86(
"multiplicity status code 86",50,-0.5,49.5);
243 Hist status83(
"multiplicity status code 83",50,-0.5,49.5);
244 Hist status84(
"multiplicity status code 84",50,-0.5,49.5);
245 Hist dndtheta(
"particle flow in event plane",100,-M_PI,M_PI);
246 Hist dedtheta(
"energy flow in event plane",100,-M_PI,M_PI);
247 Hist dpartondtheta(
"parton flow in event plane",100,-M_PI,M_PI);
248 Hist dndyAnti(
"dn/dy primaries antijunction",100, -10., 10.);
249 Hist dndyJun(
"dn/dy primaries junction",100, -10., 10.);
250 Hist dndySum(
"dn/dy all primaries",100, -10., 10.);
253 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
256 if (type == 0 || type == 11) fillParticle( idGun, eeGun, -1., 0.,
257 event, pdt, pythia.rndm, atRest);
260 else fillPartons( type, ee, event, pdt, pythia.rndm);
263 if (!pythia.next()) {
264 cout <<
" Event generation aborted prematurely, owing to error!\n";
269 if (iEvent < nList) {
272 event.listJunctions();
276 Vec4 pSum = -
event[0].p();
277 double chargeSum = 0.;
278 if (type == 0) chargeSum = -
event[1].charge();
279 if (type == 4 || type == 5) chargeSum = -1;
287 for (
int i = 0; i <
event.size(); ++i) {
288 int status =
event[i].statusAbs();
291 int id =
event[i].id();
292 if (
id == 0 || !pdt.isParticle(
id))
293 cout <<
" Error! Unknown code id = " <<
id <<
"\n";
296 double eCalc =
event[i].eCalc();
297 if (abs(eCalc/event[i].e() - 1.) > 1e-6) cout <<
" e mismatch, i = "
298 << i <<
" e_nominal = " <<
event[i].e() <<
" e-from-p = "
299 << eCalc <<
" m-from-e " <<
event[i].mCalc() <<
"\n";
302 if (status == 71 || status == 72) {
303 double thetaXZ =
event[i].thetaXZ();
304 dpartondtheta.fill(thetaXZ);
308 if (status == 85) ++n85;
309 if (status == 86) ++n86;
310 if (status == 83) ++n83;
311 if (status == 84) ++n84;
314 if (status > 80 && status < 90) {
315 double eAbs =
event[i].e();
316 if (eAbs < 0.) {cout <<
" e < 0 line " << i;
event.list();}
317 double thetaXZ =
event[i].thetaXZ();
318 dndtheta.fill(thetaXZ);
319 dedtheta.fill(thetaXZ, eAbs);
322 double y =
event[i].y();
325 int motherId =
event[
event[i].mother1()].id();
326 if (motherId > 0 ) dndyJun.fill(event[i].y());
327 else dndyAnti.fill(event[i].y());
332 if (event[i].isFinal()) {
333 pSum +=
event[i].p();
334 chargeSum +=
event[i].charge();
336 double pAbs =
event[i].pAbs();
337 dnparticledp.fill(pAbs);
342 double epDev = abs(pSum.e()) + abs(pSum.px()) + abs(pSum.py())
345 chgCons.fill(chargeSum);
351 if (epDev > 1e-3 || abs(chargeSum) > 0.1)
event.list();
358 cout << epCons << chgCons << nFinal << dnparticledp
359 << dndtheta << dedtheta << dpartondtheta << dndySum;
360 if (type >= 4) cout << status85 << status86 << status83
362 if (type >= 6) cout << dndyJun << dndyAnti;