]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA8/pythia8170/htmldoc/HepMCInterface.html
Update to pythi8.170
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8170 / htmldoc / HepMCInterface.html
CommitLineData
63ba5337 1<html>
2<head>
3<title>HepMC Interface</title>
4<link rel="stylesheet" type="text/css" href="pythia.css"/>
5<link rel="shortcut icon" href="pythia32.gif"/>
6</head>
7<body>
8
9<h2>HepMC Interface</h2>
10
11An interface to the HepMC [<a href="Bibliography.html" target="page">Dob01</a>] standard event record
12format has been provided by M. Kirsanov. To use it, the relevant
13libraries need to be linked, as explained in the <code>README</code>
14file. Only version 2 of HepMC is supported. (Version 1 requires
15a different interface structure, which was only supported up until
16Pythia 8.107.)
17
18<p/>
19The (simple) procedure to translate PYTHIA 8 events into HepMC ones
20is illustrated in the <code>main41.cc</code>, <code>main42.cc</code>
21<code>main61.cc</code> and <code>main62.cc</code>
22main programs. At the core is a call to the
23<pre>
24HepMC::I_Pythia8::fill_next_event( pythia, hepmcevt, ievnum = -1, convertGluonTo0 = false )
25</pre>
26which takes a reference of the generator object and uses it, on the one
27hand, to read out and covert the event record in <code>pythia.event</code>
28and, on the other hand, to extract and store parton-density (PDF)
29information for the hard subprocess from <code>pythia.info</code>.
30The optional last argument, if <code>true</code>, allows you to store
31gluons as "PDG" code 0 rather than the normal 21; this only applies to
32the PDF information, not the event record.
33
34<p/>
35The earlier version of this routine,
36<pre>
37HepMC::I_Pythia8::fill_next_event( pythia.event, hepmcevt, ievnum = -1 )
38</pre>
39is retained (for now) for backwards compatibility. It takes a PYTHIA event
40as input and returns a HepMC one, but without storing the PDF information.
41The latter could then instead be stored by a separate call
42<pre>
43HepMC::I_Pythia8::pdf_put_info( hepmcevt, pythia, convertGluonTo0 = false )
44</pre>
45or not, as wished.
46
47<p/>
48While PYTHIA stores momenta in units of GeV, with <i>c = 1</i>,
49the HepMC standard originally did not specify which units to use,
50unfortunately. Later versions allow units to be specified either as
51MeV or as GeV. The dividing line goes with the introduction of the
52<code>HEPMC_HAS_UNITS</code> environment variable in HepMC 2.04.
53When PYTHIA is linked to older versions, which do not have this
54environment variable, the default behaviour of
55<code>fill_next_event</code> is to convert momenta to MeV.
56To store momenta in GeV instead, you must call
57<pre>
58HepMC::I_Pythia8::set_convert_to_mev( false )
59</pre>
60beforehand. When linked to newer HepMC versions, PYTHIA will adapt
61to the unit specified for the HepMC event record. A default unit
62is chosen when HepMC is built, but this choice can be overridden
63in the constructor of a <code>HepMC::GenEvent</code>, to be either
64GeV or MeV. The <code>main41.cc</code> code illustrates these
65possibilities.
66
67<p/>
68Also for length units there could exist ambiguities, but the mm
69choice of PYTHIA seems to be shared by most other programs.
70When linked to older HepMC versions there is never a conversion,
71while for newer versions the PYTHIA interface will convert to the
72units set for the HepMC event record, as for momenta.
73
74<p/>
75By agreement with the LHC experimental community, support for the
76older behaviour will be dropped for all versions released after
77the end of 2012.
78
79<p/>
80The status code is now based on the new standard for HepMC 2.05,
81see the <a href="EventRecord.html" target="page">Event::statusHepMC(...)</a>
82conversion routine for details. The earlier behaviour, where all
83final particles had status 1 and all initial or intermediate ones
84status 2, is available as a commented-out line in the
85<code>I_Pythia8::fill_next_event(...)</code> method, and so is simple
86to recover.
87
88<p/>
89In HepMC 2.05 it also becomes possible to store the generated cross
90section and its error. The environment variable
91<code>HEPMC_HAS_CROSS_SECTION</code> is used to check whether this
92possibility exists and, if it does the current values from
93<code>pythia.info.sigmaGen()</code> and
94<code>pythia.info.sigmaErr()</code> are stored for each event,
95multiplied by <i>10^9</i> to convert from mb to pb. Note that
96PYTHIA improves its accuracy by Monte Carlo integration in the course
97of the run, so the values associated with the last generated event
98should be the most accurate ones. (If events also come with a dimensional
99weight, like in some Les Houches strategies, conversion from mb to fb
100for that weight must be set by hand, see the last method below.)
101
102<h2>The public methods</h2>
103
104Here comes a complete list of all public methods of the
105<code>I_Pythia8</code> class in the <code>HepMC</code>
106(<i>not</i> <code>Pythia8</code>!) namespace.
107
108<a name="method1"></a>
109<p/><strong>I_Pythia8::I_Pythia8() &nbsp;</strong> <br/>
110
111<strong>virtual I_Pythia8::~I_Pythia8() &nbsp;</strong> <br/>
112the constructor and destructor take no arguments.
113
114
115<a name="method2"></a>
116<p/><strong>bool I_Pythia8::fill_next_event( Pythia8::Pythia& pythia, GenEvent* evt, int ievnum = -1, bool convertGluonTo0 = false) &nbsp;</strong> <br/>
117convert a <code>Pythia</code> event to a <code>HepMC</code> one.
118Will return true if succeeded.
119<br/><code>argument</code><strong> pythia </strong> :
120the input <code>Pythia</code> generator object, from which both the
121event and the parton density information can be obtained.
122
123<br/><code>argument</code><strong> evt </strong> :
124the output <code>GenEvt</code> event, in its standard form.
125
126<br/><code>argument</code><strong> iev </strong> :
127set the event number of the current event. If negative then the
128internal event number is used, which is incremented by one for
129each new event.
130
131<br/><code>argument</code><strong> convertGluonTo0 </strong> :
132the normal gluon identity code 21 is used also when parton density
133information is stored, unless this optional argument is set true to
134have gluons represented by a 0. This choice does not affect the
135normal event record, where a gluon is always 21.
136
137
138
139<a name="method3"></a>
140<p/><strong>bool I_Pythia8::fill_next_event( Pythia8::Event& pyev, GenEvent* evt, int ievnum = -1 ) &nbsp;</strong> <br/>
141convert a <code>Pythia</code> event to a <code>HepMC</code> one.
142Will return true if succeeded. Do not store parton-density information.
143<br/><code>argument</code><strong> pyev </strong> :
144the input <code>Pythia</code> event, in its standard form.
145
146<br/><code>argument</code><strong> evt </strong> :
147the output <code>GenEvt</code> event, in its standard form.
148
149<br/><code>argument</code><strong> iev </strong> :
150set the event number of the current event. If negative then the
151internal event number is used, which is incremented by one for
152each new event.
153
154
155
156<a name="method4"></a>
157<p/><strong>bool I_Pythia8::put_pdf_info( GenEvent* evt, Pythia8::Pythia& pythia, bool convertGluonTo0 = false ) &nbsp;</strong> <br/>
158append parton-density information to an event already stored
159by the previous method.
160<br/><code>argument</code><strong> evt </strong> :
161the output <code>GenEvt</code> event record, in its standard form.
162
163<br/><code>argument</code><strong> pythia </strong> :
164the input <code>Pythia</code> generator object, from which both the
165event and the parton density information can be obtained.
166
167<br/><code>argument</code><strong> convertGluonTo0 </strong> :
168the normal gluon identity code 21 is used also when parton density
169information is stored, unless this optional argument is set true to
170have gluons represented by a 0.
171
172
173
174<p/>
175The following methods can be used to set, and in some cases interrogate,
176the status of some switches that can be used to modify the behaviour
177of the conversion routine. The <code>set</code> methods have the
178same default input values as the internal initialization ones, so
179that a call without an argument (re)stores the default.
180
181<a name="method5"></a>
182<p/><strong>void I_Pythia8::set_trust_mothers_before_daughters( bool b = true ) &nbsp;</strong> <br/>
183
184<strong>bool I_Pythia8::trust_mothers_before_daughters() &nbsp;</strong> <br/>
185if there is a conflict in the history information, then trust the
186information on mothers above that on daughters. Currently this is
187the only option implemented.
188
189
190<a name="method6"></a>
191<p/><strong>void I_Pythia8::set_trust_both_mothers_and_daughters( bool b = false ) &nbsp;</strong> <br/>
192
193<strong>bool I_Pythia8::trust_both_mothers_and_daughters() &nbsp;</strong> <br/>
194currently dummy methods intended to resolve conflicts in the event
195history.
196
197
198<a name="method7"></a>
199<p/><strong>void I_Pythia8::set_print_inconsistency_errors( bool b = true ) &nbsp;</strong> <br/>
200
201<strong>bool I_Pythia8::print_inconsistency_errors() &nbsp;</strong> <br/>
202print a warning line, on <code>cerr</code>, when inconsistent mother
203and daughter information is encountered.
204
205
206<a name="method8"></a>
207<p/><strong>void I_Pythia8::set_crash_on_problem( bool b = false ) &nbsp;</strong> <br/>
208if problems are encountered then the run is interrupted by an
209<code>exit(1)</code> command. Default is not to crash.
210
211
212<a name="method9"></a>
213<p/><strong>void I_Pythia8::set_freepartonwarnings( bool b = true ) &nbsp;</strong> <br/>
214interrupt the run by an <code>exit(1)</code> command if unhadronized
215gluons or quarks are encountered in the event record, unless
216hadronization is switched off. Default is to crash.
217
218
219<a name="method10"></a>
220<p/><strong>void I_Pythia8::set_convert_to_mev( bool b = false ) &nbsp;</strong> <br/>
221convert the normal GeV energies, momenta and masses to MeV.
222
223
224</body>
225</html>
226
227<!-- Copyright (C) 2012 Torbjorn Sjostrand -->