Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:28

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