Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Merging.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 is written by Stefan Prestel.
0007 // Merging: Wrapper class to interface matrix element merging schemes with
0008 //          Pythia
0009 
0010 #ifndef Pythia8_Merging_H
0011 #define Pythia8_Merging_H
0012 
0013 #include "Pythia8/Basics.h"
0014 #include "Pythia8/BeamParticle.h"
0015 #include "Pythia8/Event.h"
0016 #include "Pythia8/History.h"
0017 #include "Pythia8/Info.h"
0018 #include "Pythia8/MergingHooks.h"
0019 #include "Pythia8/ParticleData.h"
0020 #include "Pythia8/PartonLevel.h"
0021 #include "Pythia8/PhysicsBase.h"
0022 #include "Pythia8/PythiaStdlib.h"
0023 #include "Pythia8/Settings.h"
0024 #include "Pythia8/StandardModel.h"
0025 
0026 namespace Pythia8 {
0027 
0028 //==========================================================================
0029 
0030 // Merging is a wrapper class for the interface of matrix element merging and
0031 // Pythia8.
0032 
0033 class Merging : public PhysicsBase {
0034 
0035 public:
0036 
0037   // Constructor.
0038   Merging() : PhysicsBase(), lhaPtr(nullptr), trialPartonLevelPtr(),
0039     mergingHooksPtr(), tmsNowMin() {}
0040 
0041   // Destructor.
0042   virtual ~Merging(){}
0043 
0044   // Initialisation function for internal use inside Pythia source code
0045   void initPtrs( MergingHooksPtr mergingHooksPtrIn,
0046     PartonLevel* trialPartonLevelPtrIn) {
0047     trialPartonLevelPtr = trialPartonLevelPtrIn;
0048     mergingHooksPtr = mergingHooksPtrIn;
0049   }
0050 
0051   // Initialisation function for internal use inside Pythia source code
0052   virtual void init();
0053 
0054   // Function to print statistics.
0055   virtual void statistics();
0056 
0057   // Function to steer different merging prescriptions.
0058   virtual int mergeProcess( Event& process);
0059 
0060   // Runtime interface functions for communication with aMCatNLO
0061   // Function to retrieve shower scale information (to be used to set
0062   // scales in aMCatNLO-LHEF-production.
0063   virtual void getStoppingInfo(double scales[100][100],
0064     double masses[100][100]);
0065 
0066   // Function to retrieve if any of the shower scales would not have been
0067   // possible to produce by Pythia.
0068   virtual void getDeadzones(bool dzone[100][100]);
0069 
0070   // Function to generate Sudakov factors for MCatNLO-Delta.
0071   virtual double generateSingleSudakov (double pTbegAll, double pTendAll,
0072     double m2dip, int idA, int type, double s = -1., double x = -1.);
0073 
0074   LHEF3FromPythia8Ptr lhaPtr;
0075   void setLHAPtr(LHEF3FromPythia8Ptr lhaUpIn) { lhaPtr = lhaUpIn; }
0076 
0077 protected:
0078 
0079   // Make Pythia class friend
0080   friend class Pythia;
0081 
0082   // Pointer to trial PartonLevel object
0083   PartonLevel* trialPartonLevelPtr;
0084 
0085   // Pointer to trial MergingHooks object
0086   MergingHooksPtr mergingHooksPtr;
0087 
0088   // Minimal value found for the merging scale in events.
0089   double tmsNowMin;
0090   static const double TMSMISMATCH;
0091 
0092   // Minimum allowed weight value to prevent division by zero.
0093   static const double MINWGT;
0094 
0095   // Function to perform CKKW-L merging on the event.
0096   int mergeProcessCKKWL( Event& process);
0097 
0098   // Function to perform UMEPS merging on the event.
0099   int mergeProcessUMEPS( Event& process);
0100 
0101   // Function to perform NL3 NLO merging on the event.
0102   int mergeProcessNL3( Event& process);
0103 
0104   // Function to perform UNLOPS merging on the event.
0105   int mergeProcessUNLOPS( Event& process);
0106 
0107   // Function to apply the merging scale cut on an input event.
0108   bool cutOnProcess( Event& process);
0109 
0110   // Clear all information stored in the runtime interface to aMCatNLO.
0111   void clearInfos() {
0112     stoppingScalesSave.clear();
0113     mDipSave.clear();
0114     radSave.clear();
0115     emtSave.clear();
0116     recSave.clear();
0117     isInDeadzone.clear();
0118   }
0119 
0120   // Store all information required for the runtime interface to aMCatNLO.
0121   int clusterAndStore(Event& process);
0122 
0123   // Helper function to be able to extract all shower scales by checking
0124   // all dipoles. Relevant only to runtime aMC@NLO interface.
0125   void getDipoles( int iRad, int colTag, int colSign,
0126     const Event& event, vector<pair<int,int> >& dipEnds);
0127 
0128   // Saved information about shower stopping scales, dipole masses,
0129   // dipole ends, and whether or not a clustering is in the shower
0130   // deadzone. Relevant only to runtime aMC@NLO interface.
0131   vector<double> stoppingScalesSave, mDipSave;
0132   vector<int> radSave, emtSave, recSave;
0133   vector<bool> isInDeadzone;
0134 
0135 };
0136 
0137 //==========================================================================
0138 
0139 } // end namespace Pythia8
0140 
0141 #endif // Pythia8_Merging_H