PYTHIA  8.311
BeamSetup.h
1 // BeamSetup.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2024 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // This file contains a helper class for the setup of beam flavour,
7 // kinematics and PDFs.
8 
9 #ifndef Pythia8_BeamSetup_H
10 #define Pythia8_BeamSetup_H
11 
12 #include "Pythia8/Basics.h"
13 #include "Pythia8/BeamParticle.h"
14 #include "Pythia8/BeamShape.h"
15 #include "Pythia8/HadronLevel.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/LesHouches.h"
18 #include "Pythia8/ParticleData.h"
19 #include "Pythia8/PartonDistributions.h"
20 #include "Pythia8/PartonLevel.h"
21 #include "Pythia8/PhysicsBase.h"
22 #include "Pythia8/ProcessLevel.h"
23 #include "Pythia8/PythiaStdlib.h"
24 #include "Pythia8/Settings.h"
25 
26 namespace Pythia8 {
27 
28 //==========================================================================
29 
30 // The BeamSetup class contains a number of routines auxiliary to Pythia
31 // to set up beam flavour, kinematics and PDFs.
32 
33 class BeamSetup : public PhysicsBase {
34 
35 public:
36 
37  // Constructor.
38  BeamSetup() = default;
39 
40  // Possibility to pass in pointers to PDF's.
41  bool setPDFPtr( PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn,
42  PDFPtr pdfHardAPtrIn = nullptr, PDFPtr pdfHardBPtrIn = nullptr,
43  PDFPtr pdfPomAPtrIn = nullptr, PDFPtr pdfPomBPtrIn = nullptr,
44  PDFPtr pdfGamAPtrIn = nullptr, PDFPtr pdfGamBPtrIn = nullptr,
45  PDFPtr pdfHardGamAPtrIn = nullptr, PDFPtr pdfHardGamBPtrIn = nullptr,
46  PDFPtr pdfUnresAPtrIn = nullptr, PDFPtr pdfUnresBPtrIn = nullptr,
47  PDFPtr pdfUnresGamAPtrIn = nullptr, PDFPtr pdfUnresGamBPtrIn = nullptr,
48  PDFPtr pdfVMDAPtrIn = nullptr, PDFPtr pdfVMDBPtrIn = nullptr);
49  bool setPDFAPtr( PDFPtr pdfAPtrIn );
50  bool setPDFBPtr( PDFPtr pdfBPtrIn );
51 
52  // Set photon fluxes externally. Used with option "PDF:lepton2gammaSet = 2".
53  bool setPhotonFluxPtr( PDFPtr photonFluxAIn, PDFPtr photonFluxBIn) {
54  if ( photonFluxAIn ) pdfGamFluxAPtr = photonFluxAIn;
55  if ( photonFluxBIn ) pdfGamFluxBPtr = photonFluxBIn;
56  return true;}
57 
58  // Possibility to pass in pointer to external LHA-interfaced generator.
59  bool setLHAupPtr( LHAupPtr lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;
60  useNewLHA = false; return true;}
61 
62  // Switch to new beam particle identities; for similar hadrons only.
63  bool setBeamIDs( int idAin, int idBin = 0);
64 
65  // Switch beam kinematics.
66  bool setKinematics(double eCMIn);
67  bool setKinematics(double eAIn, double eBIn);
68  bool setKinematics(double pxAIn, double pyAIn, double pzAIn,
69  double pxBIn, double pyBIn, double pzBIn);
70  bool setKinematics(Vec4 pAIn, Vec4 pBIn);
71 
72  // Possibility to pass in pointer for beam shape.
73  bool setBeamShapePtr( BeamShapePtr beamShapePtrIn) {
74  beamShapePtr = beamShapePtrIn; return true;}
75 
76  // Possibility to access the pointer to the BeamShape object.
77  BeamShapePtr getBeamShapePtr() { return beamShapePtr; }
78 
79  // Return a parton density set among list of possibilities.
80  PDFPtr getPDFPtr(int idIn, int sequence = 1, string beam = "A",
81  bool resolved = true);
82 
83  // Return a map of the PDF pointers.
84  map<string, PDFPtr> getPDFPtr();
85 
86  // Set up frame of beams, Les Houches input, and switches for beam handling.
87  bool initFrame();
88 
89  // Initialize kinematics and PDFs of beams.
90  bool initBeams(bool doNonPertIn, StringFlav* flavSelPtr);
91 
92  // Return whether VMD states sampled.
93  bool getVMDsideA() { return doVMDsideA; }
94  bool getVMDsideB() { return doVMDsideB; }
95 
96  // Clear all beams.
97  void clear();
98 
99  // Pick new beam valence flavours (for pi0, eta, K0S, Pomeron, etc.).
100  void newValenceContent();
101 
102  // Recalculate kinematics for each event when beam momentum has a spread.
103  void nextKinematics();
104 
105  // Boost from CM frame to lab frame, or inverse. Set production vertex.
106  void boostAndVertex( Event& process, Event& event, bool toLab,
107  bool setVertex);
108 
109  // Print parton lists for the main beams. For debug mainly.
110  void list() const { beamA.list(); beamB.list(); }
111 
112  // Some data values are kept public so that the Pythia class can access them.
113  bool doLHA = false, useNewLHA = false, skipInit = false,
114  doMomentumSpread = {}, doVertexSpread = {}, doVarEcm = {},
115  allowIDAswitch = {}, hasSwitchedIDs = {}, beamA2gamma = {},
116  beamB2gamma = {};
117  int idA = {}, idB = {}, frameType = {}, boostType = {}, iPDFAsave = {},
118  gammaMode = {};
119  double mA = {}, mB = {}, pxA = {}, pxB = {}, pyA = {}, pyB = {}, pzA = {},
120  pzB = {}, eA = {}, eB = {}, pzAcm = {}, pzBcm = {}, eCM = {},
121  betaZ = {}, gammaZ = {};
122  Vec4 pAinit = {}, pBinit = {}, pAnow = {}, pBnow = {};
123  RotBstMatrix MfromCM = {}, MtoCM = {};
124  LHAupPtr lhaUpPtr = {};
125 
126  // The two incoming beams.
128  BeamParticle beamB = {};
129 
130  // Alternative Pomeron beam-inside-beam.
132  BeamParticle beamPomB = {};
133 
134  // Alternative photon beam-inside-beam.
136  BeamParticle beamGamB = {};
137 
138  // Alternative VMD beam-inside-beam.
140  BeamParticle beamVMDB = {};
141 
142  // Hadron types for rapid switching.
143  vector<int> idAList = { 2212, 211, 311, 221,
144  331, 333, 411, 431, 443, 511, 531, 541, 553, 3212, 3312, 3334,
145  4112, 4312, 4332, 5112, 5312, 5332};
146 
147 protected:
148 
149  void onInitInfoPtr() override {
150  registerSubObject(beamA);
151  registerSubObject(beamB);
152  registerSubObject(beamPomA);
153  registerSubObject(beamPomB);
154  registerSubObject(beamGamA);
155  registerSubObject(beamGamB);
156  registerSubObject(beamVMDA);
157  registerSubObject(beamVMDB);
158  }
159 
160 private:
161 
162  // Initialization data, plus some event-specific.
163  bool doNonPert = {}, doDiffraction = {}, doSoftQCD = {},
164  doHardDiff = {}, doProcessLevel = {}, doPartonVertex = {},
165  doVertexPlane = {}, isUnresolvedA = {}, isUnresolvedB = {},
166  doVMDsideA = {}, doVMDsideB = {}, beamAResGamma = {},
167  beamBResGamma = {}, beamAUnresGamma = {}, beamBUnresGamma = {};
168 
169  // Pointers to the PDFs of beams, with several alternatives.
170  PDFPtr pdfAPtr = {}, pdfBPtr = {}, pdfHardAPtr = {}, pdfHardBPtr = {},
171  pdfPomAPtr = {}, pdfPomBPtr = {}, pdfGamAPtr = {}, pdfGamBPtr = {},
172  pdfHardGamAPtr = {}, pdfHardGamBPtr = {}, pdfUnresAPtr = {},
173  pdfUnresBPtr = {}, pdfUnresGamAPtr = {}, pdfUnresGamBPtr = {},
174  pdfGamFluxAPtr = {}, pdfGamFluxBPtr = {}, pdfVMDAPtr = {},
175  pdfVMDBPtr = {};
176 
177  // Array of PDFs to be used when idA can be changed between events.
178  vector<PDFPtr> pdfASavePtrs = {};
179 
180  // Pointer to BeamShape object for beam momentum and interaction vertex.
181  BeamShapePtr beamShapePtr = {};
182 
183  // Check that beams and beam combination can be handled.
184  bool checkBeams();
185 
186  // Calculate kinematics at initialization.
187  bool initKinematics();
188 
189  // Set up pointers to PDFs.
190  bool initPDFs();
191 
192  // Create an LHAPDF plugin PDF.
193  PDFPtr initLHAPDF(int idIn, string cfg);
194 
195 };
196 
197 //==========================================================================
198 
199 } // end namespace Pythia8
200 
201 #endif // Pythia8_BeamSetup_H
BeamParticle beamVMDA
Alternative VMD beam-inside-beam.
Definition: BeamSetup.h:139
bool setPDFAPtr(PDFPtr pdfAPtrIn)
Routine to pass in pointers to PDF&#39;s. Usage optional.
Definition: BeamSetup.cc:105
Definition: PhysicsBase.h:27
void registerSubObject(PhysicsBase &pb)
Register a sub object that should have its information in sync with this.
Definition: PhysicsBase.cc:56
Definition: BeamSetup.h:33
void newValenceContent()
Pick new beam valence flavours (for pi0, eta, K0S, Pomeron, etc.).
Definition: BeamSetup.cc:585
The Event class holds all info on the generated event.
Definition: Event.h:453
Definition: BeamParticle.h:133
bool setKinematics(double eCMIn)
Switch beam kinematics.
Definition: BeamSetup.cc:227
bool setPhotonFluxPtr(PDFPtr photonFluxAIn, PDFPtr photonFluxBIn)
Set photon fluxes externally. Used with option "PDF:lepton2gammaSet = 2".
Definition: BeamSetup.h:53
void clear()
Clear all beams.
Definition: BeamSetup.cc:570
void onInitInfoPtr() override
Definition: BeamSetup.h:149
BeamSetup()=default
Constructor.
bool setPDFPtr(PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn, PDFPtr pdfHardAPtrIn=nullptr, PDFPtr pdfHardBPtrIn=nullptr, PDFPtr pdfPomAPtrIn=nullptr, PDFPtr pdfPomBPtrIn=nullptr, PDFPtr pdfGamAPtrIn=nullptr, PDFPtr pdfGamBPtrIn=nullptr, PDFPtr pdfHardGamAPtrIn=nullptr, PDFPtr pdfHardGamBPtrIn=nullptr, PDFPtr pdfUnresAPtrIn=nullptr, PDFPtr pdfUnresBPtrIn=nullptr, PDFPtr pdfUnresGamAPtrIn=nullptr, PDFPtr pdfUnresGamBPtrIn=nullptr, PDFPtr pdfVMDAPtrIn=nullptr, PDFPtr pdfVMDBPtrIn=nullptr)
Possibility to pass in pointers to PDF&#39;s.
Definition: BeamSetup.cc:21
bool initFrame()
Set up frame of beams, Les Houches input, and switches for beam handling.
Definition: BeamSetup.cc:311
BeamParticle beamPomA
Alternative Pomeron beam-inside-beam.
Definition: BeamSetup.h:131
bool doLHA
Some data values are kept public so that the Pythia class can access them.
Definition: BeamSetup.h:113
BeamParticle beamA
The two incoming beams.
Definition: BeamSetup.h:127
map< string, PDFPtr > getPDFPtr()
Return a map of the PDF pointers.
Definition: BeamSetup.cc:1523
BeamParticle beamGamA
Alternative photon beam-inside-beam.
Definition: BeamSetup.h:135
bool setBeamIDs(int idAin, int idBin=0)
Switch to new beam particle identities; for similar hadrons only.
Definition: BeamSetup.cc:153
bool setLHAupPtr(LHAupPtr lhaUpPtrIn)
Possibility to pass in pointer to external LHA-interfaced generator.
Definition: BeamSetup.h:59
void list() const
Print extracted parton list; for debug mainly.
Definition: BeamParticle.cc:1300
bool getVMDsideA()
Return whether VMD states sampled.
Definition: BeamSetup.h:93
void list() const
Print parton lists for the main beams. For debug mainly.
Definition: BeamSetup.h:110
bool initBeams(bool doNonPertIn, StringFlav *flavSelPtr)
Initialize kinematics and PDFs of beams.
Definition: BeamSetup.cc:473
Definition: Basics.h:251
bool setPDFBPtr(PDFPtr pdfBPtrIn)
Routine to pass in pointers to PDF&#39;s. Usage optional.
Definition: BeamSetup.cc:129
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
The StringFlav class is used to select quark and hadron flavours.
Definition: FragmentationFlavZpT.h:84
BeamShapePtr getBeamShapePtr()
Possibility to access the pointer to the BeamShape object.
Definition: BeamSetup.h:77
vector< int > idAList
Hadron types for rapid switching.
Definition: BeamSetup.h:143
void boostAndVertex(Event &process, Event &event, bool toLab, bool setVertex)
Boost from CM frame to lab frame, or inverse. Set production vertex.
Definition: BeamSetup.cc:669
bool setBeamShapePtr(BeamShapePtr beamShapePtrIn)
Possibility to pass in pointer for beam shape.
Definition: BeamSetup.h:73
Definition: Basics.h:32
void nextKinematics()
Recalculate kinematics for each event when beam momentum has a spread.
Definition: BeamSetup.cc:600