3 <title>Program Flow</title>
4 <link rel="stylesheet" type="text/css" href="pythia.css"/>
5 <link rel="shortcut icon" href="pythia32.gif"/>
9 <script language=javascript type=text/javascript>
10 function stopRKey(evt) {
11 var evt = (evt) ? evt : ((event) ? event : null);
12 var node = (evt.target) ? evt.target :((evt.srcElement) ? evt.srcElement : null);
13 if ((evt.keyCode == 13) && (node.type=="text"))
17 document.onkeypress = stopRKey;
20 if($_POST['saved'] == 1) {
21 if($_POST['filepath'] != "files/") {
22 echo "<font color='red'>SETTINGS SAVED TO FILE</font><br/><br/>"; }
24 echo "<font color='red'>NO FILE SELECTED YET.. PLEASE DO SO </font><a href='SaveSettings.php'>HERE</a><br/><br/>"; }
28 <form method='post' action='ProgramFlow.php'>
32 Recall that, to first order, the event generation process can be
33 subdivided into three stages:
35 <li>Initializaion.</li>
36 <li>The event loop.</li>
39 This is reflected in how the top-level <code>Pythia</code> class should
40 be used in the user-supplied main program, further outlined in the
41 following. Since the nature of the run is defined at the initialization
42 stage, this is where most of the PYTHIA user code has to be written.
43 So as not to confuse the reader unduly, the description of initialization
44 options has been subdivided into what would normally be used and what is
45 intended for more special applications.
48 At the bottom of this webpge is a complete survey of all public
49 <code>Pythia</code> methods and data members, in a more formal style
50 than the task-oriented descriptions found in the preceding sections.
51 This offers complementary information.
53 <h3>Initialization - normal usage</h3>
58 Already at the top of the main program file, you need to include the proper
63 To simplify typing, it also makes sense to declare
65 using namespace Pythia8;
71 The first step is to create a generator object,
76 It is this object that we will use from now on. Normally a run
77 will only contain one <code>Pythia</code> object. (But you can
78 use several <code>Pythia</code> objects, which then will be
79 independent of each other.)<br/>
80 By default all output from <code>Pythia</code> will be on the
81 <code>cout</code> stream, but the <code>list</code> methods below do
82 allow output to alternative streams or files.
87 You next want to set up the character of the run.
88 The pages under the "Setup Run Tasks" heading in the index
89 describe all the options available (with some very few exceptions,
90 found on the other pages).
91 The default values and your modifications are stored in two databases,
92 one for <?php $filepath = $_GET["filepath"];
93 echo "<a href='SettingsScheme.php?filepath=".$filepath."' target='page'>";?>generic settings</a>
94 and one for <?php $filepath = $_GET["filepath"];
95 echo "<a href='ParticleDataScheme.php?filepath=".$filepath."' target='page'>";?>particle data</a>.
96 Both of these are initialized with their default values by the
97 <code>Pythia</code> constructor. The default values can then be
98 changed, primarily by one of the two ways below, or by a combination
104 pythia.readString(string);
106 method repeatedly to do a change of a property at a time.
107 The information in the string is case-insensitive, but upper- and
108 lowercase can be combined for clarity. The rules are that<br/>
109 (i) if the first nonblank character of the string is a letter
110 it is assumed to contain a setting, and is sent on to
111 <code>pythia.settings.readString(string)</code>;<br/>
112 (ii) if instead the string begins with a digit it is assumed to
113 contain particle data updates, and so sent on to
114 <code>pythia.particleData.readString(string)</code>;<br/>
115 (iii) if none of the above, the string is assumed to be a comment,
116 i.e. nothing will be done.<br/>
117 In the former two cases, a warning is issued whenever a string
118 cannot be recognized (maybe because of a spelling mistake).<br/>
119 Some examples would be
121 pythia.readString("TimeShower:pTmin = 1.0");
122 pythia.readString("111:mayDecay = false");
124 The <code>readString(string)</code> method is intended primarily for
125 a few changes. It can also be useful if you want to construct a
126 parser for input files that contain commands both to PYTHIA and to
127 other libraries.<br/>
130 b) You can read in a file containing a list of those variables
131 you want to see changed, with a
133 pythia.readFile(fileName);
135 Each line in this file with be processes by the
136 <code>readString(string)</code> method introduced above. You can thus
137 freely mix comment lines and lines handed on to <code>Settings</code>
138 or to <code>ParticleData</code>.<br/>
139 This approach is better suited for more extensive changes than a direct
140 usage of <code>readString(string)</code>, and can also avoid having to
141 recompile and relink your main program between runs.<br/>
142 It is also possible to read input from an <code>istream</code>, by
143 default <code>cin</code>, rather than from a file. This may be convenient
144 if information is generated on-the-fly, within the same run.
147 Changes are made sequentially in the order the commands are encountered
148 during execution, meaning that if a parameter is changed several times
149 it is the last one that counts. The two special
150 <code><?php $filepath = $_GET["filepath"];
151 echo "<a href='Tunes.php?filepath=".$filepath."' target='page'>";?>Tune:ee</a></code> and
152 <code><?php $filepath = $_GET["filepath"];
153 echo "<a href='Tunes.php?filepath=".$filepath."' target='page'>";?>Tune:pp</a></code>
154 modes are expanded to change several settings in one go, but these obey
155 the same ordering rules.
161 Next comes the initialization stage, where all
162 remaining details of the generation are to be specified. The
163 <code>init(...)</code> method allows a few different input formats,
164 so you can pick the one convenient for you:
167 a) <code>pythia.init( idA, idB, eCM);</code><br/>
168 lets you specify the identities and the CM energy of the two incoming
169 beam particles, with A (B) assumed moving in the <i>+z (-z)</i>
173 b) <code>pythia.init( idA, idB, eA, eB);</code><br/>
174 is similar, but the two beam energies can be different, so the
175 collisions do not occur in the CM frame. If one of the beam energies
176 is below the particle mass you obtain a fixed-target topology.
179 c) <code>pythia.init( idA, idB, pxA, pyA, pzA, pxB, pyB, pzB);</code><br/>
180 is similar, but here you provide the three-momenta
181 <i>(p_x, p_y, p_z)</i> of the two incoming particles,
182 to allow for arbitrary beam directions.
185 d) <code>pythia.init(fileName);</code> <br/>
186 assumes a file in the <?php $filepath = $_GET["filepath"];
187 echo "<a href='LesHouchesAccord.php?filepath=".$filepath."' target='page'>";?>Les Houches
188 Event File</a> format is provided.
191 e) <code>pythia.init();</code><br/>
192 with no arguments will read the beam parameters from the
193 <code><?php $filepath = $_GET["filepath"];
194 echo "<a href='MainProgramSettings.php?filepath=".$filepath."' target='page'>";?>Main</a></code>
195 group of variables, which provides you with the same possibilities as
196 the above options a, b, c and d. If you don't change any of those you will
197 default to proton-proton collisions at 14 TeV, i.e. the nominal LHC
201 f) <code>pythia.init( LHAup*);</code> <br/>
202 assumes <?php $filepath = $_GET["filepath"];
203 echo "<a href='LesHouchesAccord.php?filepath=".$filepath."' target='page'>";?>Les Houches Accord</a>
204 initialization and event information is available in an <code>LHAup</code>
205 class object, and that a pointer to this object is handed in.
209 If you want to have a list of the generator and particle data used,
210 either only what has been changed or everything, you can use
212 pythia.settings.listChanged();
213 pythia.settings.listAll();
214 pythia.particleData.listChanged();
215 pythia.particleData.listAll();
221 <h3>The event loop</h3>
226 Inside the event generation loop you generate the
227 next event using the <code>next()</code> method,
231 This method takes no arguments; everything has already been specified.
232 It does return a bool value, however, <code>false</code> when the
233 generation failed. This can be a "programmed death" when the
234 supply of input parton-level configurations on file is exhausted.
235 It can alternatively signal a failure of <code>Pythia</code> to
236 generate an event, or unphysical features in the event record at the
237 end of the generation step. It makes sense to allow a few <code>false</code>
238 values before a run is aborted, so long as the related faulty
244 The generated event is now stored in the <code>event</code>
245 object, of type <code><?php $filepath = $_GET["filepath"];
246 echo "<a href='EventRecord.php?filepath=".$filepath."' target='page'>";?>Event</a></code>,
247 which is a public member of <code>pythia</code>. You therefore have
248 access to all the tools described on the pages under the "Study Output"
249 header in the index. For instance, an event can be listed with
250 <code>pythia.event.list()</code>, the identity of the <i>i</i>'th
251 <?php $filepath = $_GET["filepath"];
252 echo "<a href='ParticleProperties.php?filepath=".$filepath."' target='page'>";?>particle</a> is given by
253 <code>pythia.event[i].id()</code>, and so on.<br/>
254 The hard process - roughly the information normally stored in the
255 Les Houches Accord event record - is available as a second object,
256 <code>process</code>, also of type <code>Event</code>.<br/>
257 A third useful public object is
258 <code><?php $filepath = $_GET["filepath"];
259 echo "<a href='EventInformation.php?filepath=".$filepath."' target='page'>";?>info</a></code>, which offers
260 a set of one-of-a kind pieces of information about the most recent
270 <li>At the end of the generation process, you can call
274 to get some run statistics, on cross sections and the number of errors
275 and warnings encountered.
280 <h3>Advanced usage, mainly for initialization</h3>
282 A) Necessary data are automatically loaded when you use the
283 default PYTHIA installation directory structure and run the main
284 programs in the <code>examples</code> subdirectory. However, in the
285 general case, you must provide the path of the <code>xmldoc</code>
286 directory, where default settings and particle data are found.
287 This can be done in two ways.
292 You can set the environment variable <code>PYTHIA8DATA</code> to
293 contain the location of the <code>xmldoc</code> directory. In the
294 <code>csh</code> and <code>tcsh</code> shells this could e.g. be
296 setenv PYTHIA8DATA /home/myname/pythia81xx/xmldoc
298 while in other shells it could be
300 export PYTHIA8DATA=/home/myname/pythia81xx/xmldoc
302 where xx is the subversion number.<br/>
303 Recall that environment variables set locally are only defined in the
304 current instance of the shell. The above lines should go into your
305 <code>.cshrc</code> and <code>.bashrc</code> files, respectively,
306 if you want a more permanant assignment.
311 You can provide the path as argument to the <code>Pythia</code>
314 Pythia pythia("/home/myname/pythia81xx/xmldoc");
318 where again xx is the subversion number.<br/>
319 When <code>PYTHIA8DATA</code> is set it takes precedence, else
320 the path in the constructor is used, else one defaults to the
321 <code>../xmldoc</code> directory.
324 B) You can override the default behaviour of PYTHIA not only by the
325 settings and particle data, but also by replacing some of the
326 PYTHIA standard routines by ones of your own. Of course, this is only
327 possible if your routines fit into the general PYTHIA framework.
328 Therefore they must be coded according to the the rules relevant
329 in each case, as a derived class of a PYTHIA base class, and a pointer
330 to such an object must be handed in by one of the methods below.
331 These calls must be made before the <code>pythia.init(...)</code> call.
336 If you are not satisfied with the list of parton density functions that
337 are implemented internally or available via the LHAPDF interface
338 (see the <?php $filepath = $_GET["filepath"];
339 echo "<a href='PDFSelection.php?filepath=".$filepath."' target='page'>";?>PDF Selection</a> page), you
340 can suppy your own by a call to the <code>setPDFPtr(...)</code> method
342 pythia.setPDFptr( pdfAPtr, pdfBPtr);
344 where <code>pdfAPtr</code> and <code>pdfBPtr</code> are pointers to
345 two <code>Pythia</code> <?php $filepath = $_GET["filepath"];
346 echo "<a href='PartonDistributions.php?filepath=".$filepath."' target='page'>";?>PDF
347 objects</a>. Note that <code>pdfAPtr</code> and <code>pdfBPtr</code>
348 cannot point to the same object; even if the PDF set is the same,
349 two copies are needed to keep track of two separate sets of <i>x</i>
350 and density values.<br/>
351 If you further wish to use separate PDF's for the hard process of an
352 event than the ones being used for everything else, the extended form
354 pythia.setPDFptr( pdfAPtr, pdfBPtr, pdfHardAPtr, pdfHardBPtr);
356 allows you to specify those separately, and then the first two sets
357 would only be used for the showers and for multiple interactions.
362 If you want to perform some particle decays with an
363 external generator, you can call the <code>setDecayPtr(...)</code>
366 pythia.setDecayPtr( decayHandlePtr, particles);
368 where the <code>decayHandlePtr</code> derives from the
369 <code><?php $filepath = $_GET["filepath"];
370 echo "<a href='ExternalDecays.php?filepath=".$filepath."' target='page'>";?>DecayHandler</a></code> base
371 class and <code>particles</code> is a vector of particle codes to be
377 If you want to use an external random number generator,
378 you can call the <code>setRndmEnginePtr(...)</code> method
380 pythia.setRndmEnginePtr( rndmEnginePtr);
382 where <code>rndmEnginePtr</code> derives from the
383 <code><?php $filepath = $_GET["filepath"];
384 echo "<a href='RandomNumbers.php?filepath=".$filepath."' target='page'>";?>RndmEngine</a></code> base class.
385 The <code>Pythia</code> default random number generator is perfectly
386 good, so this is only intended for consistency in bigger frameworks.
391 If you want to interrupt the evolution at various stages,
392 to interrogate the event and possibly veto it, or you want to
393 reweight the cross section, you can use
395 pythia.setUserHooksPtr( userHooksPtr);
397 where <code>userHooksPtr</code> derives from the
398 <code><?php $filepath = $_GET["filepath"];
399 echo "<a href='UserHooks.php?filepath=".$filepath."' target='page'>";?>UserHooks</a></code> base class.
404 If you want to use your own parametrization of beam momentum spread and
405 interaction vertex, rather than the provided simple Gaussian
406 parametrization (off by default), you can call
408 pythia.setBeamShapePtr( beamShapePtr);
410 where <code>beamShapePtr</code> derives from the
411 <code><?php $filepath = $_GET["filepath"];
412 echo "<a href='BeamShape.php?filepath=".$filepath."' target='page'>";?>BeamShape</a></code> base class.
417 If you want to implement a cross section of your own, but still make use
418 of the built-in phase space selection machinery, you can use
420 pythia.setSigmaPtr( sigmaPtr);
422 where <code>sigmaPtr</code> of type <code>SigmaProcess*</code> is an
423 instance of a class derived from one of the <code>Sigma1Process</code>,
424 <code>Sigma2Process</code> and <code>Sigma3Process</code> base classes
425 in their turn derived from
426 <code><?php $filepath = $_GET["filepath"];
427 echo "<a href='SemiInternalProcesses.php?filepath=".$filepath."' target='page'>";?>SigmaProcess</a></code>.
428 This call can be used repeatedly to hand in several different processes.
433 If your cross section contains the production of a new resonance
434 with known analytical expression for all the relevant partial widths,
435 you can make this resonance available to the program with
437 pythia.setResonancePtr( resonancePtr);
439 where <code>resonancePtr</code> of type <code>ResonanceWidths*</code>
440 is an instance of a class derived from the
441 <code><?php $filepath = $_GET["filepath"];
442 echo "<a href='SemiInternalResonances.php?filepath=".$filepath."' target='page'>";?>ResonanceWidths</a></code>
443 base class. In addition you need to add the particle to the normal
444 <?php $filepath = $_GET["filepath"];
445 echo "<a href='ParticleDataScheme.php?filepath=".$filepath."' target='page'>";?>particle and decay database</a>.
446 This procedure can be used repeatedly to hand in several different
452 If you are a real expert and want to <?php $filepath = $_GET["filepath"];
453 echo "<a href='ImplementNewShowers.php?filepath=".$filepath."' target='page'>";?>replace
454 the PYTHIA initial- and final-state showers</a>, you can use
456 pythia.setShowerPtr( timesDecPtr, timesPtr, spacePtr);
458 where <code>timesDecPtr</code> and <code>timesPtr</code>
459 derive from the <code>TimeShower</code> base class, and
460 <code>spacePtr</code> from <code>SpaceShower</code>.
466 C) Some comments on collecting several tasks in the same run.
470 PYTHIA has not been written for threadsafe execution on multicore
471 processors. If you want to use all cores,
472 the most efficient way presumably is to start correspondingly many jobs,
473 with different random number seeds, and add the statistics at the end.
478 In some cases it is convenient to use more than one <code>Pythia</code>
479 object. The key example would be the simultaneous generation of signal
480 and pileup events, see <code>main19.cc</code>. The two objects are then
481 set up and initialized separately, and generate events completely
482 independently of each other. It is only afterwards that the event records
483 are combined into one single super-event per beam crossing.
488 When time is not an issue, it may be that you want to perform several
489 separate subruns sequentially inside a run, e.g. to combine results for
490 several kinematical regions or to compare results for some different
491 tunes of the underlying event. One way to go is to create (and destroy)
492 one <code>pythia</code> object for each subrun, in which case they are
493 completely separate. You can also use the same <code>pythia</code> object,
494 only doing a new <code>init(...)</code> call for each subrun. In that
495 case, the settings and particle databases remain as they were in the
496 previous subrun, only affected by the specific changes you introduced in
497 the meantime. You can put those changes in the main program, with
498 <code>pythia.readString(string)</code>, using your own logic to decide
499 which ones to execute in which subrun. A corresponding possibility
500 exists with <code>pythia.readFile(fileName, subrun)</code> (or an
501 <code>istream</code> instead of a <code>fileName</code>), which as second
502 argument can take a non-negative subrun number. Then only those
503 sections of the file before any <code>Main:subrun = ...</code> line
504 or with matching <code>subrun</code> number will be read. That is, the
505 file could have a structure like
507 ( lines always read, i.e. "default values" always (re)set )
509 ( lines only read with readFile(fileName, 1) )
511 ( lines only read with readFile(fileName, 2) )
513 Both of these possibilities are illustrated in <code>main08.cc</code>.
518 When working with Les Houches Event Files, it may well be that your
519 intended input event sample is spread over several files, that you all
520 want to turn into complete events in one and the same run. There is no
521 problem with looping over several subruns, where each new subrun
522 is initialized with a new file. However, in that case you will do
523 a complete re-initialization each time around. If you want to avoid
524 this, note that there is an optional second argument for LHEF
525 initialization: <code>pythia.init(fileName, skipInit)</code>.
526 Alternatively, the tag <code>Main:LHEFskipInit</code> can be put
527 in a file of commands to obtain the same effect.
528 Here <code>skipInit</code> defaults to <code>false</code>,
529 but if set <code>true</code> then the new file will be simulated
530 with the same initialization data as already set in a previous
531 <code>pythia.init(...)</code> call. The burden rests on you to ensure
532 that this is indeed correct, e.g. that the two event samples have not
533 been generated for different beam energies.
538 <h2>The Pythia Class</h2>
540 Here follows the complete survey of all public <code>Pythia</code>
541 methods and data members.
543 <h3>Constructor and destructor</h3>
545 <a name="method1"></a>
546 <p/><strong>Pythia::Pythia(string xmlDir = "../xmldoc") </strong> <br/>
547 creates an instance of the <code>Pythia</code> event generators,
548 and sets initial default values, notably for all settings and
549 particle data. You may use several <code>Pythia</code> instances
550 in the same run; only when you want to access external static
551 libraries could this cause problems. (This includes in particular
552 Fortran libraries such as <?php $filepath = $_GET["filepath"];
553 echo "<a href='PDFSelection.php?filepath=".$filepath."' target='page'>";?>LHAPDF</a>.)
554 <br/><code>argument</code><strong> xmlDir </strong> (<code>default = <strong>../xmldoc</strong></code>) : allows you to choose
555 from which directory the default settings and particle data values
556 are read in. If the <code>PYTHIA8DATA</code> environment variable
557 has been set it takes precedence. Else this optional argument allows
558 you to choose another directory location than the default one. Note
559 that it is only the directory location you can change, its contents
560 must be the ones of the <code>xmldoc</code> directory in the
561 standard distribution.
565 <a name="method2"></a>
566 <p/><strong>Pythia::~Pythia </strong> <br/>
567 the destructor deletes the objects created by the constructor.
571 <a name="method3"></a>
572 <p/><strong>bool Pythia::readString(string line, bool warn = true) </strong> <br/>
573 reads in a single string, that is interpreted as an instruction to
574 modify the value of a <?php $filepath = $_GET["filepath"];
575 echo "<a href='SettingsScheme.php?filepath=".$filepath."' target='page'>";?>setting</a> or
576 <?php $filepath = $_GET["filepath"];
577 echo "<a href='ParticleDataScheme.php?filepath=".$filepath."' target='page'>";?>particle data</a>, as already described
579 <br/><code>argument</code><strong> line </strong> :
580 the string to be interpreted as an instruction.
582 <br/><code>argument</code><strong> warn </strong> (<code>default = <strong>true</strong></code>) :
583 write a warning message or not whenever the instruction does not make
584 sense, e.g. if the variable does not exist in the databases.
586 <br/><b>Note:</b> the method returns false if it fails to
587 make sense out of the string.
590 <a name="method4"></a>
591 <p/><strong>bool Pythia::readFile(string fileName, bool warn = true, int subrun = SUBRUNDEFAULT) </strong> <br/>
593 <strong>bool Pythia::readFile(string fileName, int subrun = SUBRUNDEFAULT) </strong> <br/>
595 <strong>bool Pythia::readFile(istream& inStream = cin, bool warn = true, int subrun = SUBRUNDEFAULT) </strong> <br/>
597 <strong>bool Pythia::readFile(istream& inStream = cin, int subrun = SUBRUNDEFAULT) </strong> <br/>
598 reads in a whole file, where each line is interpreted as an instruction
599 to modify the value of a <?php $filepath = $_GET["filepath"];
600 echo "<a href='SettingsScheme.php?filepath=".$filepath."' target='page'>";?>setting</a> or
601 <?php $filepath = $_GET["filepath"];
602 echo "<a href='ParticleDataScheme.php?filepath=".$filepath."' target='page'>";?>particle data</a>, cf. the above
603 <code>readString</code> method. All four forms of the
604 <code>readFile</code> command share code for actually reading a file.
605 <br/><code>argument</code><strong> fileName </strong> :
606 the file from which instructions are read.
608 <br/><code>argument</code><strong> inStream </strong> :
609 an istream from which instructions are read.
611 <br/><code>argument</code><strong> warn </strong> (<code>default = <strong>true</strong></code>) :
612 write a warning message or not whenever the instruction does not make
613 sense, e.g. if the variable does not exist in the databases. In the
614 command forms where <code>warn</code> is omitted it is true.
616 <br/><code>argument</code><strong> subrun </strong> :
617 allows you have several optional sets of commands within the same file.
618 Only those sections of the file before any <code>Main:subrun = ...</code>
619 line or following such a line with matching subrun number will be read.
620 The subrun number should not be negative; negative codes like
621 <code>SUBRUNDEFAULT</code> corresponds to no specific subrun.
623 <br/><b>Note:</b> the method returns false if it fails to
624 make sense out of any one line.
627 <a name="method5"></a>
628 <p/><strong>bool Pythia::setPDFPtr( PDF* pdfAPtr, PDF* pdfBPtr, PDF* pdfHardAPtr = 0, PDF* pdfHardBPtr = 0) </strong> <br/>
629 offers the possibility to link in external PDF sets for usage inside
630 the program. The rules for constructing your own class from
631 the <code>PDF</code> base class are described
632 <?php $filepath = $_GET["filepath"];
633 echo "<a href='PartonDistributions.php?filepath=".$filepath."' target='page'>";?>here</a>.
634 <br/><code>argument</code><strong> pdfAPtr, pdfBPtr </strong> :
635 pointers to two <code>PDF</code>-derived objects, one for each of
636 the incoming beams. The two objects have to be instantiated by you
637 in your program. Even if the two beam particles are the same
638 (protons, say) two separate instances are required, since current
639 information is cached in the objects. If both arguments are zero
640 then any previous linkage to external PDF's is disconnected,
641 see further Note 2 below.
643 <br/><code>argument</code><strong> pdfHardAPtr, pdfHardBPtr </strong> (<code>default = <strong>0</strong></code>) :
644 pointers to two further <code>PDF</code>-derived objects, one for each
645 of the incoming beams. Normally only the first two arguments above would
646 be used, and then the same PDF sets would be invoked everywhere. If you
647 provide these two further pointers then two different sets of PDF's are
648 used. This second set is then exclusively for the generation of the hard
649 process from the process matrix elements library. The first set above
650 is for everything else, notably parton showers and multiple interactions.
652 <br/><b>Note 1:</b> The method returns false if the input is obviously
653 incorrect, e.g. if two (nonzero) pointers agree.
654 <br/><b>Note 2:</b> If you want to combine several subruns you can
655 call <code>setPDFPtr</code> with new arguments before each
656 <code>Pythia::init(...)</code> call. To revert from external PDF's
657 to the normal internal PDF selection you must call
658 <code>setPDFPtr(0, 0)</code> before <code>Pythia::init(...)</code>.
661 <a name="method6"></a>
662 <p/><strong>bool Pythia::setDecayPtr( DecayHandler* decayHandlePtr, vector<int> handledParticles) </strong> <br/>
663 offers the possibility to link to an external program that can do some
664 of the particle decays, instad of using the internal decay machinery.
665 With particles we here mean the normal hadrons and leptons, not
666 top quarks, electroweak bosons or new particles in BSM scenarios.
667 The rules for constructing your own class from the
668 <code>DecayHandler</code> base class are described
669 <?php $filepath = $_GET["filepath"];
670 echo "<a href='ExternalDecays.php?filepath=".$filepath."' target='page'>";?>here</a>. Note that you can only
671 provide one external object, but this object in its turn could
672 very well hand on different particles to separate decay libraries.
673 <br/><code>argument</code><strong> decayHandlePtr </strong> :
674 pointer to a <code>DecayHandler</code>-derived object. This object
675 must be instantiated by you in your program.
677 <br/><code>argument</code><strong> handledParticles </strong> : vector with the PDG identity codes
678 of the particles that should be handled by the external decay package.
679 You should only give the particle (positive) codes; the respective
680 antiparticle is always included as well.
682 <br/><b>Note:</b> The method currently always returns true.
685 <a name="method7"></a>
686 <p/><strong>bool Pythia::setRndmEnginePtr( RndmEngine* rndmEnginePtr) </strong> <br/>
687 offers the possibility to link to an external random number generator.
688 The rules for constructing your own class from the
689 <code>RndmEngine</code> base class are described
690 <?php $filepath = $_GET["filepath"];
691 echo "<a href='RandomNumbers.php?filepath=".$filepath."' target='page'>";?>here</a>.
692 <br/><code>argument</code><strong> rndmEnginePtr </strong> :
693 pointer to a <code>RndmEngine</code>-derived object. This object
694 must be instantiated by you in your program.
696 <br/><b>Note:</b> The method returns true if the pointer is different
700 <a name="method8"></a>
701 <p/><strong>bool Pythia::setUserHooksPtr( UserHooks* userHooksPtr) </strong> <br/>
702 offers the possibility to interact with the generation process at
703 a few different specified points, e.g. to reject undesirable events
704 at an early stage to save computer time. The rules for constructing
705 your own class from the <code>UserHooks</code> base class are described
706 <?php $filepath = $_GET["filepath"];
707 echo "<a href='UserHooks.php?filepath=".$filepath."' target='page'>";?>here</a>. You can only hand in one such
708 pointer, but this may be to a class that implements several of the
709 different allowed possibilities.
710 <br/><code>argument</code><strong> userHooksPtr </strong> :
711 pointer to a <code>userHooks</code>-derived object. This object
712 must be instantiated by you in your program.
714 <br/><b>Note:</b> The method currently always returns true.
717 <a name="method9"></a>
718 <p/><strong>bool Pythia::setBeamShapePtr( BeamShape* beamShapePtr) </strong> <br/>
719 offers the possibility to provide your own shape of the momentum and
720 space-time spread of the incoming beams. The rules for constructing
721 your own class from the <code>BeamShape</code> base class are described
722 <?php $filepath = $_GET["filepath"];
723 echo "<a href='BeamShape.php?filepath=".$filepath."' target='page'>";?>here</a>.
724 <br/><code>argument</code><strong> BeamShapePtr </strong> :
725 pointer to a <code>BeamShape</code>-derived object. This object
726 must be instantiated by you in your program.
728 <br/><b>Note:</b> The method currently always returns true.
731 <a name="method10"></a>
732 <p/><strong>bool Pythia::setSigmaPtr( SigmaProcess* sigmaPtr) </strong> <br/>
733 offers the possibility to link your own implementation of a process
734 and its cross section, to make it a part of the normal process
735 generation machinery, without having to recompile the
736 <code>Pythia</code> library itself. The rules for constructing your
737 own class from the <code>SigmaProcess</code> base class are described
738 <?php $filepath = $_GET["filepath"];
739 echo "<a href='SemiInternalProcesses.php?filepath=".$filepath."' target='page'>";?>here</a>. You may call this
740 routine repeatedly, to add as many new processes as you wish.
741 <br/><code>argument</code><strong> sigmaPtr </strong> :
742 pointer to a <code>SigmaProcess</code>-derived object. This object
743 must be instantiated by you in your program.
745 <br/><b>Note:</b> The method currently always returns true.
748 <a name="method11"></a>
749 <p/><strong>bool Pythia::setResonancePtr( ResonanceWidths* resonancePtr) </strong> <br/>
750 offers the possibility to link your own implementation of the
751 calculation of partial resonance widths, to make it a part of the
752 normal process generation machinery, without having to recompile the
753 <code>Pythia</code> library itself. This allows the decay of new
754 resonances to be handled internally, when combined with new particle
755 data. Note that the decay of normal hadrons cannot be modelled here;
756 this is for New Physics resonances. The rules for constructing your
757 own class from the <code>ResonanceWidths</code> base class are described
758 <?php $filepath = $_GET["filepath"];
759 echo "<a href='SemiInternalResonances.php?filepath=".$filepath."' target='page'>";?>here</a>. You may call this
760 routine repeatedly, to add as many new resonances as you wish.
761 <br/><code>argument</code><strong> resonancePtr </strong> :
762 pointer to a <code>ResonanceWidths</code>-derived object. This object
763 must be instantiated by you in your program.
765 <br/><b>Note:</b> The method currently always returns true.
768 <a name="method12"></a>
769 <p/><strong>bool Pythia::setShowerPtr( TimeShower* timesDecPtr, TimeShower* timesPtr = 0, SpaceShower* spacePtr = 0) </strong> <br/>
770 offers the possibility to link your own parton shower routines as
771 replacements for the default ones. This is much more complicated
772 since the showers are so central and are so interlinked with other
773 parts of the program. Therefore it is also possible to do the
774 replacement in stages, from the more independent to the more
775 intertwined. The rules for constructing your own classes from the
776 <code>TimeShower</code> and <code>SpaceShower</code>base classes
777 are described <?php $filepath = $_GET["filepath"];
778 echo "<a href='ImplementNewShowers.php?filepath=".$filepath."' target='page'>";?>here</a>. These
779 objects must be instantiated by you in your program.
780 <br/><code>argument</code><strong> timesDecPtr </strong> :
781 pointer to a <code>TimeShower</code>-derived object for doing
782 timelike shower evolution in resonance decays, e.g. of a
783 <i>Z^0</i>. This is decoupled from beam remnants and parton
784 distributions, and is therefore the simplest kind of shower
785 to write. If you provide a value 0 then the internal shower
786 routine will be used.
788 <br/><code>argument</code><strong> timesPtr </strong> (<code>default = <strong>0</strong></code>) :
789 pointer to a <code>TimeShower</code>-derived object for doing
790 all other timelike shower evolution, which is normally interleaved
791 with multiple interactions and spacelike showers, introducing
792 both further physics and further technical issues. If you retain
793 the default value 0 then the internal shower routine will be used.
794 You are allowed to use the same pointer as above for the
795 <code>timesDecPtr</code> if the same shower can fulfill both tasks.
797 <br/><code>argument</code><strong> spacePtr </strong> (<code>default = <strong>0</strong></code>) :
798 pointer to a <code>SpaceShower</code>-derived object for doing
799 all spacelike shower evolution, which is normally interleaved
800 with multiple interactions and timelike showers. If you retain
801 the default value 0 then the internal shower routine will be used.
803 <br/><b>Note:</b> The method currently always returns true.
808 At the initialization stage all the information provided above is
809 processed, and the stage is set up for the subsequent generation
810 of events. Several alterative forms of the <code>init</code> method
811 are available for this stage; pick the one most convenient.
813 <a name="method13"></a>
814 <p/><strong>bool Pythia::init( int idA, int idB, double eCM) </strong> <br/>
815 initialize for collisions in the center-of-mass frame, with the
816 beams moving in the <i>+-z</i> directions.
817 <br/><code>argument</code><strong> idA, idB </strong> :
818 particle identity code for the two incoming beams.
820 <br/><code>argument</code><strong> eCM </strong> :
821 the CM energy of the collisions.
823 <br/><b>Note:</b> The method returns false if the
824 initialization fails. It is then not possible to generate any
828 <a name="method14"></a>
829 <p/><strong>bool Pythia::init( int idA, int idB, double eA, double eB) </strong> <br/>
830 initialize for collisions with back-to-back beams,
831 moving in the <i>+-z</i> directions, but with different energies.
832 <br/><code>argument</code><strong> idA, idB </strong> :
833 particle identity code for the two incoming beams.
835 <br/><code>argument</code><strong> eA, eB </strong> :
836 the energies of the two beams. If an energy is set to be below
837 the mass of the respective beam particle that particle is taken to
838 be at rest. This offers a simple possibility to simulate
839 fixed-target collisions.
841 <br/><b>Note:</b> The method returns false if the
842 initialization fails. It is then not possible to generate any
846 <a name="method15"></a>
847 <p/><strong>bool Pythia::init( int idA, int idB, double pxA, double pyA, double pzA, double pxB, double pyB, double pzB) </strong> <br/>
848 initialize for collisions with arbitrary beam directions.
849 <br/><code>argument</code><strong> idA, idB </strong> :
850 particle identity code for the two incoming beams.
852 <br/><code>argument</code><strong> pxA, pyA, pzA </strong> :
853 the three-momntum vector <i>(p_x, p_y, p_z)</i> of the first
856 <br/><code>argument</code><strong> pxB, pyB, pzB </strong> :
857 the three-momntum vector <i>(p_x, p_y, p_z)</i> of the second
860 <br/><b>Note:</b> The method returns false if the
861 initialization fails. It is then not possible to generate any
865 <a name="method16"></a>
866 <p/><strong>bool Pythia::init( string LesHouchesEventFile, bool skipInit = false) </strong> <br/>
867 initialize for hard-process collisions fed in from an external file
868 with events, written according to the
869 <?php $filepath = $_GET["filepath"];
870 echo "<a href='LesHouchesAccord.php?filepath=".$filepath."' target='page'>";?>Les Houches Event File</a>
872 <br/><code>argument</code><strong> LesHouchesEventFile </strong> :
873 the file name (including path, where required) where the
874 events are stored, including relevant information on beam
875 identities and energies.
877 <br/><code>argument</code><strong> skipInit </strong> (<code>default = <strong>false</strong></code>) :
878 By default this method does a complete reinitialization of the
879 generation process. If you set this argument to true then
880 no reinitialization will occur, only the pointer to the event
881 file is updated. This may come in handy if the full event sample
882 is split across several files generated under the same conditions
883 (except random numbers, of course). You then do the first
884 initialization with the default, and all subsequent ones with
885 true. Note that things may go wrong if the files are not created
886 under the same conditions.
888 <br/><b>Note:</b> The method returns false if the
889 initialization fails. It is then not possible to generate any
893 <a name="method17"></a>
894 <p/><strong>bool Pythia::init() </strong> <br/>
895 initialize for collisions, in any of the four above possibilities.
896 In this option the beams are not specified by input arguments,
897 but instead by the settings in the
898 <?php $filepath = $_GET["filepath"];
899 echo "<a href='BeamParameters.php?filepath=".$filepath."' target='page'>";?>Beam Parameters</a> section.
900 This allows the beams to be specified in the same file as other
901 run instructions. The default settings give pp collisions at 14 TeV.
902 <br/><b>Note:</b> The method returns false if the
903 initialization fails. It is then not possible to generate any
907 <a name="method18"></a>
908 <p/><strong>bool Pythia::init( LHAup* lhaUpPtr) </strong> <br/>
909 initialize for hard-process collisions fed in from an external
910 source of events, consistent with the Les Houches Accord standard.
911 The rules for constructing your own class from the <code>LHAup</code>
912 base class are described <?php $filepath = $_GET["filepath"];
913 echo "<a href='LesHouchesAccord.php?filepath=".$filepath."' target='page'>";?>here</a>.
914 This class is also required to provide the beam parameters.
915 <br/><code>argument</code><strong> lhaUpPtr </strong> :
916 pointer to a <code>LHAup</code>-derived object. This object
917 must be instantiated by you in your program.
919 <br/><b>Note:</b> The method returns false if the
920 initialization fails. It is then not possible to generate any
924 <h3>Generate events</h3>
926 The <code>next()</code> method is the main one to generate events.
927 In this section we also put a few other specialized methods that
928 may be useful in some circumstances.
930 <a name="method19"></a>
931 <p/><strong>bool Pythia::next() </strong> <br/>
932 generate the next event. No input parameters are required; all
933 instructions have already been set up in the initialization stage.
934 <br/><b>Note:</b> The method returns false if the event generation
935 fails. The event record is then not consistent and should not be
936 studied. When reading in hard collisions from a Les Houches Event File
937 the problem may be that the end of the file has been reached. This
938 can be checked with the
939 <code><?php $filepath = $_GET["filepath"];
940 echo "<a href='EventInformation.php?filepath=".$filepath."' target='page'>";?>Info::atEndOfFile()</a></code>
944 <a name="method20"></a>
945 <p/><strong>bool Pythia::forceHadronLevel() </strong> <br/>
946 hadronize the existing event record, i.e. perform string fragmentation
947 and particle decays. There are two main applications. Firstly,
948 you can use the same parton-level content as a basis for repeated
949 hadronization attempts, in schemes intended to save computer time.
950 Secondly, you may have an external program that can simulate the full
951 partonic level of the event - hard process, parton showers, multiple
952 interactions, beam remnants, colour flow, and so on - but not
953 hadronization. Further details are found
954 <?php $filepath = $_GET["filepath"];
955 echo "<a href='HadronLevelStandalone.php?filepath=".$filepath."' target='page'>";?>here</a>.
956 <br/><b>Note:</b> The method returns false if the hadronization
957 fails. The event record is then not consistent and should not be
961 <a name="method21"></a>
962 <p/><strong>bool Pythia::moreDecays() </strong> <br/>
963 perform decays of all particles in the event record that have not been
964 decayed but should have been done so. This can be used e.g. for
965 repeated decay attempts, in schemes intended to save computer time.
966 Further details are found <?php $filepath = $_GET["filepath"];
967 echo "<a href='HadronLevelStandalone.php?filepath=".$filepath."' target='page'>";?>here</a>.
968 <br/><b>Note:</b> The method returns false if the decays fail. The
969 event record is then not consistent and should not be studied.
972 <a name="method22"></a>
973 <p/><strong>void Pythia::LHAeventList(ostream& os = cout) </strong> <br/>
974 list the Les Houches Accord information on the current event, see
975 <code><?php $filepath = $_GET["filepath"];
976 echo "<a href='LesHouchesAccord.php?filepath=".$filepath."' target='page'>";?>LHAup::listEvent(...)</a></code>.
977 (Other listings are available via the class members below, so this
978 listing is a special case that would not fit elsewhere.)
979 <br/><code>argument</code><strong> os </strong> (<code>default = <strong>cout</strong></code>) :
980 output stream where the listing occurs.
984 <a name="method23"></a>
985 <p/><strong>bool Pythia::LHAeventSkip(int nSkip) </strong> <br/>
986 skip ahead a number of events in the Les Houches generation
987 sequence, without doing anything further with them, see
988 <code><?php $filepath = $_GET["filepath"];
989 echo "<a href='LesHouchesAccord.php?filepath=".$filepath."' target='page'>";?>LHAup::skipEvent(nSkip)</a></code>.
990 Mainly intended for debug purposes, e.g. when an event at a known
991 location in a Les Houches Event File is causing problems.
992 <br/><code>argument</code><strong> nSkip </strong> :
993 number of events to skip.
995 <br/><b>Note:</b> The method returns false if the operation fails,
996 specifically if the end of a LHEF has been reached, cf.
997 <code>next()</code> above.
1002 There is no required finalization step; you can stop generating events
1003 when and how you want. It is still recommended that you make it a
1004 routine to call the following method at the end.
1006 <a name="method24"></a>
1007 <p/><strong>void Pythia::statistics(bool all = false, bool reset = false) </strong> <br/>
1008 list statistics on the event generation, specifically total and partial
1009 cross sections and the number of different errors. For more details see
1010 <?php $filepath = $_GET["filepath"];
1011 echo "<a href='EventStatistics.php?filepath=".$filepath."' target='page'>";?>here</a>.
1012 <br/><code>argument</code><strong> all </strong> (<code>default = <strong>false</strong></code>) :
1013 if true also statistics on multiple interactions is shown, by default not.
1015 <br/><code>argument</code><strong> reset </strong> (<code>default = <strong>false</strong></code>) : if true then all counters,
1016 e.g on events generated and errors experienced, are reset to zero
1017 whenever the routine is called. The default instead is that
1018 all stored statistics information is unaffected by the call. Counters
1019 are automatically reset in each new <code>Pythia::init(...)</code>
1020 call, however, so the only time the <code>reset</code> option makes a
1021 difference is if <code>statistics(...)</code> is called several times
1026 <h3>Interrogate settings</h3>
1028 Normally settings are used in the setup and initialization stages
1029 to determine the character of a run, e.g. read from a file with the
1030 above-described <code>Pythia::readFile(...)</code> method.
1031 There is no strict need for a user to interact with the
1032 <code>Settings</code> database in any other way. However, as an option,
1033 some settings variables have been left free for the user to set in
1034 such a file, and then use in the main program to directly affect the
1035 performance of that program, see
1036 <?php $filepath = $_GET["filepath"];
1037 echo "<a href='MainProgramSettings.php?filepath=".$filepath."' target='page'>";?>here</a>. A typical example would
1038 be the number of events to generate. For such applications the
1039 following shortcuts to some <code>Settings</code> methods may be
1042 <a name="method25"></a>
1043 <p/><strong>bool Pythia::flag(string key) </strong> <br/>
1044 read in a boolean variable from the <code>Settings</code> database.
1045 <br/><code>argument</code><strong> key </strong> :
1046 the name of the variable to be read.
1050 <a name="method26"></a>
1051 <p/><strong>int Pythia::mode(string key) </strong> <br/>
1052 read in an integer variable from the <code>Settings</code> database.
1053 <br/><code>argument</code><strong> key </strong> :
1054 the name of the variable to be read.
1058 <a name="method27"></a>
1059 <p/><strong>double Pythia::parm(string key) </strong> <br/>
1060 read in a double-precision variable from the <code>Settings</code>
1062 <br/><code>argument</code><strong> key </strong> :
1063 the name of the variable to be read.
1067 <a name="method28"></a>
1068 <p/><strong>string Pythia::word(string key) </strong> <br/>
1069 read in a string variable from the <code>Settings</code> database.
1070 <br/><code>argument</code><strong> key </strong> :
1071 the name of the variable to be read.
1075 <h3>Data members</h3>
1077 The <code>Pythia</code> class contains a few public data members,
1078 several of which play a central role. We list them here, with
1079 links to the places where they are further described.
1081 <a name="method29"></a>
1082 <p/><strong>Event Pythia::process </strong> <br/>
1083 the hard-process event record, see <?php $filepath = $_GET["filepath"];
1084 echo "<a href='EventRecord.php?filepath=".$filepath."' target='page'>";?>here</a>
1085 for further details.
1088 <a name="method30"></a>
1089 <p/><strong>Event Pythia::event </strong> <br/>
1090 the complete event record, see <?php $filepath = $_GET["filepath"];
1091 echo "<a href='EventRecord.php?filepath=".$filepath."' target='page'>";?>here</a>
1092 for further details.
1095 <a name="method31"></a>
1096 <p/><strong>Info Pythia::info </strong> <br/>
1097 further information on the event-generation process, see
1098 <?php $filepath = $_GET["filepath"];
1099 echo "<a href='EventInformation.php?filepath=".$filepath."' target='page'>";?>here</a> for further details.
1102 <a name="method32"></a>
1103 <p/><strong>Settings Pythia::settings </strong> <br/>
1104 the settings database, see <?php $filepath = $_GET["filepath"];
1105 echo "<a href='SettingsScheme.php?filepath=".$filepath."' target='page'>";?>here</a>
1106 for further details.
1109 <a name="method33"></a>
1110 <p/><strong>ParticleData Pythia::particleData </strong> <br/>
1111 the particle properties and decay tables database, see
1112 <?php $filepath = $_GET["filepath"];
1113 echo "<a href='ParticleDataScheme.php?filepath=".$filepath."' target='page'>";?>here</a> for further details.
1116 <a name="method34"></a>
1117 <p/><strong>Rndm Pythia::rndm </strong> <br/>
1118 the random number generator, see <?php $filepath = $_GET["filepath"];
1119 echo "<a href='RandomNumberSeed.php?filepath=".$filepath."' target='page'>";?>here</a>
1120 and <?php $filepath = $_GET["filepath"];
1121 echo "<a href='RandomNumbers.php?filepath=".$filepath."' target='page'>";?>here</a> for further details.
1124 <a name="method35"></a>
1125 <p/><strong>CoupSM Pythia::coupSM </strong> <br/>
1126 Standard Model couplings and mixing matrices, see
1127 <?php $filepath = $_GET["filepath"];
1128 echo "<a href='StandardModelParameters.php?filepath=".$filepath."' target='page'>";?>here</a> for further details.
1131 <a name="method36"></a>
1132 <p/><strong>SusyLesHouches Pythia::slha </strong> <br/>
1133 parameters and particle data in the context of supersymmetric models,
1134 see <?php $filepath = $_GET["filepath"];
1135 echo "<a href='SUSYLesHouchesAccord.php?filepath=".$filepath."' target='page'>";?>here</a> for further details.
1138 <a name="method37"></a>
1139 <p/><strong>PartonSystems Pythia::partonSystems </strong> <br/>
1140 a grouping of the partons in the event record by subsystem,
1141 see <?php $filepath = $_GET["filepath"];
1142 echo "<a href='AdvancedUsage.php?filepath=".$filepath."' target='page'>";?>here</a> for further details.
1148 <!-- Copyright (C) 2010 Torbjorn Sjostrand -->