1 // main24.cc is a part of the PYTHIA event generator.
2 // Copyright (C) 2013 Peter Skands, Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
6 // This is a simple test program.
7 // It illustrates how to run SUSY processes in Pythia8.
8 // All input is specified in the main22.cmnd file.
12 using namespace Pythia8;
16 // Generator. Shorthand for the event.
18 Event& event = pythia.event;
20 // Read in commands from external file.
21 pythia.readFile("main24.cmnd");
23 // Extract settings to be used in the main program.
24 int nEvent = pythia.mode("Main:numberOfEvents");
25 int nAbort = pythia.mode("Main:timesAllowErrors");
26 double eCM = pythia.parm("Beams:eCM");
32 double epTol = 1e-6 * eCM;
33 Hist epCons("deviation from energy-momentum conservation",100,0.,epTol);
34 Hist nFinal("final particle multiplicity",100,-0.5,799.5);
35 Hist dnparticledy("dn/dy for particles",100,-10.,10.);
39 for (int iEvent = 0; iEvent < nEvent; ++iEvent) {
41 // Generate events. Quit if failure.
43 if (++iAbort < nAbort) continue;
44 cout << " Event generation aborted prematurely, owing to error!\n";
48 // Loop over final particles in the event.
51 for (int i = 0; i < event.size(); ++i) if (event[i].isFinal()) {
54 dnparticledy.fill(event[i].y());
57 // Check and print event with too big energy-momentum deviation.
59 double epDev = abs(pSum.e() - eCM) + abs(pSum.px()) + abs(pSum.py())
63 cout << " Warning! Event with epDev = " << scientific
64 << setprecision(4) << epDev << " now listed:";
71 // Final statistics and histogram output.
73 cout << epCons << nFinal << dnparticledy;