10 #ifndef Pythia8_BeamParticle_H
11 #define Pythia8_BeamParticle_H
13 #include "Pythia8/Basics.h"
14 #include "Pythia8/Event.h"
15 #include "Pythia8/FragmentationFlavZpT.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/ParticleData.h"
18 #include "Pythia8/PartonDistributions.h"
19 #include "Pythia8/PythiaStdlib.h"
20 #include "Pythia8/Settings.h"
37 class ResolvedParton {
42 ResolvedParton(
int iPosIn = 0,
int idIn = 0,
double xIn = 0.,
43 int companionIn = -1) : iPosRes(iPosIn), idRes(idIn), xRes(xIn),
44 companionRes(companionIn), xqCompRes(0.), mRes(0.), factorRes(1.),
45 colRes(0), acolRes(0) { }
48 void iPos(
int iPosIn) {iPosRes = iPosIn;}
49 void id(
int idIn) {idRes = idIn;}
50 void x(
double xIn) {xRes = xIn;}
51 void update(
int iPosIn,
int idIn,
double xIn) {iPosRes = iPosIn;
52 idRes = idIn; xRes = xIn;}
53 void companion(
int companionIn) {companionRes = companionIn;}
54 void xqCompanion(
double xqCompIn) {xqCompRes = xqCompIn;}
55 void p(Vec4 pIn) {pRes = pIn;}
56 void px(
double pxIn) {pRes.px(pxIn);}
57 void py(
double pyIn) {pRes.py(pyIn);}
58 void pz(
double pzIn) {pRes.pz(pzIn);}
59 void e(
double eIn) {pRes.e(eIn);}
60 void m(
double mIn) {mRes = mIn;}
61 void col(
int colIn) {colRes = colIn;}
62 void acol(
int acolIn) {acolRes = acolIn;}
63 void cols(
int colIn = 0,
int acolIn = 0)
64 {colRes = colIn; acolRes = acolIn;}
65 void scalePT(
double factorIn) {pRes.px(factorIn * pRes.px());
66 pRes.py(factorIn * pRes.py()); factorRes *= factorIn;}
67 void scaleX(
double factorIn) {xRes *= factorIn;}
70 int iPos()
const {
return iPosRes;}
71 int id()
const {
return idRes;}
72 double x()
const {
return xRes;}
73 int companion()
const {
return companionRes;}
74 bool isValence()
const {
return (companionRes == -3);}
75 bool isUnmatched()
const {
return (companionRes == -2);}
76 bool isCompanion()
const {
return (companionRes >= 0);}
77 bool isFromBeam()
const {
return (companionRes > -10);}
78 double xqCompanion()
const {
return xqCompRes;}
79 Vec4 p()
const {
return pRes;}
80 double px()
const {
return pRes.px();}
81 double py()
const {
return pRes.py();}
82 double pz()
const {
return pRes.pz();}
83 double e()
const {
return pRes.e();}
84 double m()
const {
return mRes;}
85 double pT()
const {
return pRes.pT();}
86 double mT2()
const {
return (mRes >= 0.)
87 ? mRes*mRes + pRes.pT2() : - mRes*mRes + pRes.pT2();}
88 double pPos()
const {
return pRes.e() + pRes.pz();}
89 double pNeg()
const {
return pRes.e() - pRes.pz();}
90 int col()
const {
return colRes;}
91 int acol()
const {
return acolRes;}
92 double pTfactor()
const {
return factorRes;}
104 double mRes, factorRes;
120 BeamParticle() : nInit(0) {resolved.resize(0); Q2ValFracSav = -1.;}
123 void init(
int idIn,
double pzIn,
double eIn,
double mIn,
124 Info* infoPtrIn, Settings& settings, ParticleData* particleDataPtrIn,
125 Rndm* rndmPtrIn, PDF* pdfInPtr, PDF* pdfHardInPtr,
bool isUnresolvedIn,
126 StringFlav* flavSelPtrIn);
129 void initPDFPtr(PDF* pdfInPtr, PDF* pdfHardInPtr) {
130 pdfBeamPtr = pdfInPtr; pdfHardBeamPtr = pdfHardInPtr; }
133 void newValenceContent();
136 void newPzE(
double pzIn,
double eIn) {pBeam = Vec4( 0., 0., pzIn, eIn);}
139 int id()
const {
return idBeam;}
140 Vec4 p()
const {
return pBeam;}
141 double px()
const {
return pBeam.px();}
142 double py()
const {
return pBeam.py();}
143 double pz()
const {
return pBeam.pz();}
144 double e()
const {
return pBeam.e();}
145 double m()
const {
return mBeam;}
146 bool isLepton()
const {
return isLeptonBeam;}
147 bool isUnresolved()
const {
return isUnresolvedBeam;}
149 bool isHadron()
const {
return isHadronBeam;}
150 bool isMeson()
const {
return isMesonBeam;}
151 bool isBaryon()
const {
return isBaryonBeam;}
154 double xMax(
int iSkip = -1);
157 double xfHard(
int idIn,
double x,
double Q2)
158 {
return pdfHardBeamPtr->xf(idIn, x, Q2);}
161 double xf(
int idIn,
double x,
double Q2)
162 {
return pdfBeamPtr->xf(idIn, x, Q2);}
165 double xfVal(
int idIn,
double x,
double Q2)
166 {
return pdfBeamPtr->xfVal(idIn, x, Q2);}
167 double xfSea(
int idIn,
double x,
double Q2)
168 {
return pdfBeamPtr->xfSea(idIn, x, Q2);}
172 double xfMPI(
int idIn,
double x,
double Q2)
173 {
return xfModified(-1, idIn, x, Q2);}
174 double xfISR(
int indexMPI,
int idIn,
double x,
double Q2)
175 {
return xfModified( indexMPI, idIn, x, Q2);}
178 int pickValSeaComp();
184 ResolvedParton& operator[](
int i) {
return resolved[i];}
185 const ResolvedParton& operator[](
int i)
const {
return resolved[i];}
188 int size()
const {
return resolved.size();}
189 int sizeInit()
const {
return nInit;}
192 void clear() {resolved.resize(0); nInit = 0;}
195 int append(
int iPos,
int idIn,
double x,
int companion = -1)
196 {resolved.push_back( ResolvedParton( iPos, idIn, x, companion) );
197 return resolved.size() - 1;}
200 void list(ostream& os = cout)
const;
203 int nValenceKinds()
const {
return nValKinds;}
204 int nValence(
int idIn)
const {
for (
int i = 0; i < nValKinds; ++i)
205 if (idIn == idVal[i])
return nVal[i];
return 0;}
208 bool isUnresolvedLepton();
211 bool remnantFlavours(
Event& event);
214 bool remnantColours(
Event& event, vector<int>& colFrom,
218 double xRemnant(
int i);
221 bool hasJunction()
const {
return hasJunctionBeam;}
222 int junctionCol(
int i)
const {
return junCol[i];}
223 void junctionCol(
int i,
int col) {junCol[i] = col;}
226 bool pickGluon(
double mDiff);
230 int pickRemnant()
const {
return idVal2;}
234 double zShare(
double mDiff,
double m1,
double m2);
235 double pxShare()
const {
return pxRel;}
236 double pyShare()
const {
return pyRel;}
241 static const double XMINUNRESOLVED;
247 ParticleData* particleDataPtr;
257 StringFlav* flavSelPtr;
261 int maxValQuark, companionPower;
262 double valencePowerMeson, valencePowerUinP, valencePowerDinP,
263 valenceDiqEnhance, pickQuarkNorm, pickQuarkPower,
264 diffPrimKTwidth, diffLargeMassSuppress;
267 int idBeam, idBeamAbs;
271 bool isUnresolvedBeam, isLeptonBeam, isHadronBeam, isMesonBeam,
273 int nValKinds, idVal[3], nVal[3];
276 int idSave, iSkipSave, nValLeft[3];
277 double xqgTot, xqVal, xqgSea, xqCompSum;
280 vector<ResolvedParton> resolved;
284 bool hasJunctionBeam;
288 double xfModified(
int iSkip,
int idIn,
double x,
double Q2);
291 double xValFrac(
int j,
double Q2);
292 double Q2ValFracSav, uValInt, dValInt;
295 double xCompFrac(
double xs);
298 double xCompDist(
double xc,
double xs);
301 int idVal1, idVal2, idVal3;
302 double zRel, pxRel, pyRel;
310 #endif // Pythia8_BeamParticle_H