StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PhysicsBase.cc
1 // PhysicsBase.cc is a part of the PYTHIA event generator.
2 // Copyright (C) 2020 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 // Function definitions (not found in the header) for the PhysicsBase class.
7 
8 #include "Pythia8/PhysicsBase.h"
9 
10 namespace Pythia8 {
11 
12 //==========================================================================
13 
14 // The PhysicsBase class.
15 
16 //--------------------------------------------------------------------------
17 
18 // Make available an assortment of pointers stored in the info object.
19 
20 void PhysicsBase::initInfoPtr(Info& infoIn) {
21 
22  // Store the info object.
23  infoPtr = &infoIn;
24 
25  // Other objects extracted from Info.
26  settingsPtr = infoPtr->settingsPtr;
27  particleDataPtr = infoPtr->particleDataPtr;
28  hadronWidthsPtr = infoPtr->hadronWidthsPtr;
29  rndmPtr = infoPtr->rndmPtr;
30  coupSMPtr = infoPtr->coupSMPtr;
31  coupSUSYPtr = infoPtr->coupSUSYPtr;
32  beamAPtr = infoPtr->beamAPtr;
33  beamBPtr = infoPtr->beamBPtr;
34  beamPomAPtr = infoPtr->beamPomAPtr;
35  beamPomBPtr = infoPtr->beamPomBPtr;
36  beamGamAPtr = infoPtr->beamGamAPtr;
37  beamGamBPtr = infoPtr->beamGamBPtr;
38  beamVMDAPtr = infoPtr->beamVMDAPtr;
39  beamVMDBPtr = infoPtr->beamVMDBPtr;
40  partonSystemsPtr = infoPtr->partonSystemsPtr;
41  sigmaTotPtr = infoPtr->sigmaTotPtr;
42  userHooksPtr = infoPtr->userHooksPtr;
43 
44  // If the class has sub objects, register them now.
45  onInitInfoPtr();
46 }
47 
48 //--------------------------------------------------------------------------
49 
50 // Register a sub object that should have its information in sync with this.
51 void PhysicsBase::registerSubObject(PhysicsBase & pb) {
52  pb.initInfoPtr(*infoPtr);
53  subObjects.insert(&pb);
54 }
55 
56 //--------------------------------------------------------------------------
57 
58 // Calls onBeginEvent, then propagates the call to all sub objects
59 void PhysicsBase::beginEvent() {
60  onBeginEvent();
61  for (PhysicsBase* subObjectPtr : subObjects)
62  subObjectPtr->beginEvent();
63 }
64 
65 //--------------------------------------------------------------------------
66 
67 // Calls onEndEvent, then propagates the call to all sub objects
68 void PhysicsBase::endEvent(Status status) {
69  onEndEvent(status);
70  for (PhysicsBase* subObjectPtr : subObjects)
71  subObjectPtr->endEvent(status);
72 }
73 
74 //--------------------------------------------------------------------------
75 
76 // Calls onStat, then propagates the call to all sub objects
77 void PhysicsBase::stat() {
78  onStat();
79  for (PhysicsBase* subObjectPtr : subObjects)
80  subObjectPtr->stat();
81 }
82 
83 //==========================================================================
84 
85 } // end namespace Pythia8