Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // BeamParticle.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 // Header file for information on incoming beams.
0007 // ResolvedParton: an initiator or remnant in beam.
0008 // BeamParticle: contains partons, parton densities, etc.
0009 
0010 #ifndef Pythia8_BeamParticle_H
0011 #define Pythia8_BeamParticle_H
0012 
0013 #include "Pythia8/Basics.h"
0014 #include "Pythia8/Event.h"
0015 #include "Pythia8/FragmentationFlavZpT.h"
0016 #include "Pythia8/Info.h"
0017 #include "Pythia8/ParticleData.h"
0018 #include "Pythia8/PartonDistributions.h"
0019 #include "Pythia8/PhysicsBase.h"
0020 #include "Pythia8/PythiaStdlib.h"
0021 #include "Pythia8/Settings.h"
0022 
0023 namespace Pythia8 {
0024 
0025 //==========================================================================
0026 
0027 // This class holds info on a parton resolved inside the incoming beam,
0028 // i.e. either an initiator (part of a hard or a multiparton interaction)
0029 // or a remnant (part of the beam remnant treatment).
0030 
0031 // The companion code is -1 from onset and for g, is -2 for an unmatched
0032 // sea quark, is >= 0 for a matched sea quark, with the number giving the
0033 // companion position, and is -3 for a valence quark.
0034 
0035 // Rescattering partons properly do not belong here, but bookkeeping is
0036 // simpler with them, so they are stored with companion code -10.
0037 
0038 class ResolvedParton {
0039 
0040 public:
0041 
0042   // Constructor.
0043   ResolvedParton( int iPosIn = 0, int idIn = 0, double xIn = 0.,
0044     int companionIn = -1) : iPosRes(iPosIn), idRes(idIn), xRes(xIn),
0045     companionRes(companionIn), xqCompRes(0.), mRes(0.), factorRes(1.),
0046     colRes(0), acolRes(0) { }
0047 
0048   // Set info on initiator or remnant parton.
0049   void iPos( int iPosIn) {iPosRes = iPosIn;}
0050   void id( int idIn) {idRes = idIn;}
0051   void x( double xIn) {xRes = xIn;}
0052   void update( int iPosIn, int idIn, double xIn) {iPosRes = iPosIn;
0053     idRes = idIn; xRes = xIn;}
0054   void companion( int companionIn) {companionRes = companionIn;}
0055   void xqCompanion( double xqCompIn) {xqCompRes = xqCompIn;}
0056   void p(Vec4 pIn) {pRes = pIn;}
0057   void px(double pxIn) {pRes.px(pxIn);}
0058   void py(double pyIn) {pRes.py(pyIn);}
0059   void pz(double pzIn) {pRes.pz(pzIn);}
0060   void e(double eIn) {pRes.e(eIn);}
0061   void m(double mIn) {mRes = mIn;}
0062   void col(int colIn) {colRes = colIn;}
0063   void acol(int acolIn) {acolRes = acolIn;}
0064   void cols(int colIn = 0,int acolIn = 0)
0065     {colRes = colIn; acolRes = acolIn;}
0066   void scalePT( double factorIn) {pRes.px(factorIn * pRes.px());
0067     pRes.py(factorIn * pRes.py()); factorRes *= factorIn;}
0068   void scaleX( double factorIn) {xRes *= factorIn;}
0069 
0070   // Get info on initiator or remnant parton.
0071   int    iPos()        const {return iPosRes;}
0072   int    id()          const {return idRes;}
0073   double x()           const {return xRes;}
0074   int    companion()   const {return companionRes;}
0075   bool   isValence()   const {return (companionRes == -3);}
0076   bool   isUnmatched() const {return (companionRes == -2);}
0077   bool   isCompanion() const {return (companionRes >= 0);}
0078   bool   isFromBeam()  const {return (companionRes > -10);}
0079   double xqCompanion() const {return xqCompRes;}
0080   Vec4   p()           const {return pRes;}
0081   double px()          const {return pRes.px();}
0082   double py()          const {return pRes.py();}
0083   double pz()          const {return pRes.pz();}
0084   double e()           const {return pRes.e();}
0085   double m()           const {return mRes;}
0086   double pT()          const {return pRes.pT();}
0087   double mT2()         const {return (mRes >= 0.)
0088     ? mRes*mRes + pRes.pT2() : - mRes*mRes + pRes.pT2();}
0089   double pPos()        const {return pRes.e() +  pRes.pz();}
0090   double pNeg()        const {return pRes.e() -  pRes.pz();}
0091   int    col()         const {return colRes;}
0092   int    acol()        const {return acolRes;}
0093   double pTfactor()    const {return factorRes;}
0094   bool hasCol()        const {return (idRes == 21 || (idRes > 0 && idRes < 9)
0095     || (-idRes > 1000 && -idRes < 10000 && (-idRes/10)%10 == 0));}
0096   bool hasAcol()       const {return (idRes == 21 || (-idRes > 0 && -idRes < 9)
0097     || (idRes > 1000 && idRes < 10000 && (idRes/10)%10 == 0));}
0098 
0099 private:
0100 
0101   // Properties of a resolved parton.
0102   int    iPosRes, idRes;
0103   double xRes;
0104   // Companion code and distribution value, if any.
0105   int    companionRes;
0106   double xqCompRes;
0107   // Four-momentum and mass; for remnant kinematics construction.
0108   Vec4   pRes;
0109   double mRes, factorRes;
0110   // Colour codes.
0111   int   colRes, acolRes;
0112 
0113 };
0114 
0115 //==========================================================================
0116 
0117 // The xfModPrepData struct saves information on the amount of x already used,
0118 // to speed up PDF evaluation.
0119 
0120 typedef struct {
0121   double xValTot;
0122   double xValLeft;
0123   double xLeft;
0124   double xCompAdded;
0125   double rescaleGS;
0126 } xfModPrepData;
0127 
0128 //==========================================================================
0129 
0130 // This class holds info on a beam particle in the evolution of
0131 // initial-state radiation and multiparton interactions.
0132 
0133 class BeamParticle : public PhysicsBase {
0134 
0135 public:
0136 
0137   // Constructor.
0138   BeamParticle() : pdfBeamPtr(), pdfHardBeamPtr(), pdfUnresBeamPtr(),
0139     pdfBeamPtrSave(), pdfHardBeamPtrSave(), pdfSavePtrs(),
0140     pdfSaveIdx(-1), flavSelPtr(), allowJunction(), beamJunction(),
0141     maxValQuark(), companionPower(), valencePowerMeson(), valencePowerUinP(),
0142     valencePowerDinP(), valenceDiqEnhance(), pickQuarkNorm(), pickQuarkPower(),
0143     diffPrimKTwidth(), diffLargeMassSuppress(), beamSat(), gluonPower(),
0144     xGluonCutoff(), heavyQuarkEnhance(), idBeam(), idBeamAbs(), idVMDBeam(),
0145     mBeam(), mVMDBeam(), scaleVMDBeam(), isUnresolvedBeam(), isLeptonBeam(),
0146     isHadronBeam(), isMesonBeam(), isBaryonBeam(), isGammaBeam(), nValKinds(),
0147     idVal(), nVal(), idSave(), iSkipSave(), nValLeft(), xqgTot(), xqVal(),
0148     xqgSea(), xqCompSum(), doISR(), doMPI(), doND(), isResolvedGamma(),
0149     hasResGammaInBeam(), isResUnres(), hasVMDstateInBeam(), initGammaBeam(),
0150     pTminISR(), pTminMPI(), pT2gm2qqbar(), iGamVal(), iPosVal(), gammaMode(),
0151     xGm(), Q2gm(), kTgamma(), phiGamma(), cPowerCache(-100), xsCache(-1),
0152     resCache(), resolved(), nInit(0), hasJunctionBeam(), junCol(), nJuncs(),
0153     nAjuncs(), nDiffJuncs(), allowBeamJunctions(), Q2ValFracSav(-1.),
0154     uValInt(), dValInt(), idVal1(), idVal2(), idVal3(), zRel(), pxRel(),
0155     pyRel() { }
0156 
0157   // Initialize data on a beam particle and save pointers.
0158   void init( int idIn, double pzIn, double eIn, double mIn,
0159     PDFPtr pdfInPtr, PDFPtr pdfHardInPtr, bool isUnresolvedIn,
0160     StringFlav* flavSelPtrIn);
0161 
0162   // Initialize only the id.
0163   void initID( int idIn) { idBeam = idIn; initBeamKind();}
0164 
0165   // Initialize only the two pdf pointers.
0166   void initPDFPtr(PDFPtr pdfInPtr, PDFPtr pdfHardInPtr) {
0167     pdfBeamPtr = pdfInPtr; pdfHardBeamPtr = pdfHardInPtr; }
0168 
0169   // Initialize additional PDF pointer for unresolved beam.
0170   void initUnres(PDFPtr pdfUnresInPtr);
0171 
0172   // Initialize array of PDFs for switching between them.
0173   void initSwitchID( const vector<PDFPtr>& pdfSavePtrsIn) {
0174     pdfSavePtrs = pdfSavePtrsIn; }
0175 
0176   // For mesons like pi0 valence content varies from event to event.
0177   void newValenceContent();
0178   void setValenceContent(int idq1, int idq2 = 0, int idq3 = 0);
0179 
0180   // Switch to new beam particle identity; for similar hadrons only.
0181   void setBeamID( int idIn, int iPDFin = -1) {idBeam = idIn;
0182     if ( iPDFin >= 0 && iPDFin < int(pdfSavePtrs.size())
0183       && iPDFin != pdfSaveIdx ) {
0184       pdfBeamPtr = pdfSavePtrs[iPDFin]; pdfHardBeamPtr = pdfBeamPtr;
0185       pdfSaveIdx = iPDFin; }
0186     mBeam = particleDataPtr->m0(idIn); pdfBeamPtr->setBeamID(idIn); }
0187 
0188   // Set new pZ and E, but keep the rest the same.
0189   void newPzE( double pzIn, double eIn) {pBeam = Vec4( 0., 0., pzIn, eIn);}
0190 
0191   // Set new mass. Used with photons when virtuality is sampled.
0192   void newM( double mIn) { mBeam = mIn; }
0193 
0194   // Member functions for output.
0195   int id()            const {return idBeam;}
0196   int  idVMD()        const {return idVMDBeam;}
0197   Vec4 p()            const {return pBeam;}
0198   double px()         const {return pBeam.px();}
0199   double py()         const {return pBeam.py();}
0200   double pz()         const {return pBeam.pz();}
0201   double e()          const {return pBeam.e();}
0202   double m()          const {return mBeam;}
0203   double mVMD()       const {return mVMDBeam;}
0204   double scaleVMD()   const {return scaleVMDBeam;}
0205   bool isLepton()     const {return isLeptonBeam;}
0206   bool isUnresolved() const {return isUnresolvedBeam;}
0207   // As hadrons here we only count those we know how to handle remnants for.
0208   bool isHadron()     const {return isHadronBeam;}
0209   bool isMeson()      const {return isMesonBeam;}
0210   bool isBaryon()     const {return isBaryonBeam;}
0211   bool isGamma()      const {return isGammaBeam;}
0212   bool hasResGamma()  const {return hasResGammaInBeam;}
0213   bool hasVMDstate()  const {return hasVMDstateInBeam;}
0214 
0215   // Maximum x remaining after previous MPI and ISR, plus safety margin.
0216   double xMax(int iSkip = -1);
0217 
0218   // Special hard-process parton distributions (can agree with standard ones).
0219   double xfHard(int idIn, double x, double Q2)
0220     {return pdfHardBeamPtr->xf(idIn, x, Q2);}
0221 
0222   // Overestimate for PDFs. Same as normal except photons inside leptons.
0223   double xfMax(int idIn, double x, double Q2)
0224     {return pdfHardBeamPtr->xfMax(idIn, x, Q2);}
0225 
0226   // Accurate and approximated photon flux and PDFs.
0227   double xfFlux(int idIn, double x, double Q2)
0228     {return pdfHardBeamPtr->xfFlux(idIn, x, Q2);}
0229   double xfApprox(int idIn, double x, double Q2)
0230     {return pdfHardBeamPtr->xfApprox(idIn, x, Q2);}
0231   double xfGamma(int idIn, double x, double Q2)
0232     {return pdfHardBeamPtr->xfGamma(idIn, x, Q2);}
0233 
0234   // Do not sample the x_gamma value to get correct cross section with
0235   // possible second call.
0236   double xfSame(int idIn, double x, double Q2)
0237     {return pdfHardBeamPtr->xfSame(idIn, x, Q2);}
0238 
0239   // Standard parton distributions.
0240   double xf(int idIn, double x, double Q2)
0241     {return pdfBeamPtr->xf(idIn, x, Q2);}
0242 
0243   // Ditto, split into valence and sea parts (where gluon counts as sea).
0244   double xfVal(int idIn, double x, double Q2)
0245     {return pdfBeamPtr->xfVal(idIn, x, Q2);}
0246   double xfSea(int idIn, double x, double Q2)
0247     {return pdfBeamPtr->xfSea(idIn, x, Q2);}
0248 
0249   // Rescaled parton distributions, as needed for MPI and ISR.
0250   // For ISR also allow split valence/sea, and only return relevant part.
0251   double xfMPI(int idIn, double x, double Q2, xfModPrepData& xfData)
0252     {return xfISR(-1, idIn, x, Q2, xfData);}
0253   double xfMPI(int idIn, double x, double Q2)
0254     {xfModPrepData xfData = xfModPrep(-1, Q2);
0255     return xfISR(-1, idIn, x, Q2, xfData);}
0256   double xfISR(int indexMPI, int idIn, double x, double Q2,
0257     xfModPrepData& xfData) {return xfModified( indexMPI, idIn, x, Q2, xfData);}
0258   double xfISR(int indexMPI, int idIn, double x, double Q2)
0259     {xfModPrepData xfData= xfModPrep(indexMPI, Q2);
0260     return xfModified( indexMPI, idIn, x, Q2, xfData);}
0261 
0262   // Check whether x and Q2 values fall inside the fit bounds (LHAPDF6 only).
0263   bool insideBounds(double x, double Q2)
0264     {return pdfBeamPtr->insideBounds(x,Q2);}
0265 
0266   // Access the running alpha_s of a PDF set (LHAPDF6 only).
0267   double alphaS(double Q2) {return pdfBeamPtr->alphaS(Q2);}
0268 
0269   // Return quark masses used in the PDF fit (LHAPDF6 only).
0270   double mQuarkPDF(int idIn) {return pdfBeamPtr->mQuarkPDF(idIn);}
0271 
0272   // Return number of members in PDF family (LHAPDF6 only).
0273   int nMembers() {return pdfBeamPtr->nMembers();}
0274 
0275   // Calculate envelope of PDF predictions
0276   void calcPDFEnvelope(int idNow, double xNow, double Q2Now, int valSea) {
0277     pdfBeamPtr->calcPDFEnvelope(idNow,xNow,Q2Now,valSea);}
0278   void calcPDFEnvelope(pair<int,int> idNows, pair<double,double> xNows,
0279     double Q2Now, int valSea) {
0280     pdfBeamPtr->calcPDFEnvelope(idNows,xNows,Q2Now,valSea);}
0281   PDF::PDFEnvelope getPDFEnvelope() { return pdfBeamPtr->getPDFEnvelope(); }
0282 
0283   // Decide whether chosen quark is valence, sea or companion.
0284   int pickValSeaComp();
0285 
0286   // Initialize kind of incoming beam particle.
0287   void initBeamKind();
0288 
0289   // Overload index operator to access a resolved parton from the list.
0290   ResolvedParton& operator[](int i) {return resolved[i];}
0291   const ResolvedParton& operator[](int i) const {return resolved[i];}
0292 
0293   // Total number of partons extracted from beam, and initiators only.
0294   int size() const {return resolved.size();}
0295   int sizeInit() const {return nInit;}
0296 
0297   // Clear list of resolved partons.
0298   void clear() {resolved.resize(0); nInit = 0;}
0299 
0300   // Reset variables related to photon beam.
0301   void resetGamma() {iGamVal = -1; iPosVal = -1; pT2gm2qqbar = 0.;
0302     isResolvedGamma = (gammaMode == 1) ? true : false;}
0303 
0304   // Reset variables related to photon beam inside a lepton.
0305   void resetGammaInLepton() {xGm = 1.; kTgamma = 0.; phiGamma = 0.;}
0306 
0307   // Add a resolved parton to list.
0308   int append( int iPos, int idIn, double x, int companion = -1)
0309     {resolved.push_back( ResolvedParton( iPos, idIn, x, companion) );
0310     return resolved.size() - 1;}
0311 
0312   // Remove the last particle from the beam. Reset companion code if needed.
0313   void popBack() { int iComp = resolved.back().companion();
0314     resolved.pop_back(); if ( iComp >= 0 ) { iSkipSave = iComp;
0315       idSave = resolved[iComp].id(); pickValSeaComp(); } }
0316 
0317   // Print extracted parton list; for debug mainly.
0318   void list() const;
0319 
0320   // How many different flavours, and how many quarks of given flavour.
0321   int nValenceKinds() const {return nValKinds;}
0322   int nValence(int idIn) const {for (int i = 0; i < nValKinds; ++i)
0323       if (idIn == idVal[i]) return nVal[i];
0324     return 0;}
0325 
0326   // Test whether a lepton is to be considered as unresolved.
0327   bool isUnresolvedLepton();
0328 
0329   // Add extra remnant flavours to make valence and sea come out right.
0330   bool remnantFlavours(Event& event, bool isDIS = false);
0331 
0332   // Correlate all initiators and remnants to make a colour singlet.
0333   bool remnantColours(Event& event, vector<int>& colFrom,
0334     vector<int>& colTo);
0335 
0336   // Pick unrescaled x of remnant parton (valence or sea).
0337   double xRemnant(int i);
0338 
0339   // Tell whether a junction has been resolved, and its junction colours.
0340   bool hasJunction() const {return hasJunctionBeam;}
0341   int junctionCol(int i) const {return junCol[i];}
0342   void junctionCol(int i, int col) {junCol[i] = col;}
0343 
0344   // For a diffractive system, decide whether to kick out gluon or quark.
0345   bool pickGluon(double mDiff);
0346 
0347   // Pick a valence quark at random, and provide the remaining flavour.
0348   int pickValence();
0349   int pickRemnant() const {return idVal2;}
0350 
0351   // Share lightcone momentum between two remnants in a diffractive system.
0352   // At the same time generate a relative pT for the two.
0353   double zShare( double mDiff, double m1, double m2);
0354   double pxShare() const {return pxRel;}
0355   double pyShare() const {return pyRel;}
0356 
0357   // Add extra remnant flavours to make valence and sea come out right.
0358   bool remnantFlavoursNew(Event& event);
0359 
0360   // Find the colour setup of the removed partons from the scatterings.
0361   void findColSetup(Event& event);
0362 
0363   // Set initial colours.
0364   void setInitialCol(Event & event);
0365 
0366   // Update colours.
0367   void updateCol(vector<pair<int,int> > colourChanges);
0368 
0369   vector<pair <int,int> > getColUpdates() {return colUpdates;}
0370 
0371   // Set valence content for photon beams and position of first valence quark.
0372   bool gammaInitiatorIsVal(int iResolved, int id, double x, double Q2);
0373   bool gammaInitiatorIsVal(int iResolved, double Q2);
0374   int  getGammaValFlavour() { return abs(idVal[0]); }
0375   int  gammaValSeaComp(int iResolved);
0376   void posVal(int iPosValIn)          { iPosVal = iPosValIn; }
0377   void gamVal(int iGamValIn)          { iGamVal = iGamValIn; }
0378   int  gamVal()                       { return iGamVal; }
0379 
0380   // Set and get the state (resolved and/or unresolved) of photon beam.
0381   void resolvedGamma(bool isResolved) { isResolvedGamma = isResolved; }
0382   bool resolvedGamma() const          { return isResolvedGamma; }
0383   void setGammaMode(int gammaModeIn);
0384   int  getGammaMode() const           { return gammaMode; }
0385   bool isResolvedUnresolved() const   { return isResUnres; }
0386   void initGammaInBeam()              { initGammaBeam = true; }
0387   bool gammaInBeam() const            { return initGammaBeam; }
0388 
0389   // Set state of VMD inside gamma.
0390   void setVMDstate(bool isVMDIn, int idIn, double mIn, double scaleIn,
0391     bool reassignState = false) {
0392     hasVMDstateInBeam = isVMDIn;
0393     idVMDBeam         = idIn;
0394     mVMDBeam          = mIn;
0395     scaleVMDBeam      = scaleIn;
0396     if (reassignState) {
0397       idBeam = idVMDBeam;
0398       mBeam  = mVMDBeam;
0399       pdfBeamPtr->setVMDscale(scaleVMDBeam);
0400     }
0401   }
0402 
0403   // Store the pT2 value of gamma->qqbar splitting.
0404   void   pT2gamma2qqbar(double pT2in) { pT2gm2qqbar = pT2in; }
0405   double pT2gamma2qqbar()             { return pT2gm2qqbar; }
0406 
0407   // Store the pT value for the latest MPI.
0408   void   pTMPI(double pTminMPIin)     { pTminMPI = pTminMPIin; }
0409 
0410   // Check whether room for beam remnants.
0411   bool roomFor1Remnant(double eCM);
0412   bool roomFor1Remnant(int id1, double x1, double eCM);
0413   bool roomFor2Remnants(int id1, double x1, double eCM);
0414   bool roomForRemnants(BeamParticle beamOther);
0415 
0416   // Evaluate the remnant mass with initiator idIn.
0417   double remnantMass(int idIn);
0418 
0419   // Functions to approximate pdfs for ISR.
0420   double gammaPDFxDependence(int flavour, double x)
0421     { return pdfBeamPtr->gammaPDFxDependence(flavour, x); }
0422   double gammaPDFRefScale(int flavour)
0423     { return pdfBeamPtr->gammaPDFRefScale(flavour); }
0424   double xIntegratedPDFs(double Q2)
0425     { return pdfBeamPtr->xfIntegratedTotal(Q2); }
0426 
0427   // Save the x_gamma value after latest PDF call or set it later if ND.
0428   void xGammaPDF()            { xGm = pdfHardBeamPtr->xGamma(); }
0429   void xGamma(double xGmIn)   { xGm = xGmIn; }
0430   void Q2Gamma(double Q2GmIn) { Q2gm = Q2GmIn; }
0431   void newGammaKTPhi(double kTIn, double phiIn)
0432     { kTgamma = kTIn; phiGamma = phiIn; }
0433 
0434   // Get the kinematic limits for photons emitted by the beam.
0435   double xGammaMin()          { return pdfHardBeamPtr->getXmin(); }
0436   double xGammaHadr()         { return pdfHardBeamPtr->getXhadr(); }
0437   double gammaFluxIntApprox() { return pdfHardBeamPtr->intFluxApprox(); }
0438 
0439   // Do photon flux use an approximation for sampling.
0440   bool hasApproxGammaFlux() { return pdfHardBeamPtr->hasApproxGammaFlux(); }
0441 
0442   // Get the kinematics related photons form lepton beams.
0443   double xGamma()   const { return xGm; }
0444   double Q2Gamma()  const { return Q2gm; }
0445   double gammaKTx() const { return kTgamma*cos(phiGamma); }
0446   double gammaKTy() const { return kTgamma*sin(phiGamma); }
0447   double gammaKT()  const { return kTgamma; }
0448   double gammaPhi() const { return phiGamma; }
0449 
0450   // Keep track of pomeron momentum fraction.
0451   void xPom(double xpom = -1.0)
0452     { if ( pdfBeamPtr ) pdfBeamPtr->xPom(xpom); }
0453 
0454   // Sample x and Q2 for emitted photons according to flux.
0455   double sampleXgamma(double xMinIn)
0456     { xGm = pdfHardBeamPtr->sampleXgamma(xMinIn); return xGm; }
0457   double sampleQ2gamma(double Q2min)
0458     { Q2gm = pdfHardBeamPtr->sampleQ2gamma(Q2min); return Q2gm;}
0459 
0460   // Prepare data on how much x has been used, for speedup of PDF evaluation.
0461   xfModPrepData xfModPrep( int iSkip, double Q2);
0462 
0463 private:
0464 
0465   // Constants: could only be changed in the code itself.
0466   static const double XMINUNRESOLVED, POMERONMASS, XMAXCOMPANION, TINYZREL;
0467   static const int NMAX, NRANDOMTRIES;
0468 
0469   // Pointers to PDF sets.
0470   PDFPtr          pdfBeamPtr;
0471   PDFPtr          pdfHardBeamPtr;
0472 
0473   // Pointer to unresolved PDF and two others to save the resolved ptrs.
0474   PDFPtr          pdfUnresBeamPtr;
0475   PDFPtr          pdfBeamPtrSave;
0476   PDFPtr          pdfHardBeamPtrSave;
0477 
0478   // Array of PDFs to be used when idA can be changed between events.
0479   vector<PDFPtr>  pdfSavePtrs;
0480   int             pdfSaveIdx;
0481 
0482   // Pointer to class for flavour generation.
0483   StringFlav*   flavSelPtr;
0484 
0485   // Initialization data, normally only set once.
0486   bool   allowJunction, beamJunction;
0487   int    maxValQuark, companionPower;
0488   double valencePowerMeson, valencePowerUinP, valencePowerDinP,
0489          valenceDiqEnhance, pickQuarkNorm, pickQuarkPower,
0490          diffPrimKTwidth, diffLargeMassSuppress, beamSat, gluonPower,
0491          xGluonCutoff, heavyQuarkEnhance[6];
0492 
0493   // Basic properties of a beam particle.
0494   int    idBeam, idBeamAbs, idVMDBeam;
0495   Vec4   pBeam;
0496   double mBeam, mVMDBeam, scaleVMDBeam;
0497 
0498   // Beam kind. Valence flavour content for hadrons.
0499   bool   isUnresolvedBeam, isLeptonBeam, isHadronBeam, isMesonBeam,
0500          isBaryonBeam, isGammaBeam;
0501   int    nValKinds, idVal[3], nVal[3];
0502 
0503   // Current parton density, by valence, sea and companion.
0504   int    idSave, iSkipSave, nValLeft[3];
0505   double xqgTot, xqVal, xqgSea, xqCompSum;
0506 
0507   // Variables related to photon beams (also inside lepton).
0508   bool   doISR, doMPI, doND, isResolvedGamma, hasResGammaInBeam,
0509          isResUnres, hasVMDstateInBeam, initGammaBeam;
0510   double pTminISR, pTminMPI, pT2gm2qqbar;
0511   int    iGamVal, iPosVal, gammaMode;
0512 
0513   // Variables for photon from lepton.
0514   double xGm, Q2gm, kTgamma, phiGamma;
0515 
0516   // Cache values for xCompFrac method.
0517   int    cPowerCache;
0518   double xsCache, resCache;
0519 
0520   // The list of resolved partons.
0521   vector<ResolvedParton> resolved;
0522 
0523   // Status after all initiators have been accounted for. Junction content.
0524   int    nInit;
0525   bool   hasJunctionBeam;
0526   int    junCol[3];
0527 
0528   // Variables for new colour reconnection;
0529   pair <int,int> colSetup;
0530   vector<int> acols, cols;
0531   vector<bool> usedCol,usedAcol;
0532   vector< pair<int,int> > colUpdates;
0533   int nJuncs, nAjuncs, nDiffJuncs;
0534   bool allowBeamJunctions;
0535 
0536   // Routine to calculate PDFs given previous interactions.
0537   double xfModified( int iSkip, int idIn, double x, double Q2) {
0538     xfModPrepData xfData = xfModPrep(iSkip, Q2);
0539     return xfModified(iSkip, idIn, x, Q2, xfData);}
0540   double xfModified( int iSkip, int idIn, double x, double Q2,
0541     xfModPrepData& data);
0542   // In case of resolved.size() === 0.
0543   double xfModified0( int iSkip, int idIn, double x, double Q2);
0544 
0545   // Fraction of hadron momentum sitting in a valence quark distribution.
0546   double xValFrac(int j, double Q2);
0547   double Q2ValFracSav, uValInt, dValInt;
0548 
0549   // Fraction of hadron momentum sitting in a companion quark distribution.
0550   double xCompFrac(double xs);
0551 
0552   // Value of companion quark PDF, also given the sea quark x.
0553   double xCompDist(double xc, double xs);
0554 
0555   // Valence quark subdivision for diffractive systems.
0556   int    idVal1, idVal2, idVal3;
0557   double zRel, pxRel, pyRel;
0558 
0559   // Update a single (anti-) colour of the event.
0560   void updateSingleCol(int oldCol, int newCol);
0561 
0562   // Find a single (anti-) colour in the beam,
0563   // if a beam remnant is set the new colour.
0564   int findSingleCol(Event& event, bool isAcol, bool useHardScatters);
0565 
0566 };
0567 
0568 //==========================================================================
0569 
0570 } // end namespace Pythia8
0571 
0572 #endif // Pythia8_BeamParticle_H