Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // SpaceShower.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 // Header file for the base class of spacelike initial-state showers.
0007 // SpaceShower: handles the showering description.
0008 
0009 #ifndef Pythia8_SpaceShower_H
0010 #define Pythia8_SpaceShower_H
0011 
0012 #include "Pythia8/Basics.h"
0013 #include "Pythia8/BeamParticle.h"
0014 #include "Pythia8/Event.h"
0015 #include "Pythia8/Info.h"
0016 #include "Pythia8/ParticleData.h"
0017 #include "Pythia8/PartonSystems.h"
0018 #include "Pythia8/PartonVertex.h"
0019 #include "Pythia8/PhysicsBase.h"
0020 #include "Pythia8/PythiaStdlib.h"
0021 #include "Pythia8/Settings.h"
0022 #include "Pythia8/StandardModel.h"
0023 #include "Pythia8/UserHooks.h"
0024 #include "Pythia8/MergingHooks.h"
0025 #include "Pythia8/Weights.h"
0026 
0027 namespace Pythia8 {
0028 
0029 //==========================================================================
0030 
0031 // The SpaceShower class does spacelike showers.
0032 
0033 class SpaceShower : public PhysicsBase {
0034 
0035 public:
0036   // Constructor.
0037   SpaceShower() = default;
0038 
0039   // Destructor.
0040   virtual ~SpaceShower() {}
0041 
0042   // Initialize various pointers.
0043   // (Separated from rest of init since not virtual.)
0044   void initPtrs(MergingHooksPtr mergingHooksPtrIn,
0045     PartonVertexPtr partonVertexPtrIn,
0046     WeightContainer* weightContainerPtrIn) {
0047     coupSMPtr = infoPtr->coupSMPtr;
0048     mergingHooksPtr = mergingHooksPtrIn;
0049     partonVertexPtr = partonVertexPtrIn;
0050     weightContainerPtr = weightContainerPtrIn;
0051   }
0052 
0053   // New beams possible for handling of hard diffraction. (Not virtual.)
0054   void reassignBeamPtrs( BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
0055     int beamOffsetIn = 0) {beamAPtr = beamAPtrIn; beamBPtr = beamBPtrIn;
0056     beamOffset = beamOffsetIn;}
0057 
0058   // Initialize generation. Possibility to force re-initialization by hand.
0059   // Usage: init( beamAPtr, beamBPtr).
0060   virtual void init(BeamParticle* , BeamParticle* ) {}
0061 
0062   // Find whether to limit maximum scale of emissions, and whether to dampen.
0063   // Usage: limitPTmax( event, Q2Fac, double Q2Ren).
0064   virtual bool limitPTmax( Event& , double = 0., double = 0.) {return true;}
0065 
0066   // Prepare system for evolution; identify ME.
0067   // Usage: prepare( iSys, event, limitPTmax).
0068   virtual void prepare( int , Event& , bool = true) {}
0069 
0070   // Update dipole list after each FSR emission.
0071   // Usage: update( iSys, event, hasWeakRad).
0072   virtual void update( int , Event&, bool = false) {}
0073 
0074   // Select next pT in downwards evolution.
0075   // Usage: pTnext( event, pTbegAll, pTendAll, nRadIn, doTrialIn).
0076   virtual double pTnext( Event& , double , double , int = -1, bool = false)
0077     { return 0.;}
0078 
0079   // ME corrections and kinematics that may give failure.
0080   // Usage: branch( event).
0081   virtual bool branch( Event& ) {return true;}
0082 
0083   // Print dipole list; for debug mainly.
0084   virtual void list() const {}
0085 
0086   // Initialize data members for calculation of uncertainty bands.
0087   virtual bool initUncertainties() {return false;}
0088 
0089   // Initialize data members for application of enhancements.
0090   virtual bool initEnhancements() {return false;}
0091 
0092   // Flag for failure in branch(...) that will force a retry of parton level.
0093   virtual bool doRestart() const {return false;}
0094 
0095   // Tell if latest scattering was a gamma->qqbar.
0096   virtual bool wasGamma2qqbar() { return false; }
0097 
0098   // Tell whether ISR has done a weak emission.
0099   virtual bool getHasWeaklyRadiated() {return false;}
0100 
0101   // Tell which system was the last processed one.
0102   virtual int system() const {return 0;}
0103 
0104   // Potential enhancement factor of pTmax scale for hardest emission.
0105   virtual double enhancePTmax() const {return 1.;}
0106 
0107   // Functions to allow usage of shower kinematics, evolution variables,
0108   // and splitting probabilities outside of shower.
0109   // Virtual so that shower plugins can overwrite these functions.
0110   // This makes it possible for another piece of the code to request
0111   // these - which is very convenient for merging.
0112   // Function variable names are not included to avoid compiler warnings.
0113   // Please see the documentation under "Implement New Showers" for details.
0114 
0115   // Return clustering kinematics - as needed for merging.
0116   virtual Event clustered( const Event& , int , int , int , string )
0117     { return Event();}
0118 
0119   // Return the evolution variable(s).
0120   // Important note: this map must contain the following entries
0121   // - a key "t" for the value of the shower evolution variable;
0122   // - a key "tRS" for the value of the shower evolution variable
0123   //   from which the shower would be restarted after a branching;
0124   // - a key "scaleAS" for the argument of alpha_s used for the branching;
0125   // - a key "scalePDF" for the argument of the PDFs used for the branching.
0126   // Usage: getStateVariables( event, iRad, iEmt, iRec,  name)
0127   virtual map<string, double> getStateVariables (const Event& , int , int ,
0128     int , string ) { return map<string,double>();}
0129 
0130   // Check if attempted clustering is handled by spacelike shower.
0131   // Usage: isSpacelike( event, iRad, iEmt, iRec, name)
0132   virtual bool isSpacelike(const Event&, int, int, int, string)
0133     { return false; }
0134 
0135   // Return a string identifier of a splitting.
0136   // Usage: getSplittingName( event, iRad, iEmt, iRec)
0137   virtual vector<string> getSplittingName( const Event& , int , int , int )
0138     { return vector<string>();}
0139 
0140   // Return the splitting probability.
0141   // Usage: getSplittingProb( event, iRad, iEmt, iRec)
0142   virtual double getSplittingProb( const Event& , int , int , int , string )
0143     { return 0.;}
0144 
0145   virtual bool allowedSplitting( const Event& , int , int)
0146     { return true;}
0147   virtual vector<int> getRecoilers( const Event&, int, int, string)
0148     { return vector<int>(); }
0149 
0150   virtual double enhanceFactor(const string& name) {
0151     unordered_map<string, double>::iterator it = enhanceISR.find(name);
0152     if ( it == enhanceISR.end() ) return 1.;
0153     return it->second;
0154   }
0155 
0156   // Functions to directly extract the probability of no emission between two
0157   // scales. This functions is not used in the Pythia core code, but can be
0158   // used by external programs to interface with the shower directly.
0159   virtual double noEmissionProbability( double, double, double, int, int,
0160     double, double) { return 1.; }
0161 
0162   // Pointer to MergingHooks object for NLO merging.
0163   MergingHooksPtr  mergingHooksPtr{};
0164 
0165   WeightContainer* weightContainerPtr{};
0166 
0167 protected:
0168 
0169   // Beam location offset in event.
0170   int            beamOffset{};
0171 
0172   // Pointer to assign space-time vertices during parton evolution.
0173   PartonVertexPtr  partonVertexPtr{};
0174 
0175   // Store uncertainty variations relevant to SpaceShower.
0176   bool   doUncertainties{}, uVarMuSoftCorr{}, uVarMPIshowers{};
0177   int    nUncertaintyVariations{}, nVarQCD{}, uVarNflavQ{};
0178   double dASmax{}, cNSpTmin{}, uVarpTmin2{}, overFactor{};
0179   map<int,double> varG2GGmuRfac, varQ2QGmuRfac, varQ2GQmuRfac, varG2QQmuRfac,
0180     varX2XGmuRfac, varG2GGcNS, varQ2QGcNS, varQ2GQcNS, varG2QQcNS, varX2XGcNS;
0181   map<int,double>* varPDFplus;
0182   map<int,double>* varPDFminus;
0183   map<int,double>* varPDFmember;
0184   unordered_map<string,double> enhanceISR;
0185 
0186 };
0187 
0188 //==========================================================================
0189 
0190 } // end namespace Pythia8
0191 
0192 #endif // Pythia8_SpaceShower_H