]>
Commit | Line | Data |
---|---|---|
9419eeef | 1 | // main20.cc is a part of the PYTHIA event generator. |
2 | // Copyright (C) 2010 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 | // Tevatron initialization. | |
32 | pythia.init( 2212, -2212, 1960.); | |
33 | ||
34 | // Store initialization info in the LHAup object. | |
35 | myLHA.setInit(); | |
36 | ||
37 | // Write out this initialization info on the file. | |
38 | myLHA.initLHEF(); | |
39 | ||
40 | // Loop over events. | |
41 | for (int i = 0; i < 100; ++i) { | |
42 | ||
43 | // Generate an event. | |
44 | pythia.next(); | |
45 | ||
46 | // Store event info in the LHAup object. | |
47 | myLHA.setEvent(); | |
48 | ||
49 | // Write out this event info on the file. | |
50 | myLHA.eventLHEF(); | |
51 | } | |
52 | ||
53 | // Statistics: full printout. | |
54 | pythia.statistics(); | |
55 | ||
56 | // Update the cross section info based on Monte Carlo integration during run. | |
57 | myLHA.updateSigma(); | |
58 | ||
59 | // Write endtag. Overwrite initialization info with new cross sections. | |
60 | myLHA.closeLHEF(true); | |
61 | ||
62 | // Done. | |
63 | return 0; | |
64 | } |