10 #include "Pythia8/Pythia.h"
12 using namespace Pythia8;
20 Event&
event = pythia.event;
23 pythia.readFile(
"main03.cmnd");
26 int nEvent = pythia.mode(
"Main:numberOfEvents");
27 int nAbort = pythia.mode(
"Main:timesAllowErrors");
33 Hist pThard(
"process pT scale", 100, 0., 500.);
34 Hist nFinal(
"final particle multiplicity", 100, -0.5, 1599.5);
35 Hist nCharged(
"charged particle multiplicity", 100, -0.5, 799.5);
36 Hist dndy(
"dn/dy for charged particles", 100, -10., 10.);
37 Hist dndeta(
"dn/d(eta) for charged particles", 100, -10., 10.);
38 Hist dndpT(
"dn/dpT for charged particles", 100, 0., 10.);
39 Hist epCons(
"deviation from energy-momentum conservation", 100, 0., 1e-6);
43 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
47 if (++iAbort < nAbort)
continue;
48 cout <<
" Event generation aborted prematurely, owing to error!\n";
53 pThard.fill( pythia.info.pTHat() );
59 for (
int i = 0; i <
event.size(); ++i)
if (event[i].isFinal()) {
66 if (event[i].isCharged()) {
68 dndy.fill( event[i].y() );
69 dndeta.fill( event[i].eta() );
70 dndpT.fill( event[i].pT() );
76 nCharged.fill( nChg );
78 double epDev = abs(pSum.e() - 1.) + abs(pSum.px()) + abs(pSum.py())
88 dndeta *= 5. / nEvent;
89 dndpT *= 10. / nEvent;
90 cout << pThard << nFinal << nCharged << dndy << dndeta << dndpT << epCons;