PYTHIA  8.314
Pythia.h
1 // Pythia.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2025 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 
6 // This file contains the main class for event generation.
7 // Pythia: provide the main user interface to everything else.
8 
9 #ifndef Pythia8_Pythia_H
10 #define Pythia8_Pythia_H
11 
12 // Version number defined for use in macros and for consistency checks.
13 #define PYTHIA_VERSION 8.314
14 #define PYTHIA_VERSION_INTEGER 8314
15 
16 // Header files for the Pythia class and for what else the user may need.
17 #include "Pythia8/Analysis.h"
18 #include "Pythia8/Basics.h"
19 #include "Pythia8/BeamParticle.h"
20 #include "Pythia8/BeamSetup.h"
21 #include "Pythia8/Event.h"
22 #include "Pythia8/FragmentationFlavZpT.h"
23 #include "Pythia8/HadronLevel.h"
24 #include "Pythia8/HadronWidths.h"
25 #include "Pythia8/Info.h"
26 #include "Pythia8/JunctionSplitting.h"
27 #include "Pythia8/LesHouches.h"
28 #include "Pythia8/Logger.h"
29 #include "Pythia8/SigmaLowEnergy.h"
30 #include "Pythia8/Merging.h"
31 #include "Pythia8/MergingHooks.h"
32 #include "Pythia8/PartonLevel.h"
33 #include "Pythia8/ParticleData.h"
34 #include "Pythia8/PartonDistributions.h"
35 #include "Pythia8/PartonSystems.h"
36 #include "Pythia8/PartonVertex.h"
37 #include "Pythia8/PhysicsBase.h"
38 #include "Pythia8/ProcessLevel.h"
39 #include "Pythia8/PythiaStdlib.h"
40 #include "Pythia8/ResonanceWidths.h"
41 #include "Pythia8/RHadrons.h"
42 #include "Pythia8/Ropewalk.h"
43 #include "Pythia8/Settings.h"
44 #include "Pythia8/ShowerModel.h"
45 #include "Pythia8/SigmaTotal.h"
46 #include "Pythia8/SimpleSpaceShower.h"
47 #include "Pythia8/SimpleTimeShower.h"
48 #include "Pythia8/SpaceShower.h"
49 #include "Pythia8/StandardModel.h"
50 #include "Pythia8/StringInteractions.h"
51 #include "Pythia8/SusyCouplings.h"
52 #include "Pythia8/SLHAinterface.h"
53 #include "Pythia8/TimeShower.h"
54 #include "Pythia8/UserHooks.h"
55 #include "Pythia8/VinciaCommon.h"
56 #include "Pythia8/Weights.h"
57 
58 namespace Pythia8 {
59 
60 //==========================================================================
61 
62 // Forward declaration of the HeavyIons and HIUserHooks classes.
63 class HeavyIons;
64 class HIUserHooks;
65 
66 // Forward declaration of PythiaParallel class, to be friended.
67 class PythiaParallel;
68 
69 // The Pythia class contains the top-level routines to generate an event.
70 
71 class Pythia {
72 
73 public:
74 
75  // Constructor. (See Pythia.cc file.)
76  Pythia(string xmlDir = "../share/Pythia8/xmldoc", bool printBanner = true);
77 
78  // Constructor to copy settings and particle database from another Pythia
79  // object instead of XML files (to speed up multiple initialisations).
80  Pythia(Settings& settingsIn, ParticleData& particleDataIn,
81  bool printBanner = true);
82 
83  // Constructor taking input from streams instead of files.
84  Pythia( istream& settingsStrings, istream& particleDataStrings,
85  bool printBanner = true);
86 
87  // Destructor.
88  ~Pythia() {}
89 
90  // Copy and = constructors cannot be used.
91  Pythia(const Pythia&) = delete;
92  Pythia& operator=(const Pythia&) = delete;
93 
94  // Check consistency of version numbers (called by constructors).
95  bool checkVersion();
96 
97  // Read in one update for a setting or particle data from a single line.
98  inline bool readString(string line, bool warn = true,
99  int subrun = SUBRUNDEFAULT) {
100  return isConstructed ? settings.readString(line, warn, subrun) : false;}
101 
102  // Read in updates for settings or particle data from user-defined file.
103  inline bool readFile(string fileName, bool warn = true,
104  int subrun = SUBRUNDEFAULT) {
105  return isConstructed ? settings.readFile(fileName, warn, subrun) : false;}
106  inline bool readFile(string fileName, int subrun) {
107  return readFile(fileName, true, subrun);}
108  inline bool readFile(istream& is = cin, bool warn = true,
109  int subrun = SUBRUNDEFAULT) {
110  return isConstructed ? settings.readFile(is, warn, subrun) : false;}
111  inline bool readFile(istream& is, int subrun) {
112  return readFile(is, true, subrun);}
113 
114  // Possibility to pass in pointers to PDF's.
115  inline bool setPDFPtr(PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn,
116  PDFPtr pdfHardAPtrIn = nullptr, PDFPtr pdfHardBPtrIn = nullptr,
117  PDFPtr pdfPomAPtrIn = nullptr, PDFPtr pdfPomBPtrIn = nullptr,
118  PDFPtr pdfGamAPtrIn = nullptr, PDFPtr pdfGamBPtrIn = nullptr,
119  PDFPtr pdfHardGamAPtrIn = nullptr, PDFPtr pdfHardGamBPtrIn = nullptr,
120  PDFPtr pdfUnresAPtrIn = nullptr, PDFPtr pdfUnresBPtrIn = nullptr,
121  PDFPtr pdfUnresGamAPtrIn = nullptr, PDFPtr pdfUnresGamBPtrIn = nullptr,
122  PDFPtr pdfVMDAPtrIn = nullptr, PDFPtr pdfVMDBPtrIn = nullptr) {
123  return beamSetup.setPDFPtr( pdfAPtrIn, pdfBPtrIn, pdfHardAPtrIn,
124  pdfHardBPtrIn, pdfPomAPtrIn, pdfPomBPtrIn, pdfGamAPtrIn, pdfGamBPtrIn,
125  pdfHardGamAPtrIn, pdfHardGamBPtrIn, pdfUnresAPtrIn, pdfUnresBPtrIn,
126  pdfUnresGamAPtrIn, pdfUnresGamBPtrIn, pdfVMDAPtrIn, pdfVMDBPtrIn); }
127  inline bool setPDFAPtr( PDFPtr pdfAPtrIn ) {
128  return beamSetup.setPDFAPtr( pdfAPtrIn); }
129  inline bool setPDFBPtr( PDFPtr pdfBPtrIn ) {
130  return beamSetup.setPDFBPtr( pdfBPtrIn); }
131 
132  // Set photon fluxes externally. Used with option "PDF:lepton2gammaSet = 2".
133  inline bool setPhotonFluxPtr(PDFPtr photonFluxAIn, PDFPtr photonFluxBIn) {
134  return beamSetup.setPhotonFluxPtr( photonFluxAIn, photonFluxBIn); }
135 
136  // Possibility to pass in pointer to external LHA-interfaced generator.
137  inline bool setLHAupPtr(LHAupPtr lhaUpPtrIn) {
138  lhaUpPtr = lhaUpPtrIn;
139  useNewLHA = false;
140  return beamSetup.setLHAupPtr(lhaUpPtrIn);}
141 
142  // Possibility to pass in pointer for external handling of some decays.
143  inline bool setDecayPtr(DecayHandlerPtr decayHandlePtrIn,
144  vector<int> handledParticlesIn = {}) {
145  decayHandlePtr = decayHandlePtrIn;
146  handledParticles = handledParticlesIn.size() == 0 ?
147  decayHandlePtrIn->handledParticles() : handledParticlesIn; return true;}
148 
149  // Possibility to pass in pointer for external random number generation.
150  inline bool setRndmEnginePtr(RndmEnginePtr rndmEnginePtrIn) {
151  return rndm.rndmEnginePtr(rndmEnginePtrIn);}
152 
153  // Possibility to pass in pointer for user hooks.
154  inline bool setUserHooksPtr(UserHooksPtr userHooksPtrIn) {
155  userHooksPtr = userHooksPtrIn; return true;}
156 
157  // Possibility to add further pointers to allow multiple user hooks.
158  inline bool addUserHooksPtr(UserHooksPtr userHooksPtrIn) {
159  if ( !userHooksPtrIn ) return false;
160  if ( !userHooksPtr ) return setUserHooksPtr(userHooksPtrIn);
161  shared_ptr<UserHooksVector> uhv =
162  dynamic_pointer_cast<UserHooksVector>(userHooksPtr);
163  if ( !uhv ) { uhv = make_shared<UserHooksVector>();
164  uhv->hooks.push_back(userHooksPtr); userHooksPtr = uhv; }
165  uhv->hooks.push_back(userHooksPtrIn); return true;}
166 
167  // Possibility to insert a user hook.
168  inline bool insertUserHooksPtr(int idx, UserHooksPtr userHooksPtrIn) {
169  if ( !userHooksPtrIn || !userHooksPtr ) return false;
170  shared_ptr<UserHooksVector> uhv =
171  dynamic_pointer_cast<UserHooksVector>(userHooksPtr);
172  if ( !uhv || idx < 0 || idx > (int)uhv->hooks.size() ) return false;
173  uhv->hooks.insert(uhv->hooks.begin() + idx, userHooksPtrIn); return true;}
174 
175  // Possibility to pass in pointer for full merging class.
176  inline bool setMergingPtr(MergingPtr mergingPtrIn) {
177  mergingPtr = mergingPtrIn; return true;}
178 
179  // Possibility to pass in pointer for merging hooks.
180  inline bool setMergingHooksPtr(MergingHooksPtr mergingHooksPtrIn) {
181  mergingHooksPtr = mergingHooksPtrIn; return true;}
182 
183  // Possibility to pass in pointer for beam shape.
184  inline bool setBeamShapePtr(BeamShapePtr beamShapePtrIn) {
185  return beamSetup.setBeamShapePtr(beamShapePtrIn);}
186 
187  // Possibility to pass in pointer for external cross section,
188  // with option to include external phase-space generator.
189  inline bool setSigmaPtr(SigmaProcessPtr sigmaPtrIn,
190  PhaseSpacePtr phaseSpacePtrIn = nullptr) {
191  sigmaPtrs.resize(0), phaseSpacePtrs.resize(0);
192  sigmaPtrs.push_back(sigmaPtrIn);
193  phaseSpacePtrs.push_back(phaseSpacePtrIn); return true;}
194 
195  // Possibility to add further pointers to allow for multiple cross sections.
196  inline bool addSigmaPtr(SigmaProcessPtr sigmaPtrIn,
197  PhaseSpacePtr phaseSpacePtrIn = nullptr) {
198  sigmaPtrs.push_back(sigmaPtrIn);
199  phaseSpacePtrs.push_back(phaseSpacePtrIn); return true;}
200 
201  // Possibility to insert further pointers to allow for multiple
202  // cross sections.
203  inline bool insertSigmaPtr(int idx, SigmaProcessPtr sigmaPtrIn,
204  PhaseSpacePtr phaseSpacePtrIn = nullptr) {
205  if (idx < 0 || idx > (int)sigmaPtrs.size()) return false;
206  sigmaPtrs.insert(sigmaPtrs.begin() + idx, sigmaPtrIn);
207  phaseSpacePtrs.insert(phaseSpacePtrs.begin() + idx, phaseSpacePtrIn);
208  return true;}
209 
210  // Possibility to pass in pointer for external resonance.
211  inline bool setResonancePtr(ResonanceWidthsPtr resonancePtrIn) {
212  resonancePtrs.resize(0);
213  resonancePtrs.push_back( resonancePtrIn); return true;}
214 
215  // Possibility to add further pointers to allow for multiple resonances.
216  inline bool addResonancePtr(ResonanceWidthsPtr resonancePtrIn) {
217  resonancePtrs.push_back( resonancePtrIn); return true;}
218 
219  // Possibility to insert further pointers to allow for multiple resonances.
220  inline bool insertResonancePtr(int idx, ResonanceWidthsPtr resonancePtrIn) {
221  if (idx < 0 || idx > (int)resonancePtrs.size()) return false;
222  resonancePtrs.insert( resonancePtrs.begin() + idx, resonancePtrIn);
223  return true;}
224 
225  // Possibility to pass in pointer for external showers.
226  inline bool setShowerModelPtr(ShowerModelPtr showerModelPtrIn) {
227  showerModelPtr = showerModelPtrIn; return true;}
228 
229  // Possibility to pass in pointer for external fragmentation model.
230  inline bool setFragmentationPtr(FragmentationModelPtr fragmentationPtrIn) {
231  fragPtrs.resize(0);
232  fragPtrs.push_back(fragmentationPtrIn); return true;}
233 
234  // Possibility to allow for multiple external fragmentation models.
235  inline bool addFragmentationPtr(FragmentationModelPtr fragmentationPtrIn) {
236  fragPtrs.push_back(fragmentationPtrIn); return true;}
237 
238  // Possibility to insert external fragmentation model, in specific position.
239  inline bool insertFragmentationPtr(int idx,
240  FragmentationModelPtr fragmentationPtrIn) {
241  if (idx < 0 || idx > (int)fragPtrs.size()) return false;
242  fragPtrs.insert( fragPtrs.begin() + idx, fragmentationPtrIn);
243  return true;}
244 
245  // Possibility to pass in pointer for modelling of heavy ion collisions.
246  inline bool setHeavyIonsPtr(HeavyIonsPtr heavyIonsPtrIn) {
247  heavyIonsPtr = heavyIonsPtrIn; return true;}
248 
249  // Possibility to pass a HIUserHooks pointer for modifying the
250  // behavior of the heavy ion modelling.
251  inline bool setHIHooks(HIUserHooksPtr hiHooksPtrIn) {
252  hiHooksPtr = hiHooksPtrIn; return true; }
253 
254  // Possibility to get the pointer to a object modelling heavy ion
255  // collisions.
256  inline HeavyIonsPtr getHeavyIonsPtr() { return heavyIonsPtr;}
257 
258  // Possibility to access the pointer to the BeamShape object.
259  inline BeamShapePtr getBeamShapePtr() { return beamSetup.getBeamShapePtr();}
260 
261  // Possibility to get the pointer to the parton-shower model.
262  inline ShowerModelPtr getShowerModelPtr() { return showerModelPtr;}
263 
264  // Possibility to get the pointer to the LHA accessor.
265  inline LHAupPtr getLHAupPtr() { return lhaUpPtr;}
266 
267  // Possibility to pass in pointer for setting of parton space-time vertices.
268  inline bool setPartonVertexPtr( PartonVertexPtr partonVertexPtrIn) {
269  partonVertexPtr = partonVertexPtrIn; return true;}
270 
271  // Initialize.
272  bool init();
273 
274  // Generate the next event.
275  inline bool next() { return next(0); }
276  bool next(int procTypeIn);
277 
278  // Switch to new beam particle identities; for similar hadrons only.
279  bool setBeamIDs( int idAin, int idBin = 0);
280 
281  // Switch beam kinematics.
282  bool setKinematics(double eCMIn);
283  bool setKinematics(double eAIn, double eBIn);
284  bool setKinematics(double pxAIn, double pyAIn, double pzAIn,
285  double pxBIn, double pyBIn, double pzBIn);
286  bool setKinematics(Vec4 pAIn, Vec4 pBIn);
287 
288  // Generate only a single timelike shower as in a decay.
289  inline int forceTimeShower( int iBeg, int iEnd, double pTmax,
290  int nBranchMax = 0) {
291  if (!isInit) {
292  logger.ERROR_MSG("Pythia is not properly initialized");
293  return 0;
294  }
296  infoPrivate.setScalup( 0, pTmax);
297  return timesDecPtr->shower(iBeg, iEnd, event, pTmax, nBranchMax);}
298 
299  // Generate only the hadronization/decay stage.
300  bool forceHadronLevel( bool findJunctions = true);
301 
302  // Special routine to allow more decays if on/off switches changed.
303  bool moreDecays() {return hadronLevel.moreDecays(event);}
304  bool moreDecays(int index) {return hadronLevel.decay(index, event);}
305 
306  // Special routine to force R-hadron decay when not done before.
307  bool forceRHadronDecays() {return doRHadronDecays();}
308 
309  // Do a low-energy collision between two hadrons in the event record.
310  inline bool doLowEnergyProcess(int i1, int i2, int procTypeIn) {
311  if (!isInit) {
312  logger.ERROR_MSG("Pythia is not properly initialized"); return false; }
313  return hadronLevel.doLowEnergyProcess( i1, i2, procTypeIn, event); }
314 
315  // Get total cross section for two hadrons in the event record or standalone.
316  inline double getSigmaTotal() {
317  return getSigmaTotal(beamSetup.idA, beamSetup.idB, beamSetup.eCM, 0);}
318  inline double getSigmaTotal(double eCM12, int mixLoHi = 0) {
319  return getSigmaTotal(beamSetup.idA, beamSetup.idB, eCM12, mixLoHi);}
320  inline double getSigmaTotal(int id1, int id2, double eCM12,
321  int mixLoHi = 0) {
322  return getSigmaTotal(id1, id2, eCM12, particleData.m0(id1),
323  particleData.m0(id2), mixLoHi); }
324  inline double getSigmaTotal(int id1, int id2, double eCM12, double m1,
325  double m2, int mixLoHi = 0) {
326  if (!isInit) {
327  logger.ERROR_MSG("Pythia is not properly initialized"); return 0.; }
328  return sigmaCmb.sigmaTotal(id1, id2, eCM12, m1, m2, mixLoHi); }
329 
330  // Get partial (elastic, diffractive, non-diffractive, ...) cross sections
331  // for two hadrons in the event record or standalone.
332  inline double getSigmaPartial(int procTypeIn) {
333  return getSigmaPartial(beamSetup.idA, beamSetup.idB, beamSetup.eCM,
334  procTypeIn, 0); }
335  inline double getSigmaPartial(double eCM12, int procTypeIn,
336  int mixLoHi = 0) {return getSigmaPartial(
337  beamSetup.idA, beamSetup.idB, eCM12, procTypeIn, mixLoHi); }
338  inline double getSigmaPartial(int id1, int id2, double eCM12, int procTypeIn,
339  int mixLoHi = 0) {return getSigmaPartial(id1, id2, eCM12,
340  particleData.m0(id1), particleData.m0(id2), procTypeIn, mixLoHi); }
341  inline double getSigmaPartial(int id1, int id2, double eCM12, double m1,
342  double m2, int procTypeIn, int mixLoHi = 0) {
343  if (!isInit) {
344  logger.ERROR_MSG("Pythia is not properly initialized"); return 0.;}
345  return sigmaCmb.sigmaPartial(
346  id1, id2, eCM12, m1, m2, procTypeIn, mixLoHi);}
347 
348  // Return a parton density set among list of possibilities.
349  inline PDFPtr getPDFPtr(int idIn, int sequence = 1, string beam = "A",
350  bool resolved = true) {
351  return beamSetup.getPDFPtr( idIn, sequence, beam, resolved); }
352 
353  // List the current Les Houches event.
354  inline void LHAeventList() { if (lhaUpPtr != 0) lhaUpPtr->listEvent();}
355 
356  // Skip a number of Les Houches events at input.
357  inline bool LHAeventSkip(int nSkip) {
358  if (lhaUpPtr != 0) return lhaUpPtr->skipEvent(nSkip);
359  return false;}
360 
361  // Main routine to provide final statistics on generation.
362  void stat();
363 
364  // Read in settings values: shorthand, not new functionality.
365  bool flag(string key) {return settings.flag(key);}
366  int mode(string key) {return settings.mode(key);}
367  double parm(string key) {return settings.parm(key);}
368  string word(string key) {return settings.word(key);}
369 
370  // The event record for the parton-level central process.
372 
373  // The event record for the complete event history.
374  Event event = {};
375 
376  // Public information and statistic on the generation.
377  const Info& info = infoPrivate;
378 
379  // Logger: for diagnostic messages, errors, statistics, etc.
381 
382  // Settings: databases of flags/modes/parms/words to control run.
384 
385  // ParticleData: the particle data table/database.
387 
388  // Random number generator.
389  Rndm rndm = {};
390 
391  // Standard Model couplings, including alphaS and alphaEM.
393 
394  // SUSY couplings.
396 
397  // SLHA Interface
399 
400  // The partonic content of each subcollision system (auxiliary to event).
402 
403  // Merging object as wrapper for matrix element merging routines.
404  MergingPtr mergingPtr = {};
405 
406  // Pointer to MergingHooks object for user interaction with the merging.
407  // MergingHooks also more generally steers the matrix element merging.
408  MergingHooksPtr mergingHooksPtr;
409 
410  // Pointer to a HeavyIons object for generating heavy ion collisions
411  HeavyIonsPtr heavyIonsPtr = {};
412 
413  // Pointer to a HIUserHooks object to modify heavy ion modelling.
414  HIUserHooksPtr hiHooksPtr = {};
415 
416  // HadronWidths: the hadron widths data table/database.
418 
419  // The two incoming beams.
420  BeamParticlePtr beamAPtr;
421  BeamParticlePtr beamBPtr;
422 
423 private:
424 
425  // Friend PythiaParallel to give full access to underlying info.
426  friend class PythiaParallel;
427 
428  // The collector of all event generation weights that should eventually
429  // be transferred to the final output.
430  WeightContainer weightContainer = {};
431 
432  // The main keeper/collector of information, accessible from all
433  // PhysicsBase objects. The information is available from the
434  // outside through the public info object.
435  Info infoPrivate = {};
436 
437  // Initialise new Pythia object (called by constructors).
438  void initPtrs();
439 
440  // Initialise user provided plugins.
441  void initPlugins();
442 
443  // Functions to be called at the beginning and end of a next() call.
444  void beginEvent();
445  void endEvent(PhysicsBase::Status status);
446 
447  // Register a PhysicsBase object and give it a pointer to the info object.
448  inline void registerPhysicsBase(PhysicsBase &pb) {
449  if (find(physicsPtrs.begin(), physicsPtrs.end(), &pb) != physicsPtrs.end())
450  return;
451  pb.initInfoPtr(infoPrivate);
452  physicsPtrs.push_back(&pb);
453  }
454 
455  // If new pointers are set in Info propagate this to all
456  // PhysicsBase objects.
457  void pushInfo();
458 
459  // Constants: could only be changed in the code itself.
460  static const double VERSIONNUMBERHEAD, VERSIONNUMBERCODE;
461  // Maximum number of tries to produce parton level from given input.
462  // Negative integer to denote that no subrun has been set.
463  static const int NTRY = 10;
464 
465  // Initialization data, extracted from database.
466  string xmlPath = {};
467  bool doProcessLevel = {}, doPartonLevel = {}, doHadronLevel = {},
468  doLowEnergy = {}, doSoftQCDall = {}, doSoftQCDinel = {},
469  doCentralDiff = {}, doDiffraction = {}, doSoftQCD = {},
470  doHardDiff = {}, doResDec = {}, doFSRinRes = {}, decayRHadrons = {},
471  doPartonVertex = {}, abortIfVeto = {}, checkEvent = {},
472  checkHistory = {}, doNonPert = {};
473  int nErrList = {};
474  double epTolErr = {}, epTolWarn = {}, mTolErr = {}, mTolWarn = {};
475 
476  // Initialization data, from init(...) call, plus some event-specific.
477  bool isConstructed = {}, isInit = {}, showSaV = {}, showMaD = {},
478  doReconnect = {}, forceHadronLevelCR = {};
479  int nCount = {}, nShowLHA = {}, nShowInfo = {}, nShowProc = {},
480  nShowEvt = {}, reconnectMode = {};
481 
482  // information for error checkout.
483  int nErrEvent = {};
484  vector<int> iErrId = {}, iErrCol = {}, iErrEpm = {}, iErrNan = {},
485  iErrNanVtx = {};
486 
487  // Setup of beams: flavours, kinematics and PDFs.
488  BeamSetup beamSetup = {};
489 
490  // LHAup object for generating external events.
491  bool doLHA = false;
492  bool useNewLHA = false;
493  LHAupPtr lhaUpPtr = {};
494 
495  // Pointer to external decay handler and list of particles it handles.
496  DecayHandlerPtr decayHandlePtr = {};
497  vector<int> handledParticles = {};
498 
499  // Pointer to UserHooks object for user interaction with program.
500  UserHooksPtr userHooksPtr = {};
501  bool doVetoProcess = {}, doVetoPartons = {},
502  retryPartonLevel = {}, canVetoHadronization = {};
503 
504  // Pointer to BeamShape object for beam momentum and interaction vertex.
505  BeamShapePtr beamShapePtr = {};
506  bool doVertexSpread = {};
507  double eMinPert = {}, eWidthPert = {};
508 
509  // Pointers to external processes derived from the Pythia base classes.
510  vector<SigmaProcessPtr> sigmaPtrs = {};
511 
512  // Pointers to external phase-space generators derived from Pythia
513  // base classes.
514  vector<PhaseSpacePtr> phaseSpacePtrs = {};
515 
516  // Pointers to external calculation of resonance widths.
517  vector<ResonanceWidthsPtr> resonancePtrs = {};
518 
519  // Pointers to timelike and spacelike showers, including Vincia and
520  // Dire. Note, the showerModelPtr must be declared before the
521  // individual shower pointers, partonLevel, and hadronLevel. This
522  // ensures shared pointers that belong to showerModelPtr are
523  // unloaded correctly.
524  ShowerModelPtr showerModelPtr = {};
525  TimeShowerPtr timesDecPtr = {};
526  TimeShowerPtr timesPtr = {};
527  SpaceShowerPtr spacePtr = {};
528 
529  // Pointers to fragmentation models.
530  vector<FragmentationModelPtr> fragPtrs = {};
531 
532  // Pointer to assign space-time vertices during parton evolution.
533  PartonVertexPtr partonVertexPtr;
534 
535  // The main generator class to define the core process of the event.
536  ProcessLevel processLevel = {};
537 
538  // The main generator class to produce the parton level of the event.
539  PartonLevel partonLevel = {};
540 
541  // The main generator class to perform trial showers of the event.
542  PartonLevel trialPartonLevel = {};
543 
544  // Flags for defining the merging scheme.
545  bool doMerging = {};
546 
547  // The StringInteractions class.
548  StringIntPtr stringInteractionsPtr;
549 
550  // The Colour reconnection class.
551  ColRecPtr colourReconnectionPtr = {};
552 
553  // The junction splitting class.
554  JunctionSplitting junctionSplitting = {};
555 
556  // The main generator class to produce the hadron level of the event.
557  HadronLevel hadronLevel = {};
558 
559  // The total cross section classes are used both on process and parton level.
560  SigmaTotal sigmaTot = {};
561  SigmaLowEnergy sigmaLowEnergy;
562  NucleonExcitations nucleonExcitations = {};
563  SigmaCombined sigmaCmb = {};
564 
565  // The fragmentation pointer is used in low energy processes and HadronLevel.
566  LundFragmentationPtr fragPtr{};
567 
568  // The RHadrons class is used both at PartonLevel and HadronLevel.
569  RHadronsPtr rHadronsPtr{};
570 
571  // Flags for handling generation of heavy ion collisons.
572  bool hasHeavyIons = {}, doHeavyIons = {};
573 
574  // Write the Pythia banner, with symbol and version information.
575  void banner();
576 
577  // Check that combinations of settings are allowed; change if not.
578  void checkSettings();
579 
580  // Simplified treatment for low-energy nonperturbative collisions.
581  bool nextNonPert(int procTypeIn = 0);
582 
583  // Perform R-hadron decays.
584  bool doRHadronDecays();
585 
586  // Check that the final event makes sense.
587  bool check();
588 
589  // Initialization of SLHA data.
590  bool initSLHA();
591  stringstream particleDataBuffer;
592 
593  // Keep track of and initialize all pointers to PhysicsBase-derived objects.
594  vector<PhysicsBase*> physicsPtrs = {};
595 
596 };
597 
598 //==========================================================================
599 
600 } // end namespace Pythia8
601 
602 #endif // Pythia8_Pythia_H
Event process
The event record for the parton-level central process.
Definition: Pythia.h:371
HeavyIonsPtr getHeavyIonsPtr()
Definition: Pythia.h:256
bool doLowEnergyProcess(int i1, int i2, int procTypeIn)
Do a low-energy collision between two hadrons in the event record.
Definition: Pythia.h:310
BeamParticlePtr beamAPtr
The two incoming beams.
Definition: Pythia.h:420
bool setRndmEnginePtr(RndmEnginePtr rndmEnginePtrIn)
Possibility to pass in pointer for external random number generation.
Definition: Pythia.h:150
double sigmaPartial(int id1, int id2, double eCM12, double m1, double m2, int type, int mixLoHi=0)
Get partial cross sections.
Definition: SigmaLowEnergy.cc:1563
bool moreDecays(Event &event)
Special routine to allow more decays if on/off switches changed.
Definition: HadronLevel.cc:339
bool setPDFAPtr(PDFPtr pdfAPtrIn)
Routine to pass in pointers to PDF&#39;s. Usage optional.
Definition: BeamSetup.cc:105
LHAupPtr getLHAupPtr()
Possibility to get the pointer to the LHA accessor.
Definition: Pythia.h:265
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1601
Definition: NucleonExcitations.h:23
PDFPtr getPDFPtr(int idIn, int sequence=1, string beam="A", bool resolved=true)
Return a parton density set among list of possibilities.
Definition: Pythia.h:349
Definition: PhysicsBase.h:27
Definition: Info.h:45
bool rndmEnginePtr(RndmEnginePtr rndmEngPtrIn)
Possibility to pass in pointer for external random number generation.
Definition: Basics.cc:27
Definition: BeamSetup.h:33
Rndm rndm
Random number generator.
Definition: Pythia.h:389
bool LHAeventSkip(int nSkip)
Skip a number of Les Houches events at input.
Definition: Pythia.h:357
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:98
ParticleData particleData
ParticleData: the particle data table/database.
Definition: Pythia.h:386
The Event class holds all info on the generated event.
Definition: Event.h:408
bool addResonancePtr(ResonanceWidthsPtr resonancePtrIn)
Possibility to add further pointers to allow for multiple resonances.
Definition: Pythia.h:216
Definition: Weights.h:433
Definition: SigmaLowEnergy.h:135
PDFPtr getPDFPtr(int idIn, int sequence=1, string beam="A", bool resolved=true)
Return a parton density set among list of possibilities.
Definition: BeamSetup.cc:1146
bool setResonancePtr(ResonanceWidthsPtr resonancePtrIn)
Possibility to pass in pointer for external resonance.
Definition: Pythia.h:211
Definition: SLHAinterface.h:27
vector< shared_ptr< UserHooks > > hooks
The vector of user hooks.
Definition: UserHooks.h:738
Definition: SigmaTotal.h:141
bool setDecayPtr(DecayHandlerPtr decayHandlePtrIn, vector< int > handledParticlesIn={})
Possibility to pass in pointer for external handling of some decays.
Definition: Pythia.h:143
bool setPhotonFluxPtr(PDFPtr photonFluxAIn, PDFPtr photonFluxBIn)
Set photon fluxes externally. Used with option "PDF:lepton2gammaSet = 2".
Definition: BeamSetup.h:62
Definition: JunctionSplitting.h:30
bool setFragmentationPtr(FragmentationModelPtr fragmentationPtrIn)
Possibility to pass in pointer for external fragmentation model.
Definition: Pythia.h:230
Class for doing Pythia runs in parallel.
Definition: PythiaParallel.h:18
bool checkVersion()
Check consistency of version numbers (called by constructors).
Definition: Pythia.cc:374
Settings settings
Settings: databases of flags/modes/parms/words to control run.
Definition: Pythia.h:383
bool forceRHadronDecays()
Special routine to force R-hadron decay when not done before.
Definition: Pythia.h:307
void initInfoPtr(Info &infoPtrIn)
This function is called from above for physics objects used in a run.
Definition: PhysicsBase.cc:21
Definition: ProcessLevel.h:36
Gets cross sections for hadron-hadron collisions at low energies.
Definition: SigmaLowEnergy.h:22
bool setLHAupPtr(LHAupPtr lhaUpPtrIn)
Possibility to pass in pointer to external LHA-interfaced generator.
Definition: Pythia.h:137
HIUserHooksPtr hiHooksPtr
Pointer to a HIUserHooks object to modify heavy ion modelling.
Definition: Pythia.h:414
bool setKinematics(double eCMIn)
Switch beam kinematics.
Definition: Pythia.cc:1344
Event event
The event record for the complete event history.
Definition: Pythia.h:374
bool init()
Initialize.
Definition: Pythia.cc:411
bool setPDFPtr(PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn, PDFPtr pdfHardAPtrIn=nullptr, PDFPtr pdfHardBPtrIn=nullptr, PDFPtr pdfPomAPtrIn=nullptr, PDFPtr pdfPomBPtrIn=nullptr, PDFPtr pdfGamAPtrIn=nullptr, PDFPtr pdfGamBPtrIn=nullptr, PDFPtr pdfHardGamAPtrIn=nullptr, PDFPtr pdfHardGamBPtrIn=nullptr, PDFPtr pdfUnresAPtrIn=nullptr, PDFPtr pdfUnresBPtrIn=nullptr, PDFPtr pdfUnresGamAPtrIn=nullptr, PDFPtr pdfUnresGamBPtrIn=nullptr, PDFPtr pdfVMDAPtrIn=nullptr, PDFPtr pdfVMDBPtrIn=nullptr)
Possibility to pass in pointers to PDF&#39;s.
Definition: Pythia.h:115
bool setMergingPtr(MergingPtr mergingPtrIn)
Possibility to pass in pointer for full merging class.
Definition: Pythia.h:176
bool setPDFPtr(PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn, PDFPtr pdfHardAPtrIn=nullptr, PDFPtr pdfHardBPtrIn=nullptr, PDFPtr pdfPomAPtrIn=nullptr, PDFPtr pdfPomBPtrIn=nullptr, PDFPtr pdfGamAPtrIn=nullptr, PDFPtr pdfGamBPtrIn=nullptr, PDFPtr pdfHardGamAPtrIn=nullptr, PDFPtr pdfHardGamBPtrIn=nullptr, PDFPtr pdfUnresAPtrIn=nullptr, PDFPtr pdfUnresBPtrIn=nullptr, PDFPtr pdfUnresGamAPtrIn=nullptr, PDFPtr pdfUnresGamBPtrIn=nullptr, PDFPtr pdfVMDAPtrIn=nullptr, PDFPtr pdfVMDBPtrIn=nullptr)
Possibility to pass in pointers to PDF&#39;s.
Definition: BeamSetup.cc:21
~Pythia()
Destructor.
Definition: Pythia.h:88
Definition: Logger.h:23
SLHAinterface slhaInterface
SLHA Interface.
Definition: Pythia.h:398
bool insertResonancePtr(int idx, ResonanceWidthsPtr resonancePtrIn)
Possibility to insert further pointers to allow for multiple resonances.
Definition: Pythia.h:220
bool insertUserHooksPtr(int idx, UserHooksPtr userHooksPtrIn)
Possibility to insert a user hook.
Definition: Pythia.h:168
HeavyIonsPtr heavyIonsPtr
Pointer to a HeavyIons object for generating heavy ion collisions.
Definition: Pythia.h:411
bool readString(string line, bool warn=true, int subrun=SUBRUNDEFAULT)
Read in one update from a single line.
Definition: Settings.cc:384
bool setPartonVertexPtr(PartonVertexPtr partonVertexPtrIn)
Possibility to pass in pointer for setting of parton space-time vertices.
Definition: Pythia.h:268
BeamShapePtr getBeamShapePtr()
Possibility to access the pointer to the BeamShape object.
Definition: Pythia.h:259
CoupSUSY coupSUSY
SUSY couplings.
Definition: Pythia.h:395
bool readFile(string fileName, bool warn=true, int subrun=SUBRUNDEFAULT)
Read in updates from a user-defined file.
Definition: Settings.cc:698
bool addFragmentationPtr(FragmentationModelPtr fragmentationPtrIn)
Possibility to allow for multiple external fragmentation models.
Definition: Pythia.h:235
bool setBeamIDs(int idAin, int idBin=0)
Switch to new beam particle identities; for similar hadrons only.
Definition: Pythia.cc:1322
CoupSM coupSM
Standard Model couplings, including alphaS and alphaEM.
Definition: Pythia.h:392
Definition: HadronLevel.h:44
Definition: Basics.h:388
PartonSystems partonSystems
The partonic content of each subcollision system (auxiliary to event).
Definition: Pythia.h:401
bool moreDecays()
Special routine to allow more decays if on/off switches changed.
Definition: Pythia.h:303
ShowerModelPtr getShowerModelPtr()
Possibility to get the pointer to the parton-shower model.
Definition: Pythia.h:262
bool insertFragmentationPtr(int idx, FragmentationModelPtr fragmentationPtrIn)
Possibility to insert external fragmentation model, in specific position.
Definition: Pythia.h:239
bool setBeamShapePtr(BeamShapePtr beamShapePtrIn)
Possibility to pass in pointer for beam shape.
Definition: Pythia.h:184
Definition: PartonLevel.h:45
Status
Enumerate the different status codes the event generation can have.
Definition: PhysicsBase.h:32
Definition: HadronWidths.h:22
bool setMergingHooksPtr(MergingHooksPtr mergingHooksPtrIn)
Possibility to pass in pointer for merging hooks.
Definition: Pythia.h:180
MergingHooksPtr mergingHooksPtr
Definition: Pythia.h:408
void stat()
Main routine to provide final statistics on generation.
Definition: Pythia.cc:1672
bool doLowEnergyProcess(int i1, int i2, int procTypeIn, Event &event)
Special routine to do a low-energy hadron-hadron scattering.
Definition: HadronLevel.h:81
bool addSigmaPtr(SigmaProcessPtr sigmaPtrIn, PhaseSpacePtr phaseSpacePtrIn=nullptr)
Possibility to add further pointers to allow for multiple cross sections.
Definition: Pythia.h:196
bool setHeavyIonsPtr(HeavyIonsPtr heavyIonsPtrIn)
Possibility to pass in pointer for modelling of heavy ion collisions.
Definition: Pythia.h:246
bool setLHAupPtr(LHAupPtr lhaUpPtrIn)
Possibility to pass in pointer to external LHA-interfaced generator.
Definition: BeamSetup.h:68
Definition: StandardModel.h:135
bool forceHadronLevel(bool findJunctions=true)
Generate only the hadronization/decay stage.
Definition: Pythia.cc:1461
bool readFile(string fileName, bool warn=true, int subrun=SUBRUNDEFAULT)
Read in updates for settings or particle data from user-defined file.
Definition: Pythia.h:103
HadronWidths hadronWidths
HadronWidths: the hadron widths data table/database.
Definition: Pythia.h:417
double getSigmaTotal()
Get total cross section for two hadrons in the event record or standalone.
Definition: Pythia.h:316
double m2(const Vec4 &v1)
The squared invariant mass of one or more four-vectors.
Definition: Basics.cc:598
bool setUserHooksPtr(UserHooksPtr userHooksPtrIn)
Possibility to pass in pointer for user hooks.
Definition: Pythia.h:154
bool setPDFBPtr(PDFPtr pdfBPtrIn)
Routine to pass in pointers to PDF&#39;s. Usage optional.
Definition: BeamSetup.cc:129
bool addUserHooksPtr(UserHooksPtr userHooksPtrIn)
Possibility to add further pointers to allow multiple user hooks.
Definition: Pythia.h:158
bool setShowerModelPtr(ShowerModelPtr showerModelPtrIn)
Possibility to pass in pointer for external showers.
Definition: Pythia.h:226
The PartonSystems class describes the whole set of subcollisions.
Definition: PartonSystems.h:42
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:71
double getSigmaPartial(int procTypeIn)
Definition: Pythia.h:332
UserHooksVector implements a vector of UserHooks and is itself a UserHooks.
Definition: UserHooks.h:313
const Info & info
Public information and statistic on the generation.
Definition: Pythia.h:377
Pythia(string xmlDir="../share/Pythia8/xmldoc", bool printBanner=true)
Constructor. (See Pythia.cc file.)
Definition: Pythia.cc:33
bool next()
Generate the next event.
Definition: Pythia.h:275
BeamShapePtr getBeamShapePtr()
Possibility to access the pointer to the BeamShape object.
Definition: BeamSetup.h:90
double sigmaTotal(int id1, int id2, double eCM12, double m1, double m2, int mixLoHi=0)
Get total cross section.
Definition: SigmaLowEnergy.cc:1526
bool setPhotonFluxPtr(PDFPtr photonFluxAIn, PDFPtr photonFluxBIn)
Set photon fluxes externally. Used with option "PDF:lepton2gammaSet = 2".
Definition: Pythia.h:133
int forceTimeShower(int iBeg, int iEnd, double pTmax, int nBranchMax=0)
Generate only a single timelike shower as in a decay.
Definition: Pythia.h:289
bool insertSigmaPtr(int idx, SigmaProcessPtr sigmaPtrIn, PhaseSpacePtr phaseSpacePtrIn=nullptr)
Definition: Pythia.h:203
void LHAeventList()
List the current Les Houches event.
Definition: Pythia.h:354
MergingPtr mergingPtr
Merging object as wrapper for matrix element merging routines.
Definition: Pythia.h:404
This class holds a map of all ParticleDataEntries.
Definition: ParticleData.h:422
bool setSigmaPtr(SigmaProcessPtr sigmaPtrIn, PhaseSpacePtr phaseSpacePtrIn=nullptr)
Definition: Pythia.h:189
bool decay(int iDec, Event &event)
Try to decay the specified particle. Returns false if decay failed.
Definition: HadronLevel.h:66
Logger logger
Logger: for diagnostic messages, errors, statistics, etc.
Definition: Pythia.h:380
bool flag(string key)
Read in settings values: shorthand, not new functionality.
Definition: Pythia.h:365
bool setBeamShapePtr(BeamShapePtr beamShapePtrIn)
Possibility to pass in pointer for beam shape.
Definition: BeamSetup.h:86
Definition: Basics.h:32
bool setHIHooks(HIUserHooksPtr hiHooksPtrIn)
Definition: Pythia.h:251
Definition: SusyCouplings.h:27
Definition: Settings.h:196
void clear()
Reset system list to empty.
Definition: PartonSystems.h:50