source: HiSusy/trunk/Pythia8/pythia8170/xmldoc/ImplementNewShowers.xml @ 1

Last change on this file since 1 was 1, checked in by zerwas, 11 years ago

first import of structure, PYTHIA8 and DELPHES

File size: 23.3 KB
Line 
1<chapter name="Implement New Showers">
2
3<h2>Implement New Showers</h2>
4
5In case you want to replace the PYTHIA initial- and final-state
6showers by your own, it is possible but not trivial. The point is
7that multiparton interactions (MPI), initial-state radiation (ISR) and
8final-state radiation (FSR) in general appear in one single
9interleaved sequence of decreasing <ei>pT</ei> values. Therefore
10shower replacements would have to be able to play the game by such
11rules, as we will outline further below. Of course, this still
12leaves the field open exactly how to define what to mean by
13<ei>pT</ei>, how to handle recoil effects, how the colour flow is
14affected, and so on, so there is certainly room for alternative
15showers. A first example of a shower implemented within the PYTHIA
16context is <a href="http://home.fnal.gov/~skands/vincia/">VINCIA</a>,
17which however so far only handles FSR.
18
19<p/>
20For the moment we assume you want to keep the MPI part of the story
21unchanged, and make use of the existing beam-remnants (BR) machinery.
22If you want to replace both MPI, ISR, FSR and BR then you had better
23replace the whole <code>PartonLevel</code> module of the code.
24If, in addition, you want to produce your own hard processes,
25then you only need the
26<aloc href="HadronLevelStandalone">hadron-level standalone</aloc>
27part of the machinery.
28
29<p/>
30In order to write replacement codes for ISR and/or FSR it is useful
31to be aware of which information has to be shared between the
32different components, and which input/output structure is required
33of the relevant methods. For details, nothing beats studying the
34existing code. However, here we provide an overview, that should
35serve as a useful introduction.
36
37<p/>
38It should be noted that we here primarily address the problem in
39its full generality, with interleaved MPI, ISR and FSR. There exists
40an option <code>TimeShower:interleave = off</code> where only
41MPI and ISR would be interleaved and FSR be considered after these
42two, but still before BR. Most of the aspects described here would
43apply also for that case. By contrast, resonance decays are only
44considered after all the four above components, and timelike
45showers in those decays would never be interleaved with anything
46else, so are much simpler to administrate.
47
48<p/>
49Therefore the <code><aloc href="ProgramFlow">
50pythia.setShowerPtr( timesDecPtr, timesPtr, spacePtr)</aloc></code>
51method allows two separate pointers to be set to instances of
52derived <code>TimeShower</code> classes. The first is only required
53to handle decays, say of <ei>Z^0</ei> or <ei>Upsilon</ei>, with no
54dependence on beam remnants or ISR. The second, as well as
55<code>spacePtr</code>, has to handle the interleaved evolution of MPI,
56ISR and FSR. Therefore you are free to implement only the first, and
57let the PYTHIA default showers take care of the latter two. But, if
58you wanted to, you could also set <code>timesDecPtr = 0</code> and
59only provide a <code>timesPtr</code>, or only a <code>spacePtr</code>.
60If your timelike shower does both cases, the first two pointers
61can agree. The only tiny point to take into account then is that
62<code>init( beamAPtr, beamBPtr)</code> is called twice, a first time
63to <code>timesDecPtr</code> with beam pointers 0, and a second time
64to <code>timesPtr</code> with nonvanishing beam pointers. 
65
66<h3>The event record and associated information</h3> 
67
68Obviously the main place for sharing information is the event
69record, specifically the <code>Event event</code> member of
70<code>Pythia</code>, passed around as a reference. It is
71assumed you already studied how it works, so here we only draw
72attention to a few aspects of special relevance.
73
74<p/>
75One basic principle is that existing partons should not be
76overwritten. Instead new partons should be created, even when a
77parton only receives a slightly shifted momentum and for the rest
78stays the same. Such "carbon copies" by final-state branchings
79should be denoted by both daughter indices of the original parton
80pointing to the copy, and both mother indices of the copy to the
81original. If the copy instead is intended to represent an earlier
82step, e.g. in ISR backwards evolution, the role of mothers and
83daughters is interchanged. The
84<code>event.copy( iCopy, newStatus)</code>
85routine can take care of this tedious task; the sign of
86<code>newStatus</code> tells the program which case to assume.
87
88<p/>
89To make the event record legible it is essential that the
90<aloc href="ParticleProperties">status codes</aloc> 
91are selected appropriately to represent the reason why each new
92parton is added to the record. Also remember to change the
93status of a parton to be negative whenever an existing parton
94is replaced by a set of new daughter partons.
95
96<p/>
97Another important parton property is <code>scale()</code>,
98which does not appear in the normal event listing, but only
99if you use the extended
100<code>Event:listScaleAndVertex = on</code> option.
101This property is supposed to represent the production scale
102(in GeV) of a parton. In the current FSR and ISR algorithms
103it is used to restrict from above the allowed <ei>pT</ei> 
104values for branchings of this particular parton. 
105Beam remnants and other partons that should not radiate are
106assigned scale 0.   
107
108<p/>
109Auxiliary to the event record proper is the
110<code><aloc href="AdvancedUsage">PartonSystems</aloc></code> 
111class, that keep track of which partons belong together in the
112same scattering subsystem. This information must be kept up-to-date
113during the shower evolution.
114
115<p/>
116For initial-state showers it is also necessary to keep track of
117the partonic content extracted from the beams. This information
118is stored in the
119<code><aloc href="AdvancedUsage">BeamParticle</aloc></code> 
120class. 
121
122<h3>The TimeShower interface</h3>
123
124If you want to replace the <code>TimeShower</code> class this would
125involve replacing the virtual methods among the following ones.
126
127<method name="TimeShower::TimeShower()">
128The constructor does not need to do anything.
129</method>
130
131<method name="virtual TimeShower::~TimeShower()">
132The destructor does not need to do anything.
133</method>
134
135<method name="void TimeShower::initPtr(Info* infoPtr, Settings* settingsPtr,
136ParticleData* particleDataPtr, Rndm* rndmPtr, CoupSM* coupSMPtr,
137PartonSystems* partonSystemsPtr, UserHooks* userHooksPtr)">
138This method only imports pointers to standard facilities,
139and is not virtual.
140</method>
141
142<method name="virtual void TimeShower::init( BeamParticle* beamAPtrIn = 0,
143BeamParticle* beamBPtrIn = 0)">
144You have to store your local copy of the pointers to these objects,
145since they have to be used during the generation, as explained above.
146The pointers could be zero; e.g. a local copy of <code>TimeShower</code>
147is created to handle showers in decays such as <ei>Upsilon -> q qbar</ei>
148from inside the <code>ParticleDecays class</code>. This is also the
149place to do initialization of whatever parameters you plan to use,
150e.g. by reading in them from a user-accessible database like the
151<code>Settings</code> one.
152</method>
153
154<method name="virtual bool TimeShower::limitPTmax( Event& event,
155double Q2Fac = 0.,  double Q2Ren = 0.)">
156The question is whether the FSR should be allowed to occur at larger
157scales than the hard process it surrounds. This is process-dependent,
158as illustrated below for the the analogous
159<code>SpaeShower::limitPTmax(...)</code> method, although the two
160kinds of radiation need not have to be modelled identically.
161The <code>TimeShower:pTmaxMatch</code> switch allows you to force the
162behaviour among three options, but you may replace by your own logic.
163<br/>The internal PYTHIA implementation also allows intermediate options,
164where emissions can go up to the kinematical limit but be dampened above
165the factorization or renormalization scale. Therefore the (square of the)
166latter two are provided as optional input parameters. 
167</method>
168
169<method name="double TimeShower::enhancePTmax()">
170Relative to the default <ei>pT_max</ei> evolution scale of the process,
171it may still be convenient to vary the matching slightly for the hardest
172interaction in an event, to probe the sensitivity to such details. The
173base-class implementation returns the value of the
174<code>TimeShower:pTmaxFudge</code> parameter.
175</method>
176
177<method name="virtual int TimeShower::shower( int iBeg, int iEnd,
178Event& event, double pTmax, int nBranchMax = 0)">
179This is an all-in-one call for shower evolution, and as such cannot be
180used for the normal interleaved evolution, where only the routines below
181are used. It also cannot be used in resonance decays that form part of
182the hard process, since there the
183<aloc href="UserHooks">user hooks</aloc> insert a potential
184veto step. Currently this routine is therefore only used in the
185hadron-level decays, e.g. <ei>Upsilon -> g g g</ei>.
186<br/><code>iBeg</code> and <code>iEnd</code> is the position of the
187first and last parton of a separate system, typically produced by a
188resonance decay. Such a system only evolves in isolation, and in
189particular does not relate to the beams.
190<br/>The <code>pTmax</code> value sets the maximum scale for evolution,
191but normally you would restrict that further for each individual
192parton based on its respective scale value.
193<br/>The <code>nBranchMax</code> value, if positive, gives the maximum
194number of allowed branchings in the call, as useful for matching studies.
195<br/>The routine is expected to return the number of FSR branchings that
196were generated, but only for non-critical statistics purposes.
197<br/>Since the real action typically is delegated to the routines
198below, it may well be that the existing code need not be replaced.
199</method>
200
201<method name="double TimeShower::pTLastInShower()">
202Can be used to return the <ei>pT</ei> evolution scale of the last
203branching in the cascade generated with the above
204<code>shower(...)</code> method. Is to be set in the internal
205<code>pTLastInShower</code> variable, and should be 0 if there
206were no branchings. Can be useful for matching studies.
207</method>
208
209<method name="virtual void TimeShower::prepare( int iSys, Event& event)">
210This method is called immediately after a new interaction (or the
211products of a resonance decay) has been added, and should then be used
212to prepare the subsystem of partons for subsequent evolution. In
213the current code this involves identifying all colour and charge
214dipole ends: the position of radiating and recoiling partons, maximum
215<ei>pT</ei> scales, possible higher-order matrix elements matchings
216to apply, and so on.
217<br/>The <code>iSys</code> parameter specifies which parton system
218is to be prepared. It is used to extract the set of partons to be
219treated, with rules as described in the above section on subsystems. 
220Specifically, the first two partons represent the incoming state,
221or are 0 for resonance decays unrelated to the beams, while the
222rest are not required to be in any particular order.
223</method>
224
225<method name="virtual void TimeShower::rescatterUpdate( int iSys,
226Event& event)">
227This method is called immediately after rescattering in the description
228of multiparton interactions. Thus the information on one or several
229systems is out-of-date, while that of the others is unchanged.
230We do not provide the details here, since we presume few implementors
231of new showers will want to touch the technicalities involved
232in obtaining a description of rescattering.
233</method>
234
235<method name="virtual void TimeShower::update( int iSys, Event& event)">
236This method is called immediately after a spacelike branching in the
237<code>iSys</code>'th subsystem. Thus the information for that system is
238out-of-date, while that of the others is unchanged. If you want, you are
239free to throw away all information for the affected subsystem and call
240<code>prepare( iSys, event)</code> to create new one. Alternatively
241you may choose only to update the information that has changed.
242</method>
243
244<method name="virtual double TimeShower::pTnext( Event& event,
245double pTbegAll, double pTendAll)">
246This is the main driver routine for the downwards evolution. A new
247<ei>pT</ei> is to be selected based on the current information set up
248by the routines above, and along with that a branching parton or dipole.
249The <code>pTbegAll</code> scale is the maximum scale allowed, from which
250the downwards evolution should be begun (usually respecting the maximum
251scale of each individual parton). If no emission is found above
252<code>pTendAll</code> (and above the respective shower cutoff scales)
253then <code>0.</code> should be returned and no emissions will be allowed.
254Both scales can vary from one event to the next: if a scale has
255already been selected for MPI or ISR it makes no sense to look for
256a scale smaller than that from FSR, since it would not be able to
257compete, so <code>pTendAll</code> is set correspondingly. As it happens,
258FSR is tried before ISR and MPI in the interleaved evolution,
259but this is an implementational detail that could well change. 
260<br/>Typically the implementation of this routine would be to set
261up a loop over all possible radiating objects (dipoles, dipole ends, ...),
262for each pick its possible branching scale and then pick the one
263with largest scale as possible winner. At this stage no branching should
264actually be carried out, since MPI, ISR and FSR still have to be compared
265to assign the winner.
266</method>
267
268<method name="virtual bool TimeShower::branch( Event& event,
269bool isInterleaved = false)">
270This method will be called once FSR has won the competition with
271MPI and ISR to do the next branching. The candidate branching found
272in the previous step should here be carried out in full. The
273pre-branching partons should get a negative status code and new
274replacement ones added to the end of the event record. Also the 
275subsystem information should be updated, and possibly also the
276beams.
277<br/>Should some problem be encountered in this procedure, e.g. if
278some not-previously-considered kinematics requirement fails, it is
279allowed to return <code>false</code> to indicate that no branching
280could be carried out.   
281<br/>Normally the optional <code>isInterleaved</code> argument would
282not be of interest. It can be used to separate resonance decays, false,
283from the interleaved evolution together with MPI and ISR, true.
284More precisely, it separates calls to the <code>timesDecPtr</code>
285and the <code>timesPtr</code> instances.
286</method>
287
288<method name="virtual bool TimeShower::rescatterPropogateRecoil(
289Event& event, Vec4& pNew)">
290This method is only called if rescattering is switched on in the
291description of multiparton interactions. It then propagates a recoil
292from a timelike branching to internal lines that connect systems.
293As for <code>rescatterUpdate</code> above, this is not likely to be
294of interest to most implementors of new showers.
295</method>
296
297<method name="int TimeShower::system()">
298This method is not virtual. If a branching is constructed by the
299previous routine this tiny method should be able to return the number
300of the selected subsystem <code>iSysSel</code> where it occured,
301so that the spacelike shower can be told which system to update,
302if necessary. Therefore <code>iSysSel</code> must be set in
303<code>branch</code> (or already in <code>pTnext</code>). 
304</method>
305
306<method name="virtual void TimeShower::list( ostream& os = cout)">
307This method is not at all required. In the current implementation it
308outputs a list of all the dipole ends, with information on the
309respective dipole. The routine is not called anywhere in the public
310code, but has been inserted at various places during the
311development/debug phase.
312</method>
313   
314<h3>The SpaceShower interface</h3>
315
316If you want to replace the <code>SpaceShower</code> class this would
317involve replacing the virtual methods in the following. You will find
318that much of the story reminds of <code>TimeShower</code> above, and
319actually some cut-and-paste of text is involved. In some respects the
320description is simpler, since there are no special cases for resonance
321decays and non-interleaved evolution. Thus there is no correspondence
322to the <code>TimeShower::shower(...)</code> routine. 
323
324<method name="SpaceShower::SpaceShower()">
325The constructor does not need to do anything.
326</method>
327
328<method name="virtual SpaceShower::~SpaceShower()">
329Also the destructor does not need to do anything.
330</method>
331
332<method name="void SpaceShower::initPtr(Info* infoPtr,
333Settings* settingsPtr, ParticleData* particleDataPtr, Rndm* rndmPtr,
334PartonSystems* partonSystemsPtr, UserHooks* userHooksPtr)">
335This method only imports pointers to standard facilities,
336and is not virtual.
337</method>
338
339<method name="virtual void SpaceShower::init( BeamParticle* beamAPtrIn,
340BeamParticle* beamBPtrIn)">
341You have to store your local copy of the pointers to these objects,
342since they have to be used during the generation, as explained above.
343This is also the place to do initialization of whatever parameters
344you plan to use, e.g. by reading in them from a user-accessible
345database like the <code>Settings</code> one.
346</method>
347
348<method name="virtual bool SpaceShower::limitPTmax( Event& event,
349double Q2Fac = 0.,  double Q2Ren = 0.)">
350The question is whether the ISR should be allowed to occur at larger
351scales than the hard process it surrounds. This is process-dependent.
352For instance, if the hard process is <ei>Z^0</ei> production we know
353that ISR should be allowed to go right up to the kinematical limit.
354If it is a <ei>2 -> 2</ei> QCD process the ISR should not exceed
355the scale of the hard process, since if so one would doublecount.
356The <code>SpaceShower:pTmaxMatch</code> switch allows you to force the
357behaviour, or else to program your own logic. The current default
358implementation limits <ei>pT</ei> whenever the final state contains
359a quark (except top), gluon or photon, since then the danger of
360doublecounting is there. You may replace by your own logic, or leave as is.
361<br/>The internal PYTHIA implementation also allows intermediate options,
362where emissions can go up to the kinematical limit but be dampened above
363the factorization or renormalization scale. Therefore the (square of the)
364latter two are provided as optional input parameters. 
365</method>
366
367<method name="virtual double SpaceShower::enhancePTmax()">
368When the above method limits <ei>pT_max</ei> to the scale of the process,
369it may still be convenient to vary the matching slightly for the hardest
370interaction in an event, to probe the sensitivity to such details. The
371base-class implementation returns the value of the
372<code>SpaceShower:pTmaxFudge</code> parameter.
373</method>
374
375<method name="virtual void SpaceShower::prepare( int iSys, Event& event,
376bool limitPTmax = true)">
377This method is called immediately after a new interaction has been
378added, and should then be used to prepare the subsystem of partons
379for subsequent evolution. In the current code this involves identifying
380the colour and charge dipole ends: the position of radiating and recoiling
381partons, maximum <ei>pT</ei> scales, and possible higher-order matrix
382elements matchings to apply. Depending on what you have in mind you may
383choose to store slightly different quantities. You have to use the
384subsystem information described above to find the positions of the two
385incoming partons (and the outgoing ones) of the system, and from there
386the scales at which they were produced.
387<br/> The <code>limitPTmax</code> input agrees with the output of the
388previous method for the hardest process, and is always true for
389subsequent MPI, since there an unlimited <ei>pT</ei> for sure
390would lead to doublecounting.
391</method>
392
393<method name="virtual void SpaceShower::update( int iSys, Event& event)">
394This method is called immediately after a timelike branching in the
395<code>iSys</code>'th subsystem. Thus the information for that system may
396be out-of-date, and to be updated. For the standard PYTHIA showers
397this routine does not need to do anything, but that may be different
398in another implementation.
399</method>
400
401<method name="virtual double SpaceShower::pTnext( Event& event,
402double pTbegAll, double pTendAll, int nRadIn = -1)">
403This is the main driver routine for the downwards evolution. A new
404<ei>pT</ei> is to be selected based on the current information set up
405by the routines above, and along with that a branching parton or dipole.
406The <code>pTbegAll</code> scale is the maximum scale allowed, from which
407the downwards evolution should be begun (usually respecting the maximum
408scale of each individual parton). If no emission is found above
409<code>pTendAll</code> (and above the respective shower cutoff scales)
410then <code>0.</code> should be returned and no emissions will be allowed.
411Both scales can vary from one event to the next: if a scale has
412already been selected for MPI or ISR it makes no sense to look for
413a scale smaller than that from FSR, since it would not be able to
414compete, so <code>pTendAll</code> is set correspondingly. As it happens,
415FSR is tried before ISR and MPI in the interleaved evolution,
416but this is an implementational detail that could well change. 
417<br/>Typically the implementation of this routine would be to set
418up a loop over all possible radiating objects (dipoles, dipole ends, ...),
419for each pick its possible branching scale and then pick the one
420with largest scale as possible winner. At this stage no branching should
421actually be carried out, since MPI, ISR and FSR still have to be compared
422to assign the winner.
423<br/>The final input <code>nRadIn</code> provides the total number of
424ISR and FSR emissions already generated in the event, and so allows a
425special treatment for the very first emission, if desired.
426</method>
427
428<method name="virtual bool SpaceShower::branch( Event& event)">
429This method will be called once FSR has won the competition with
430MPI and ISR to do the next branching. The candidate branching found
431in the previous step should here be carried out in full. The
432pre-branching partons should get a negative status code and new
433replacement ones added to the end of the event record. Also the 
434subsystem information should be updated, and possibly also the
435beams.
436<br/>Should some problem be encountered in this procedure, e.g. if
437some not-previously-considered kinematics requirement fails, it is
438allowed to return <code>false</code> to indicate that no branching
439could be carried out. Also a complete restart of the parton-level
440description may be necessary, see <code>doRestart()</code> below. 
441</method>
442
443<method name="int SpaceShower::system()">
444This method is not virtual. If a branching is constructed by the
445previous routine this tiny method should be able to return the number
446of the selected subsystem <code>iSysSel</code> where it occured,
447so that the spacelike shower can be told which system to update,
448if necessary. Therefore <code>iSysSel</code> must be set in
449<code>branch</code> (or already in <code>pTnext</code>). 
450</method>
451
452<method name="bool SpaceShower::doRestart()">
453This method is not virtual. If <code>branch(...)</code> above fails
454to construct a branching, and the conditions are such that the whole
455parton-level description should be restarted, then it should return
456true, else not. Currently only the rescattering description can give
457thi kind of failures, and so the internal <code>rescatterFail</code> 
458boolean must be set true when this should happen, and else false.
459</method>
460
461<method name="virtual void SpaceShower::list( ostream& os = cout)">
462This method is not at all required. In the current implementation it
463outputs a list of all the dipole ends, with information on the
464respective dipole. The routine is not called anywhere in the public
465code, but has been inserted at various places during the
466development/debug phase.
467</method>
468   
469</chapter>
470
471<!-- Copyright (C) 2012 Torbjorn Sjostrand -->
Note: See TracBrowser for help on using the repository browser.