PYTHIA  8.317
PythiaCascade.h
1 // PythiaCascade.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2026 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 // Author: Torbjorn Sjostrand.
6 
7 #ifndef Pythia8_PythiaCascade_H
8 #define Pythia8_PythiaCascade_H
9 
10 #include "Pythia8/Pythia.h"
11 
12 namespace Pythia8 {
13 
14 //==========================================================================
15 
16 // Wrapper class for Pythia usage in cosmic ray or detector cascades.
17 // Here it is assumed that the user wants to control the full
18 // evolution. The complete event record is then kept somewhere
19 // separate from PYTHIA, and specific input on production and decay
20 // generates the next subevent.
21 
22 // Kindly note non-negligible changes as of Pythia 8.316. This is related
23 // both to bug fixes in Angantyr, and to a better understanding of what
24 // it is supposed to do. The main difference is that elastic scatterings
25 // now are not simulated, it being assumed that they have no impact on
26 // the evolution of the cascade. As a consequence cross sections and
27 // event properties also change.
28 
29 // Intended flow:
30 
31 // - init sets up all generation, given a maximum energy. This may be
32 // time-consuming, less so if MPI initialization data can be reused.
33 
34 // - sigmaSetuphN prepares a possible collision for a given hadron by
35 // calculating the hadron-nucleon inelastic cross section (if possible).
36 // Moderately time-consuming.
37 
38 // - sigmahA uses the hN cross section calculated by sigaSetuphN and
39 // returns the hadron-ion inelastic cross section for a collision
40 // with a specified nucleus. It can be called several times to cover
41 // a mix of target nuclei, with minimal time usage.
42 
43 // - nextColl performs the hadron-nucleus collision, as a sequences of
44 // hadron-nucleon ones. Can be quite time-consuming.
45 
46 // - nextDecay can be used anytime to decay a particle. Each
47 // individual decay is rather fast, but there may be many of them.
48 
49 // - After a nextColl three methods can give information about the
50 // collision just generated:
51 // * nCollisions() gives the number of hadron-nucleon inelastic
52 // (sub)collisions, i.e. the number of wounded target nucleons;
53 // * firstCollisionCode() gives the process number of the first
54 // (sub)collision, as enumerated in the Process Selection section
55 // of the html manual.
56 // * firstCollisionMPI() gives the number of multiparton interactions
57 // in the first (sub)collision.
58 
59 // - stat() can be used at end of run to give a summary of error
60 // messages. Negligible time usage.
61 
62 // - references to particleData() and rndm() can be used in the main
63 // - program.
64 
65 // Note: when a hadron interacts with a medium particle, the latter is
66 // added to the event record. This program uses these additional
67 // status codes for target particles in the medium:
68 // 181: the first (or only) target nucleon in a collision.
69 // 182: nucleons from further subcollisions with the same target nucleus.
70 
71 // Warning: the large boosts involved at the higher cosmic ray
72 // energies are not perfectly managed, which leads to non-negligible
73 // energy-momentum non-conservation. The worst (sub)events are caught
74 // and regenerated.
75 
76 //--------------------------------------------------------------------------
77 
79 
80 public:
81 
82  // Default constructor; all setup is done in init().
83  PythiaCascade() = default;
84 
85  //--------------------------------------------------------------------------
86 
87  // Initialize PythiaCascade for a given maximal incoming energy.
88 
89  // Hadrons below the kinetic energy threshold eKinMin will not be allowed
90  // to interact with the medium. If reduced from the 0.3 GeV default then
91  // some inelastic interactions are still allowed, while others fail
92  // (but the run keeps going).
93 
94  // The enhanceSDtarget provides an enhancement factor for target-side
95  // single diffraction, process codes 104 and 154, in subcollisions
96  // after the first. This gives topologies more similar to Angantyr ones.
97  // If 0 then no SD enhancement, if 1 only SD, with default in between.
98  // A larger value means a smaller multiplicity, and vice versa, so this
99  // is a quick way to obtain an envelope of hadronization uncertainties.
100 
101  // The initFile, by default "../share/Pythia8/setups/InitDefaultMPI.cmnd",
102  // provides MPI initialization data over a range of CM-frame energies,
103  // where the upper edge sets the limit for allowed collisions.
104  // Use main424.cc to rerun if you change any of the parameters that
105  // affect the MPI rates, such as the pT0 parameter, its energy dependence,
106  // the alpha_strong value, and the choice parton distributions.
107 
108  // Keep rapidDecays = false if you want to do every decay yourself,
109  // else all particle types with a tau0 below smallTau0 will be
110  // decayed immediately. The tau0 units are mm/c, so default gives
111  // c * tau0 = 1e-10 mm = 100 fm. Note that time dilation effects are
112  // not included, and they can be large, hence the low default value.
113  // The Pythia default setup for decaying particles is obtained for
114  // rapidDecays = true and smallTau0 = 1000.
115 
116  // With slowDecays true the mu+-, pi+-, K+- and K0L are allowed to decay,
117  // as is expected in an atmospheric cascade but not for collider studies.
118  // Note that rapidDecays and smallTau0 still determine how those decays
119  // are handled, in the competition between interactions and decays.
120 
121  // Keep listFinalOnly = false if you want to get back the full event record,
122  // else only the "final" particles of the collision or decay are returned.
123 
124  bool init( double eKinMinIn = 0.3, double enhanceSDtargetIn = 0.5,
125  string initFile = "../share/Pythia8/setups/InitDefaultMPI.cmnd",
126  bool rapidDecaysIn = false, double smallTau0In = 1e-10,
127  bool slowDecays = true, bool listFinalOnlyIn = false) {
128 
129  // Store input for future usage.
130  eKinMin = eKinMinIn;
131  enhanceSDtarget = enhanceSDtargetIn;
132  rapidDecays = rapidDecaysIn;
133  smallTau0 = smallTau0In;
134  listFinalOnly = listFinalOnlyIn;
135 
136  // Proton and neutron masses.
137  mp = pythiaMain.particleData.m0(2212);
138  mn = pythiaMain.particleData.m0(2112);
139 
140  // Main Pythia object for managing the cascade evolution in a nucleus.
141  // Can also do decays, but no hard processes.
142  pythiaMain.readString("ProcessLevel:all = off");
143  if (slowDecays) {
144  pythiaMain.readString("13:mayDecay = on");
145  pythiaMain.readString("211:mayDecay = on");
146  pythiaMain.readString("321:mayDecay = on");
147  pythiaMain.readString("130:mayDecay = on");
148  }
149  pythiaMain.settings.flag("ParticleDecays:limitTau0", rapidDecays);
150  pythiaMain.settings.parm("ParticleDecays:tau0Max", smallTau0);
151 
152  // Reduce statistics printout to relevant ones.
153  pythiaMain.readString("Print:quiet = on");
154  pythiaMain.readString("Stat:showProcessLevel = off");
155  pythiaMain.readString("Stat:showPartonLevel = off");
156 
157  // Initialize. Return if failure.
158  if (!pythiaMain.init()) return false;
159 
160  // Secondary Pythia object for individual collisions, or decays.
161  // Reuse existing MPI initialization file. Failure if not found.
162  if ( !pythiaColl.readString("include = " + initFile)) {
163  cout << "\n Abort: failed to find or read MPI initialization file"
164  << endl;
165  return false;
166  }
167 
168  // Variable incoming beam type and energy.
169  pythiaColl.readString("Beams:allowVariableEnergy = on");
170  pythiaColl.readString("Beams:allowIDAswitch = on");
171 
172  // Initialization eCM energy according to initFile.
173  eCMMax = pythiaColl.settings.parm("Beams:eCMMaxMPI");
174  pythiaColl.settings.parm("Beams:eCM", eCMMax);
175 
176  // Must use the soft and low-energy QCD processes, except elastic.
177  pythiaColl.readString("SoftQCD:inelastic = on");
178  pythiaColl.readString("LowEnergyQCD:inelastic = on");
179 
180  // Primary (single) decay to be done by pythiaColl, to circumvent
181  // limitTau0.
182  if (slowDecays) {
183  pythiaColl.readString("13:mayDecay = on");
184  pythiaColl.readString("211:mayDecay = on");
185  pythiaColl.readString("321:mayDecay = on");
186  pythiaColl.readString("130:mayDecay = on");
187  }
188 
189  // Secondary decays to be done by pythiaMain, respecting limitTau0.
190  pythiaColl.readString("HadronLevel:Decay = off");
191 
192  // Reduce printout and relax energy-momentum conservation.
193  // (Unusually large errors unfortunate consequence of large boosts.)
194  pythiaColl.readString("Print:quiet = on");
195  pythiaColl.readString("Check:epTolErr = 0.01");
196  pythiaColl.readString("Check:epTolWarn = 0.0001");
197  pythiaColl.readString("Check:mTolErr = 0.01");
198 
199  // Redure statistics printout to relevant ones.
200  pythiaColl.readString("Stat:showProcessLevel = off");
201  pythiaColl.readString("Stat:showPartonLevel = off");
202 
203  // Initialize and done.
204  return pythiaColl.init();
205 
206  }
207 
208  //--------------------------------------------------------------------------
209 
210  // Calculate the average number of inelastic hadron-nucleon (hN) collisions
211  // in a hadron-nucleus one, as a function of the inelastic hN cross section.
212  // Interpolate if not in table, assuming <n> - 1 propto A^{2/3}.
213 
214  double nCollAvg(int A) {
215 
216  // Studied nuclei by A number, with offset and slope of <nColl>(sigma):
217  // 1H, 2H, 4He, 9Be, 12C, 14N, 16O, 27Al, 40Ar, 56Fe, 63Cu, 84Kr,
218  // 107Ag, 129Xe, 197Au, 208Pb.
219  static const int nA = 16;
220  static const int tabA[] = {
221  1, 2, 4, 9, 12, 14, 16, 27, 40, 56, 63, 84, 107, 129, 197, 208};
222  static const double tabOffset[] = {
223  0.0000, 0.0510, 0.1164, 0.2036, 0.2328, 0.2520, 0.2624, 0.3190,
224  0.3562, 0.3898, 0.3900, 0.3446, 0.3496, 0.3504, 0.3484, 0.3415 };
225  static const double tabSlope[] = {
226  0.0000,0.00187,0.00496, 0.0107, 0.0136, 0.0152, 0.0169, 0.0243,
227  0.0314, 0.0385, 0.0415, 0.0506, 0.0581, 0.0644, 0.0806, 0.0830 };
228  static const double tabSlopeLo[] = {
229  0.0000,0.00361,0.00884, 0.0174, 0.0210, 0.0233, 0.0252, 0.0340,
230  0.0418, 0.0496, 0.0524, 0.0600, 0.0668, 0.0727, 0.0873, 0.0893 };
231 
232  for (int i = 0; i < nA; ++i) {
233  if (A == tabA[i]) {
234  return min( 1. + tabSlopeLo[i] * sigmaNow,
235  1. + tabOffset[i] + tabSlope[i] * sigmaNow);
236  } else if (A < tabA[i]) {
237  double nColl1 = min( tabSlopeLo[i - 1] * sigmaNow,
238  tabOffset[i - 1] + tabSlope[i - 1] * sigmaNow);
239  double nColl2 = min( tabSlopeLo[i] * sigmaNow,
240  tabOffset[i] + tabSlope[i] * sigmaNow);
241  double wt1 = double(tabA[i] - A) / double(tabA[i] - tabA[i - 1]);
242  return 1. + wt1 * pow( A / tabA[i - 1], 2./3.) * nColl1
243  + (1. - wt1) * pow( A / tabA[i], 2./3.) * nColl2;
244  }
245  }
246 
247  return numeric_limits<double>::quiet_NaN();
248  }
249 
250  //--------------------------------------------------------------------------
251 
252  // Calculate the hadron-nucleon (proton) inelastic collision cross section.
253  // Return false if not possible to find.
254 
255  bool sigmaSetuphN(int idNowIn, Vec4 pNowIn, double mNowIn) {
256 
257  // Cannot (or does not want to) handle low-energy hadrons.
258  if (pNowIn.e() - mNowIn < eKinMin) return false;
259 
260  // Cannot handle hadrons above maximum energy set at initialization.
261  eCMNow = (pNowIn + Vec4(0, 0, 0, mp)).mCalc();
262  if (eCMNow > eCMMax) {
263  logger.ERROR_MSG("too high energy");
264  return false;
265  }
266 
267  // Save incoming quantities for reuse in later methods.
268  idNow = idNowIn;
269  pNow = pNowIn;
270  mNow = mNowIn;
271 
272  // Calculate hadron-nucleon inelastic cross section.
273  // Check if cross section vanishes.
274  sigmaNow = pythiaColl.getSigmaTotal(idNow, 2212, eCMNow, mNow, mp)
275  - pythiaColl.getSigmaPartial(idNow, 2212, eCMNow, mNow, mp, 2);
276  if (sigmaNow < 0.001) {
277  if (eCMNow - mNow - mp > eKinMin)
278  logger.WARNING_MSG("vanishing cross section");
279  return false;
280  }
281 
282  // Done.
283  return true;
284 
285  }
286 
287  //--------------------------------------------------------------------------
288 
289  // Calculate the hadron-nucleus cross section for a given nucleon
290  // number A, using hN cross section from sigmaSetuphN. Interpolate
291  // where not (yet) available.
292 
293  double sigmahA(int A) {
294 
295  // Restrict to allowed range 1 <= A <= 208.
296  if (A < 1 || A > 208) {
297  logger.ERROR_MSG("A is outside of valid range (1 <= A <= 208)");
298  return 0.;
299  }
300 
301  // Correction factor for number of h-nucleon collisions per
302  // h-nucleus one.
303  double sigmahA = A * sigmaNow / nCollAvg(A);
304 
305  // Done.
306  return sigmahA;
307 
308  }
309 
310  //--------------------------------------------------------------------------
311 
312  // Generate a collision, and return the event record.
313  // Input (Z, A) of nucleus, and optionally collision vertex.
314 
315  Event& nextColl(int Znow, int Anow, Vec4 vNow = Vec4() ) {
316 
317  // References to the two event records. Clear main event record.
318  Event& eventMain = pythiaMain.event;
319  Event& eventColl = pythiaColl.event;
320  eventMain.clear();
321  codeFirstColl = 0;
322  nMPIsave = 0;
323 
324  // Restrict to allowed range 1 <= A <= 208.
325  if (Anow < 1 || Anow > 208) {
326  logger.ERROR_MSG("A is outside of valid range (1 <= A <= 208)");
327  return eventMain;
328  }
329 
330  // Insert incoming particle in cleared main event record.
331  eventMain.append(90, -11, 0, 0, 1, 1, 0, 0, pNow, mNow);
332  int iHad = eventMain.append(idNow, 12, 0, 0, 0, 0, 0, 0, pNow, mNow);
333  eventMain[iHad].vProd(vNow);
334 
335  // Set up for collisions on a nucleus.
336  int np = Znow;
337  int nn = Anow - Znow;
338  int sizeOld = 0;
339  int sizeNew = 0;
340  Vec4 dirNow = pNow / pNow.pAbs();
341  Rndm& rndm = pythiaMain.rndm;
342 
343  // Drop rate of geometric series. (Deuterium is special case.)
344  double probMore = (Anow == 2) ? nCollAvg(Anow) - 1.
345  : 1. - 1. / nCollAvg(Anow);
346  nCollAcc = 0;
347 
348  // Loop over varying number of hit nucleons in target nucleus.
349  for (int iColl = 1; iColl <= Anow; ++iColl) {
350  if (iColl > 1 && rndm.flat() > probMore) break;
351 
352  // Pick incoming projectile: trivial for first subcollision, else ...
353  int iProj = iHad;
354 
355  // ... find highest-pLongitudinal particle from latest subcollision.
356  if (iColl > 1) {
357  iProj = 0;
358  double pMax = 0.;
359  for (int i = sizeOld; i < sizeNew; ++i)
360  if ( eventMain[i].isFinal() && eventMain[i].isHadron()) {
361  double pp = dot3(dirNow, eventMain[i].p());
362  if (pp > pMax) {
363  iProj = i;
364  pMax = pp;
365  }
366  }
367 
368  // No further subcollision if no particle with enough energy.
369  if ( iProj == 0
370  || eventMain[iProj].e() - eventMain[iProj].m() < eKinMin) break;
371  }
372 
373  // Pick one p or n from target.
374  int idProj = eventMain[iProj].id();
375  bool doProton = rndm.flat() < (np / double(np + nn));
376  if (doProton) np -= 1;
377  else nn -= 1;
378  int idNuc = (doProton) ? 2212 : 2112;
379 
380  // Current subcollision four-vectors and CM energy.
381  Vec4 pProj = eventMain[iProj].p();
382  double mTarg = (doProton) ? mp : mn;
383  Vec4 pTarg( 0., 0., 0., mTarg);
384  double eCMPT = (pProj + pTarg).mCalc();
385 
386  // Reject if process is only possible because projectile is off-shell.
387  // (Current kinematics handling assumes that "beam particles" are
388  // on the mass shell, but this could be changed eventually.)
389  mProjMax = max(eventMain[iProj].m(), pythiaMain.particleData.m0(idProj));
390  if (sqrt(pProj.pAbs2() + pow2(mProjMax)) - mProjMax < eKinMin) break;
391 
392  // Do a projectile-nucleon subcollision. Return empty event if failure.
393  // Optionally enhance secondary single diffractive on target side.
394  // for non-first collision, i.e. make more of codes 104 or 154.
395  pythiaColl.setBeamIDs(idProj, idNuc);
396  pythiaColl.setKinematics(eCMPT);
397  int codeNow = (iColl > 1 && rndm.flat() < enhanceSDtarget) ? 4 : 0;
398  if (!pythiaColl.next(codeNow)) {
399  eventMain.clear();
400  return eventMain;
401  }
402 
403  // Statistics.
404  if (iColl == 1) codeFirstColl = pythiaColl.info.code();
405  if (iColl == 1) nMPIsave = pythiaColl.info.nMPI();
406 
407  // Boost back collision to lab frame.
408  RotBstMatrix MtoLab;
409  MtoLab.fromCMframe( pProj, pTarg);
410  eventColl.rotbst( MtoLab);
411 
412  // Insert target nucleon. Mothers are (0,iProj) to mark who it
413  // interacted with. Always use proton mass for simplicity.
414  int statusNuc = (iColl == 1) ? -181 : -182;
415  int iNuc = eventMain.append( idNuc, statusNuc, 0, iProj, 0, 0, 0, 0,
416  0., 0., 0., mp, mp);
417  eventMain[iNuc].vProdAdd(vNow);
418 
419  // Update full energy of the event with the target mass.
420  eventMain[0].e( eventMain[0].e() + mTarg);
421  eventMain[0].m( eventMain[0].p().mCalc() );
422 
423  // Insert secondary produced particles (but skip intermediate partons)
424  // into main event record and shift to correct production vertex.
425  sizeOld = eventMain.size();
426  for (int iSub = 3; iSub < eventColl.size(); ++iSub) {
427  if (!eventColl[iSub].isFinal()) continue;
428  int iNew = eventMain.append(eventColl[iSub]);
429  eventMain[iNew].mothers(iNuc, iProj);
430  eventMain[iNew].vProdAdd(vNow);
431  }
432  sizeNew = eventMain.size();
433 
434  // Update daughters of colliding hadrons and other history.
435  eventMain[iProj].daughters(sizeOld, sizeNew - 1);
436  eventMain[iNuc].daughters(sizeOld, sizeNew - 1);
437  eventMain[iProj].statusNeg();
438  eventMain[iProj].tau(0.);
439 
440  // End of loop over interactions in a nucleus.
441  ++nCollAcc;
442  }
443 
444  // Optionally do decays of short-lived particles.
445  if (rapidDecays) pythiaMain.moreDecays();
446 
447  // Optionally compress event record.
448  if (listFinalOnly) compress();
449 
450  // Return generated collision.
451  return eventMain;
452 
453  }
454 
455  //--------------------------------------------------------------------------
456 
457  // Generate a particle decay, and return the event record.
458  // You can allow sequential decays, if they occur rapidly enough.
459 
460  Event& nextDecay(int idNowIn, Vec4 pNowIn, double mNowIn,
461  Vec4 vNow = Vec4() ) {
462 
463  // Save incoming quantities. (Not needed, but by analogy with
464  // collisions.)
465  idNow = idNowIn;
466  pNow = pNowIn;
467  mNow = mNowIn;
468 
469  // References to the event records. Clear them.
470  Event& eventMain = pythiaMain.event;
471  Event& eventColl = pythiaColl.event;
472  eventMain.clear();
473  eventColl.clear();
474 
475  // Insert incoming particle in cleared collision event record.
476  eventColl.append(90, -11, 0, 0, 1, 1, 0, 0, pNow, mNow);
477  int iHad = eventColl.append(idNow, 12, 0, 0, 0, 0, 0, 0, pNow, mNow);
478  eventColl[iHad].vProd(vNow);
479 
480  // Decay incoming particle. Return empty event if fail. Copy event record.
481  if (!pythiaColl.moreDecays(iHad)) return eventMain;
482  eventMain = eventColl;
483 
484  // Optionally do secondary decays of short-lived particles.
485  if (rapidDecays) pythiaMain.moreDecays();
486 
487  // Optionally compress event record.
488  if (listFinalOnly) compress();
489 
490  // Return generated collision.
491  return eventMain;
492 
493  }
494 
495  //--------------------------------------------------------------------------
496 
497  // Compress the event record by removing initial and intermediate
498  // particles. Keep line 0, since the += operator for event records
499  // only adds from 1 on.
500 
501  void compress() {
502 
503  // Reference to the main event record. Original and new size.
504  Event& eventMain = pythiaMain.event;
505  int sizeOld = eventMain.size();
506  int sizeNew = 1;
507 
508  // Loop through all particles and move up the final ones to the top.
509  // Remove history information. Update event record size.
510  for (int i = 1; i < sizeOld; ++i) if (eventMain[i].isFinal()) {
511  eventMain[sizeNew] = eventMain[i];
512  eventMain[sizeNew].mothers( 0, 0);
513  eventMain[sizeNew].daughters( 0, 0);
514  ++sizeNew;
515  }
516 
517  // Shrink event record to new size.
518  eventMain.popBack( sizeOld - sizeNew);
519 
520  }
521 
522  //--------------------------------------------------------------------------
523 
524  // Summary of aborts, errors and warnings.
525 
526  void stat() {
527  pythiaMain.stat();
528  pythiaColl.stat();
529  logger.errorStatistics();
530  }
531 
532  //--------------------------------------------------------------------------
533 
534  // Provide number of subcollisions, hardest subprocess, and whether elastic.
535  // The latter should always be false after the recent code changes.
536 
537  int nCollisions() {return nCollAcc;}
538 
539  int firstCollisionCode() {return codeFirstColl;}
540 
541  int firstCollisionMPI() {return nMPIsave;}
542 
543  //--------------------------------------------------------------------------
544 
545  // Possibility to access particle data and random numbers from
546  // pythiaMain.
547 
548  ParticleData& particleData() {return pythiaMain.particleData;}
549 
550  Rndm& rndm() {return pythiaMain.rndm;}
551 
552 //--------------------------------------------------------------------------
553 
554 private:
555 
556  // The Pythia instances used for decays and for collisions. Could
557  // be made public, but cleaner to allow only limited access as
558  // above.
559  Pythia pythiaMain, pythiaColl;
560 
561  // Logger instance for errors in this class.
562  Logger logger;
563 
564  // Save quantities.
565  bool rapidDecays, listFinalOnly;
566  int idNow, nCollAcc, codeFirstColl, nMPIsave;
567  double eKinMin, enhanceSDtarget, smallTau0, mp, mn, eCMMax, mNow, mProjMax,
568  eCMNow, sigmaNow;
569  Vec4 pNow;
570 
571 };
572 
573 //==========================================================================
574 
575 } // end namespace Pythia8
576 
577 #endif // end Pythia8_PythiaCascade_H
constexpr double pow2(const double &x)
Powers of small integers - for balance speed/code clarity.
Definition: PythiaStdlib.h:175
double nCollAvg(int A)
Definition: PythiaCascade.h:214
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1615
PythiaCascade()=default
Default constructor; all setup is done in init().
Rndm rndm
Random number generator.
Definition: Pythia.h:392
bool readString(string line, bool warn=true, int subrun=SUBRUNDEFAULT)
Read in one update for a setting or particle data from a single line.
Definition: Pythia.h:99
ParticleData particleData
ParticleData: the particle data table/database.
Definition: Pythia.h:389
The Event class holds all info on the generated event.
Definition: Event.h:408
int nMPI() const
Number of multiparton interactions, with code and pT for them.
Definition: Info.h:274
Settings settings
Settings: databases of flags/modes/parms/words to control run.
Definition: Pythia.h:386
void clear()
Clear event record.
Definition: Event.h:428
bool setKinematics(double eCMIn)
Switch beam kinematics.
Definition: Pythia.cc:1387
Event event
The event record for the complete event history.
Definition: Pythia.h:377
bool init()
Initialize.
Definition: Pythia.cc:422
double dot3(const Vec4 &v1, const Vec4 &v2)
Scalar and cross product of 3-vector parts.
Definition: Basics.cc:617
bool moreDecays(bool allowPartons=false)
Special routine to allow more decays if on/off switches changed.
Definition: Pythia.h:304
void stat()
Summary of aborts, errors and warnings.
Definition: PythiaCascade.h:526
Definition: Logger.h:23
double sigmahA(int A)
Definition: PythiaCascade.h:293
bool setBeamIDs(int idAin, int idBin=0)
Switch to new beam particle identities; for similar hadrons only.
Definition: Pythia.cc:1365
Definition: Basics.h:393
int append(Particle entryIn)
Put a new particle at the end of the event record; return index.
Definition: Event.h:462
Event & nextDecay(int idNowIn, Vec4 pNowIn, double mNowIn, Vec4 vNow=Vec4())
Definition: PythiaCascade.h:460
bool sigmaSetuphN(int idNowIn, Vec4 pNowIn, double mNowIn)
Definition: PythiaCascade.h:255
int nCollisions()
Definition: PythiaCascade.h:537
Intended flow:
Definition: PythiaCascade.h:78
void stat()
Main routine to provide final statistics on generation.
Definition: Pythia.cc:1705
void popBack(int nRemove=1)
Remove last n entries.
Definition: Event.h:516
int size() const
Event record size.
Definition: Event.h:459
bool init(double eKinMinIn=0.3, double enhanceSDtargetIn=0.5, string initFile="../share/Pythia8/setups/InitDefaultMPI.cmnd", bool rapidDecaysIn=false, double smallTau0In=1e-10, bool slowDecays=true, bool listFinalOnlyIn=false)
Initialize PythiaCascade for a given maximal incoming energy.
Definition: PythiaCascade.h:124
double getSigmaTotal()
Get total cross section for two hadrons in the event record or standalone.
Definition: Pythia.h:319
Definition: Basics.h:259
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
The Pythia class contains the top-level routines to generate an event.
Definition: Pythia.h:72
double m(const Vec4 &v1)
Invariant mass and its square.
Definition: Basics.cc:587
void compress()
Definition: PythiaCascade.h:501
double getSigmaPartial(int procTypeIn)
Definition: Pythia.h:335
const Info & info
Public information and statistic on the generation.
Definition: Pythia.h:380
ParticleData & particleData()
Definition: PythiaCascade.h:548
bool next()
Generate the next event.
Definition: Pythia.h:276
double flat()
Generate next random number uniformly between 0 and 1.
Definition: Basics.cc:189
void errorStatistics() const
Print error statistics.
Definition: Logger.h:113
This class holds a map of all ParticleDataEntries.
Definition: ParticleData.h:423
Definition: Basics.h:32
Event & nextColl(int Znow, int Anow, Vec4 vNow=Vec4())
Definition: PythiaCascade.h:315
void fromCMframe(const Vec4 &, const Vec4 &, bool flip=false)
Definition: Basics.cc:984