<chapter name="Particle Properties"> 
 
<h2>Particle Properties</h2> 
 
A <code>Particle</code> corresponds to one entry/slot in the 
event record. Its properties therefore is a mix of ones belonging 
to a particle-as-such, like its identity code or four-momentum, 
and ones related to the event-as-a-whole, like which mother it has. 
Recall that energies, momenta and masses are all given in GeV, and 
space-time coordinates all in mm, i.e. units are chosen such that 
the speed of light <ei>c</ei> is unity. In particular, times are 
also in mm, <b>not</b> in seconds. 
 
<p/> 
What is stored for each particle is 
<ul> 
<li>the identity code,</li> 
<li>the status code,</li> 
<li>two mother indices,</li> 
<li>two daughter indices,</li> 
<li>a colour and an anticolour index,</li> 
<li>the four-momentum and mass,</li> 
<li>the scale at which the particle was produced (optional),</li> 
<li>the polarization/spin/helicity of the particle (optional),</li> 
<li>the production vertex and proper lifetime (optional),</li> 
<li>a pointer to the particle kind in the particle data table, and</li> 
<li>a pointer to the event the particle belongs to.</li> 
</ul> 
From these, a number of further quantities may be derived. 
 
<h3>Basic output methods</h3> 
 
The following member functions can be used to extract the most important 
information: 
 
<method name="int Particle::id()"> 
the identity of a particle, according to the PDG particle codes 
<ref>Yao06</ref>. 
</method> 
 
<method name="int Particle::status()"> 
status code. The status code includes information on how a particle was 
produced, i.e. where in the program execution it was inserted into the 
event record, and why. It also tells whether the particle is still present 
or not. It does not tell how a particle disappeared, whether by a decay, 
a shower branching, a hadronization process, or whatever, but this is 
implicit in the status code of its daughter(s). The basic scheme is: 
<ul> 
<li>status = +- (10 * i + j)</li> 
<li> +          : still remaining particles</li> 
<li> -          : decayed/branched/fragmented/... and not remaining</li> 
<li> i =  1 - 9 : stage of event generation inside PYTHIA</li> 
<li> i = 10 -19 : reserved for future expansion</li> 
<li> i >= 20    : free for add-on programs</li> 
<li> j = 1 - 9  : further specification</li> 
</ul> 
In detail, the list of used or foreseen status codes is: 
<ul> 
<li>11 - 19 : beam particles</li> 
  <ul> 
  <li>11 : the event as a whole</li> 
  <li>12 : incoming beam</li> 
  <li>13 : incoming beam-inside-beam (e.g. <ei>gamma</ei> 
           inside <ei>e</ei>)</li> 
  <li>14 : outgoing elastically scattered</li> 
  <li>15 : outgoing diffractively scattered</li> 
  </ul> 
<li>21 - 29 : particles of the hardest subprocess</li> 
  <ul> 
  <li>21 : incoming</li> 
  <li>22 : intermediate (intended to have preserved mass)</li> 
  <li>23 : outgoing</li> 
  <li>24 : outgoing, nonperturbatively kicked out in diffraction</li> 
  </ul> 
<li>31 - 39 : particles of subsequent subprocesses</li> 
  <ul> 
  <li>31 : incoming</li> 
  <li>32 : intermediate (intended to have preserved mass)</li> 
  <li>33 : outgoing</li> 
  <li>34 : incoming that has already scattered</li> 
  </ul> 
<li>41 - 49 : particles produced by initial-state-showers</li> 
  <ul> 
  <li>41 : incoming on spacelike main branch</li> 
  <li>42 : incoming copy of recoiler</li> 
  <li>43 : outgoing produced by a branching</li> 
  <li>44 : outgoing shifted by a branching</li> 
  <li>45 : incoming rescattered parton, with changed kinematics 
           owing to ISR in the mother system (cf. status 34)</li> 
  <li>46 : incoming copy of recoiler when this is a rescattered 
           parton (cf. status 42)</li> 
  <li>47 : a <ei>W</ei> or <ei>Z</ei> gauge boson produced in the 
           shower evolution</li> 
  <li>49 : a special state in the evolution, where 
           <ei>E^2 - p^2 = m^2</ei> is not fulfilled</li> 
  </ul> 
<li>51 - 59 : particles produced by final-state-showers</li> 
  <ul> 
  <li>51 : outgoing produced by parton branching</li> 
  <li>52 : outgoing copy of recoiler, with changed momentum</li> 
  <li>53 : copy of recoiler when this is incoming parton, 
           with changed momentum</li> 
  <li>54 : copy of a recoiler, when in the initial state of a 
           different system from the radiator</li> 
  <li>55 : copy of a recoiler, when in the final state of a 
           different system from the radiator</li> 
  <li>56 : a <ei>W</ei> or <ei>Z</ei> gauge boson produced in a 
           shower branching (special case of 51)</li> 
  <li>59 : a special state in the evolution, where 
           <ei>E^2 - p^2 = m^2</ei> is not fulfilled</li> 
  </ul> 
<li>61 - 69 : particles produced by beam-remnant treatment</li> 
  <ul> 
  <li>61 : incoming subprocess particle with primordial <ei>kT</ei> 
           included</li> 
  <li>62 : outgoing subprocess particle with primordial <ei>kT</ei> 
           included</li> 
  <li>63 : outgoing beam remnant</li> 
  <li>64 : copied particle with new colour according to the colour 
           configuration of the beam remnant</li> 
  </ul> 
<li>71 - 79 : partons in preparation of hadronization process</li> 
  <ul> 
  <li>71 : copied partons to collect into contiguous colour singlet</li> 
  <li>72 : copied recoiling singlet when ministring collapses to 
           one hadron and momentum has to be reshuffled</li> 
  <li>73 : combination of very nearby partons into one</li> 
  <li>74 : combination of two junction quarks (+ nearby gluons) 
           to a diquark (this index is not changed by recoils 
           or recombinations)</li> 
  <li>75 : gluons split to decouple a junction-antijunction pair</li> 
  <li>76 : partons with momentum shuffled or a new colour to decouple 
           junction-antijunction structures </li> 
  <li>77 : temporary opposing parton when fragmenting first two 
           strings in to junction (should disappear again)</li> 
  <li>78 : temporary combined diquark end when fragmenting last 
           string in to junction (should disappear again)</li> 
  <li>79 : copy of particle with new colour indices after the 
           colour reconnection</li> 
  </ul> 
<li>81 - 89 : primary hadrons produced by hadronization process</li> 
  <ul> 
  <li>81 : from ministring into one hadron</li> 
  <li>82 : from ministring into two hadrons</li> 
  <li>83, 84 : from normal string (the difference between the two 
           is technical, whether fragmented off from the top of the 
           string system or from the bottom, useful for debug only)</li> 
  <li>85, 86 : primary produced hadrons in junction fragmentation of 
           the first two string legs in to the junction, 
           in order of treatment</li> 
  <li>87, 88 : primary produced baryon from a junction, with technical 
            difference similar to codes 83 and 84.</li> 
  <li>89 : primary produced baryon from a junction in the ministring 
           framework</li> 
  </ul> 
<li>91 - 99 : particles produced in decay process, or by Bose-Einstein 
  effects</li> 
  <ul> 
  <li>91 : normal decay products</li> 
  <li>92 : decay products after oscillation <ei>B0 &harr; B0bar</ei> or 
           <ei>B_s0 &harr; B_s0bar</ei></li> 
  <li>93, 94 : decay handled by an external program, normally 
           or with oscillation</li> 
  <li>95, 96 : a forced decay handled by an external program, i.e. picked 
           from a subset of the possible channels to enhance the rate 
           of rare signals, normally or with oscillation</li> 
  <li>97 : decay products from a resonance produced in rescattering</li> 
  <li>99 : particles with momenta shifted by Bose-Einstein effects 
           (not a proper decay, but bookkept as an <ei>1 &rarr; 1</ei> such, 
           happening after decays of short-lived resonances but before 
           decays of longer-lived particles)</li> 
  </ul> 
<li>101 - 109 : particles in the handling of R-hadron production and 
  decay, i.e. long-lived (or stable) particles containing a very heavy 
  flavour</li> 
  <ul> 
  <li>101 : when a string system contains two such long-lived particles, 
            the system is split up by the production of a new q-qbar 
            pair (bookkept as decay chains that seemingly need not conserve 
            flavour etc., but do when considered together)</li> 
  <li>102 : partons rearranged from the long-lived particle end to prepare 
            for fragmentation from this end</li> 
  <li>103 : intermediate "half-R-hadron" formed when a colour octet particle 
            (like the gluino) has been fragmented on one side, but not yet on 
            the other</li> 
  <li>104 : an R-hadron</li> 
  <li>105 : partons or particles formed together with the R-hadron during 
            the fragmentation treatment</li> 
  <li>106 : subdivision of an R-hadron into its flavour content, with 
            momentum split accordingly, in preparation of the decay of 
            the heavy new particle, if it is unstable</li> 
  <li>107 : two temporary leftover gluons joined into one in the formation 
            of a gluino-gluon R-hadron</li> 
  </ul> 
<li>121 - 129 : other special hadron production mechanisms</li> 
  <ul> 
  <li>121 : deuteron formed by coalescence, and other particles formed 
  simultaneously (like a <ei>gamma</ei> or <ei>pi</ei>)</li> 
  </ul> 
<li>150 - 159 : new hadrons or hadrons with changed momentum due to hadron 
  (re)scattering</li> 
  <ul> 
  <li>150 : reserved for possible future expansion</li> 
  <li>151 : inelastic nondiffractive collisions</li> 
  <li>152 : elastic scattering</li> 
  <li>153 : single diffraction, first particle excited</li> 
  <li>154 : single diffraction, second particle excited</li> 
  <li>155 : double diffraction</li> 
  <li>156 : reserved for future central diffraction</li> 
  <li>157 : low-mass diffraction, forming explicit resonances 
            (NN collisions only)</li> 
  <li>158 : annihilation of incoming quark-antiquark pairs</li> 
  <li>159 : formation of a resonance particle</li> 
  </ul> 
<li>181 - 189 : reserved for the tracking of a cascade through a 
medium and is not (yet) used in the core code, but only in the 
<code>PythiaCascade</code> class 
  <ul> 
  <li>181 : a nucleon hit in the medium, specifically the first 
  (by order in the event record) nucleon hit in the current nucleus</li> 
  <li>182: a further nucleon hit in a nucleus, subsequent to the first 
  one above.</li> 
  </ul> 
  Thus the number of -181 codes represents the number of medium nuclei 
  hit, while the sum of -181 and -182 codes gives the total number of 
  medium nucleons hit. In a hydrogen medium there would be no 182 codes. 
</li> 
<li>100 - 199 : reserved for future expansion</li> 
<li>201 - : free to be used by anybody.</li> 
</ul> 
<note>Note:</note> a clarification on the role of the "hardest" vs. the 
"subsequent" subprocesses, the 20'ies and 30'ies status code series, 
respectively. Most events contain exactly one "hardest" 
<ei>2 &rarr; n</ei> interaction, and then an arbitrary number of 
"subsequent" softer <ei>2 &rarr; 2</ei> ones generated by the 
MPI framework. In the <code>SoftQCD:nonDiffractive</code> event class 
also the "hardest" is generated by the MPI machinery, and can be 
arbitrarily soft, but still with 20'ies codes. Diffractive systems 
span a broad mass range, where the higher masses admit a perturbative 
description with "hard" and "subsequent" subprocesses, like for 
nondiffractive events. A double diffractive event can contain up to two 
such "hardest" interactions, one per diffractive system. A nonperturbative 
diffractive system does not contain any <ei>2 &rarr; n</ei> subprocesses, 
but there is a kicked-out quark or gluon with status 24, combined with a 
beam remnant of one or two partons with status 63, that together define 
the mass and longitudinal axis of the diffractive system, for use in the 
subsequent hadronization. An event may also contain two 20'ies 
perturbative subcollisions if you use the 
<aloc href="SecondHardProcess">Second Hard Process</aloc> 
generation machinery. 
</method> 
 
<method name="int Particle::mother1()"> 
</method> 
<methodmore name="int Particle::mother2()"> 
the indices in the event record where the first and last mothers are 
stored, if any. There are six allowed combinations of <code>mother1</code> 
and <code>mother2</code>: 
<ol> 
<li><code>mother1 = mother2 = 0</code>: for lines 0 - 2, where line 0 
represents the event as a whole, and 1 and 2 the two incoming 
beam particles; </li> 
<li><code>mother1 = mother2 > 0</code>: the particle is a "carbon copy" 
of its mother, but with changed momentum as a "recoil"  effect, 
e.g. in a shower;</li> 
<li><code>mother1 > 0, mother2 = 0</code>: the "normal" mother case, where 
it is meaningful to speak of one single mother to several products, 
in a shower or decay;</li> 
<li><code>mother1 &lt; mother2</code>, both > 0, for 
<code>abs(status) = 81 - 86</code>: primary hadrons produced from the 
fragmentation of a string spanning the range from <code>mother1</code> 
to <code>mother2</code>, so that all partons in this range should be 
considered mothers; and analogously for 
<code>abs(status) = 101 - 106</code>, the formation of R-hadrons;</li> 
<li><code>mother1 &lt; mother2</code>, both > 0, except case 4: particles 
with two truly different mothers, in particular the particles emerging 
from a hard <ei>2 &rarr; n</ei> interaction.</li> 
<li><code>mother2 &lt; mother1</code>, both > 0: particles with two truly 
different mothers, notably for the special case that two nearby partons are 
joined together into a status 73 or 74 new parton, in the 
<ei>g + q &rarr; q</ei> case the <ei>q</ei> is made first mother 
to simplify flavour tracing.</li> 
</ol> 
<note>Note 1:</note> in backwards evolution of initial-state showers, 
the mother may well appear below the daughter in the event record. 
<note>Note 2:</note> the <code>motherList()</code> method below returns 
a vector of all the mothers, providing a uniform representation for all 
six cases. 
</methodmore> 
 
<method name="int Particle::daughter1()"> 
</method> 
<methodmore name="int Particle::daughter2()"> 
the indices in the event record where the first and last daughters 
are stored, if any. There are five allowed combinations of 
<code>daughter1</code> and <code>daughter2</code>: 
<ol> 
<li><code>daughter1 = daughter2 = 0</code>: there are no daughters 
(so far);</li> 
<li><code>daughter1 = daughter2 > 0</code>: the particle has a 
"carbon copy" as its sole daughter, but with changed momentum 
as a "recoil" effect, e.g. in a shower;</li> 
<li><code>daughter1 > 0, daughter2 = 0</code>: each of the incoming beams 
has only (at most) one daughter, namely the initiator parton of the 
hardest interaction; further, in a <ei>2 &rarr; 1</ei> hard interaction, 
like <ei>q qbar &rarr; Z^0</ei>, or in a clustering of two nearby partons, 
the initial partons only have this one daughter;</li> 
<li><code>daughter1 &lt; daughter2</code>, both > 0: the particle has 
a range of decay products from <code>daughter1</code> to 
<code>daughter2</code>;</li> <li><code>daughter2 &lt; daughter1</code>, 
both > 0: the particle has two separately stored decay products (e.g. 
in backwards evolution of initial-state showers).</li> 
</ol> 
<note>Note 1:</note> in backwards evolution of initial-state showers, the 
daughters may well appear below the mother in the event record. 
<note>Note 2:</note> the mother-daughter relation normally is reciprocal, 
but not always. An example is hadron beams (indices 1 and 2), where each 
beam remnant and the initiator of each multiparton interaction has the 
respective beam as mother, but the beam itself only has the initiator 
of the hardest interaction as daughter. 
<note>Note 3:</note> the <code>daughterList()</code> method below 
returns a vector of all the daughters, providing a uniform representation 
for all five cases. With this method, also all the daughters of the beams 
are caught, with the initiators of the basic process given first,  while 
the rest are in no guaranteed order (since they are found by a scanning 
of the event record for particles with the beam as mother, with no further 
information). 
</methodmore> 
 
<method name="int Particle::col()"> 
</method> 
<methodmore name="int Particle::acol()"> 
the colour and anticolour tags, Les Houches Accord <ref>Boo01</ref> 
style (starting from tag 101 by default, see below). 
<note>Note:</note> in the preliminary implementation of colour sextets 
(exotic BSM particles) that exists since PYTHIA 8.150, a negative 
anticolour tag is interpreted as an additional positive colour tag, 
and vice versa. 
</methodmore> 
 
<method name="double Particle::px()"> 
</method> 
<methodmore name="double Particle::py()"> 
</methodmore> 
<methodmore name="double Particle::pz()"> 
</methodmore> 
<methodmore name="double Particle::e()"> 
the particle four-momentum components. 
</methodmore> 
 
<method name="Vec4 Particle::p()"> 
the particle four-momentum vector, with components as above. 
</method> 
 
<method name="double Particle::m()"> 
the particle mass, stored with a minus sign (times the absolute value) 
for spacelike virtual particles. 
</method> 
 
<method name="double Particle::scale()"> 
the scale at which a parton was produced, which can be used to restrict 
its radiation to lower scales in subsequent steps of the shower evolution. 
Note that scale is linear in momenta, not quadratic (i.e. <ei>Q</ei>, 
not <ei>Q^2</ei>). 
</method> 
 
<method name="double Particle::pol()"> 
the polarization/spin/helicity of a particle. Currently Pythia does not 
use this variable for internal operations, except for <ei>W/Z</ei> 
polarization states in weak showers, so its meaning is not 
uniquely defined. The LHA standard sets <code>SPINUP</code> to be the 
cosine of the angle between the spin vector and the 3-momentum of the 
decaying particle in the lab frame, i.e. restricted to be between +1 
and -1. A more convenient choice could be the same quantity in the rest 
frame of the particle production, either the hard subprocess or the 
mother particle of a decay. Unknown or unpolarized particles should 
be assigned the value 9. 
</method> 
 
<method name="double Particle::xProd()"> 
</method> 
<methodmore name="double Particle::yProd()"> 
</methodmore> 
<methodmore name="double Particle::zProd()"> 
</methodmore> 
<methodmore name="double Particle::tProd()"> 
the production vertex coordinates, in mm or mm/c. 
</methodmore> 
 
<method name="Vec4 Particle::vProd()"> 
The production vertex four-vector. Note that the components of a 
<code>Vec4</code> are named <code>px(), py(), pz() and e()</code> 
which of course then should be reinterpreted as above. 
</method> 
 
<method name="double Particle::tau()"> 
the proper lifetime, in mm/c. (Since c = 3 * 10^11 mm/s, 
<code>Particle::tau()</code>/(3 * 10^11) is the lifetime in seconds.) 
It is assigned for all hadrons with positive nominal <ei>tau</ei>, 
<ei>tau_0 > 0</ei>, because it can be used by PYTHIA to decide whether 
a particle should or should not be allowed to decay, e.g. based on 
the decay vertex distance to the primary interaction vertex. 
</method> 
 
<h3>Input methods</h3> 
 
The same method names as above are also overloaded in versions that 
set values. These have an input argument of the same type as the 
respective output above, and are of type <code>void</code>. 
 
<p/> 
There are also a few alternative methods for input: 
 
<method name="void Particle::statusPos()"> 
</method> 
<methodmore name="void Particle::statusNeg()"> 
sets the status sign positive or negative, without changing the absolute 
value. 
</methodmore> 
 
<method name="void Particle::statusCode(int code)"> 
changes the absolute value but retains the original sign. 
</method> 
 
<method name="void Particle::mothers(int mother1, int mother2)"> 
sets both mothers in one go. 
</method> 
 
<method name="void Particle::daughters(int daughter1, int daughter2)"> 
sets both daughters in one go. 
</method> 
 
<method name="void Particle::cols(int col, int acol)"> 
sets both colour and anticolour in one go. 
</method> 
 
<method name="void Particle::p(double px, double py, double pz, double e)"> 
sets the four-momentum components in one go. 
</method> 
 
<method name="void Particle::vProd(double xProd, double yProd, 
double zProd, double tProd)"> 
sets the production vertex components in one go. 
</method> 
 
<method name="void Particle::vProdAdd(Vec4 vProdIn)"> 
shifts the production vertex four-vector by the input four-vector amount. 
</method> 
 
<h3>Further output methods</h3> 
 
In addition, a number of derived quantities can easily be obtained, 
but cannot be set, such as: 
 
<method name="int Particle::idAbs()"> 
the absolute value of the particle identity code. 
</method> 
 
<method name="int Particle::statusAbs()"> 
the absolute value of the status code. 
</method> 
 
<method name="bool Particle::isFinal()"> 
true for a remaining particle, i.e. one with positive status code, 
else false. Thus, after an event has been fully generated, it 
separates the final-state particles from intermediate-stage ones. 
(If used earlier in the generation process, a particle then 
considered final may well decay later.) 
</method> 
 
<method name="int Particle::intPol()"> 
if the polarization value is within 1e-10 of an integer 0, +-1, +-2 or 
9 then this integer is returned, else -9. Is useful when the 
double-precision value returned by <code>pol()</code> is really intended 
to represent an integer, e.g. a helicity eigenstate. 
</method> 
 
<method name="bool Particle::isRescatteredIncoming()"> 
true for particles with a status code -34, -45, -46 or -54, else false. 
This singles out partons that have been created in a previous 
scattering but here are bookkept as belonging to the incoming state 
of another scattering. 
</method> 
 
<method name="bool Particle::hasVertex()"> 
production vertex has been set; if false then production at the origin 
is assumed. 
</method> 
 
<method name="double Particle::m2()"> 
squared mass, which can be negative for spacelike partons. 
</method> 
 
<method name="double Particle::mCalc()"> 
</method> 
<methodmore name="double Particle::m2Calc()"> 
(squared) mass calculated from the four-momentum; should agree 
with <code>m(), m2()</code> up to roundoff. Negative for spacelike 
virtualities. 
</methodmore> 
 
<method name="double Particle::eCalc()"> 
energy calculated from the mass and three-momentum; should agree 
with <code>e()</code> up to roundoff. For spacelike partons a 
positive-energy  solution is picked. This need not be the correct 
one, so it is recommended not to use the method in such cases. 
</method> 
 
<method name="double Particle::pT()"> 
</method> 
<methodmore name="double Particle::pT2()"> 
(squared) transverse momentum. 
</methodmore> 
 
<method name="double Particle::mT()"> 
</method> 
<methodmore name="double Particle::mT2()"> 
(squared) transverse mass. If <ei>m_T^2</ei> is negative, which can happen 
for a spacelike parton, then <code>mT()</code> returns 
<ei>-sqrt(-m_T^2)</ei>, by analogy with the negative sign used to store 
spacelike masses. 
</methodmore> 
 
<method name="double Particle::pAbs()"> 
</method> 
<methodmore name="double Particle::pAbs2()"> 
(squared) three-momentum size. 
</methodmore> 
 
<method name="double Particle::eT()"> 
</method> 
<methodmore name="double Particle::eT2()"> 
(squared) transverse energy, 
<ei>eT = e * sin(theta) = e * pT / pAbs</ei>. 
</methodmore> 
 
<method name="double Particle::theta()"> 
</method> 
<methodmore name="double Particle::phi()"> 
polar and azimuthal angle. 
</methodmore> 
 
<method name="double Particle::thetaXZ()"> 
angle in the <ei>(p_x, p_z)</ei> plane, between <ei>-pi</ei> and 
<ei>+pi</ei>, with 0 along the <ei>+z</ei> axis 
</method> 
 
<method name="double Particle::pPos()"> 
</method> 
<methodmore name="double Particle::pNeg()"> 
<ei>E +- p_z</ei>. 
</methodmore> 
 
<method name="double Particle::y()"> 
</method> 
<methodmore name="double Particle::eta()"> 
rapidity and pseudorapidity. 
</methodmore> 
 
<method name="double Particle::y(double mCut)"> 
</method> 
<methodmore name="double Particle::y(double mCut, RotBstMatrix& M)"> 
rapidity, but calculated assuming that the particle transverse mass 
is at least <ei>mCut</ei>, and optionally if the particle were first 
to be boosted and rotated by <ei>M</ei>. 
</methodmore> 
 
<method name="double Particle::xDec()"> 
</method> 
<methodmore name="double Particle::yDec()"> 
</methodmore> 
<methodmore name="double Particle::zDec()"> 
</methodmore> 
<methodmore name="double Particle::tDec()"> 
</methodmore> 
<methodmore name="Vec4 Particle::vDec()"> 
the decay vertex coordinates, in mm or mm/c. This decay vertex is 
calculated from the production vertex, the proper lifetime and the 
four-momentum assuming no magnetic field or other detector interference. 
It can be used to decide whether a decay should be performed or not, 
and thus is defined also for particles which PYTHIA did not let decay. 
</methodmore> 
 
<p/> 
Not part of the <code>Particle</code> class proper, but obviously tightly 
linked, are the two methods 
 
<method name="double m(const Particle& pp1, const Particle& pp2)"> 
</method> 
<methodmore name="double m2(const Particle& pp1, const Particle& pp2)"> 
the (squared) invariant mass of two particles. 
</methodmore> 
 
<h3>Properties of the particle species</h3> 
 
Each Particle contains a pointer to the respective 
<code>ParticleDataEntry</code> object in the 
<aloc href="ParticleDataScheme">particle data tables</aloc>. 
This gives access to properties of the particle species as such. It is 
there mainly for convenience, and should be thrown if an event is 
written to disk, to avoid any problems of object persistency. Should 
an event later be read back in, the pointer will be recreated from the 
<code>id</code> code if the normal input methods are used. (Use the 
<code><aloc href="EventRecord">Event::restorePtrs()</aloc></code> method 
if your persistency scheme bypasses the normal methods.) This pointer is 
used by the following member functions: 
 
<method name="string Particle::name()"> 
the name of the particle. 
</method> 
 
<method name="string Particle::nameWithStatus()"> 
as above, but for negative-status particles the name is given in 
brackets to emphasize that they are intermediaries. 
</method> 
 
<method name="int Particle::spinType()"> 
<ei>2 *spin + 1</ei> when defined, else 0. 
</method> 
 
<method name="double Particle::charge()"> 
</method> 
<methodmore name="int Particle::chargeType()"> 
charge, and three times it to make an integer. 
</methodmore> 
 
<method name="bool Particle::isCharged()"> 
</method> 
<methodmore name="bool Particle::isNeutral()"> 
charge different from or equal to 0. 
</methodmore> 
 
<method name="int Particle::colType()"> 
0 for colour singlets, 1 for triplets, 
-1 for antitriplets and 2 for octets. (A preliminary implementation of 
colour sextets also exists, using 3 for sextets and -3 for antisextets.) 
</method> 
 
<method name="double Particle::m0()"> 
the nominal mass of the particle, according to the data tables. 
</method> 
 
<method name="double Particle::mWidth()"> 
</method> 
<methodmore name="double Particle::mMin()"> 
</methodmore> 
<methodmore name="double Particle::mMax()"> 
the width of the particle, and the minimum and maximum allowed mass value 
for particles with a width, according to the data tables. 
</methodmore> 
 
<method name="double Particle::mSel()"> 
the mass of the particle, picked according to a Breit-Wigner 
distribution for particles with width. It is different each time called, 
and is therefore only used once per particle to set its mass 
<code>m()</code>. 
</method> 
 
<method name="double Particle::mSelInRange(double mMinNow, double mMaxNow)"> 
same as <code>mSel()</code> above, but restricted to the range 
between <code>mMinNow</code> and <code>mMaxNow</code>, which is assumed 
to be a subrange of the <code>mMin()</code> to <code>mMax()</code> range. 
</method> 
 
<method name="double Particle::constituentMass()"> 
will give the constituent masses for quarks and diquarks, 
else the same masses as with <code>m0()</code>. 
</method> 
 
<method name="double Particle::tau0()"> 
the nominal lifetime <ei>tau_0 > 0</ei>, in mm/c, of the particle species. 
It is used to assign the actual lifetime <ei>tau</ei>. 
</method> 
 
<method name="bool Particle::mayDecay()"> 
flag whether particle has been declared unstable or not, offering 
the main user switch to select which particle species to decay. 
</method> 
 
<method name="bool Particle::canDecay()"> 
flag whether decay modes have been declared for a particle, 
so that it could be decayed, should that be requested. 
</method> 
 
<method name="bool Particle::doExternalDecay()"> 
particles that are decayed by an external program. 
</method> 
 
<method name="bool Particle::isResonance()"> 
particles where the decay is to be treated as part of the hard process, 
typically with nominal mass above 20 GeV (<ei>W^+-, Z^0, t, ...</ei>). 
</method> 
 
<method name="bool Particle::isVisible()"> 
particles with strong or electric charge, or composed of ones having it, 
which thereby should be considered visible in a normal detector. 
</method> 
 
<method name="bool Particle::isLepton()"> 
true for a lepton or an antilepton (including neutrinos). 
</method> 
 
<method name="bool Particle::isQuark()"> 
true for a quark or an antiquark. 
</method> 
 
<method name="bool Particle::isGluon()"> 
true for a gluon. 
</method> 
 
<method name="bool Particle::isDiquark()"> 
true for a diquark or an antidiquark. 
</method> 
 
<method name="bool Particle::isParton()"> 
true for a gluon, a quark or antiquark up to the b (but excluding top), 
and a diquark or antidiquark consisting of quarks up to the b. 
</method> 
 
<method name="bool Particle::isHadron()"> 
true for a hadron (made up out of normal quarks and gluons, 
i.e. not for R-hadrons and other exotic states). 
</method> 
 
<method name="ParticleDataEntry& particleDataEntry()"> 
a reference to the ParticleDataEntry. 
</method> 
 
<h3>Methods that may access the event the particle belongs to</h3> 
 
A particle can be created on its own. When inserted into an event record, 
it obtains a pointer to that event-as-a-whole. It is then possible to 
use methods that do not make sense for a particle in isolation. These 
methods are listed below. Whenever the pointer to the event is not 
defined, these will return an appropriate "null" value, this being -1 
for an integer, false for a bool, and empty for a vector, unless otherwise 
specified. 
 
<method name="void Particle::index()"> 
the index of the particle itself in the event record. 
</method> 
 
<method name="int Particle::iTopCopy()"> 
</method> 
<methodmore name="int Particle::iBotCopy()"> 
are used to trace carbon copies of the particle up to its top mother 
or down to its bottom daughter. If there are no such carbon copies, 
the index of the particle itself will be returned. A carbon copy is 
when the "same" particle appears several times in the event record, but 
with changed momentum owing to recoil effects. 
</methodmore> 
 
<method name="int Particle::iTopCopyId(bool simplify = false)"> 
</method> 
<methodmore name="int Particle::iBotCopyId(bool simplify = false)"> 
also trace top mother and bottom daughter, but do not require carbon 
copies, only that one can find an unbroken chain, of mothers or daughters, 
with the same flavour <code>id</code> code. When it encounters ambiguities, 
say a <ei>g &rarr; g g</ei> branching or a <ei>u u &rarr; u u</ei> hard 
scattering, it will stop the tracing and return the current position. 
It can be confused by nontrivial flavour changes, e.g. a hard process 
<ei>u d &rarr; d u</ei> by <ei>W^+-</ei> exchange will give the wrong 
answer. These methods therefore are of limited use for common particles, 
in particular for the gluon, but should work well for "rare" particles. 
By default all mothers and daughters are studied in each step, but with 
<code>simplify = true</code> only the first and last mother/daughter 
are checked, which saves time and almost always gives the same result. 
</methodmore> 
 
<method name="vector&lt;int&gt; Particle::motherList()"> 
returns a vector of all the mother indices of the particle. This is 
derived from the <code>mother1</code>, <code>mother2</code> and 
<code>status</code> information as explained above. This list is empty 
for entries 0, 1 and 2, i.e. the "system" in line 0 is not counted as 
part of the history. Normally the list contains one or two mothers, 
but it can also be more, e.g. in string fragmentation the whole 
fragmenting system is counted as mothers to the primary hadrons. 
Many particles may have the same <code>motherList</code>. 
Mothers are listed in ascending order. 
</method> 
 
<method name="vector&lt;int&gt; Particle::daughterList()"> 
returns a vector of all the daughter indices of the particle. This is 
derived from the <code>daughter1</code>, <code>daughter2</code> and 
<code>status</code> information as explained above. This list is empty 
for a particle that did not decay (or, if the evolution is stopped 
early enough, a parton that did not branch), while otherwise it can 
contain a list of varying length, from one to many. For the two 
incoming beam particles, all shower initiators and beam remnants are 
counted as daughters, with the one in slot 0 being the one leading up 
to the hardest interaction. The "system" in line 0 does not have any 
daughters, i.e. is not counted as part of the history. Many partons 
may have the same <code>daughterList</code>. Daughters are listed in 
ascending order. 
</method> 
 
<method name="vector&lt;int&gt; Particle::daughterListRecursive()"> 
returns a vector of all the daughter indices of the particle, recursively 
including all subsequent decay generations. It is based on the 
<code>daughterList()</code> method, so obeys the rules given there, 
except that the listing does not necessarily have to be in ascending 
order. Its primary application is for the decay of a hadron, or of a 
resonance in the <code>process</code> record. It is less convenient 
e.g. for the full parton-shower evolution, and should there only be 
used with caution. 
</method> 
 
<method name="vector&lt;int&gt; Particle::sisterList(bool traceTopBot 
= false)"> 
returns a vector of all the sister indices of the particle, i.e. all the 
daughters of the first mother, except the particle itself. If the argument 
<code>traceTopBot = true</code> the particle is first traced up with 
<code>iTopCopy()</code> before its mother is found, and then all the 
particles in the <code>daughterList()</code> of this mother are traced down 
with <code>iBotCopy()</code>, omitting the original particle itself. 
The method is not meaningful for the 0 entry, with status code -11, and 
there returns an empty list. 
</method> 
 
<method name="bool Particle::isAncestor(int iAncestor)"> 
traces the particle upwards through mother, grandmother, and so on, until 
either <ei>iAncestor</ei> is found or the top of the record is reached. 
Normally one unique mother is required, as is the case e.g. in decay chains 
or in parton showers, so that e.g. the tracing through a hard scattering 
would not work. For hadronization, first-rank hadrons are identified with 
the respective string endpoint quark, which may be useful e.g. for 
<ei>b</ei> physics, while higher-rank hadrons give <code>false</code>. 
Currently also ministrings that collapsed to one single hadron and 
junction topologies give <code>false</code>. 
</method> 
 
<method name="bool Particle::isFinalPartonLevel()"> 
is true if the particle belonged to the final state (i.e. with positive 
status code) right before hadronization is invoked. This is intended to 
further simple comparisons between parton-level and hadron-level 
properties, say the number of jets. This method makes use of the event 
record size set when <code>HadronLevel::next()</code> is invoked, so 
would not work otherwise (unless <code>Event::savePartonLevelSize()</code> 
is called by hand). Note that what should be counted as parton level is not 
always unique. For instance, R-hadron formation is part of the hadron level 
machinery, even though a subsequent R-hadron decay could well give rise 
to new activity on the parton level, which thereby is missed. 
</method> 
 
<method name="int Particle::statusHepMC()"> 
returns the status code according to the HepMC conventions agreed in 
February 2009. This convention does not preserve the full information 
provided by the internal PYTHIA status code, as obtained by 
<code>Particle::status()</code>, but comes reasonably close. 
The allowed output values are: 
<ul> 
<li>0 : an empty entry, with no meaningful information and therefore 
to be skipped unconditionally;</li> 
<li>1 : a final-state particle, i.e. a particle that is not decayed 
further by the generator (may also include unstable particles that 
are to be decayed later, as part of the detector simulation);</li> 
<li>2 : a decayed Standard Model hadron or tau or mu lepton, excepting 
virtual intermediate states thereof (i.e. the particle must undergo 
a normal decay, not e.g. a shower branching);</li> 
<li>3 : a documentation entry (not used in PYTHIA);</li> 
<li>4 : an incoming beam particle;</li> 
<li>11 - 200 : an intermediate (decayed/branched/...) particle that does 
not fulfill the criteria of status code 2, with a generator-dependent 
classification of its nature; in PYTHIA the absolute value of the normal 
status code is used.</li> 
</ul> 
<note>Note:</note> for a particle without a properly set pointer to its 
event, codes 1 and 4 can still be inferred from its status code, while 
everythg else is assigned code 0. 
</method> 
 
<method name="bool Particle::undoDecay()"> 
removes the decay chain of the particle and thus restores 
it to its undecayed state. It is only intended for "normal" particle 
decay chains, and will return false in other cases, notably if 
the particle is coloured. The procedure would not work if non-local 
momentum shifts have been performed, such as with a Bose-Einstein 
shift procedure (or for a dipole shower recoiler). As the decay products 
are erased from the event record, mother and daughter indices are 
updated to retain a correct history for the remaining particles. 
</method> 
 
<p/> 
In <aloc href="HiddenValleyProcesses">Hidden Valley</aloc> 
<b>SU(N)</b> scenarios, HV colour and anticolour tags are 
assigned to relevant HV-particles. Since some particles may have 
both regular and HV colour tags, it is not possible to reuse the 
normal colour slots. (But it is possible to share in the same colour 
tag enumeration  sequence.) Instead a special vector exists in the 
event record, where only HV-coloured particles are bookkept by index 
(in the event record) and colour tags. This vector would not be used 
in non-HV applications  and therefore takes negligible space, unlike 
a case where further integers had been introduced for all particles. 
The particle methods that can be used to access the HV colours are 
 
<method name="int Particle::colHV()"> 
</method> 
<methodmore name="int Particle::acolHV()"> 
return the particle HV colour or anticolour tag, or 0 where 
there is no such tag. 
</methodmore> 
 
<method name="int Particle::colHV(int colHV)"> 
</method> 
<methodmore name="int Particle::acolHV(int acolHV)"> 
</methodmore> 
<methodmore name="int Particle::colsHV(int colHV, int acolHV)"> 
set the particle HV colour or anticolour tag, or both in one go. 
</methodmore> 
 
Further methods are found in the 
<aloc href="EventRecord">Event</aloc> class, notably 
<code>Event::listHVcols()</code> to list the HV colours that have 
been assigned. 
 
<h3>Methods that perform operations</h3> 
 
There are some further methods, some of them inherited from 
<code>Vec4</code>, to modify the properties of a particle. 
They are of little interest to the normal user. 
 
<method name="void Particle::rescale3(double fac)"> 
multiply the three-momentum components by <code>fac</code>. 
</method> 
 
<method name="void Particle::rescale4(double fac)"> 
multiply the four-momentum components by <code>fac</code>. 
</method> 
 
<method name="void Particle::rescale5(double fac)"> 
multiply the four-momentum components and the mass by <code>fac</code>. 
</method> 
 
<method name="void Particle::rot(double theta, double phi)"> 
rotate three-momentum and production vertex by these polar and azimuthal 
angles. 
</method> 
 
<method name="void Particle::bst(double betaX, double betaY, double betaZ)"> 
boost four-momentum and production vertex by this three-vector. 
</method> 
 
<method name="void Particle::bst(double betaX, double betaY, double betaZ, 
double gamma)"> 
as above, but also input the <ei>gamma</ei> value, to reduce roundoff errors. 
</method> 
 
<method name="void Particle::bst(const Vec4& pBst)"> 
boost four-momentum and production vertex by 
<ei>beta = (px/e, py/e, pz/e)</ei>. 
</method> 
 
<method name="void Particle::bst(const Vec4& pBst, double mBst)"> 
as above, but also use <ei>gamma> = e/m</ei> to reduce roundoff errors. 
</method> 
 
<method name="void Particle::bstback(const Vec4& pBst)"> 
</method> 
<methodmore name="void Particle::bstback(const Vec4& pBst, double mBst)"> 
as above, but with sign of boost flipped. 
</methodmore> 
 
<method name="void Particle::rotbst(const RotBstMatrix& M, 
bool boostVertex = true)"> 
combined rotation and boost of the four-momentum and production vertex. 
If the optional second argument is false only the four-momentum is 
boosted, and not the production vertex. 
</method> 
 
<method name="void Particle::offsetHistory( int minMother, int addMother, 
int minDaughter, int addDaughter))"> 
add a positive offset to the mother and daughter indices, i.e. 
if <code>mother1</code> is above <code>minMother</code> then 
<code>addMother</code> is added to it, same with <code>mother2</code>, 
if <code>daughter1</code> is above <code>minDaughter</code> then 
<code>addDaughter</code> is added to it, same with <code>daughter2</code>. 
</method> 
 
<method name="void Particle::offsetCol( int addCol)"> 
add a positive offset to colour indices, i.e. if <code>col</code> is 
positive then <code>addCol</code> is added to it, same with <code>acol</code>. 
</method> 
 
<h3>Constructors and operators</h3> 
 
Normally a user would not need to create new particles. However, if 
necessary, the following constructors and methods may be of interest. 
 
<method name="Particle::Particle()"> 
constructs an empty particle, i.e. where all properties have been set 0 
or equivalent. 
</method> 
 
<method name="Particle::Particle(int id, int status = 0, int mother1 = 0, 
int mother2 = 0, int daughter1 = 0, int daughter2 = 0, int col = 0, 
int acol = 0, double px = 0., double py = 0., double pz = 0., double e = 0., 
double m = 0., double scale = 0., double pol = 9.)"> 
constructs a particle with the input properties provided, and non-provided 
ones set 0 (9 for <code>pol</code>). 
</method> 
 
<method name="Particle::Particle(int id, int status, int mother1, int mother2, 
int daughter1, int daughter2, int col, int acol, Vec4 p, double m = 0., 
double scale = 0., double pol = 9.)"> 
constructs a particle with the input properties provided, and non-provided 
ones set 0 (9 for <code>pol</code>). 
</method> 
 
<method name="Particle::Particle(const Particle& pt)"> 
constructs an particle that is a copy of the input one. 
</method> 
 
<method name="Particle& Particle::operator=(const Particle& pt)"> 
copies the input particle. 
</method> 
 
<method name="void Particle::setEvtPtr(Event* evtPtr)"> 
sets the pointer to the <code>Event</code> object the particle 
belongs to. This method is automatically called when a particle 
is appended to an event record. Also calls <code>setPDEPtr</code> below. 
</method> 
 
<method name="void Particle::setPDEPtr(ParticleDataEntry* pdePtr = 0)"> 
sets the pointer to the <code>ParticleDataEntry</code> object of the 
particle, based on its current <code>id</code> code. If the particle 
belongs to an event there is no need to provide the input argument. 
As explained above, a valid <code>ParticleDataEntry</code> pointer 
is needed for the methods that provide information generic to the 
particle species. 
</method> 
 
</chapter> 
 
<!-- Copyright (C) 2026 Torbjorn Sjostrand --> 
