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/PhysicsBase.h" 20 #include "Pythia8/PythiaStdlib.h" 21 #include "Pythia8/Settings.h" 44 int companionIn = -1) : iPosRes(iPosIn), idRes(idIn), xRes(xIn),
45 companionRes(companionIn), xqCompRes(0.), mRes(0.), factorRes(1.),
46 colRes(0), acolRes(0) { }
49 void iPos(
int iPosIn) {iPosRes = iPosIn;}
50 void id(
int idIn) {idRes = idIn;}
51 void x(
double xIn) {xRes = xIn;}
52 void update(
int iPosIn,
int idIn,
double xIn) {iPosRes = iPosIn;
53 idRes = idIn; xRes = xIn;}
54 void companion(
int companionIn) {companionRes = companionIn;}
55 void xqCompanion(
double xqCompIn) {xqCompRes = xqCompIn;}
56 void p(
Vec4 pIn) {pRes = pIn;}
57 void px(
double pxIn) {pRes.px(pxIn);}
58 void py(
double pyIn) {pRes.py(pyIn);}
59 void pz(
double pzIn) {pRes.pz(pzIn);}
60 void e(
double eIn) {pRes.e(eIn);}
61 void m(
double mIn) {mRes = mIn;}
62 void col(
int colIn) {colRes = colIn;}
63 void acol(
int acolIn) {acolRes = acolIn;}
64 void cols(
int colIn = 0,
int acolIn = 0)
65 {colRes = colIn; acolRes = acolIn;}
66 void scalePT(
double factorIn) {pRes.px(factorIn * pRes.px());
67 pRes.py(factorIn * pRes.py()); factorRes *= factorIn;}
68 void scaleX(
double factorIn) {xRes *= factorIn;}
71 int iPos()
const {
return iPosRes;}
72 int id()
const {
return idRes;}
73 double x()
const {
return xRes;}
74 int companion()
const {
return companionRes;}
75 bool isValence()
const {
return (companionRes == -3);}
76 bool isUnmatched()
const {
return (companionRes == -2);}
77 bool isCompanion()
const {
return (companionRes >= 0);}
78 bool isFromBeam()
const {
return (companionRes > -10);}
79 double xqCompanion()
const {
return xqCompRes;}
80 Vec4 p()
const {
return pRes;}
81 double px()
const {
return pRes.px();}
82 double py()
const {
return pRes.py();}
83 double pz()
const {
return pRes.pz();}
84 double e()
const {
return pRes.e();}
85 double m()
const {
return mRes;}
86 double pT()
const {
return pRes.pT();}
87 double mT2()
const {
return (mRes >= 0.)
88 ? mRes*mRes + pRes.pT2() : - mRes*mRes + pRes.pT2();}
89 double pPos()
const {
return pRes.e() + pRes.pz();}
90 double pNeg()
const {
return pRes.e() - pRes.pz();}
91 int col()
const {
return colRes;}
92 int acol()
const {
return acolRes;}
93 double pTfactor()
const {
return factorRes;}
94 bool hasCol()
const {
return (idRes == 21 || (idRes > 0 && idRes < 9)
95 || (-idRes > 1000 && -idRes < 10000 && (-idRes/10)%10 == 0));}
96 bool hasAcol()
const {
return (idRes == 21 || (-idRes > 0 && -idRes < 9)
97 || (idRes > 1000 && idRes < 10000 && (idRes/10)%10 == 0));}
109 double mRes, factorRes;
139 pdfBeamPtrSave(), pdfHardBeamPtrSave(), pdfSavePtrs(),
140 pdfSaveIdx(-1), flavSelPtr(), allowJunction(), beamJunction(),
141 maxValQuark(), companionPower(), valencePowerMeson(), valencePowerUinP(),
142 valencePowerDinP(), valenceDiqEnhance(), pickQuarkNorm(), pickQuarkPower(),
143 diffPrimKTwidth(), diffLargeMassSuppress(), beamSat(), gluonPower(),
144 xGluonCutoff(), heavyQuarkEnhance(), idBeam(), idBeamAbs(), idVMDBeam(),
145 mBeam(), mVMDBeam(), scaleVMDBeam(), isUnresolvedBeam(), isLeptonBeam(),
146 isHadronBeam(), isMesonBeam(), isBaryonBeam(), isGammaBeam(), nValKinds(),
147 idVal(), nVal(), idSave(), iSkipSave(), nValLeft(), xqgTot(), xqVal(),
148 xqgSea(), xqCompSum(), doISR(), doMPI(), doND(), isResolvedGamma(),
149 hasResGammaInBeam(), isResUnres(), hasVMDstateInBeam(), initGammaBeam(),
150 pTminISR(), pTminMPI(), pT2gm2qqbar(), iGamVal(), iPosVal(), gammaMode(),
151 xGm(), Q2gm(), kTgamma(), phiGamma(), cPowerCache(-100), xsCache(-1),
152 resCache(), resolved(), nInit(0), hasJunctionBeam(), junCol(), nJuncs(),
153 nAjuncs(), nDiffJuncs(), allowBeamJunctions(), Q2ValFracSav(-1.),
154 uValInt(), dValInt(), idVal1(), idVal2(), idVal3(), zRel(), pxRel(),
158 void init(
int idIn,
double pzIn,
double eIn,
double mIn,
159 PDFPtr pdfInPtr, PDFPtr pdfHardInPtr,
bool isUnresolvedIn,
163 void initID(
int idIn) { idBeam = idIn; initBeamKind();}
167 pdfBeamPtr = pdfInPtr; pdfHardBeamPtr = pdfHardInPtr; }
170 void initUnres(PDFPtr pdfUnresInPtr);
174 pdfSavePtrs = pdfSavePtrsIn; }
177 void newValenceContent();
178 void setValenceContent(
int idq1,
int idq2 = 0,
int idq3 = 0);
181 void setBeamID(
int idIn,
int iPDFin = -1) {idBeam = idIn;
182 if ( iPDFin >= 0 && iPDFin <
int(pdfSavePtrs.size())
183 && iPDFin != pdfSaveIdx ) {
184 pdfBeamPtr = pdfSavePtrs[iPDFin]; pdfHardBeamPtr = pdfBeamPtr;
185 pdfSaveIdx = iPDFin; }
186 mBeam = particleDataPtr->m0(idIn); pdfBeamPtr->setBeamID(idIn); }
189 void newPzE(
double pzIn,
double eIn) {pBeam =
Vec4( 0., 0., pzIn, eIn);}
192 void newM(
double mIn) { mBeam = mIn; }
195 int id()
const {
return idBeam;}
196 int idVMD()
const {
return idVMDBeam;}
197 Vec4 p()
const {
return pBeam;}
198 double px()
const {
return pBeam.px();}
199 double py()
const {
return pBeam.py();}
200 double pz()
const {
return pBeam.pz();}
201 double e()
const {
return pBeam.e();}
202 double m()
const {
return mBeam;}
203 double mVMD()
const {
return mVMDBeam;}
204 double scaleVMD()
const {
return scaleVMDBeam;}
205 bool isLepton()
const {
return isLeptonBeam;}
206 bool isUnresolved()
const {
return isUnresolvedBeam;}
209 bool isMeson()
const {
return isMesonBeam;}
210 bool isBaryon()
const {
return isBaryonBeam;}
211 bool isGamma()
const {
return isGammaBeam;}
212 bool hasResGamma()
const {
return hasResGammaInBeam;}
213 bool hasVMDstate()
const {
return hasVMDstateInBeam;}
216 double xMax(
int iSkip = -1);
219 double xfHard(
int idIn,
double x,
double Q2)
220 {
return pdfHardBeamPtr->xf(idIn, x, Q2);}
223 double xfMax(
int idIn,
double x,
double Q2)
224 {
return pdfHardBeamPtr->xfMax(idIn, x, Q2);}
227 double xfFlux(
int idIn,
double x,
double Q2)
228 {
return pdfHardBeamPtr->xfFlux(idIn, x, Q2);}
229 double xfApprox(
int idIn,
double x,
double Q2)
230 {
return pdfHardBeamPtr->xfApprox(idIn, x, Q2);}
231 double xfGamma(
int idIn,
double x,
double Q2)
232 {
return pdfHardBeamPtr->xfGamma(idIn, x, Q2);}
236 double xfSame(
int idIn,
double x,
double Q2)
237 {
return pdfHardBeamPtr->xfSame(idIn, x, Q2);}
240 double xf(
int idIn,
double x,
double Q2)
241 {
return pdfBeamPtr->xf(idIn, x, Q2);}
244 double xfVal(
int idIn,
double x,
double Q2)
245 {
return pdfBeamPtr->xfVal(idIn, x, Q2);}
246 double xfSea(
int idIn,
double x,
double Q2)
247 {
return pdfBeamPtr->xfSea(idIn, x, Q2);}
252 {
return xfISR(-1, idIn, x, Q2, xfData);}
253 double xfMPI(
int idIn,
double x,
double Q2)
255 return xfISR(-1, idIn, x, Q2, xfData);}
256 double xfISR(
int indexMPI,
int idIn,
double x,
double Q2,
257 xfModPrepData& xfData) {
return xfModified( indexMPI, idIn, x, Q2, xfData);}
258 double xfISR(
int indexMPI,
int idIn,
double x,
double Q2)
260 return xfModified( indexMPI, idIn, x, Q2, xfData);}
264 {
return pdfBeamPtr->insideBounds(x,Q2);}
267 double alphaS(
double Q2) {
return pdfBeamPtr->alphaS(Q2);}
270 double mQuarkPDF(
int idIn) {
return pdfBeamPtr->mQuarkPDF(idIn);}
277 pdfBeamPtr->calcPDFEnvelope(idNow,xNow,Q2Now,valSea);}
278 void calcPDFEnvelope(pair<int,int> idNows, pair<double,double> xNows,
279 double Q2Now,
int valSea) {
280 pdfBeamPtr->calcPDFEnvelope(idNows,xNows,Q2Now,valSea);}
284 int pickValSeaComp();
291 const ResolvedParton& operator[](
int i)
const {
return resolved[i];}
296 int size()
const {
return resolved.size();}
297 int sizeInit()
const {
return nInit;}
300 void clear() {resolved.resize(0); nInit = 0;}
303 void resetGamma() {iGamVal = -1; iPosVal = -1; pT2gm2qqbar = 0.;
304 isResolvedGamma = (gammaMode == 1) ?
true :
false;}
310 int append(
int iPos,
int idIn,
double x,
int companion = -1)
312 return resolved.size() - 1;}
315 void popBack() {
int iComp = resolved.back().companion();
316 resolved.pop_back();
if ( iComp >= 0 ) { iSkipSave = iComp;
317 idSave = resolved[iComp].id(); pickValSeaComp(); } }
324 int nValence(
int idIn)
const {
for (
int i = 0; i < nValKinds; ++i)
325 if (idIn == idVal[i])
return nVal[i];
329 bool isUnresolvedLepton();
332 bool remnantFlavours(
Event& event,
bool isDIS =
false);
335 bool remnantColours(
Event& event, vector<int>& colFrom,
339 double xRemnant(
int i);
343 int junctionCol(
int i)
const {
return junCol[i];}
344 void junctionCol(
int i,
int col) {junCol[i] = col;}
347 bool pickGluon(
double mDiff);
351 int pickRemnant()
const {
return idVal2;}
355 double zShare(
double mDiff,
double m1,
double m2);
356 double pxShare()
const {
return pxRel;}
357 double pyShare()
const {
return pyRel;}
360 bool remnantFlavoursNew(
Event& event);
363 void findColSetup(
Event& event);
366 void setInitialCol(
Event & event);
369 void updateCol(vector<pair<int,int> > colourChanges);
371 vector<pair <int,int> > getColUpdates() {
return colUpdates;}
374 bool gammaInitiatorIsVal(
int iResolved,
int id,
double x,
double Q2);
375 bool gammaInitiatorIsVal(
int iResolved,
double Q2);
376 int getGammaValFlavour() {
return abs(idVal[0]); }
377 int gammaValSeaComp(
int iResolved);
378 void posVal(
int iPosValIn) { iPosVal = iPosValIn; }
379 void gamVal(
int iGamValIn) { iGamVal = iGamValIn; }
380 int gamVal() {
return iGamVal; }
384 bool resolvedGamma()
const {
return isResolvedGamma; }
385 void setGammaMode(
int gammaModeIn);
386 int getGammaMode()
const {
return gammaMode; }
387 bool isResolvedUnresolved()
const {
return isResUnres; }
388 void initGammaInBeam() { initGammaBeam =
true; }
389 bool gammaInBeam()
const {
return initGammaBeam; }
392 void setVMDstate(
bool isVMDIn,
int idIn,
double mIn,
double scaleIn,
393 bool reassignState =
false) {
394 hasVMDstateInBeam = isVMDIn;
397 scaleVMDBeam = scaleIn;
401 pdfBeamPtr->setVMDscale(scaleVMDBeam);
407 double pT2gamma2qqbar() {
return pT2gm2qqbar; }
410 void pTMPI(
double pTminMPIin) { pTminMPI = pTminMPIin; }
413 bool roomFor1Remnant(
double eCM);
414 bool roomFor1Remnant(
int id1,
double x1,
double eCM);
415 bool roomFor2Remnants(
int id1,
double x1,
double eCM);
419 double remnantMass(
int idIn);
423 {
return pdfBeamPtr->gammaPDFxDependence(flavour, x); }
424 double gammaPDFRefScale(
int flavour)
425 {
return pdfBeamPtr->gammaPDFRefScale(flavour); }
426 double xIntegratedPDFs(
double Q2)
427 {
return pdfBeamPtr->xfIntegratedTotal(Q2); }
431 void xGamma(
double xGmIn) { xGm = xGmIn; }
432 void Q2Gamma(
double Q2GmIn) { Q2gm = Q2GmIn; }
433 void newGammaKTPhi(
double kTIn,
double phiIn)
434 { kTgamma = kTIn; phiGamma = phiIn; }
437 double xGammaMin() {
return pdfHardBeamPtr->getXmin(); }
438 double xGammaHadr() {
return pdfHardBeamPtr->getXhadr(); }
439 double gammaFluxIntApprox() {
return pdfHardBeamPtr->intFluxApprox(); }
446 double Q2Gamma()
const {
return Q2gm; }
447 double gammaKTx()
const {
return kTgamma*cos(phiGamma); }
448 double gammaKTy()
const {
return kTgamma*sin(phiGamma); }
449 double gammaKT()
const {
return kTgamma; }
450 double gammaPhi()
const {
return phiGamma; }
454 {
if ( pdfBeamPtr ) pdfBeamPtr->xPom(xpom); }
458 { xGm = pdfHardBeamPtr->sampleXgamma(xMinIn);
return xGm; }
459 double sampleQ2gamma(
double Q2min)
460 { Q2gm = pdfHardBeamPtr->sampleQ2gamma(Q2min);
return Q2gm;}
468 virtual void onInitInfoPtr()
override {
471 beamPomAPtr =
nullptr;
472 beamPomBPtr =
nullptr;
473 beamGamAPtr =
nullptr;
474 beamGamBPtr =
nullptr;
475 beamVMDAPtr =
nullptr;
476 beamVMDBPtr =
nullptr;
477 userHooksPtr =
nullptr;
481 static const double XMINUNRESOLVED, POMERONMASS, XMAXCOMPANION, TINYZREL;
482 static const int NMAX, NRANDOMTRIES;
486 PDFPtr pdfHardBeamPtr;
489 PDFPtr pdfUnresBeamPtr;
490 PDFPtr pdfBeamPtrSave;
491 PDFPtr pdfHardBeamPtrSave;
494 vector<PDFPtr> pdfSavePtrs;
501 bool allowJunction, beamJunction;
502 int maxValQuark, companionPower;
503 double valencePowerMeson, valencePowerUinP, valencePowerDinP,
504 valenceDiqEnhance, pickQuarkNorm, pickQuarkPower,
505 diffPrimKTwidth, diffLargeMassSuppress, beamSat, gluonPower,
506 xGluonCutoff, heavyQuarkEnhance[6];
509 int idBeam, idBeamAbs, idVMDBeam;
511 double mBeam, mVMDBeam, scaleVMDBeam;
514 bool isUnresolvedBeam, isLeptonBeam, isHadronBeam, isMesonBeam,
515 isBaryonBeam, isGammaBeam;
516 int nValKinds, idVal[3], nVal[3];
519 int idSave, iSkipSave, nValLeft[3];
520 double xqgTot, xqVal, xqgSea, xqCompSum;
523 bool doISR, doMPI, doND, isResolvedGamma, hasResGammaInBeam,
524 isResUnres, hasVMDstateInBeam, initGammaBeam;
525 double pTminISR, pTminMPI, pT2gm2qqbar;
526 int iGamVal, iPosVal, gammaMode;
529 double xGm, Q2gm, kTgamma, phiGamma;
533 double xsCache, resCache;
536 vector<ResolvedParton> resolved;
540 bool hasJunctionBeam;
544 pair <int,int> colSetup;
545 vector<int> acols, cols;
546 vector<bool> usedCol,usedAcol;
547 vector< pair<int,int> > colUpdates;
548 int nJuncs, nAjuncs, nDiffJuncs;
549 bool allowBeamJunctions;
552 double xfModified(
int iSkip,
int idIn,
double x,
double Q2) {
554 return xfModified(iSkip, idIn, x, Q2, xfData);}
555 double xfModified(
int iSkip,
int idIn,
double x,
double Q2,
558 double xfModified0(
int iSkip,
int idIn,
double x,
double Q2);
561 double xValFrac(
int j,
double Q2);
562 double Q2ValFracSav, uValInt, dValInt;
565 double xCompFrac(
double xs);
568 double xCompDist(
double xc,
double xs);
571 int idVal1, idVal2, idVal3;
572 double zRel, pxRel, pyRel;
575 void updateSingleCol(
int oldCol,
int newCol);
579 int findSingleCol(
Event& event,
bool isAcol,
bool useHardScatters);
ResolvedParton(int iPosIn=0, int idIn=0, double xIn=0., int companionIn=-1)
Constructor.
Definition: BeamParticle.h:43
double xfMax(int idIn, double x, double Q2)
Overestimate for PDFs. Same as normal except photons inside leptons.
Definition: BeamParticle.h:223
void setBeamID(int idIn, int iPDFin=-1)
Switch to new beam particle identity; for similar hadrons only.
Definition: BeamParticle.h:181
Definition: BeamParticle.h:120
void resolvedGamma(bool isResolved)
Set and get the state (resolved and/or unresolved) of photon beam.
Definition: BeamParticle.h:383
double xfFlux(int idIn, double x, double Q2)
Accurate and approximated photon flux and PDFs.
Definition: BeamParticle.h:227
Definition: PhysicsBase.h:27
The Event class holds all info on the generated event.
Definition: Event.h:408
void newM(double mIn)
Set new mass. Used with photons when virtuality is sampled.
Definition: BeamParticle.h:192
bool hasJunction() const
Tell whether a junction has been resolved, and its junction colours.
Definition: BeamParticle.h:342
Definition: BeamParticle.h:133
double xfHard(int idIn, double x, double Q2)
Special hard-process parton distributions (can agree with standard ones).
Definition: BeamParticle.h:219
void clear()
Clear list of resolved partons.
Definition: BeamParticle.h:300
BeamParticle()
Constructor.
Definition: BeamParticle.h:138
void iPos(int iPosIn)
Set info on initiator or remnant parton.
Definition: BeamParticle.h:49
void setVMDstate(bool isVMDIn, int idIn, double mIn, double scaleIn, bool reassignState=false)
Set state of VMD inside gamma.
Definition: BeamParticle.h:392
void newPzE(double pzIn, double eIn)
Set new pZ and E, but keep the rest the same.
Definition: BeamParticle.h:189
void initPDFPtr(PDFPtr pdfInPtr, PDFPtr pdfHardInPtr)
Initialize only the two pdf pointers.
Definition: BeamParticle.h:166
int nValenceKinds() const
How many different flavours, and how many quarks of given flavour.
Definition: BeamParticle.h:323
bool hasApproxGammaFlux()
Do photon flux use an approximation for sampling.
Definition: BeamParticle.h:442
void resetGammaInLepton()
Reset variables related to photon beam inside a lepton.
Definition: BeamParticle.h:307
double xGamma() const
Get the kinematics related photons form lepton beams.
Definition: BeamParticle.h:445
int size() const
Total number of partons extracted from beam, and initiators only.
Definition: BeamParticle.h:296
void xGammaPDF()
Save the x_gamma value after latest PDF call or set it later if ND.
Definition: BeamParticle.h:430
void pTMPI(double pTminMPIin)
Store the pT value for the latest MPI.
Definition: BeamParticle.h:410
Error envelope from PDF uncertainty.
Definition: PartonDistributions.h:102
double xfMPI(int idIn, double x, double Q2, xfModPrepData &xfData)
Definition: BeamParticle.h:251
bool isHadron() const
As hadrons here we only count those we know how to handle remnants for.
Definition: BeamParticle.h:208
void pT2gamma2qqbar(double pT2in)
Store the pT2 value of gamma->qqbar splitting.
Definition: BeamParticle.h:406
double xf(int idIn, double x, double Q2)
Standard parton distributions.
Definition: BeamParticle.h:240
void popBack()
Remove the last particle from the beam. Reset companion code if needed.
Definition: BeamParticle.h:315
void calcPDFEnvelope(int idNow, double xNow, double Q2Now, int valSea)
Calculate envelope of PDF predictions.
Definition: BeamParticle.h:276
ResolvedParton & operator[](int i)
Overload index operator to access a resolved parton from the list.
Definition: BeamParticle.h:290
double mQuarkPDF(int idIn)
Return quark masses used in the PDF fit (LHAPDF6 only).
Definition: BeamParticle.h:270
bool insideBounds(double x, double Q2)
Check whether x and Q2 values fall inside the fit bounds (LHAPDF6 only).
Definition: BeamParticle.h:263
double gammaPDFxDependence(int flavour, double x)
Functions to approximate pdfs for ISR.
Definition: BeamParticle.h:422
void initSwitchID(const vector< PDFPtr > &pdfSavePtrsIn)
Initialize array of PDFs for switching between them.
Definition: BeamParticle.h:173
double alphaS(double Q2)
Access the running alpha_s of a PDF set (LHAPDF6 only).
Definition: BeamParticle.h:267
int iPos() const
Get info on initiator or remnant parton.
Definition: BeamParticle.h:71
int id() const
Member functions for output.
Definition: BeamParticle.h:195
Definition: BeamParticle.h:38
double m2(const Vec4 &v1)
The squared invariant mass of one or more four-vectors.
Definition: Basics.cc:598
int nMembers()
Return number of members in PDF family (LHAPDF6 only).
Definition: BeamParticle.h:273
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
double m(const Vec4 &v1)
Invariant mass and its square.
Definition: Basics.cc:588
The StringFlav class is used to select quark and hadron flavours.
Definition: FragmentationFlavZpT.h:87
void initID(int idIn)
Initialize only the id.
Definition: BeamParticle.h:163
void resetGamma()
Reset variables related to photon beam.
Definition: BeamParticle.h:303
double xfSame(int idIn, double x, double Q2)
Definition: BeamParticle.h:236
double sampleXgamma(double xMinIn)
Sample x and Q2 for emitted photons according to flux.
Definition: BeamParticle.h:457
double xfVal(int idIn, double x, double Q2)
Ditto, split into valence and sea parts (where gluon counts as sea).
Definition: BeamParticle.h:244
double xGammaMin()
Get the kinematic limits for photons emitted by the beam.
Definition: BeamParticle.h:437
void xPom(double xpom=-1.0)
Keep track of pomeron momentum fraction.
Definition: BeamParticle.h:453
int append(int iPos, int idIn, double x, int companion=-1)
Add a resolved parton to list.
Definition: BeamParticle.h:310