]>
Commit | Line | Data |
---|---|---|
63ba5337 | 1 | // main53.cc is a part of the PYTHIA event generator. |
2 | // Copyright (C) 2012 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. | |
5 | ||
6 | // This is a simple test program. | |
7 | // It illustrates how to interface an external process with an incoming photon | |
8 | // in a hadron beam, using the MRST2004QED PDF set. | |
9 | // All input apart from the name of the external LHEF file is specified in the | |
10 | // main53.cmnd file. | |
11 | ||
12 | #include "Pythia.h" | |
13 | ||
14 | using namespace Pythia8; | |
15 | ||
16 | int main() { | |
17 | ||
18 | // Generator. Shorthand for the event. | |
19 | Pythia pythia; | |
20 | Event& event = pythia.event; | |
21 | ||
22 | // Read in commands from external file. | |
23 | pythia.readFile("main53.cmnd"); | |
24 | ||
25 | // Extract settings to be used in the main program. | |
26 | int nEvent = pythia.mode("Main:numberOfEvents"); | |
27 | ||
28 | // Initialize. Either of two opions, to be picked in main53.cmnd. | |
29 | // 1) Read in external event with incoming photon in the ME, | |
30 | // from pre-generated .lhe file (thanks to SANC and R. Sadykov). | |
31 | // 2) Use internal fermion gamma -> W+- fermion' process. | |
32 | pythia.init(); | |
33 | ||
34 | // Histograms for pT distribution in gluon production vertex. | |
35 | Hist pTprim( "pT of photon production, no ISR", 100, 0., 100.); | |
36 | Hist pTwith( "pT of photon production, with ISR", 100, 0., 100.); | |
37 | ||
38 | // Begin event loop. | |
39 | for (int iEvent = 0; iEvent < nEvent; ++iEvent) { | |
40 | ||
41 | // Generate events. Quit if failure. | |
42 | if (!pythia.next()) { | |
43 | break; | |
44 | } | |
45 | ||
46 | // Analyze event to find branching where photon is produced. | |
47 | int iGam = (event[3].id() == 22) ? 3 : 4; | |
48 | int iGamMother = iGam; | |
49 | for ( ; ; ) { | |
50 | iGamMother = event[iGam].mother1(); | |
51 | if (iGamMother < iGam || event[iGamMother].id() != 22) break; | |
52 | iGam = iGamMother; | |
53 | } | |
54 | ||
55 | // Find and histogram pT in this branching. | |
56 | if (iGamMother < iGam) pTprim.fill( event[iGam].pT() ); | |
57 | else { | |
58 | int iQ = iGamMother; | |
59 | int size = event.size(); | |
60 | do ++iQ; | |
61 | while (event[iQ].status() != -43 && iQ < size - 1); | |
62 | if (event[iQ].status() == -43) pTwith.fill( event[iQ].pT() ); | |
63 | } | |
64 | ||
65 | // End of event loop. | |
66 | } | |
67 | ||
68 | // Final statistics and histogram output. | |
69 | pythia.stat(); | |
70 | cout << pTprim << pTwith; | |
71 | ||
72 | return 0; | |
73 | } | |
74 |