]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA8/pythia8145/xmldoc/SemiInternalProcesses.xml
Use Output directive instead of the old OutputFile and OUtputArchive. Save fileinfo...
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8145 / xmldoc / SemiInternalProcesses.xml
CommitLineData
9419eeef 1<chapter name="Semi-Internal Processes">
2
3<h2>Semi-Internal Processes</h2>
4
5Normally users are expected to implement new processes via the
6<aloc href="LesHouchesAccord">Les Houches Accord</aloc>. Then
7you do all flavour, colour and phase-space selection externally,
8before your process-level events are input for further processing
9by PYTHIA. However, it is also possible to implement a
10new process in exactly the same way as the internal PYTHIA
11ones, thus making use of the internal phase space selection machinery
12to sample an externally provided cross-section expression.
13This page gives a brief summary how to do that. If you additionally
14want to introduce a new resonance species, with its own internal
15width calculations, you will find further instructions
16<aloc href="SemiInternalResonances">here</aloc>.
17
18<p/>
19Should you actually go ahead, it is strongly recommended to shop around
20for a similar process that has already been implemented, and to use that
21existing code as a template. Look for processes with the same combinations
22of incoming flavours and colour flows, rather than the shape of the
23cross section itself. With a reasonable such match the task should be
24of medium difficulty, without it more demanding.
25
26<p/>
27PYTHIA is rather good at handling the phase space of
28<ei>2 -> 1</ei> and <ei>2 -> 2</ei> processes, is more primitive for
29<ei>2 -> 3</ei> ones and does not at all address higher multiplicities.
30This limits the set of processes that you can implement in this
31framework. The produced particles may be resonances, however, so it is
32possible to end up with bigger "final" multiplicities through sequential
33decays, and to include further matrix-element weighting in those decays.
34
35<p/>
36There are three steps involved in implementing a process:
37<br/>1) making use of the PYTHIA-provided kinematics information to
38calculate the relevant cross section,
39<br/>2) writing a new class, where the matrix elements are implemented,
40including information on incoming and outgoing flavours and colours, and
41<br/>3) making the process available.
42<br/>We consider these aspects in turn. An example where it all comes
43together is found in <code>main25.cc</code>.
44
45<h3>The Cross Section Calculation</h3>
46
47The key method for the cross section calculation is
48<code>SigmaProcess::sigmaHat()</code>, described below. At the point when
49it is called, the kinematics has already been set up, and from these
50phase space variables the differential cross section is to be calculated.
51
52<p/>
53For a <ei>2 -> 1</ei> process, the returned value should be
54<ei>sigmaHat(sHat)</ei>, where <code>mH</code> (= <ei>mHat</ei>),
55<code>sH</code> (= <ei>sHat</ei>) and <code>sH2</code> (= <ei>sHat^2</ei>)
56are available to be used. Incoming partons are massless. Overload the
57<code>convertME()</code> method below if you instead plan to return
58<ei>|M|^2</ei>.
59
60<p/>
61For a <ei>2 -> 2</ei> process, instead <ei>d(sigmaHat)/d(tHat)</ei>
62should be returned, based on provided
63<code>mH, sH, sH2, tH, tH2, uH, uH2, m3, s3, m4, s4</code> and
64<code>pT2</code> values (<code>s3 = m3*m3</code> etc.). Incoming
65partons are massless. Overload the <code>convertME()</code> method
66below if you instead plan to return <ei>|M|^2</ei>.
67
68<p/>
69For a <ei>2 -> 3</ei> process, instead <ei>|M|^2</ei> should be
70returned, with normalization such that <ei>|M|^2 / (2 sHat)</ei> integrated
71over the three-body phase space gives the cross section. Here no standard
72set of Mandelstam-style variables exists. Instead the obvious ones,
73<code>mH, sH, m3, s3, m4, s4, m5, s5</code>, are complemented by the
74four-vectors <code>p3cm, p4cm, p5cm</code>, from which further invariants
75may be calculated. The four-vectors are defined in the CM frame of the
76subcollision, with massless incoming partons along the <ei>+-z</ei> axis.
77
78<p/>
79In either case, <ei>alpha_s</ei> and <ei>alpha_em</ei> have already
80been calculated, and are stored in <code>alpS</code> and <code>alpEM</code>.
81Also other standard variables may be used, like
82<code>CoupEW::sin2thetaW()</code>, and related flavour-dependent
83vector and axial couplings in <code>CoupEW</code> and CKM combinations
84in <code>VCKM</code>.
85
86<p/>
87In case some of the final-state particles are resonances, their
88squared masses have already been selected according to a Breit-Wigner
89with a linearly running width <ei>Gamma(m) = Gamma(m_0) * m / m_0</ei>.
90More precisely, the mass spectrum is weighted according to
91<ei>w_BW(m^2) d(m^2)</ei>, where
92<eq>
93w_BW(m^2) = (1/pi) * (m * Gamma(m)) / ( (m^2 - m_0^2)^2 + (m * Gamma(m))^2 ) .
94</eq>
95If you would like to have another expression, the above weights are stored
96in <code>runBW3</code>, <code>runBW4</code> and <code>runBW5</code>,
97respectively. If you divide out one of these factors, you just remain with
98a phase space selection <ei>d(m^2)</ei> for this particle,
99and can multiply on your desired shape factor instead. Unfortunately, the
100Monte Carlo efficiency will drop if your new mass distribution differs
101dramatically from the input one. Therefore it does make sense to adjust the
102database value of the width to be slightly (but not too much) broader
103than the distribution you have in mind. Also note that, already by default,
104the wings of the Breit-Wigner are oversampled (with a compensating lower
105internal weight) by partly sampling like <ei>(a + b/m^2 + c/m^4) d(m^2)</ei>,
106where the last term is only used for <ei>gamma^*/Z^0</ei>.
107
108<p/>
109As alternative to the kinematics variables defined above, also the two
110arrays <code>mME[5]</code> and <code>pME[5]</code>, for masses and
111four-momenta, respectively, can be used for cross-section calculations.
112Here indices 0 and 1 are the two incoming beams, and 2 and onwards the
113outgoing particles. Note that this differs by one step from the normal
114internal labelling, where slot 0 is left empty. The four-momenta are
115defined in the rest frame of the subcollision, with the incoming partons
116along the <ei>+-z</ei> direction. The kinematics need not agree with the
117"correct" one stored in the event record, for three reasons.
118<br/>1) Gauge invariance forces matrix-element calculations to use
119the same masses for incoming as outgoing legs of a particle species,
120say <ei>b</ei> quarks. Therefore the kinematics of the two incoming
121partons is recalculated, relative to the normal event record, to put
122the partons on the mass shell. (Note that initial masses is a technical
123issue, not the correct physics picture: the incoming partons are likely
124to be spacelike virtual rather than on the mass shell.)
125<br/>2) In principle each fermion flavour has to be treated separately,
126owing to a different mass. However, in many cases fermions can be
127assumed massless, which speeds up the calculations, and further gains
128occur if then different flavours can use the same cross-section
129expression. In MadGraph the default is that fermions up to and including
130the <ei>c</ei> quark and the <ei>mu</ei> lepton are considered massless,
131while the <ei>b</ei> quark and the <ei>tau</ei> lepton are considered
132massive. This can be modified however, and below we provide four flags
133that can be used to consider the "borderline" fermions either as
134massless or as massive when matrix elements are evaluated, to match the
135assumptions made for the matrix elements themselves.
136<br/>3) For <ei>2 -> 2</ei> and <ei>2 -> 3</ei> processes of massive
137identical particles (or antiparticles) in the final state, such as
138<ei>t tbar</ei> or <ei>W^+ W^-</ei>, the kinematics is here adjusted
139so that the two or three particles have the same mass, formed as a
140suitable average of the actual Breit-Wigner-distributed masses. This
141allows the evaluation of matrix-element expressions that only have
142meaning if the two/three have the same mass.
143<br/>Thus the mass array <code>mME[5]</code> and the four-momentum array
144<code>pME[5]</code> present values both for initial- and final-state
145particles based on these mass principles suited for matrix-element input.
146Note that these variables therefore differ from the kinematics stored in
147the event record proper, where incoming fermions are always massless and
148outgoing resonances have independent Breit-Wigner mass distributions.
149<br/>The conversion from the normal to the special kinematics is done
150by calling the <code>setupForME()</code> method. This you have to do
151yourself in the <code>SigmaHat()</code> member of your derived class.
152Alternatively it could be done in <code>SigmaKin()</code>, i.e. before
153the loop over incoming flavours, but then these would be considered
154massless. The identity of final-state particles is obtained from the
155<code>id3Mass()</code>, <code>id4Mass()</code> and <code>id5Mass()</code>
156methods. Should the conversion to <code>mME[5]</code> and
157<code>pME[5]</code> not work, <code>setupForME()</code> will return
158<code>false</code>, and then the cross section should be put zero.
159
160<flag name="SigmaProcess:cMassiveME" default="off">
161Let the <ei>c</ei> quark be massive or not in the kinematics set up for
162external matrix-element evaluation.
163</flag>
164
165<flag name="SigmaProcess:bMassiveME" default="on">
166Let the <ei>b</ei> quark be massive or not in the kinematics set up for
167external matrix-element evaluation.
168</flag>
169
170<flag name="SigmaProcess:muMassiveME" default="off">
171Let the <ei>mu</ei> lepton be massive or not in the kinematics set up for
172external matrix-element evaluation.
173</flag>
174
175<flag name="SigmaProcess:tauMassiveME" default="on">
176Let the <ei>tau</ei> lepton be massive or not in the kinematics set up for
177external matrix-element evaluation.
178</flag>
179
180
181<h3>The Cross Section Class</h3>
182
183The matrix-element information has to be encoded in a new class.
184The relevant code could either be put before the main program in the
185same file, or be stored separately, e.g. in a matched pair
186of <code>.h</code> and <code>.cc</code> files. The latter may be more
187convenient, in particular if the cross sections are lengthy, or if you
188intend to build up your own little process library, but of course
189requires that these additional files are correctly compiled and linked.
190
191<p/>
192The class has to be derived either from
193<code>Sigma1Process</code>, for <ei>2 -> 1</ei> processes, from
194<code>Sigma2Process</code>, for <ei>2 -> 2</ei> ones, or from
195<code>Sigma3Process</code>, for <ei>2 -> 3</ei> ones. (The
196<code>Sigma0Process</code> class is used for elastic, diffractive
197and minimum-bias events, and is not recommended for use beyond that.)
198These are in their turn derived from the <code>SigmaProcess</code>
199base class.
200
201<p/>
202The class can implement a number of methods. Some of these are
203compulsory, others strongly recommended, and the rest are to be
204used only when the need arises to override the default behaviour.
205The methods are:
206
207<p/>
208A <b>constructor</b> for the derived class obviously must be available.
209Here you are quite free to allow a list of arguments, to set
210the parameters of your model, or even to create a set of closely
211related but distinct processes. For instance, <ei>g g -> Q Qbar</ei>,
212<ei>Q = c</ei> or <ei>b</ei>, is only coded once, and then the
213constructor takes the quark code (4 or 5) as argument,
214to allow the proper amount of differentiation.
215
216<p/>
217A <b>destructor</b> is only needed if you plan to delete the process
218before the natural end of the run, and require some special behaviour
219at that point. If you call such a destructor you will leave a pointer
220dangling inside the <code>Pythia</code> object you gave it in to,
221if that still exists.
222
223<method name="void SigmaProcess::initProc()">
224is called once during initalization, and can then be used to set up
225parameters, such as masses and couplings, and perform calculations
226that need not be repeated for each new event, thereby saving time.
227This method needs not be implemented, since in principle all
228calculations can be done in <code>sigmaHat</code> below.
229</method>
230
231<method name="void SigmaProcess::sigmaKin()">
232is called once a kinematical configuration has been determined, but
233before the two incoming flavours are known. This routine can therefore
234be used to perform calculations that otherwise might have to be repeated
235over and over again in <code>sigmaHat</code> below. For instance
236a flavour-independent cross section calculation for a <ei>q g</ei>
237initial state would be repeated 20 times in <code>sigmaHat</code>,
238five times for the five quark flavours allowed in the incoming beams,
239times twice to include antiquarks, times twice since the (anti)quark
240could be in either of the two beams. You could therefore calculate the
241result once only and store it as a private data member of the class.
242It is optional whether you want to use this method, however, or put
243everything in <code>sigmaHat</code>.
244</method>
245
246<method name="double SigmaProcess::sigmaHat()">
247is the key method for cross section calculations and returns a cross section
248value, as described in the previous section. It is called when also a
249preliminary set of incoming flavours has been picked, in addition to the
250kinematical ones already available for <code>sigmaKin</code>.
251Typically <code>sigmaHat</code> is called inside a loop over all allowed
252incoming flavour combinations, stored in <code>id1</code> and
253<code>id2</code>, with fixed kinematics, as already illustrated above.
254The sum over the different flavour combinations provides the total
255cross section, while their relative size is used to make a selection of
256a specific incomimg state.
257</method>
258
259<method name="bool SigmaProcess::setupForME()">
260to be called by the user from inside <code>sigmaHat()</code>
261(or possibly <code>sigmaKin()</code>) to setup alternative kinematics
262in the <code>mME[5]</code> and <code>pME[5]</code> arrays, better
263suited for matrix-element calculations. See the end of the previous
264section for a more detailed description. Should the method return
265<code>false</code> then the conversion did not work, and
266<code>sigmaHat()</code> (or <code>sigmaKin()</code>) should be set to
267vanish.
268</method>
269
270<method name="void SigmaProcess::setIdColAcol()">
271is called only once an initial state and a kinematical configuration has
272been picked. This routine must set the complete flavour information and
273the colour flow of the process. This may involve further random choices,
274between different possible final-state flavours or between possible
275competing colour flows. Private data members of the class may be used to
276retain some information from the previous steps above.
277<br/>When this routine is called the two incoming flavours have already
278been selected and are available in <code>id1</code> and <code>id2</code>,
279whereas the one, two or three outgoing ones either are fixed for a given
280process or can be determined from the instate (e.g. whether a <ei>W^+</ei>
281or <ei>W^-</ei> was produced). There is also a standard method in
282<code>VCKM</code> to pick a final flavour from an initial one with CKM
283mixing. Once you have figured out the value of
284<code>id3</code> and, the case being, <code>id4</code> and
285<code>id5</code>, you store these values permanently by a call
286<code>setId( id1, id2, id3, id4, id5)</code>, where the last two may be
287omitted if irrelevant.
288<br/>Correspondingly, the colours are stored with
289<code>setColAcol( col1, acol1, col2, acol2, col3, acol3, col4, acol4,
290col5, acol5)</code>, where the final ones may be omitted if irrelevant.
291Les Houches style colour tags are used, but starting with number 1
292(and later shifted by the currently requested offset). The
293input is grouped particle by particle, with the colour index before the
294anticolour one. You may need to select colour flow dynamically, depending
295on the kinematics, when several distinct possibilities exist. Trivial
296operations, like swapping colours and anticolours, can be done with
297existing methods.
298<br/>When the <code>id3Mass()</code> and <code>id4Mass()</code>
299methods have been used, the order of the outgoing particles may be
300inconsistent with the way the <ei>tHat</ei> and <ei>uHat</ei>
301variables have been defined. A typical example would be a process like
302<ei>q g -> q' W</ei> with <ei>tHat</ei> defined between incoming and
303outgoing quark, but where <code>id3Mass() = 24</code> and so the
304process is to be stored as <ei>q g -> W q'</ei>. One should then put
305the variable <code>swapTU = true</code> in <code>setIdColAcol()</code>
306for each event where the <ei>tHat</ei> and <ei>uHat</ei> variables
307should be swapped before the event kinematics is reconstructed. This
308variable is automatically restored to <code>false</code> for each new
309event.
310</method>
311
312<method name="double SigmaProcess::weightDecayFlav( Event& process)">
313is called to allow a reweighting of the simultaneous flavour choices of
314resonance decay products. Is currently only used for the
315<ei>q qbar -> gamma*/Z^0 gamma*/Z^0</ei> process, and will likely not
316be of interest for you.
317</method>
318
319<method name="double SigmaProcess::weightDecay( Event& process,
320int iResBeg, int iResEnd)">
321is called when the basic process has one or several resonances, after each
322set of related resonances in <code>process[i]</code>,
323<code>iResBeg</code> &lt;= <code>i </code> &lt;= <code>iResEnd</code>,
324has been allowed to decay. The calculated weight, to be normalized
325to the range between 0 and 1, is used to decide whether to accept the
326decay(s) or try for a new decay configuration. The base-class version of
327this method returns unity, i.e. gives isotropic decays by default.
328This method may be called repeatedly for a single event. For instance, in
329<ei>q qbar -> H^0 Z^0</ei> with <ei>H^0 -> W^+ W^-</ei>, a first call
330would be made after the <ei>H^0</ei> and <ei>Z^0</ei> decays, and then
331depend only on the <ei>Z^0</ei> decay angles since the <ei>H^0</ei>
332decays isotropically. The second call would be after the <ei>W^+ W^-</ei>
333decays and then involve correlations between the four daughter fermions.
334</method>
335
336<method name="string SigmaProcess::name()">
337returns the name of the process, as you want it to be shown in listings.
338</method>
339
340<method name="int SigmaProcess::code()">
341returns an integer identifier of the process. This has no internal function,
342but is only intended as a service for the user to rapidly (and hopefully
343uniquely) identify which process occured in a given event. Numbers below
34410000 are reserved for internal PYTHIA use.
345</method>
346
347<method name="string SigmaProcess::inFlux()">
348this string specifies the combinations of incoming partons that are
349allowed for the process under consideration, and thereby which incoming
350flavours <code>id1</code> and <code>id2</code> the <code>sigmaHat()</code>
351calls will be looped over. It is always possible to pick a wider flavour
352selection than strictly required and then put to zero cross sections in
353the superfluous channels, but of course this may cost some extra execution
354time. Currently allowed options are:
355<br/>* <code>gg</code>: two gluons.
356<br/>* <code>qg</code>: one (anti)quark and one gluon.
357<br/>* <code>qq</code>: any combination of two quarks, two antiquarks or
358a quark and an antiquark.
359<br/>* <code>qqbarSame</code>: a quark and its antiquark;
360this is a subset of the above <code>qq</code> option.
361<br/>* <code>ff</code>: any combination of two fermions, two antifermions
362or a fermion and an antifermion; is the same as <code>qq</code> for
363hadron beams but also allows processes to work with lepton beams.
364<br/>* <code>ffbarSame</code>: a fermion and its antifermion; is the
365same as <code>qqbarSame</code> for hadron beams but also allows processes
366to work with lepton beams.
367<br/>* <code>ffbarChg</code>: a fermion and an antifermion that combine
368to give charge +-1.
369<br/>* <code>fgm</code>: a fermion and a photon (gamma).
370<br/>* <code>ggm</code>: a gluon and a photon.
371<br/>* <code>gmgm</code>: two photons.
372</method>
373
374<method name="bool SigmaProcess::convert2mb()">
375it is assumed that cross sections normally come in dimensions such that
376they, when integrated over the relevant phase space, obtain the dimension
377GeV^-2, and therefore need to be converted to mb. If the cross section
378is already encoded as mb then <code>convert2mb()</code> should be
379overloaded to instead return <code>false</code>.
380</method>
381
382<method name="bool SigmaProcess::convertME()">
383it is assumed that <ei>2 -> 1</ei> cross sections are encoded as
384<ei>sigmaHat(sHat)</ei>, and <ei>2 -> 2</ei> ones as
385<ei>d(sigmaHat)/d(tHat)</ei> in the <code>SigmaProcess::sigmaHat()</code>
386methods. If <code>convertME()</code> is overloaded to instead return
387<code>true</code> then the return value is instead assumed to be the
388squared matrix element <ei>|M|^2</ei>, and
389<code>SigmaProcess::sigmaHatWrap(...)</code> converts to
390<ei>sigmaHat(sHat)</ei> or <ei>d(sigmaHat)/d(tHat)</ei>, respectively.
391This switch has no effect on <ei>2 -> 3</ei> processes, where
392<ei>|M|^2</ei> is the only allowed input anyway.
393</method>
394
395<method name="int SigmaProcess::id3Mass()">
396</method>
397<methodmore name="int SigmaProcess::id4Mass()">
398</methodmore>
399<methodmore name="int SigmaProcess::id5Mass()">
400are the one, two or three final-state flavours, where masses are to be
401selected before the matrix elements are evaluated. Only the absolute value
402should be given. For massless particles, like gluons and photons, one need
403not give anything, i.e. one defaults to 0. The same goes for normal light
404quarks, where masses presumably are not implemented in the matrix elements.
405Later on, these quarks can still (automatically) obtain constituent masses,
406once a <ei>u</ei>, <ei>d</ei> or <ei>s</ei> flavour has been selected.
407</methodmore>
408
409<method name="int SigmaProcess::resonanceA()">
410</method>
411<methodmore name="int SigmaProcess::resonanceB()">
412are the codes of up to two <ei>s</ei>-channel resonances contributing to
413the matrix elements. These are used by the program to improve the phase-space
414selection efficiency, by partly sampling according to the relevant
415Breit-Wigners. Massless resonances (the gluon and photon) need not be
416specified.
417</methodmore>
418
419<method name="bool SigmaProcess::isSChannel()">
420normally the choice of renormalization and factorization scales in
421<ei>2 -> 2</ei> and <ei>2 -> 3</ei> processes is based on the assumption
422that <ei>t</ei>- and <ei>u</ei>-channel exchanges dominates the
423cross section. In cases such as <ei>f fbar -> gamma* -> f' fbar'</ei> a
424<ei>2 -> 2</ei> process actually ought to be given scales as a
425<ei>2 -> 1</ei> one, in the sense that it proceeds entirely through
426an <ei>s</ei>-channel resonance. This can be achieved if you override the
427default <code>false</code> to return <code>true</code>. See further the
428page on <aloc href="CouplingsAndScales">couplings and scales</aloc>.
429</method>
430
431<method name="int SigmaProcess::idSChannel()">
432normally no intermediate state is shown in the event record for
433<ei>2 -> 2</ei> and <ei>2 -> 3</ei> processes. However, in case
434that <code>idSChannel</code> is overloaded to return a nonzero value,
435an intermediate particle with that identity code is inserted into the
436event record, to make it a <ei>2 -> 1 -> 2</ei> or <ei>2 -> 1 -> 3</ei>
437process. Thus if both <code>isSChannel</code> and <code>idSChannel</code>
438are overloaded, a process will behave and look like it proceeded through
439a resonance. The one difference is that the implementation of the
440matrix element is not based on the division into a production and a
441decay of an intermediate resonance, but is directly describing the
442transition from the initial to the final state.
443</method>
444
445<method name="int SigmaProcess::isQCD3body()">
446there are two different 3-body phase-space selection machineries,
447of which the non-QCD one is default. If you overload this method
448instead the QCD-inspired machinery will be used. The differences
449between these two is related to which
450<aloc href="PhaseSpaceCuts">phase space cuts</aloc>
451can be set, and also that the QCD machinery assumes (almost) massless
452outgoing partons.
453</method>
454
455<method name="int SigmaProcess::idTchan1()">
456</method>
457<methodmore name="int SigmaProcess::idTchan2()">
458the non-QCD <ei>2 -> 3</ei> phase space selection machinery is rather
459primitive, as already mentioned. The efficiency can be improved in
460processes that proceed though <ei>t</ei>-channel exchanges, such as
461<ei>q qbar' -> H^0 q qbar'</ei> via <ei>Z^0 Z^0</ei> fusion, if the identity
462of the <ei>t</ei>-channel-exchanged particles on the two side of the
463event are provided. Only the absolute value is of interest.
464</methodmore>
465
466<method name="double SigmaProcess::tChanFracPow1()">
467</method>
468<methodmore name="double SigmaProcess::tChanFracPow2()">
469in the above kind of <ei>2 -> 3</ei> phase-space selection, the
470sampling of <ei>pT^2</ei> is done with one part flat, one part weighted
471like <ei>1 / (pT^2 + m_R^2)</ei> and one part like
472<ei>1 / (pT^2 + m_R^2)^2</ei>. The above values provide the relative
473amount put in the latter two channels, respectively, with the first
474obtaining the rest. Thus the sum of <code>tChanFracPow1()</code> and
475<code>tChanFracPow2()</code> must be below unity. The final results
476should be independent of these numbers, but the Monte Carlo efficiency
477may be quite low for a bad choice. Here <ei>m_R</ei> is the mass of the
478exchanged resonance specified by <code>idTchan1()</code> or
479<code>idTchan2()</code>. Note that the order of the final-state
480listing is important in the above <ei>q qbar' -> H^0 q qbar'</ei> example,
481i.e. the <ei>H^0</ei> must be returned by <code>id3Mass()</code>,
482since it is actually the <ei>pT^2</ei> of the latter two that are
483selected independently, with the first <ei>pT</ei> then fixed
484by transverse-momentum conservation.
485</methodmore>
486
487<method name="bool SigmaProcess::useMirrorWeight()">
488in <ei>2 -> 3</ei> processes the phase space selection used here
489involves a twofold ambiguity basically corresponding to a flipping of
490the positions of last two outgoing particles. These are assumed equally
491likely by default, <code>false</code>, but for processes proceeding entirely
492through <ei>t</ei>-channel exchange the Monte Carlo efficiency can be
493improved by making a preselection based on the relative propagator
494weights, <code>true</code>.
495</method>
496
497<method name="int SigmaProcess::gmZmode()">
498allows a possibility to override the global mode
499<code><aloc href="ElectroweakProcesses">WeakZ0:gmZmode</aloc></code>
500for a specific process. The global mode normally is used to switch off
501parts of the <ei>gamma^*/Z^0</ei> propagator for test purposes. The
502above local mode is useful for processes where a <ei>Z^0</ei> really is
503that and nothing more, such as <ei>q qbar -> H^0 Z^0</ei>. The default
504value -1 returned by <code>gmZmode()</code> ensures that the global
505mode is used, while 0 gives full <ei>gamma^*/Z^0</ei> interference,
5061 <ei>gamma^*</ei> only and 2 <ei>Z^0</ei> only.
507</method>
508
509<h3>Access to a process</h3>
510
511Once you have implemented a class, it is straightforward to make use of
512it in a run. Assume you have written a new class <code>MySigma</code>,
513which inherits from <code>Sigma1Process</code>, <code>Sigma2Process</code>
514or <code>Sigma3Process</code>, which in their turn inherit from
515<code>SigmaProcess</code>. You then create an instance of this class
516and hand it in to a <code>pythia</code> object with
517<pre>
518 SigmaProcess* mySigma = new MySigma();
519 pythia.setSigmaPtr( mySigma);
520</pre>
521If you have several processes you can repeat the procedure any number
522of times. When <code>pythia.init(...)</code> is called these processes
523are initialized along with any internal processes you may have switched on,
524and treated in exactly the same manner. The <code>pythia.next()</code>
525will therefore generate a mix of the different kinds of processes without
526distinction. See also the <aloc href="ProgramFlow">Program Flow</aloc>
527description.
528
529<p/>
530If the code should be of good quality and general usefulness, it would
531be simple to include it as a permanently available process in the
532standard program distribution. The final step of that integration ought to
533be left for the PYTHIA authors, but here is a description of what is
534required.
535
536<p/>
537A flag has to be defined, that allows the process to be switched on;
538by default it should always be off. The name of the flag should be
539chosen of the type <code>model:process</code>. Here the
540<code>model</code> would be related to the general scenario considered,
541e.g. <code>Compositeness</code>, while <code>process</code> would
542specify instate and outstate, separated by a 2 (= to), e.g.
543<code>ug2u*g</code>.
544When several processes are implemented and "belong together" it is
545also useful to define a <code>model:all</code> switch that affects
546all the separate processes.
547
548<p/>
549The flags should normally be stored in the <code>ProcessSelection.xml</code>
550file or one of its daughters for a specific kind of processes. This is to
551make them easily found by users. You could create and use your own
552<code>.xml</code> file, so long as you then add that name to the
553list of files in the <code>Index.xml</code> file. (If not,
554the flags would never be created and the program would not work.)
555
556<p/>
557In the <code>ProcessContainer.c</code> file, the
558<code>SetupContainers::init()</code> method needs to be expanded to
559create instances of the processes switched on. This code is fairly
560repetitive, and should be easy to copy and modify from the code
561already there. The basic structure is
562<br/>(i) check whether a process is requested by the user and, if so,
563<br/>(ii) create an instance of the matrix-element class,
564<br/>(iii)create a container for the matrix element and its associated
565phase-space handling, and
566<br>(iv) add the container to the existing process list.
567
568<p/>
569Two minor variations are possible. One is that a set of related
570processes are lumped inside the the same initial check, i.e. are
571switched on all together. The second is that the matrix-element
572constructor may take arguments, as specified by you (see above).
573If so, the same basic matrix element may be recycled for a set of
574related processes, e.g. one for a composite <ei>u</ei> and one for
575a composite <ei>d</ei>. Obviously these variations may be combined.
576
577</chapter>
578
579<!-- Copyright (C) 2010 Torbjorn Sjostrand -->