Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // BeamSetup.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 a helper class for the setup of beam flavour,
0007 // kinematics and PDFs.
0008 
0009 #ifndef Pythia8_BeamSetup_H
0010 #define Pythia8_BeamSetup_H
0011 
0012 #include "Pythia8/Basics.h"
0013 #include "Pythia8/BeamParticle.h"
0014 #include "Pythia8/BeamShape.h"
0015 #include "Pythia8/HadronLevel.h"
0016 #include "Pythia8/Info.h"
0017 #include "Pythia8/LesHouches.h"
0018 #include "Pythia8/ParticleData.h"
0019 #include "Pythia8/PartonDistributions.h"
0020 #include "Pythia8/PartonLevel.h"
0021 #include "Pythia8/PhysicsBase.h"
0022 #include "Pythia8/ProcessLevel.h"
0023 #include "Pythia8/PythiaStdlib.h"
0024 #include "Pythia8/Settings.h"
0025 
0026 namespace Pythia8 {
0027 
0028 //==========================================================================
0029 
0030 // The BeamSetup class contains a number of routines auxiliary to Pythia
0031 // to set up beam flavour, kinematics and PDFs.
0032 
0033 class BeamSetup : public PhysicsBase {
0034 
0035 public:
0036 
0037   // Constructor.
0038   BeamSetup() = default;
0039 
0040   // Possibility to pass in pointers to PDF's.
0041   bool setPDFPtr( PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn,
0042     PDFPtr pdfHardAPtrIn = nullptr, PDFPtr pdfHardBPtrIn = nullptr,
0043     PDFPtr pdfPomAPtrIn = nullptr, PDFPtr pdfPomBPtrIn = nullptr,
0044     PDFPtr pdfGamAPtrIn = nullptr, PDFPtr pdfGamBPtrIn = nullptr,
0045     PDFPtr pdfHardGamAPtrIn = nullptr, PDFPtr pdfHardGamBPtrIn = nullptr,
0046     PDFPtr pdfUnresAPtrIn = nullptr, PDFPtr pdfUnresBPtrIn = nullptr,
0047     PDFPtr pdfUnresGamAPtrIn = nullptr, PDFPtr pdfUnresGamBPtrIn = nullptr,
0048     PDFPtr pdfVMDAPtrIn = nullptr, PDFPtr pdfVMDBPtrIn = nullptr);
0049   bool setPDFAPtr( PDFPtr pdfAPtrIn );
0050   bool setPDFBPtr( PDFPtr pdfBPtrIn );
0051 
0052   // Set photon fluxes externally. Used with option "PDF:lepton2gammaSet = 2".
0053   bool setPhotonFluxPtr( PDFPtr photonFluxAIn, PDFPtr photonFluxBIn) {
0054     if ( photonFluxAIn ) pdfGamFluxAPtr = photonFluxAIn;
0055     if ( photonFluxBIn ) pdfGamFluxBPtr = photonFluxBIn;
0056     return true;}
0057 
0058   // Possibility to pass in pointer to external LHA-interfaced generator.
0059   bool setLHAupPtr( LHAupPtr lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;
0060     useNewLHA = false; return true;}
0061 
0062   // For a given particle id, get a particle that represents its properties,
0063   // i.e. a particle with the same PDF shape and parameters.
0064   int represent(int idIn) const;
0065 
0066   // Switch to new beam particle identities; for similar hadrons only.
0067   bool setBeamIDs( int idAin, int idBin = 0);
0068 
0069   // Switch beam kinematics.
0070   bool setKinematics(double eCMIn);
0071   bool setKinematics(double eAIn, double eBIn);
0072   bool setKinematics(double pxAIn, double pyAIn, double pzAIn,
0073                      double pxBIn, double pyBIn, double pzBIn);
0074   bool setKinematics(Vec4 pAIn, Vec4 pBIn);
0075 
0076   // Possibility to pass in pointer for beam shape.
0077   bool setBeamShapePtr( BeamShapePtr beamShapePtrIn) {
0078     beamShapePtr = beamShapePtrIn; return true;}
0079 
0080   // Possibility to access the pointer to the BeamShape object.
0081   BeamShapePtr getBeamShapePtr() { return beamShapePtr; }
0082 
0083   // Return a parton density set among list of possibilities.
0084   PDFPtr getPDFPtr(int idIn, int sequence = 1, string beam = "A",
0085     bool resolved = true);
0086 
0087   // Return a map of the PDF pointers.
0088   map<string, PDFPtr> getPDFPtr();
0089 
0090   // Set up frame of beams, Les Houches input, and switches for beam handling.
0091   bool initFrame();
0092 
0093   // Initialize kinematics and PDFs of beams.
0094   bool initBeams(bool doNonPertIn, StringFlav* flavSelPtr);
0095 
0096   // Return whether VMD states sampled.
0097   bool getVMDsideA() { return doVMDsideA; }
0098   bool getVMDsideB() { return doVMDsideB; }
0099 
0100   // Clear all beams.
0101   void clear();
0102 
0103   // Pick new beam valence flavours (for pi0, eta, K0S, Pomeron, etc.).
0104   void newValenceContent();
0105 
0106   // Recalculate kinematics for each event when beam momentum has a spread.
0107   void nextKinematics();
0108 
0109   // Boost from CM frame to lab frame, or inverse. Set production vertex.
0110   void boostAndVertex( Event& process, Event& event, bool toLab,
0111     bool setVertex);
0112 
0113   // Print parton lists for the main beams. For debug mainly.
0114   void list() const { beamA.list(); beamB.list(); }
0115 
0116   // Some data values are kept public so that the Pythia class can access them.
0117   bool   doLHA = false, useNewLHA = false, skipInit = false,
0118          doMomentumSpread = {}, doVertexSpread = {}, doVarEcm = {},
0119          allowIDAswitch = {}, hasSwitchedIDs = {}, beamA2gamma = {},
0120          beamB2gamma = {};
0121   int    idA = {}, idB = {}, frameType = {}, boostType = {}, iPDFAsave = {},
0122          gammaMode = {};
0123   double mA = {}, mB = {}, pxA = {}, pxB = {}, pyA = {}, pyB = {}, pzA = {},
0124          pzB = {}, eA = {}, eB = {}, pzAcm = {}, pzBcm = {}, eCM = {},
0125          betaZ = {}, gammaZ = {};
0126   Vec4   pAinit = {}, pBinit = {}, pAnow = {}, pBnow = {};
0127   RotBstMatrix MfromCM = {}, MtoCM = {};
0128   LHAupPtr lhaUpPtr = {};
0129 
0130   // The two incoming beams.
0131   BeamParticle   beamA = {};
0132   BeamParticle   beamB = {};
0133 
0134   // Alternative Pomeron beam-inside-beam.
0135   BeamParticle beamPomA = {};
0136   BeamParticle beamPomB = {};
0137 
0138   // Alternative photon beam-inside-beam.
0139   BeamParticle beamGamA = {};
0140   BeamParticle beamGamB = {};
0141 
0142   // Alternative VMD beam-inside-beam.
0143   BeamParticle beamVMDA = {};
0144   BeamParticle beamVMDB = {};
0145 
0146   // Hadron types for rapid switching.
0147   vector<int> idAList = { 2212, 211, 311, 221,
0148          331, 333, 411, 431, 443, 511, 531, 541, 553, 3212, 3312, 3334,
0149          4112, 4312, 4332, 5112, 5312, 5332};
0150 
0151 protected:
0152 
0153   void onInitInfoPtr() override {
0154     registerSubObject(beamA);
0155     registerSubObject(beamB);
0156     registerSubObject(beamPomA);
0157     registerSubObject(beamPomB);
0158     registerSubObject(beamGamA);
0159     registerSubObject(beamGamB);
0160     registerSubObject(beamVMDA);
0161     registerSubObject(beamVMDB);
0162   }
0163 
0164 private:
0165 
0166   // Initialization data, plus some event-specific.
0167   bool   doNonPert = {}, doDiffraction = {}, doSoftQCD = {},
0168          doHardDiff = {}, doProcessLevel = {}, doPartonVertex = {},
0169          doVertexPlane = {}, isUnresolvedA = {}, isUnresolvedB = {},
0170          doVMDsideA = {}, doVMDsideB = {}, beamAResGamma = {},
0171          beamBResGamma = {}, beamAUnresGamma = {}, beamBUnresGamma = {};
0172 
0173   // Pointers to the PDFs of beams, with several alternatives.
0174   PDFPtr pdfAPtr = {}, pdfBPtr = {}, pdfHardAPtr = {}, pdfHardBPtr = {},
0175          pdfPomAPtr = {}, pdfPomBPtr = {}, pdfGamAPtr = {}, pdfGamBPtr = {},
0176          pdfHardGamAPtr = {}, pdfHardGamBPtr = {}, pdfUnresAPtr = {},
0177          pdfUnresBPtr = {}, pdfUnresGamAPtr = {}, pdfUnresGamBPtr = {},
0178          pdfGamFluxAPtr = {}, pdfGamFluxBPtr = {}, pdfVMDAPtr = {},
0179          pdfVMDBPtr = {};
0180 
0181   // Array of PDFs to be used when idA can be changed between events.
0182   vector<PDFPtr> pdfASavePtrs = {};
0183 
0184   // Pointer to BeamShape object for beam momentum and interaction vertex.
0185   BeamShapePtr  beamShapePtr = {};
0186 
0187   // Check that beams and beam combination can be handled.
0188   bool checkBeams();
0189 
0190   // Calculate kinematics at initialization.
0191   bool initKinematics();
0192 
0193   // Set up pointers to PDFs.
0194   bool initPDFs();
0195 
0196   // Create an LHAPDF plugin PDF.
0197   PDFPtr initLHAPDF(int idIn, string cfg);
0198 
0199 };
0200 
0201 //==========================================================================
0202 
0203 } // end namespace Pythia8
0204 
0205 #endif // Pythia8_BeamSetup_H