Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Pythia8/PartonLevel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // PartonLevel.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 main class for parton-level event generation
0007 // PartonLevel: administrates showers, multiparton interactions and remnants.
0008 
0009 #ifndef Pythia8_PartonLevel_H
0010 #define Pythia8_PartonLevel_H
0011 
0012 #include "Pythia8/Basics.h"
0013 #include "Pythia8/BeamParticle.h"
0014 #include "Pythia8/BeamRemnants.h"
0015 #include "Pythia8/Event.h"
0016 #include "Pythia8/HardDiffraction.h"
0017 #include "Pythia8/Info.h"
0018 #include "Pythia8/JunctionSplitting.h"
0019 #include "Pythia8/MergingHooks.h"
0020 #include "Pythia8/MultipartonInteractions.h"
0021 #include "Pythia8/ParticleData.h"
0022 #include "Pythia8/PartonSystems.h"
0023 #include "Pythia8/PartonVertex.h"
0024 #include "Pythia8/PhysicsBase.h"
0025 #include "Pythia8/PythiaStdlib.h"
0026 #include "Pythia8/ResonanceDecays.h"
0027 #include "Pythia8/RHadrons.h"
0028 #include "Pythia8/Settings.h"
0029 #include "Pythia8/Settings.h"
0030 #include "Pythia8/SharedPointers.h"
0031 #include "Pythia8/SigmaTotal.h"
0032 #include "Pythia8/SpaceShower.h"
0033 #include "Pythia8/StandardModel.h"
0034 #include "Pythia8/StringLength.h"
0035 #include "Pythia8/TimeShower.h"
0036 #include "Pythia8/UserHooks.h"
0037 
0038 namespace Pythia8 {
0039 
0040 //==========================================================================
0041 
0042 // The PartonLevel class contains the top-level routines to generate
0043 // the partonic activity of an event.
0044 
0045 class PartonLevel : public PhysicsBase {
0046 
0047 public:
0048 
0049   // Constructor.
0050   PartonLevel() = default;
0051 
0052   // Initialization of all classes at the parton level.
0053   bool init( TimeShowerPtr timesDecPtrIn, TimeShowerPtr timesPtrIn,
0054     SpaceShowerPtr spacePtrIn, RHadronsPtr rHadronsPtrIn,
0055     MergingHooksPtr mergingHooksPtr, PartonVertexPtr partonVertexPtrIn,
0056     StringIntPtr stringInteractionPtrIn,
0057     bool useAsTrial);
0058 
0059   // Special setup to allow switching between beam PDFs for MPI handling.
0060   // Not needed when MPI for incoming pomeron, since same for all beams.
0061   void initSwitchID( const vector<int>& idAList) {
0062     multiMB.initSwitchID(  idAList);
0063     multiSDA.initSwitchID( idAList);}
0064 
0065   // Switch to new beam particle identities; for similar hadrons only.
0066   void setBeamID(int iPDFA = 0) {multiMB.setBeamID(iPDFA);
0067     multiSDA.setBeamID(iPDFA);}
0068 
0069   // Generate the next parton-level process.
0070   bool next( Event& process, Event& event);
0071 
0072   // Perform showers in resonance decay chains. (For special cases.)
0073   void setupShowerSys( Event& process, Event& event);
0074   bool resonanceShowers( Event& process, Event& event, bool skipForR);
0075 
0076   // Perform decays and showers of W and Z emitted in shower.
0077   bool wzDecayShowers( Event& event);
0078 
0079   // Tell whether failure was due to vetoing.
0080   bool hasVetoed() const {return doVeto;}
0081   bool hasVetoedDiff() const {return doDiffVeto;}
0082   bool hasVetoedMerging() const {return doMergingVeto;}
0083 
0084   // Accumulate, print and reset statistics.
0085   void accumulate() {if (isResolved && !isDiff) multiPtr->accumulate();}
0086   void statistics(bool reset = false) {
0087     if (doMPI) multiMB.statistics(reset);}
0088   void resetStatistics() { if (doMPI) multiMB.resetStatistics(); }
0089 
0090   // Reset PartonLevel object for trial shower usage.
0091   void resetTrial();
0092   // Provide the pT scale of the last branching in the shower.
0093   double pTLastInShower() { return pTLastBranch; }
0094   // Provide the type of the last branching in the shower.
0095   int typeLastInShower() { return typeLastBranch; }
0096 
0097   // Check of any trial emissions could have been enhanced.
0098   bool canEnhanceTrial() { return doEnhanceTrial; }
0099   // Get enhanced trial emission evolution variable.
0100   double getEnhancedTrialPT() {
0101     if (canEnhanceTrial()) return infoPtr->weightContainerPtr->
0102       weightsSimpleShower.getEnhancedTrialPT();
0103     return 0.;
0104   }
0105   // Get enhanced trial emission weight.
0106   double getEnhancedTrialWeight() {
0107     if (canEnhanceTrial()) return infoPtr->weightContainerPtr->
0108       weightsSimpleShower.getEnhancedTrialWeight();
0109     return 1.;
0110   }
0111 
0112   // Spare copies of normal beam pointers.
0113   BeamParticle* beamHadAPtr{};
0114   BeamParticle* beamHadBPtr{};
0115 
0116   // Pointers to timelike showers for resonance decays and the rest.
0117   TimeShowerPtr   timesDecPtr{};
0118   TimeShowerPtr   timesPtr{};
0119 
0120   // Pointer to spacelike showers.
0121   SpaceShowerPtr  spacePtr{};
0122 
0123 protected:
0124 
0125   virtual void onInitInfoPtr() override {
0126     registerSubObject(multiMB);
0127     registerSubObject(multiSDA);
0128     registerSubObject(multiSDB);
0129     registerSubObject(multiCD);
0130     registerSubObject(multiGmGm);
0131     registerSubObject(remnants);
0132     registerSubObject(resonanceDecays);
0133     registerSubObject(junctionSplitting);
0134     registerSubObject(hardDiffraction);
0135   }
0136 
0137 private:
0138 
0139   // Constants: could only be changed in the code itself.
0140   static const int NTRY;
0141 
0142   // Initialization data, mainly read from Settings.
0143   bool   doNonDiff{}, doDiffraction{}, doMPI{}, doMPIMB{}, doMPISDA{},
0144          doMPISDB{}, doMPICD{}, doMPIinit{}, doISR{}, doFSRduringProcess{},
0145          doFSRafterProcess{}, doFSRinResonances{}, doInterleaveResDec{},
0146          doRemnants{}, doSecondHard{}, hasOneLeptonBeam{}, hasTwoLeptonBeams{},
0147          hasPointLeptons{}, canVetoPT{}, canVetoStep{}, canVetoMPIStep{},
0148          canVetoEarly{}, canSetScale{}, allowRH{}, earlyResDec{},
0149          vetoWeakJets{}, canReconResSys{}, doReconnect{}, doHardDiff{},
0150          forceResonanceCR{}, doNDgamma{}, doMPIgmgm{}, showUnresGamma{};
0151   int    pTmaxMatchMPI;
0152   double mMinDiff{}, mWidthDiff{}, pMaxDiff{}, vetoWeakDeltaR2{};
0153 
0154   // Event generation strategy. Number of steps. Maximum pT scales.
0155   bool   doVeto{};
0156   int    nMPI{}, nISR{}, nFSRinProc{}, nFSRinRes{}, nISRhard{}, nFSRhard{},
0157          typeLatest{}, nVetoStep{}, typeVetoStep{}, nVetoMPIStep{}, iSysNow{},
0158          reconnectMode{}, hardDiffSide{}, sampleTypeDiff{};
0159   double pTsaveMPI{}, pTsaveISR{}, pTsaveFSR{}, pTvetoPT{};
0160 
0161   // Current event properties.
0162   bool   isNonDiff{}, isDiffA{}, isDiffB{}, isDiffC{}, isDiff{},
0163          isSingleDiff{}, isDoubleDiff{}, isCentralDiff{},
0164          isResolved{}, isResolvedA{}, isResolvedB{}, isResolvedC{},
0165          isHardDiffA{}, isHardDiffB{}, isHardDiff{}, doDiffVeto{},
0166          hardDiffSet{}, isElastic{}, twoHard{};
0167   int    sizeProcess{}, sizeEvent{}, nHardDone{}, nHardDoneRHad{}, iDS{};
0168   double eCMsave;
0169   vector<bool> inRHadDecay;
0170   vector<int>  iPosBefShow;
0171 
0172   // Variables for photon inside electron.
0173   bool   hasGammaA{}, hasGammaB{}, beamHasGamma{}, beamAisGamma{},
0174          beamBisGamma{}, beamAhasGamma{}, beamBhasGamma{}, beamAhasResGamma{},
0175          beamBhasResGamma{}, beamHasResGamma{}, isGammaHadronDir{},
0176          sampleQ2gamma{};
0177   int    gammaMode{}, gammaModeEvent{}, gammaOffset{};
0178   double eCMsaveGamma{};
0179 
0180   // Pointer to assign space-time vertices during parton evolution.
0181   PartonVertexPtr partonVertexPtr{};
0182 
0183   // The generator classes for multiparton interactions.
0184   MultipartonInteractions  multiMB;
0185   MultipartonInteractions  multiSDA;
0186   MultipartonInteractions  multiSDB;
0187   MultipartonInteractions  multiCD;
0188   MultipartonInteractions* multiPtr{};
0189   MultipartonInteractions  multiGmGm;
0190 
0191   // The generator class to construct beam-remnant kinematics.
0192   BeamRemnants remnants;
0193 
0194   // The RHadrons class is used to fragment off and decay R-hadrons.
0195   RHadronsPtr rHadronsPtr{};
0196 
0197   // ResonanceDecay object does sequential resonance decays.
0198   ResonanceDecays resonanceDecays;
0199 
0200   // The Colour reconnection class used to do colour reconnection.
0201   ColRecPtr colourReconnectionPtr{};
0202 
0203   // The Junction splitting class used to split junctions systems.
0204   JunctionSplitting junctionSplitting;
0205 
0206   // The Diffraction class is for hard diffraction selection.
0207   HardDiffraction hardDiffraction;
0208 
0209   // Resolved diffraction: find how many systems should have it.
0210   int decideResolvedDiff( Event& process);
0211 
0212   // Set up an unresolved process, i.e. elastic or diffractive.
0213   bool setupUnresolvedSys( Event& process, Event& event);
0214 
0215   // Set up the hard process, excluding subsequent resonance decays.
0216   void setupHardSys( Event& process, Event& event);
0217 
0218   // Resolved diffraction: pick whether to have it and set up for it.
0219   void setupResolvedDiff( Event& process);
0220 
0221   // Resolved diffraction: restore normal behaviour.
0222   void leaveResolvedDiff( int iHardLoop, Event& process, Event& event);
0223 
0224   // Hard diffraction: set up the process record.
0225   void setupHardDiff( Event& process);
0226 
0227   // Hard diffraction: leave the process record.
0228   void leaveHardDiff( Event& process, Event& event, bool physical = true);
0229 
0230   // Photon beam inside lepton beam: set up the parton level generation.
0231   bool setupResolvedLeptonGamma( Event& process);
0232 
0233   // Photon beam inside lepton beam: recover the whole event and
0234   // add scattered leptons.
0235   void leaveResolvedLeptonGamma( Event& process, Event& event,
0236     bool physical = true);
0237 
0238   // Set the photon collision mode for the current event.
0239   void saveGammaModeEvent( int gammaModeA, int gammaModeB);
0240 
0241   // Photon beam inside lepton beam: set up the parton level generation.
0242   void cleanEventFromGamma( Event& event);
0243 
0244   // Pointer to MergingHooks object for user interaction with the merging.
0245   MergingHooksPtr mergingHooksPtr{};
0246   // Parameters to specify trial shower usage.
0247   bool doTrial{};
0248   bool doEnhanceTrial{};
0249   int nTrialEmissions{};
0250   // Parameters to store to veto trial showers.
0251   double pTLastBranch{};
0252   int typeLastBranch{};
0253   // Parameters to specify merging usage.
0254   bool canRemoveEvent{}, canRemoveEmission{}, doMergingVeto{};
0255 
0256 };
0257 
0258 //==========================================================================
0259 
0260 } // end namespace Pythia8
0261 
0262 #endif // Pythia8_PartonLevel_H