1 | // main20.cc is a part of the PYTHIA event generator. |
---|
2 | // Copyright (C) 2012 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. |
---|
5 | |
---|
6 | // This is a simple test program. It shows how PYTHIA 8 can write |
---|
7 | // a Les Houches Event File based on its process-level events. |
---|
8 | |
---|
9 | #include "Pythia.h" |
---|
10 | using namespace Pythia8; |
---|
11 | int main() { |
---|
12 | |
---|
13 | // Generator. |
---|
14 | Pythia pythia; |
---|
15 | |
---|
16 | // Process selection. Minimal masses for gamma*/Z and W+-. |
---|
17 | pythia.readString("WeakDoubleBoson:all = on"); |
---|
18 | pythia.readString("23:mMin = 50."); |
---|
19 | pythia.readString("24:mMin = 50."); |
---|
20 | |
---|
21 | // Switch off generation of steps subsequent to the process level one. |
---|
22 | // (These will not be stored anyway, so only steal time.) |
---|
23 | pythia.readString("PartonLevel:all = off"); |
---|
24 | |
---|
25 | // Create an LHAup object that can access relevant information in pythia. |
---|
26 | LHAupFromPYTHIA8 myLHA(&pythia.process, &pythia.info); |
---|
27 | |
---|
28 | // Open a file on which LHEF events should be stored, and write header. |
---|
29 | myLHA.openLHEF("weakbosons.lhe"); |
---|
30 | |
---|
31 | // LHC 8 TeV initialization. |
---|
32 | pythia.readString("Beams:eCM = 8000."); |
---|
33 | pythia.init(); |
---|
34 | |
---|
35 | // Store initialization info in the LHAup object. |
---|
36 | myLHA.setInit(); |
---|
37 | |
---|
38 | // Write out this initialization info on the file. |
---|
39 | myLHA.initLHEF(); |
---|
40 | |
---|
41 | // Loop over events. |
---|
42 | for (int i = 0; i < 100; ++i) { |
---|
43 | |
---|
44 | // Generate an event. |
---|
45 | pythia.next(); |
---|
46 | |
---|
47 | // Store event info in the LHAup object. |
---|
48 | myLHA.setEvent(); |
---|
49 | |
---|
50 | // Write out this event info on the file. |
---|
51 | // With optional argument (verbose =) false the file is smaller. |
---|
52 | myLHA.eventLHEF(); |
---|
53 | } |
---|
54 | |
---|
55 | // Statistics: full printout. |
---|
56 | pythia.stat(); |
---|
57 | |
---|
58 | // Update the cross section info based on Monte Carlo integration during run. |
---|
59 | myLHA.updateSigma(); |
---|
60 | |
---|
61 | // Write endtag. Overwrite initialization info with new cross sections. |
---|
62 | myLHA.closeLHEF(true); |
---|
63 | |
---|
64 | // Done. |
---|
65 | return 0; |
---|
66 | } |
---|