PYTHIA  8.312
PhysicsBase.h
1 // PhysicsBase.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2024 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 base class for physics classes used inside Pyhia8.
7 
8 // Still to convert:
9 // BeamParticle
10 // BeamShape
11 
12 #ifndef Pythia8_PhysicsBase_H
13 #define Pythia8_PhysicsBase_H
14 
15 #include "Pythia8/Info.h"
16 #include "Pythia8/Settings.h"
17 #include "Pythia8/SharedPointers.h"
18 
19 namespace Pythia8 {
20 
21 //==========================================================================
22 
23 // Classes that implement physics models should inherit from the PhysicsBase
24 // class. It includes pointers to objects set up in the controlling Pythia
25 // object to take care of bookkeeping and simpler service tasks.
26 
27 class PhysicsBase {
28 
29 public:
30 
31  // Enumerate the different status codes the event generation can have.
32  enum Status { INCOMPLETE = -1, COMPLETE = 0, CONSTRUCTOR_FAILED,
33  INIT_FAILED, LHEF_END, LOWENERGY_FAILED, PROCESSLEVEL_FAILED,
34  PROCESSLEVEL_USERVETO, MERGING_FAILED, PARTONLEVEL_FAILED,
35  PARTONLEVEL_USERVETO, HADRONLEVEL_FAILED, CHECK_FAILED,
36  OTHER_UNPHYSICAL, HEAVYION_FAILED, HADRONLEVEL_USERVETO };
37 
38  // This function is called from above for physics objects used in a run.
39  void initInfoPtr(Info& infoPtrIn);
40 
41  // Empty virtual destructor.
42  virtual ~PhysicsBase() {}
43 
44  // Shorthand to read settings values.
45  bool flag(string key) const {return settingsPtr->flag(key);}
46  int mode(string key) const {return settingsPtr->mode(key);}
47  double parm(string key) const {return settingsPtr->parm(key);}
48  string word(string key) const {return settingsPtr->word(key);}
49  vector<bool> fvec(string key) const {return settingsPtr->fvec(key);}
50  vector<int> mvec(string key) const {return settingsPtr->mvec(key);}
51  vector<double> pvec(string key) const {return settingsPtr->pvec(key);}
52  vector<string> wvec(string key) const {return settingsPtr->wvec(key);}
53 
54 protected:
55 
56  // Default constructor.
58 
59  // If an object needs to set up infoPtr for sub objects, override this
60  // and call registerSubObject for each object in question.
61  virtual void onInitInfoPtr() {}
62 
63  // This function is called in the very beginning of each Pythia::next call.
64  virtual void onBeginEvent() {}
65 
66  // This function is called in the very end of each Pythia::next call
67  // with the argument set to the current status of the event.
68  virtual void onEndEvent(Status) {}
69 
70  // This function is called from the Pythia::stat() call.
71  virtual void onStat() {}
72 
73  // Register a sub object that should have its information in sync with this.
75 
76  // Pointer to various information on the generation.
77  // This is also the place from which a number of pointers are recovered.
78  Info* infoPtr = {};
79 
80  // Pointer to the settings database.
82 
83  // Pointer to the particle data table.
85 
86  // Pointer to logger.
88 
89  // Pointer to the hadron widths data table
91 
92  // Pointer to the random number generator.
93  Rndm* rndmPtr = {};
94 
95  // Pointers to SM and SUSY couplings.
97  CoupSUSY* coupSUSYPtr = {};
98 
99  // Pointers to the two incoming beams and to Pomeron, photon or VMD
100  // beam-inside-beam cases.
102  BeamParticle* beamAPtr = {};
103  BeamParticle* beamBPtr = {};
104  BeamParticle* beamPomAPtr = {};
105  BeamParticle* beamPomBPtr = {};
106  BeamParticle* beamGamAPtr = {};
107  BeamParticle* beamGamBPtr = {};
108  BeamParticle* beamVMDAPtr = {};
109  BeamParticle* beamVMDBPtr = {};
110 
111  // Pointer to information on subcollision parton locations.
113 
114  // Pointers to the total/elastic/diffractive cross sections.
116  SigmaCombined* sigmaCmbPtr = {};
117 
118  // A set of sub objects that should have their information in sync
119  // with This.
120  set<PhysicsBase*> subObjects;
121 
122  // Pointer to the UserHooks object (needs to be sett to null in
123  // classes deriving from UserHooks to avoid closed loop ownership).
124  UserHooksPtr userHooksPtr;
125 
126 private:
127 
128  friend class Pythia;
129 
130  // Calls onBeginEvent, then propagates the call to all sub objects
131  void beginEvent();
132 
133  // Calls onEndEvent, then propagates the call to all sub objects
134  void endEvent(Status status);
135 
136  // Calls onStat, then propagates the call to all sub objects
137  void stat();
138 
139 };
140 
141 //==========================================================================
142 
143 } // end namespace Pythia8
144 
145 #endif // Pythia8_PhysicsBase_H
virtual ~PhysicsBase()
Empty virtual destructor.
Definition: PhysicsBase.h:42
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1478
Settings * settingsPtr
Pointer to the settings database.
Definition: PhysicsBase.h:81
Definition: PhysicsBase.h:27
void registerSubObject(PhysicsBase &pb)
Register a sub object that should have its information in sync with this.
Definition: PhysicsBase.cc:56
Definition: Info.h:45
Definition: BeamSetup.h:33
Definition: BeamParticle.h:133
virtual void onBeginEvent()
This function is called in the very beginning of each Pythia::next call.
Definition: PhysicsBase.h:64
Definition: SigmaLowEnergy.h:135
PartonSystems * partonSystemsPtr
Pointer to information on subcollision parton locations.
Definition: PhysicsBase.h:112
Definition: SigmaTotal.h:141
void initInfoPtr(Info &infoPtrIn)
This function is called from above for physics objects used in a run.
Definition: PhysicsBase.cc:21
Rndm * rndmPtr
Pointer to the random number generator.
Definition: PhysicsBase.h:93
virtual void onStat()
This function is called from the Pythia::stat() call.
Definition: PhysicsBase.h:71
Definition: Logger.h:23
BeamSetup * beamSetupPtr
Definition: PhysicsBase.h:101
ParticleData * particleDataPtr
Pointer to the particle data table.
Definition: PhysicsBase.h:84
Definition: Basics.h:386
UserHooksPtr userHooksPtr
Definition: PhysicsBase.h:124
virtual void onInitInfoPtr()
Definition: PhysicsBase.h:61
set< PhysicsBase * > subObjects
Definition: PhysicsBase.h:120
Status
Enumerate the different status codes the event generation can have.
Definition: PhysicsBase.h:32
Definition: HadronWidths.h:22
Definition: StandardModel.h:135
CoupSM * coupSMPtr
Pointers to SM and SUSY couplings.
Definition: PhysicsBase.h:96
Logger * loggerPtr
Pointer to logger.
Definition: PhysicsBase.h:87
PhysicsBase()
Default constructor.
Definition: PhysicsBase.h:57
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
Info * infoPtr
Definition: PhysicsBase.h:78
virtual void onEndEvent(Status)
Definition: PhysicsBase.h:68
bool flag(string key) const
Shorthand to read settings values.
Definition: PhysicsBase.h:45
This class holds a map of all ParticleDataEntries.
Definition: ParticleData.h:422
SigmaTotal * sigmaTotPtr
Pointers to the total/elastic/diffractive cross sections.
Definition: PhysicsBase.h:115
Definition: SusyCouplings.h:27
Definition: Settings.h:195
HadronWidths * hadronWidthsPtr
Pointer to the hadron widths data table.
Definition: PhysicsBase.h:90