3 <title>Event Analysis</title>
4 <link rel="stylesheet" type="text/css" href="pythia.css"/>
5 <link rel="shortcut icon" href="pythia32.gif"/>
9 <h2>Event Analysis</h2>
13 The routines in this section are intended to be used to analyze
14 event properties. As such they are not part of the main event
15 generation chain, but can be used in comparisons between Monte
16 Carlo events and real data. They are rather free-standing, but
17 assume that input is provided in the PYTHIA 8
18 <code>Event</code> format, and use a few basic facilities such
22 In addition to the methods presented here, there is also the
23 possibility to make use of <a href="JetFinders.html" target="page">external
28 The standard sphericity tensor is
30 S^{ab} = (sum_i p_i^a p_i^b) / (sum_i p_i^2)
32 where the <i>sum i</i> runs over the particles in the event,
33 <i>a, b = x, y, z,</i> and <i>p</i> without such an index is
34 the absolute size of the three-momentum . This tensor can be
35 diagonalized to find eigenvalues and eigenvectors.
38 The above tensor can be generalized by introducing a power
41 S^{ab} = (sum_i p_i^a p_i^b p_i^{r-2}) / (sum_i p_i^r)
43 In particular, <i>r = 1</i> gives a linear dependence on momenta
44 and thus a collinear safe definition, unlike sphericity.
47 To do sphericity analyses you have to set up a <code>Sphericity</code>
48 instance, and then feed in events to it, one at a time. The results
49 for the latest event are available as output from a few methods.
51 <a name="method1"></a>
52 <p/><strong>Sphericity::Sphericity(double power = 2., int select = 2) </strong> <br/>
53 create a sphericity analysis object, where
54 <br/><code>argument</code><strong> power </strong> (<code>default = <strong>2.</strong></code>) :
55 is the power <i>r</i> defined above, i.e.
56 <br/><code>argumentoption </code><strong> 2.</strong> : gives Spericity, and
57 <br/><code>argumentoption </code><strong> 1.</strong> : gives the linear form.
59 <br/><code>argument</code><strong> select </strong> (<code>default = <strong>2</strong></code>) :
60 tells which particles are analyzed,
61 <br/><code>argumentoption </code><strong> 1</strong> : all final-state particles,
62 <br/><code>argumentoption </code><strong> 2</strong> : all observable final-state particles,
63 i.e. excluding neutrinos and other particles without strong or
64 electromagnetic interactions (the <code>isVisible()</code>
67 <br/><code>argumentoption </code><strong> 3</strong> : only charged final-state particles.
71 <a name="method2"></a>
72 <p/><strong>bool Sphericity::analyze( const Event& event, ostream& os = cout) </strong> <br/>
73 perform a sphericity analysis, where
74 <br/><code>argument</code><strong> event </strong> : is an object of the <code>Event</code> class,
75 most likely the <code>pythia.event</code> one.
77 <br/><code>argument</code><strong> os </strong> (<code>default = <strong>cout</strong></code>) : is the output stream for
78 error messages. (The method does not rely on the <code>Info</code>
79 mchinery for error messages.)
81 <br/>If the routine returns <code>false</code> the
82 analysis failed, e.g. if too few particles are present to analyze.
86 After the analysis has been performed, a few methods are available
87 to return the result of the analysis of the latest event:
89 <a name="method3"></a>
90 <p/><strong>double Sphericity::sphericity() </strong> <br/>
91 gives the sphericity (or equivalent if <i>r</i> is not 2),
94 <a name="method4"></a>
95 <p/><strong>double Sphericity::aplanarity() </strong> <br/>
96 gives the aplanarity (with the same comment),
99 <a name="method5"></a>
100 <p/><strong>double Sphericity::eigenValue(int i) </strong> <br/>
101 gives one of the three eigenvalues for <i>i</i> = 1, 2 or 3, in
105 <a name="method6"></a>
106 <p/><strong>Vec4 Sphericity::eventAxis(i) </strong> <br/>
107 gives the matching normalized eigenvector, as a <code>Vec4</code>
108 with vanishing time/energy component.
111 <a name="method7"></a>
112 <p/><strong>void Sphericity::list(ostream& os = cout) </strong> <br/>
113 provides a listing of the above information.
117 There is also one method that returns information accumulated for all
118 the events analyzed so far.
120 <a name="method8"></a>
121 <p/><strong>int Sphericity::nError() </strong> <br/>
122 tells the number of times <code>analyze(...)</code> failed to analyze
123 events, i.e. returned <code>false</code>.
128 Thrust is obtained by varying the thrust axis so that the longitudinal
129 momentum component projected onto it is maximized, and thrust itself is
130 then defined as the sum of absolute longitudinal momenta divided by
131 the sum of absolute momenta. The major axis is found correspondingly
132 in the plane transverse to thrust, and the minor one is then defined
133 to be transverse to both. Oblateness is the difference between the major
134 and the minor values.
137 The calculation of thrust is more computer-time-intensive than e.g.
138 linear sphericity, introduced above, and has no specific advantages except
139 historical precedent. In the PYTHIA 6 implementation the search was
140 speeded up at the price of then not being guaranteed to hit the absolute
141 maximum. The current implementation studies all possibilities, but at
142 the price of being slower, with time consumption for an event with
143 <i>n</i> particles growing like <i>n^3</i>.
146 To do thrust analyses you have to set up a <code>Thrust</code>
147 instance, and then feed in events to it, one at a time. The results
148 for the latest event are available as output from a few methods.
150 <a name="method9"></a>
151 <p/><strong>Thrust::Thrust(int select = 2) </strong> <br/>
152 create a thrust analysis object, where
153 <br/><code>argument</code><strong> select </strong> (<code>default = <strong>2</strong></code>) :
154 tells which particles are analyzed,
155 <br/><code>argumentoption </code><strong> 1</strong> : all final-state particles,
156 <br/><code>argumentoption </code><strong> 2</strong> : all observable final-state particles,
157 i.e. excluding neutrinos and other particles without strong or
158 electromagnetic interactions (the <code>isVisible()</code>
159 particle method), and
161 <br/><code>argumentoption </code><strong> 3</strong> : only charged final-state particles.
165 <a name="method10"></a>
166 <p/><strong>bool Thrust::analyze( const Event& event, ostream& os = cout) </strong> <br/>
167 perform a thrust analysis, where
168 <br/><code>argument</code><strong> event </strong> : is an object of the <code>Event</code> class,
169 most likely the <code>pythia.event</code> one.
171 <br/><code>argument</code><strong> os </strong> (<code>default = <strong>cout</strong></code>) : is the output stream for
172 error messages. (The method does not rely on the <code>Info</code>
173 mchinery for error messages.)
175 <br/>If the routine returns <code>false</code> the
176 analysis failed, e.g. if too few particles are present to analyze.
180 After the analysis has been performed, a few methods are available
181 to return the result of the analysis of the latest event:
183 <a name="method11"></a>
184 <p/><strong>double Thrust::thrust() </strong> <br/>
186 <strong>double Thrust::tMajor() </strong> <br/>
188 <strong>double Thrust::tMinor() </strong> <br/>
190 <strong>double Thrust::oblateness() </strong> <br/>
191 gives the thrust, major, minor and oblateness values, respectively,
194 <a name="method12"></a>
195 <p/><strong>Vec4 Thrust::eventAxis(int i) </strong> <br/>
196 gives the matching normalized event-axis vectors, for <i>i</i> = 1, 2 or 3
197 corresponding to thrust, major or minor, as a <code>Vec4</code> with
198 vanishing time/energy component.
201 <a name="method13"></a>
202 <p/><strong>void Thrust::list(ostream& os = cout) </strong> <br/>
203 provides a listing of the above information.
207 There is also one method that returns information accumulated for all
208 the events analyzed so far.
210 <a name="method14"></a>
211 <p/><strong>int Thrust::nError() </strong> <br/>
212 tells the number of times <code>analyze(...)</code> failed to analyze
213 events, i.e. returned <code>false</code>.
218 <code>ClusterJet</code> (a.k.a. <code>LUCLUS</code> and
219 <code>PYCLUS</code>) is a clustering algorithm of the type used for
220 analyses of <i>e^+e^-</i> events, see the PYTHIA 6 manual. All
221 visible particles in the events are clustered into jets. A few options
222 are available for some well-known distance measures. Cutoff
223 distances can either be given in terms of a scaled quadratic quantity
224 like <i>y = pT^2/E^2</i> or an unscaled linear one like <i>pT</i>.
227 To do jet finding analyses you have to set up a <code>ClusterJet</code>
228 instance, and then feed in events to it, one at a time. The results
229 for the latest event are available as output from a few methods.
231 <a name="method15"></a>
232 <p/><strong>ClusterJet::ClusterJet(string measure = "Lund", int select = 2, int massSet = 2, bool precluster = false, bool reassign = false) </strong> <br/>
233 create a <code>ClusterJet</code> instance, where
234 <br/><code>argument</code><strong> measure </strong> (<code>default = <strong>"Lund"</strong></code>) : distance measure,
235 to be provided as a character string (actually, only the first character
237 <br/><code>argumentoption </code><strong> "Lund"</strong> : the Lund <i>pT</i> distance,
239 <br/><code>argumentoption </code><strong> "JADE"</strong> : the JADE mass distance, and
241 <br/><code>argumentoption </code><strong> "Durham"</strong> : the Durham <i>kT</i> measure.
244 <br/><code>argument</code><strong> select </strong> (<code>default = <strong>2</strong></code>) :
245 tells which particles are analyzed,
246 <br/><code>argumentoption </code><strong> 1</strong> : all final-state particles,
247 <br/><code>argumentoption </code><strong> 2</strong> : all observable final-state particles,
248 i.e. excluding neutrinos and other particles without strong or
249 electromagnetic interactions (the <code>isVisible()</code> particle
252 <br/><code>argumentoption </code><strong> 3</strong> : only charged final-state particles.
254 <br/><code>argument</code><strong> massSet </strong> (<code>default = <strong>2</strong></code>) : masses assumed for the particles
256 <br/><code>argumentoption </code><strong> 0</strong> : all massless,
257 <br/><code>argumentoption </code><strong> 1</strong> : photons are massless while all others are
258 assigned the <i>pi+-</i> mass, and
260 <br/><code>argumentoption </code><strong> 2</strong> : all given their correct masses.
262 <br/><code>argument</code><strong> precluster </strong> (<code>default = <strong>false</strong></code>) :
263 perform or not a early preclustering step, where nearby particles
264 are lumped together so as to speed up the subsequent normal clustering.
266 <br/><code>argument</code><strong> reassign </strong> (<code>default = <strong>false</strong></code>) :
267 reassign all particles to the nearest jet each time after two jets
272 <a name="method16"></a>
273 <p/><strong>ClusterJet::analyze( const Event& event, double yScale, double pTscale, int nJetMin = 1, int nJetMax = 0, ostream& os = cout) </strong> <br/>
274 performs a jet finding analysis, where
275 <br/><code>argument</code><strong> event </strong> : is an object of the <code>Event</code> class,
276 most likely the <code>pythia.event</code> one.
278 <br/><code>argument</code><strong> yScale </strong> :
279 is the cutoff joining scale, below which jets are joined. Is given
280 in quadratic dimensionless quantities. Either <code>yScale</code>
281 or <code>pTscale</code> must be set nonvanishing, and the larger of
282 the two dictates the actual value.
284 <br/><code>argument</code><strong> pTscale </strong> :
285 is the cutoff joining scale, below which jets are joined. Is given
286 in linear quantities, such as <i>pT</i> or <i>m</i> depending on
287 the measure used, but always in units of GeV. Either <code>yScale</code>
288 or <code>pTscale</code> must be set nonvanishing, and the larger of
289 the two dictates the actual value.
291 <br/><code>argument</code><strong> nJetMin </strong> (<code>default = <strong>1</strong></code>) :
292 the minimum number of jets to be reconstructed. If used, it can override
293 the <code>yScale</code> and <code>pTscale</code> values.
295 <br/><code>argument</code><strong> nJetMax </strong> (<code>default = <strong>0</strong></code>) :
296 the maximum number of jets to be reconstructed. Is not used if below
297 <code>nJetMin</code>. If used, it can override the <code>yScale</code>
298 and <code>pTscale</code> values. Thus e.g.
299 <code>nJetMin = nJetMax = 3</code> can be used to reconstruct exactly
302 <br/><code>argument</code><strong> os </strong> (<code>default = <strong>cout</strong></code>) : is the output stream for
303 error messages. (The method does not rely on the <code>Info</code>
304 mchinery for error messages.)
306 <br/>If the routine returns <code>false</code> the analysis failed,
307 e.g. because the number of particles was smaller than the minimum number
312 After the analysis has been performed, a few <code>ClusterJet</code>
313 class methods are available to return the result of the analysis:
315 <a name="method17"></a>
316 <p/><strong>int ClusterJet::size() </strong> <br/>
317 gives the number of jets found, with jets numbered 0 through
318 <code>size() - 1</code>,
321 <a name="method18"></a>
322 <p/><strong>Vec4 ClusterJet::p(int i) </strong> <br/>
323 gives a <code>Vec4</code> corresponding to the four-momentum defined by
324 the sum of all the contributing particles to the <i>i</i>'th jet,
327 <a name="method19"></a>
328 <p/><strong>int ClusterJet::jetAssignment(int i) </strong> <br/>
329 gives the index of the jet that the particle <i>i</i> of the event
333 <a name="method20"></a>
334 <p/><strong>void ClusterJet::list(ostream& os = cout) </strong> <br/>
335 provides a listing of the reconstructed jets.
338 <a name="method21"></a>
339 <p/><strong>int ClusterJet::distanceSize() </strong> <br/>
340 the number of most recent clustering scales that have been stored
341 for readout with the next method. Normally this would be five,
342 but less if fewer clustering steps occured.
345 <a name="method22"></a>
346 <p/><strong>double ClusterJet::distance(int i) </strong> <br/>
347 clustering scales, with <code>distance(0)</code> being the most
348 recent one, i.e. normally the highest, up to <code>distance(4)</code>
349 being the fifth most recent. That is, with <i>n</i> being the final
350 number of jets, <code>ClusterJet::size()</code>, the scales at which
351 <i>n+1</i> jets become <i>n</i>, <i>n+2</i> become <i>n+1</i>,
352 and so on till <i>n+5</i> become <i>n+4</i>. Nonexisting clustering
353 scales are returned as zero. The physical interpretation of a scale is
354 as provided by the respective distance measure (Lund, JADE, Durham).
358 There is also one method that returns information accumulated for all
359 the events analyzed so far.
361 <a name="method23"></a>
362 <p/><strong>int ClusterJet::nError() </strong> <br/>
363 tells the number of times <code>analyze(...)</code> failed to analyze
364 events, i.e. returned <code>false</code>.
369 <code>CellJet</code> (a.k.a. <code>PYCELL</code>) is a simple cone jet
370 finder in the UA1 spirit, see the PYTHIA 6 manual. It works in an
371 <i>(eta, phi, eT)</i> space, where <i>eta</i> is pseudorapidity,
372 <i>phi</i> azimuthal angle and <i>eT</i> transverse energy.
373 It will draw cones in <i>R = sqrt(Delta-eta^2 + Delta-phi^2)</i>
374 around seed cells. If the total <i>eT</i> inside the cone exceeds
375 the threshold, a jet is formed, and the cells are removed from further
376 analysis. There are no split or merge procedures, so later-found jets
377 may be missing some of the edge regions already used up by previous
378 ones. Not all particles in the event are assigned to jets; leftovers
379 may be viewed as belonging to beam remnants or the underlying event.
380 It is not used by any experimental collaboration, but is closely
381 related to the more recent and better theoretically motivated
382 anti-<i>kT</i> algorithm [<a href="Bibliography.html" target="page">Cac08</a>].
385 To do jet finding analyses you have to set up a <code>CellJet</code>
386 instance, and then feed in events to it, one at a time. Especially note
387 that, if you want to use the options where energies are smeared in
388 order so emulate detector imperfections, you must hand in an external
389 random number generator, preferably the one residing in the
390 <code>Pythia</code> class. The results for the latest event are
391 available as output from a few methods.
393 <a name="method24"></a>
394 <p/><strong>CellJet::CellJet(double etaMax = 5., int nEta = 50, int nPhi = 32, int select = 2, int smear = 0, double resolution = 0.5, double upperCut = 2., double threshold = 0., Rndm* rndmPtr = 0) </strong> <br/>
395 create a <code>CellJet</code> instance, where
396 <br/><code>argument</code><strong> etaMax </strong> (<code>default = <strong>5.</strong></code>) :
397 the maximum +-pseudorapidity that the detector is assumed to cover.
399 <br/><code>argument</code><strong> nEta </strong> (<code>default = <strong>50</strong></code>) :
400 the number of equal-sized bins that the <i>+-etaMax</i> range
401 is assumed to be divided into.
403 <br/><code>argument</code><strong> nPhi </strong> (<code>default = <strong>32</strong></code>) :
404 the number of equal-sized bins that the <i>phi</i> range
405 <i>+-pi</i> is assumed to be divided into.
407 <br/><code>argument</code><strong> select </strong> (<code>default = <strong>2</strong></code>) :
408 tells which particles are analyzed,
409 <br/><code>argumentoption </code><strong> 1</strong> : all final-state particles,
410 <br/><code>argumentoption </code><strong> 2</strong> : all observable final-state particles,
411 i.e. excluding neutrinos and other particles without strong or
412 electromagnetic interactions (the <code>isVisible()</code> particle
415 <br/><code>argumentoption </code><strong> 3</strong> : only charged final-state particles.
417 <br/><code>argument</code><strong> smear </strong> (<code>default = <strong>0</strong></code>) :
418 strategy to smear the actual <i>eT</i> bin by bin,
419 <br/><code>argumentoption </code><strong> 0</strong> : no smearing,
420 <br/><code>argumentoption </code><strong> 1</strong> : smear the <i>eT</i> according to a Gaussian
421 with width <i>resolution * sqrt(eT)</i>, with the Gaussian truncated
422 at 0 and <i>upperCut * eT</i>,
423 <br/><code>argumentoption </code><strong> 2</strong> : smear the <i>e = eT * cosh(eta)</i> according
424 to a Gaussian with width <i>resolution * sqrt(e)</i>, with the
425 Gaussian truncated at 0 and <i>upperCut * e</i>.
427 <br/><code>argument</code><strong> resolution </strong> (<code>default = <strong>0.5</strong></code>) :
430 <br/><code>argument</code><strong> upperCut </strong> (<code>default = <strong>2.</strong></code>) :
433 <br/><code>argument</code><strong> threshold </strong> (<code>default = <strong>0 GeV</strong></code>) :
434 completely neglect all bins with an <i>eT < threshold</i>.
436 <br/><code>argument</code><strong> rndmPtr </strong> (<code>default = <strong>0</strong></code>) :
437 the random-number generator used to select the smearing described
438 above. Must be handed in for smearing to be possible. If your
439 <code>Pythia</code> class instance is named <code>pythia</code>,
440 then <code>&pythia.rndm</code> would be the logical choice.
444 <a name="method25"></a>
445 <p/><strong>bool CellJet::analyze( const Event& event, double eTjetMin = 20., double coneRadius = 0.7, double eTseed = 1.5, ostream& os = cout) </strong> <br/>
446 performs a jet finding analysis, where
447 <br/><code>argument</code><strong> event </strong> : is an object of the <code>Event</code> class,
448 most likely the <code>pythia.event</code> one.
450 <br/><code>argument</code><strong> eTjetMin </strong> (<code>default = <strong>20. GeV</strong></code>) :
451 is the minimum transverse energy inside a cone for this to be
454 <br/><code>argument</code><strong> coneRadius </strong> (<code>default = <strong>0.7</strong></code>) :
455 is the size of the cone in <i>(eta, phi)</i> space drawn around
456 the geometric center of the jet.
458 <br/><code>argument</code><strong> eTseed </strong> (<code>default = <strong>1.5 GeV</strong></code>) :
459 the mimimum <i>eT</i> in a cell for this to be acceptable as
460 the trial center of a jet.
462 <br/><code>argument</code><strong> os </strong> (<code>default = <strong>cout</strong></code>) : is the output stream for
463 error messages. (The method does not rely on the <code>Info</code>
464 mchinery for error messages.)
466 <br/>If the routine returns <code>false</code> the analysis failed,
467 but currently this is not foreseen ever to happen.
471 After the analysis has been performed, a few <code>CellJet</code>
472 class methods are available to return the result of the analysis:
474 <a name="method26"></a>
475 <p/><strong>int CellJet::size() </strong> <br/>
476 gives the number of jets found, with jets numbered 0 through
477 <code>size() - 1</code>,
480 <a name="method27"></a>
481 <p/><strong>double CellJet::eT(i) </strong> <br/>
482 gives the <i>eT</i> of the <i>i</i>'th jet, where jets have been
483 ordered with decreasing <i>eT</i> values,
486 <a name="method28"></a>
487 <p/><strong>double CellJet::etaCenter(int i) </strong> <br/>
489 <strong>double CellJet::phiCenter(int i) </strong> <br/>
490 gives the <i>eta</i> and <i>phi</i> coordinates of the geometrical
491 center of the <i>i</i>'th jet,
494 <a name="method29"></a>
495 <p/><strong>double CellJet::etaWeighted(int i) </strong> <br/>
497 <strong>double CellJet::phiWeighted(int i) </strong> <br/>
498 gives the <i>eta</i> and <i>phi</i> coordinates of the
499 <i>eT</i>-weighted center of the <i>i</i>'th jet,
502 <a name="method30"></a>
503 <p/><strong>int CellJet::multiplicity(int i) </strong> <br/>
504 gives the number of particles clustered into the <i>i</i>'th jet,
507 <a name="method31"></a>
508 <p/><strong>Vec4 CellJet::pMassless(int i) </strong> <br/>
509 gives a <code>Vec4</code> corresponding to the four-momentum defined
510 by the <i>eT</i> and the weighted center of the <i>i</i>'th jet,
513 <a name="method32"></a>
514 <p/><strong>Vec4 CellJet::pMassive(int i) </strong> <br/>
515 gives a <code>Vec4</code> corresponding to the four-momentum defined by
516 the sum of all the contributing cells to the <i>i</i>'th jet, where
517 each cell contributes a four-momentum as if all the <i>eT</i> is
518 deposited in the center of the cell,
521 <a name="method33"></a>
522 <p/><strong>double CellJet::m(int i) </strong> <br/>
523 gives the invariant mass of the <i>i</i>'th jet, defined by the
524 <code>pMassive</code> above,
527 <a name="method34"></a>
528 <p/><strong>void CellJet::list() </strong> <br/>
529 provides a listing of the above information (except <code>pMassless</code>,
530 for reasons of space).
534 There is also one method that returns information accumulated for all
535 the events analyzed so far.
536 <a name="method35"></a>
537 <p/><strong>int CellJet::nError() </strong> <br/>
538 tells the number of times <code>analyze(...)</code> failed to analyze
539 events, i.e. returned <code>false</code>.
545 <!-- Copyright (C) 2010 Torbjorn Sjostrand -->