Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // TimeShower.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 timelike final-state showers.
0007 // TimeShower: handles the showering description.
0008 
0009 #ifndef Pythia8_TimeShower_H
0010 #define Pythia8_TimeShower_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/PhysicsBase.h"
0019 #include "Pythia8/PythiaStdlib.h"
0020 #include "Pythia8/PartonVertex.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 TimeShower class does timelike showers.
0032 
0033 class TimeShower : public PhysicsBase {
0034 
0035 public:
0036 
0037   // Constructor.
0038   TimeShower() = default;
0039 
0040   // Destructor.
0041   virtual ~TimeShower() {}
0042 
0043   // Initialize various pointers.
0044   // (Separated from rest of init since not virtual.)
0045   void initPtrs(MergingHooksPtr mergingHooksPtrIn,
0046     PartonVertexPtr partonVertexPtrIn,
0047     WeightContainer* weightContainerPtrIn) {
0048     coupSMPtr = infoPtr->coupSMPtr;
0049     mergingHooksPtr = mergingHooksPtrIn;
0050     partonVertexPtr = partonVertexPtrIn;
0051     weightContainerPtr = weightContainerPtrIn;
0052   }
0053 
0054   // New beams possible for handling of hard diffraction. (Not virtual.)
0055   void reassignBeamPtrs( BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
0056     int beamOffsetIn = 0) {beamAPtr = beamAPtrIn; beamBPtr = beamBPtrIn;
0057     beamOffset = beamOffsetIn;}
0058 
0059   // Initialize alphaStrong and related pTmin parameters.
0060   // Usage: init( beamAPtr, beamBPtr).
0061   virtual void init( BeamParticle* = 0, BeamParticle* = 0) {}
0062 
0063   // Find whether to limit maximum scale of emissions, and whether to dampen.
0064   // Usage: limitPTmax( event, Q2Fac, double Q2Ren).
0065   virtual bool limitPTmax( Event& , double = 0., double = 0.) {return true;}
0066 
0067   // Top-level routine to do a full time-like shower in resonance decay.
0068   // Usage: shower( iBeg, iEnd, event, pTmax, nBranchMax).
0069   virtual int shower( int , int , Event& , double , int = 0) {return 0;}
0070 
0071   // Top-level routine for QED radiation in hadronic decay to two leptons.
0072   // Usage: showerQED( i1, i2, event, pTmax).
0073   virtual int showerQED( int , int , Event& , double ) {return 0;}
0074 
0075   // Optional method to add QED showers after remnants have been added
0076   // but before hadronisation. (Called from PartonLevel.)
0077   virtual int showerQEDafterRemnants(Event&) { return 0; }
0078 
0079   // Prepare process-level event for shower + interleaved resonance decays.
0080   // Usage: prepareProcess( process, event, iPos).
0081   // iPos provides mapping from process to event entries (before showering).
0082   virtual void prepareProcess( Event&, Event&, vector<int>&) {};
0083 
0084   // Global recoil: reset counters and store locations of outgoing partons.
0085   // Usage: prepareGlobal( event).
0086   virtual void prepareGlobal( Event& ) {}
0087 
0088   // Prepare system for evolution after each new interaction; identify ME.
0089   // Usage: prepare( iSys, event, limitPTmax).
0090   virtual void prepare( int , Event& , bool = true) {}
0091 
0092   // Update dipole list after a multiparton interactions rescattering.
0093   // Usage: rescatterUpdate( iSys, event).
0094   virtual void rescatterUpdate( int , Event& ) {}
0095 
0096   // Update dipole list after each ISR emission.
0097   // Usage: update( iSys, event, hasWeakRad).
0098   virtual void update( int , Event& , bool = false) {}
0099 
0100   // Select next pT in downwards evolution.
0101   // Usage: pTnext( event, pTbegAll, pTendAll, isFirstTrial, doTrialIn).
0102   virtual double pTnext( Event& , double , double , bool = false, bool = false)
0103     { return 0.;}
0104 
0105   // Select next pT for interleaved resonance decays.
0106   virtual double pTnextResDec() { return 0.; }
0107 
0108   // ME corrections and kinematics that may give failure.
0109   // Usage: branch( event, isInterleaved).
0110   virtual bool branch( Event& , bool = false) {return true;}
0111 
0112   // Handle a resonance decay + resonance shower (including any nested decays).
0113   // Assumes decay channel and kinematics already selected and present in
0114   // either the process or event record.
0115   // May be called recursively for nested decays.
0116   // Usage: resonanceShower( process, event, iPos, pTmerge), where iPos
0117   // maps process to event entries, and pTmerge is the scale at which this
0118   // system should be merged into its parent system.
0119   virtual bool resonanceShower( Event&, Event&, vector<int>&, double = 0.)
0120     { return false;}
0121 
0122   // Print dipole list; for debug mainly.
0123   virtual void list() const {}
0124 
0125   // Initialize data members for calculation of uncertainty bands.
0126   virtual bool initUncertainties() {return false;}
0127 
0128   // Initialize data members for application of enhancements.
0129   virtual bool initEnhancements() {return false;}
0130 
0131   // Tell whether FSR has done a weak emission.
0132   virtual bool getHasWeaklyRadiated() {return false;}
0133 
0134   // Tell which system was the last processed one.
0135   virtual int system() const {return 0;}
0136 
0137   // Potential enhancement factor of pTmax scale for hardest emission.
0138   virtual double enhancePTmax() {return 1.;}
0139 
0140   // Provide the pT scale of the last branching in the above shower.
0141   virtual double pTLastInShower() {return 0.;}
0142 
0143   // Functions to allow usage of shower kinematics, evolution variables,
0144   // and splitting probabilities outside of shower.
0145   // Virtual so that shower plugins can overwrite these functions.
0146   // This makes it possible for another piece of the code to request
0147   // these - which is very convenient for merging.
0148   // Function variable names are not included to avoid compiler warnings.
0149   // Please see the documentation under "Implement New Showers" for details.
0150 
0151   // Return clustering kinematics - as needed for merging.
0152   virtual Event clustered( const Event& , int , int , int , string )
0153     { return Event();}
0154 
0155   // Return the evolution variable(s).
0156   // Important note: this map must contain the following entries
0157   // - a key "t" for the value of the shower evolution variable;
0158   // - a key "tRS" for the value of the shower evolution variable
0159   //   from which the shower would be restarted after a branching;
0160   // - a key "scaleAS" for the argument of alpha_s used for the branching;
0161   // - a key "scalePDF" for the argument of the PDFs used for the branching.
0162   // Usage: getStateVariables( event, iRad, iEmt, iRec,  name)
0163   virtual map<string, double> getStateVariables (const Event& , int , int ,
0164     int , string ) { return map<string,double>();}
0165 
0166   // Check if attempted clustering is handled by timelike shower
0167   // Usage: isTimelike( event, iRad, iEmt, iRec, name)
0168   virtual bool isTimelike(const Event& , int , int , int , string )
0169     { return false; }
0170 
0171   // Return a string identifier of a splitting.
0172   // Usage: getSplittingName( event, iRad, iEmt, iRec)
0173   virtual vector<string> getSplittingName( const Event& , int, int , int)
0174     { return vector<string>();}
0175 
0176   // Return the splitting probability.
0177   // Usage: getSplittingProb( event, iRad, iEmt, iRec)
0178   virtual double getSplittingProb( const Event& , int , int , int , string )
0179     { return 0.;}
0180   virtual bool allowedSplitting( const Event& , int , int)
0181     { return true; }
0182   virtual vector<int> getRecoilers( const Event&, int, int, string)
0183     { return vector<int>(); }
0184 
0185   virtual double enhanceFactor(const string& name) {
0186     unordered_map<string, double>::iterator it = enhanceFSR.find(name);
0187     if ( it == enhanceFSR.end() ) return 1.;
0188     return it->second;
0189   }
0190 
0191   // Functions to directly extract the probability of no emission between two
0192   // scales. This functions is not used in the Pythia core code, but can be
0193   // used by external programs to interface with the shower directly.
0194   virtual double noEmissionProbability( double, double, double, int, int,
0195     double, double) { return 1.; }
0196 
0197   // Pointer to MergingHooks object for NLO merging.
0198   MergingHooksPtr  mergingHooksPtr{};
0199 
0200   WeightContainer* weightContainerPtr{};
0201 
0202 protected:
0203 
0204   // Beam location offset in event.
0205   int              beamOffset{};
0206 
0207   // Pointer to assign space-time vertices during parton evolution.
0208   PartonVertexPtr  partonVertexPtr{};
0209 
0210   // Store uncertainty variations relevant to TimeShower.
0211   bool   doUncertainties{}, uVarMuSoftCorr{}, uVarMPIshowers{},
0212          noResVariations{}, noProcVariations{};
0213   int    nUncertaintyVariations{}, nVarQCD{}, uVarNflavQ{};
0214   double dASmax{}, cNSpTmin{}, uVarpTmin2{}, overFactor{}, overFactorEnhance{};
0215   map<int,double> varG2GGmuRfac, varQ2QGmuRfac, varG2QQmuRfac, varX2XGmuRfac,
0216                   varG2GGcNS, varQ2QGcNS, varG2QQcNS, varX2XGcNS;
0217   map<int,double>* varPDFplus;
0218   map<int,double>* varPDFminus;
0219   map<int,double>* varPDFmember;
0220   unordered_map<string,double> enhanceFSR;
0221 
0222 };
0223 
0224 //==========================================================================
0225 
0226 } // end namespace Pythia8
0227 
0228 #endif // Pythia8_TimeShower_H