Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-30 08:49:52

0001 // PhysicsBase.h is a part of the PYTHIA event generator.
0002 // Copyright (C) 2025 Torbjorn Sjostrand.
0003 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
0004 // Please respect the MCnet Guidelines, see GUIDELINES for details.
0005 
0006 // This file contains the base class for physics classes used inside Pyhia8.
0007 
0008 #ifndef Pythia8_PhysicsBase_H
0009 #define Pythia8_PhysicsBase_H
0010 
0011 #include "Pythia8/Info.h"
0012 #include "Pythia8/Settings.h"
0013 #include "Pythia8/SharedPointers.h"
0014 
0015 namespace Pythia8 {
0016 
0017 //==========================================================================
0018 
0019 // Classes that implement physics models should inherit from the PhysicsBase
0020 // class. It includes pointers to objects set up in the controlling Pythia
0021 // object to take care of bookkeeping and simpler service tasks.
0022 
0023 class PhysicsBase {
0024 
0025 public:
0026 
0027   // Enumerate the different status codes the event generation can have.
0028   enum Status { INCOMPLETE = -1, COMPLETE = 0, CONSTRUCTOR_FAILED,
0029     INIT_FAILED, LHEF_END, LOWENERGY_FAILED, PROCESSLEVEL_FAILED,
0030     PROCESSLEVEL_USERVETO, MERGING_FAILED, PARTONLEVEL_FAILED,
0031     PARTONLEVEL_USERVETO, HADRONLEVEL_FAILED, CHECK_FAILED,
0032     OTHER_UNPHYSICAL, HEAVYION_FAILED, HADRONLEVEL_USERVETO };
0033 
0034   // This function is called from above for physics objects used in a run.
0035   void initInfoPtr(Info& infoPtrIn);
0036 
0037   // Empty virtual destructor.
0038   virtual ~PhysicsBase() {}
0039 
0040   // Shorthand to read settings values.
0041   bool   flag(string key) const {return settingsPtr->flag(key);}
0042   int    mode(string key) const {return settingsPtr->mode(key);}
0043   double parm(string key) const {return settingsPtr->parm(key);}
0044   string word(string key) const {return settingsPtr->word(key);}
0045   vector<bool>   fvec(string key) const {return settingsPtr->fvec(key);}
0046   vector<int>    mvec(string key) const {return settingsPtr->mvec(key);}
0047   vector<double> pvec(string key) const {return settingsPtr->pvec(key);}
0048   vector<string> wvec(string key) const {return settingsPtr->wvec(key);}
0049 
0050 protected:
0051 
0052   // Default constructor.
0053   PhysicsBase() {}
0054 
0055   // If an object needs to set up infoPtr for sub objects, override this
0056   // and call registerSubObject for each object in question.
0057   virtual void onInitInfoPtr() {}
0058 
0059   // This function is called in the very beginning of each Pythia::next call.
0060   virtual void onBeginEvent() {}
0061 
0062   // This function is called in the very end of each Pythia::next call
0063   // with the argument set to the current status of the event.
0064   virtual void onEndEvent(Status) {}
0065 
0066   // This function is called from the Pythia::stat() call.
0067   virtual void onStat() {}
0068 
0069   // Register a sub object that should have its information in sync with this.
0070   void registerSubObject(PhysicsBase& pb);
0071 
0072   // Pointer to various information on the generation.
0073   // This is also the place from which a number of pointers are recovered.
0074   Info*          infoPtr       =  {};
0075 
0076   // Pointer to the settings database.
0077   Settings*      settingsPtr      = {};
0078 
0079   // Pointer to the particle data table.
0080   ParticleData*  particleDataPtr  = {};
0081 
0082   // Pointer to logger.
0083   Logger*        loggerPtr        = {};
0084 
0085   // Pointer to the hadron widths data table
0086   HadronWidths*  hadronWidthsPtr  = {};
0087 
0088   // Pointer to the random number generator.
0089   Rndm*          rndmPtr          = {};
0090 
0091   // Pointers to SM and SUSY couplings.
0092   CoupSM*        coupSMPtr        = {};
0093   CoupSUSY*      coupSUSYPtr      = {};
0094 
0095   // Pointers to the two incoming beams and to Pomeron, photon or VMD
0096   // beam-inside-beam cases.
0097   BeamSetup*    beamSetupPtr    = {};
0098   BeamParticle* beamAPtr        = {};
0099   BeamParticle* beamBPtr        = {};
0100   BeamParticle* beamPomAPtr     = {};
0101   BeamParticle* beamPomBPtr     = {};
0102   BeamParticle* beamGamAPtr     = {};
0103   BeamParticle* beamGamBPtr     = {};
0104   BeamParticle* beamVMDAPtr     = {};
0105   BeamParticle* beamVMDBPtr     = {};
0106 
0107   // Pointer to information on subcollision parton locations.
0108   PartonSystems* partonSystemsPtr = {};
0109 
0110   // Pointers to the total/elastic/diffractive cross sections.
0111   SigmaTotal*    sigmaTotPtr      = {};
0112   SigmaCombined* sigmaCmbPtr      = {};
0113 
0114   // A set of sub objects that should have their information in sync
0115   // with This.
0116   set<PhysicsBase*> subObjects;
0117 
0118   // Pointer to the UserHooks object (needs to be sett to null in
0119   // classes deriving from UserHooks to avoid closed loop ownership).
0120   UserHooksPtr      userHooksPtr;
0121 
0122 private:
0123 
0124   friend class Pythia;
0125 
0126   // Calls onBeginEvent, then propagates the call to all sub objects
0127   void beginEvent();
0128 
0129   // Calls onEndEvent, then propagates the call to all sub objects
0130   void endEvent(Status status);
0131 
0132   // Calls onStat, then propagates the call to all sub objects
0133   void stat();
0134 
0135 };
0136 
0137 //==========================================================================
0138 
0139 } // end namespace Pythia8
0140 
0141 #endif // Pythia8_PhysicsBase_H