3
<title>Sample Main Programs</title>
4
<link rel="stylesheet" type="text/css" href="pythia.css"/>
5
<link rel="shortcut icon" href="pythia32.gif"/>
9
<h2>Sample Main Programs</h2>
11
Descriptions of available classes, methods and settings are all
12
very good and useful. Ultimately they are necessary for you to
13
be able to fine-tune your runs to the task at hand. To get going,
14
however, nothing helps like having explicit examples to study.
15
This is what is provided in the <code>examples</code> subdirectory,
16
along with instructions how they should be run:
19
<li><code>main00.cc</code> : does not exist, but it has been defined
20
in the <code>Makefile</code>, so this name could be used for a simple
23
<li><code>main01.cc</code> : a simple study of the charged multiplicity
24
for jet events at the LHC. (Brief example fitting on one slide.)</li>
26
<li><code>main02.cc</code> : a simple study of the <i>pT</i> spectrum
27
of Z bosons at the Tevatron. (Brief example fitting on one slide.)</li>
29
<li><code>main03.cc</code> : a simple study of several different kinds
30
of events, with the choice to be made in the <code>main03.cmnd</code>
33
<li><code>main04.cc</code> : tests of cross sections, multiplicities and
34
average transverse momenta for elastic, diffractive and nondiffractive
35
topologies, using <code>main04.cmnd</code> to pick processes.</li>
37
<li><code>main05.cc</code> : generation of QCD jet events at the LHC,
38
with jet analysis using the <code>SlowJet</code> inclusive anti-<i>kT</i>
39
sequential-recombination finder and the <code>CellJet</code>
42
<li><code>main06.cc</code> : generation of LEP1 hadronic events, i.e.
43
<i>e^+e^- -> gamma*/Z^0 -> q qbar</i>, with charged multiplicity,
44
sphericity, thrust and jet analysis.</li>
46
<li><code>main07.cc</code> : set up a fictitious production process
47
to a generic resonance, where you easily can compose your own list
48
of (two-body) decay modes to a variety of final states. Also traces
49
decay chains down to truly stable particles: gamma, e+-, p/pbar and
50
neutrinos. Suitable for astroparticle applications, like neutralino
51
pair annihilation, where cross sections are calculated separately
54
<li><code>main08.cc</code> : generation of the QCD jet cross section
55
by splitting the run into subruns, each in its own <i>pT</i> bin,
56
and adding the results properly reweighted. Two options, with limits
57
set either in the main program or by subrun specification in the
58
<code>main08.cmnd</code> file.</li>
60
<li><code>main09.cc</code> : generation of two predetermined hard
61
interactions in each event.</li>
63
<li><code>main10.cc</code> : illustration how userHooks can be used
64
interact directly with the event-generation process.</li>
66
<li><code>main11.cc</code> : a study of top events, fed in from the
67
Les Houches Event File <code>ttbar.lhe</code>, here generated by
68
PYTHIA 6.4. This file currently only contains 100 events
69
so as not to make the distributed PYTHIA package too big, and so serves
70
mainly as a demonstration of the principles involved. </li>
72
<li><code>main12.cc</code> : a more sophisticated variant of
73
<code>main11.cc</code>, where two Les Houches Event Files
74
(<code>ttbar.lhe</code> and <code>ttbar2.lhe</code>) successively
75
are used as input. Also illustrating some other aspects, like the
76
capability to mix in internally generated events.</li>
78
<li><code>main13.cc</code> : a streamlined version of
79
<code>main12.cc</code>, where two Les Houches Event Files
80
(<code>ttbar.lhe</code> and <code>ttbar2.lhe</code>) successively
81
are used as input in <code>main13.cmnd</code> file.</li>
83
<li><code>main14.cc</code> : a systematic comparison of several
84
cross section values with their corresponding values in PYTHIA 6.4,
85
the latter available as a table in the code.</li>
87
<li><code>main15.cc</code> : loop over several tries, either to redo
88
B decays only or to redo the complete hadronization chain of an event.
89
Since much of the generation process is only made once this is a way
90
to increase efficiency.</li>
92
<li><code>main16.cc</code> : put all user analysis code into a class
93
of its own, separate from the main program; provide the "cards file"
94
name as a command-line argument.</li>
96
<li><code>main17.cc</code> : shows (a) how to use UserHooks to
97
regularize onium cross section for pT -> 0, and (b) how decays
98
could be handled externally.</li>
100
<li><code>main18.cc</code> : shows how to write an event filter class,
101
where you keep a vector of pointers to the subset of particles you
102
want to study further. The event record itself remains unchanged.</li>
104
<li><code>main19.cc</code> : use several instances of Pythia, one for
105
signal events and others for a variable number of pileup and "beam-gas"
106
events, combined into one common event record.</li>
108
<li><code>main20.cc</code> : shows how PYTHIA 8 can write a Les Houches
109
Event File, using facilities potentially useful also for other programs
110
to write an LHEF.</li>
112
<li><code>main21.cc</code> : an example how a single particle or various
113
parton-level configurations can be input directly for hadronization,
114
without being tied to the full process-generation machinery, e.g. to
115
study the hadronization of junction topologies. </li>
117
<li><code>main22.cc</code> : shows how an external resonance can be
118
implemented as a new class derived from a PYTHIA base class, and be
119
used in an external process, both of them handed in for generation
120
as with normal internal classes.</li>
122
<li><code>main23.cc</code> : shows how an external beam momentum spread
123
and vertex location generator can be implemented as a new class derived
124
from a PYTHIA base class, and then handed in for internal use.
125
Also how to use an external random-number generator and an external
126
parton distribution set.</li>
128
<li><code>main24.cc</code> : tests of internally implemented cross sections
129
for Supersymmetric particle production, with SYSY spectrum defined in
130
<code>cmssm.spc</code> and settings in <code>main24.cmnd</code>. For
131
illustration, an alternative example spectrum is also
132
available, <code>sps1aWithDecays.spc</code>, which contains a decay
133
table in SLHA format.</li>
135
<li><code>main25.cc</code> : input RPV-SUSY events from an LHEF file that
136
contains an SLHA spectrum inside its <code><header></code>. The
137
event file, <code>main25.lhe</code>, contains a sample events that
138
illustrate how to arrange color tags in the presence of the
139
color-space epsilon tensors that accompany baryon number violating
140
event topologies. </li>
142
<li><code>main26.cc</code> : test program for processes in scenarios
143
with large extra dimensions or unparticles. </li>
145
<li><code>main27.cc</code> : production of Kaluza-Klein <i>gamma/Z</i>
146
states in TeV-sized extra dimensions. </li>
148
<li><code>main28.cc</code> : production of long-lived R-hadrons, that
149
are forced to decay at a separate vertices and possibly with changed
152
<li><code>main31.cc</code> : exemplifies an improved matching of
153
parton showers to LHEF-style input based on the POWHEG approach.
154
The <code>main31.cmnd</code> allows to switch between several
155
different matching options. It also allows to select input process,
156
in this case either for the POWHEG-hvq program applied to top
157
pair production [<a href="Bibliography.html" target="page">Cor10</a>] or for QCD 2+3-jet events. The small
158
samples of input events are stored in the <code>powheg-hvq.lhe</code>
159
and <code>powheg-dijets.lhe</code> files, respectively.
162
<li><code>main41.cc</code> : similar to <code>main01</code>, except that
163
the event record is output in the HepMC event record format. Requires that
164
HepMC is properly linked. Note that the <code>hepmcout41.dat</code> output
165
file can become quite big; so no example is included in this
168
<li><code>main42.cc</code> : a streamlined version for the generation
169
of events that are then stored in HepMC format, without any event
170
analysis. That is, all physics studies will have to be done afterwards.
171
The name of the input "cards file" (e.g. <code>main42.cmnd</code>)
172
and output HepMC event file (e.g. <code>hepmcout42.dat</code>) are to
173
be provided as command-line arguments. Requires that HepMC is properly
174
linked. Note that the HepMC output file can become quite big; so no
175
example is included in this distribution.</li>
177
<li><code>main51.cc</code> : a test of the shape of parton densities,
178
as a check prior to using a given PDF set in a generator. Requires
179
that LHAPDF is properly linked.</li>
181
<li><code>main52.cc</code> : compares the charged multiplicity
182
distribution, and a few other minimum-bias physics aspects, between
183
default PYTHIA PDF and another one. Requires that LHAPDF is properly
186
<li><code>main53.cc</code> : tests the possibility to do backwards
187
evolution from an incoming photon at the hard interaction. Requires
188
that you link to a LHAPDF set that includes the photon PDF.</li>
190
<li><code>main61.cc</code> : a streamlined version for the generation
191
of events that are then stored in HepMC format, without any event
192
analysis. That is, just like <code>main42.cc</code>, with the difference
193
that <code>main61.cc</code> can be used in conjunction with LHAPDF.
194
The name of the input "cards file" (e.g. <code>main61.cmnd</code>)
195
and output HepMC event file (e.g. <code>hepmcout61.dat</code>) are to
196
be provided as command-line arguments. Requires that HepMC and LHAPDF
197
are properly linked. Note that the HepMC output file can become quite
198
big; so no example is included in this distribution.</li>
200
<li><code>main62.cc</code> : a further extension of <code>main61.cc</code>,
201
where subruns are used to process several consecutive LHEF,
202
as in <code>main13.cc</code>, with information stored e.g in
203
<code>main62.cmnd</code>. Other comments as for <code>main61.cc</code>.</li>
205
<li><code>main71.cc</code> : an example how the FastJet jet finding
206
package can be linked to allow an analysis of the final state,
207
in this case for a study of W + jet production.</li>
209
<li><code>main72.cc</code> : a comparison of SlowJet and FastJet
210
jet finding, showing that they find the same jets if run under
211
identical conditions, in this case for QCD jets.</li>
213
<li><code>main81.cc</code> : do CKKW-L merging with a merging scale
214
defined in <i>kT</i>. Input is provided by the <code>main81.cmnd</code>
215
file and the three data files <code>w+_production_lhc_0.lhe</code>,
216
<code>w+_production_lhc_1.lhe</code> and <code>w+_production_lhc_2.lhe</code>.
219
<li><code>main82.cc</code> : do CKKW-L merging with a user-defined
220
merging scale function. Input is provided by the <code>main82.cmnd</code>
221
file and the three data files <code>w+_production_lhc_0.lhe</code>,
222
<code>w+_production_lhc_1.lhe</code> and <code>w+_production_lhc_2.lhe</code>.
225
<li><code>main83.cc</code> : as <code>main82.cc</code> but with an
226
additional cut on the lowest multiplicity allowed for the reclustered
227
state. The same input as for <code>main82.cc</code> can be used.
230
<li><code>main84.cc</code> : do CKKW-L merging with output in such a way
231
that it can be used in subsequent RIVET analyses. Input is provided by
232
the <code>main84.cmnd</code> file and the three data files
233
<code>w+_production_lhc_0.lhe</code>, <code>w+_production_lhc_1.lhe</code>
234
and <code>w+_production_lhc_2.lhe</code>.
237
<li><code>main91.cc</code> : exemplifies how you can link in runtime
238
generation of hard processes from PYTHIA 6, using the Les Houches
239
Accord facilities. This example is deprecated, since PYTHIA 8 by now
240
contains essentially all hard processes found in PYTHIA 6.</li>
244
In addition two main program illustrating the use of ROOT are available
245
in the <code>rootexamples</code> subdirectory:
249
<li><code>hist.cc</code> : shows how ROOT can be used for histogramming
250
in a program that for the rest is structured like a normal PYTHIA run.
253
<li><code>hist.cc</code> : shows how PYTHIA events can be stored as
258
This subdirectory also contains a special Makefile and related
265
<!-- Copyright (C) 2012 Torbjorn Sjostrand -->