LCOV - code coverage report
Current view: top level - PYTHIA8/pythia8210dev/include/Pythia8 - Event.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 249 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 171 0.0 %

          Line data    Source code
       1             : // Event.h is a part of the PYTHIA event generator.
       2             : // Copyright (C) 2015 Torbjorn Sjostrand.
       3             : // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
       4             : // Please respect the MCnet Guidelines, see GUIDELINES for details.
       5             : 
       6             : // Header file for the Particle and Event classes.
       7             : // Particle: information on an instance of a particle.
       8             : // Junction: information on a junction between three colours.
       9             : // Event: list of particles in the current event.
      10             : 
      11             : #ifndef Pythia8_Event_H
      12             : #define Pythia8_Event_H
      13             : 
      14             : #include "Pythia8/Basics.h"
      15             : #include "Pythia8/ParticleData.h"
      16             : #include "Pythia8/PythiaStdlib.h"
      17             : 
      18             : namespace Pythia8 {
      19             : 
      20             : //==========================================================================
      21             : 
      22             : // Forward references to ParticleDataEntry and ResonanceWidths classes.
      23             : class ParticleDataEntry;
      24             : class ResonanceWidths;
      25             : class Event;
      26             : 
      27             : //==========================================================================
      28             : 
      29             : // Particle class.
      30             : // This class holds info on a particle in general.
      31             : 
      32             : class Particle {
      33             : 
      34             : public:
      35             : 
      36             :   // Constructors.
      37           0 :   Particle() : idSave(0), statusSave(0), mother1Save(0), mother2Save(0),
      38           0 :     daughter1Save(0), daughter2Save(0), colSave(0), acolSave(0),
      39           0 :     pSave(Vec4(0.,0.,0.,0.)), mSave(0.), scaleSave(0.), polSave(9.),
      40           0 :     hasVertexSave(false), vProdSave(Vec4(0.,0.,0.,0.)), tauSave(0.),
      41           0 :     pdePtr(0), evtPtr(0) { }
      42             :   Particle(int idIn, int statusIn = 0, int mother1In = 0,
      43             :     int mother2In = 0, int daughter1In = 0, int daughter2In = 0,
      44             :     int colIn = 0, int acolIn = 0, double pxIn = 0., double pyIn = 0.,
      45             :     double pzIn = 0., double eIn = 0., double mIn = 0.,
      46             :     double scaleIn = 0., double polIn = 9.)
      47           0 :     : idSave(idIn), statusSave(statusIn), mother1Save(mother1In),
      48           0 :     mother2Save(mother2In), daughter1Save(daughter1In),
      49           0 :     daughter2Save(daughter2In), colSave(colIn), acolSave(acolIn),
      50           0 :     pSave(Vec4(pxIn, pyIn, pzIn, eIn)), mSave(mIn), scaleSave(scaleIn),
      51           0 :     polSave(polIn), hasVertexSave(false), vProdSave(Vec4(0.,0.,0.,0.)),
      52           0 :     tauSave(0.), pdePtr(0), evtPtr(0) { }
      53             :   Particle(int idIn, int statusIn, int mother1In, int mother2In,
      54             :     int daughter1In, int daughter2In, int colIn, int acolIn,
      55             :     Vec4 pIn, double mIn = 0., double scaleIn = 0., double polIn = 9.)
      56           0 :     : idSave(idIn), statusSave(statusIn), mother1Save(mother1In),
      57           0 :     mother2Save(mother2In), daughter1Save(daughter1In),
      58           0 :     daughter2Save(daughter2In), colSave(colIn), acolSave(acolIn),
      59           0 :     pSave(pIn), mSave(mIn), scaleSave(scaleIn), polSave(polIn),
      60           0 :     hasVertexSave(false), vProdSave(Vec4(0.,0.,0.,0.)), tauSave(0.),
      61           0 :     pdePtr(0), evtPtr(0) { }
      62           0 :   Particle(const Particle& pt) : idSave(pt.idSave),
      63           0 :     statusSave(pt.statusSave), mother1Save(pt.mother1Save),
      64           0 :     mother2Save(pt.mother2Save), daughter1Save(pt.daughter1Save),
      65           0 :     daughter2Save(pt.daughter2Save), colSave(pt.colSave),
      66           0 :     acolSave(pt.acolSave), pSave(pt.pSave), mSave(pt.mSave),
      67           0 :     scaleSave(pt.scaleSave), polSave(pt.polSave),
      68           0 :     hasVertexSave(pt.hasVertexSave), vProdSave(pt.vProdSave),
      69           0 :     tauSave(pt.tauSave), pdePtr(pt.pdePtr), evtPtr(pt.evtPtr) { }
      70           0 :   Particle& operator=(const Particle& pt) {if (this != &pt) {
      71           0 :     idSave = pt.idSave; statusSave = pt.statusSave;
      72           0 :     mother1Save = pt.mother1Save; mother2Save = pt.mother2Save;
      73           0 :     daughter1Save = pt.daughter1Save; daughter2Save = pt.daughter2Save;
      74           0 :     colSave = pt.colSave; acolSave = pt.acolSave; pSave = pt.pSave;
      75           0 :     mSave = pt.mSave; scaleSave = pt.scaleSave; polSave = pt.polSave;
      76           0 :     hasVertexSave = pt.hasVertexSave; vProdSave = pt.vProdSave;
      77           0 :     tauSave = pt.tauSave; pdePtr = pt.pdePtr; evtPtr = pt.evtPtr; }
      78           0 :     return *this; }
      79             : 
      80             :   // Member functions to set the Event and ParticleDataEntry pointers.
      81           0 :   void setEvtPtr(Event* evtPtrIn) { evtPtr = evtPtrIn; setPDEPtr();}
      82             :   void setPDEPtr(ParticleDataEntry* pdePtrIn = 0);
      83             : 
      84             :   // Member functions for input.
      85           0 :   void id(int idIn) {idSave = idIn; setPDEPtr();}
      86           0 :   void status(int statusIn) {statusSave = statusIn;}
      87           0 :   void statusPos() {statusSave = abs(statusSave);}
      88           0 :   void statusNeg() {statusSave = -abs(statusSave);}
      89             :   void statusCode(int statusIn) {statusSave =
      90             :     (statusSave > 0) ? abs(statusIn) : -abs(statusIn);}
      91           0 :   void mother1(int mother1In) {mother1Save = mother1In;}
      92           0 :   void mother2(int mother2In) {mother2Save = mother2In;}
      93             :   void mothers(int mother1In = 0, int mother2In = 0)
      94           0 :     {mother1Save = mother1In; mother2Save = mother2In;}
      95           0 :   void daughter1(int daughter1In) {daughter1Save = daughter1In;}
      96           0 :   void daughter2(int daughter2In) {daughter2Save = daughter2In;}
      97             :   void daughters(int daughter1In = 0, int daughter2In = 0)
      98           0 :     {daughter1Save = daughter1In; daughter2Save = daughter2In;}
      99           0 :   void col(int colIn) {colSave = colIn;}
     100           0 :   void acol(int acolIn) {acolSave = acolIn;}
     101           0 :   void cols(int colIn = 0,int acolIn = 0) {colSave = colIn;
     102           0 :     acolSave = acolIn;}
     103           0 :   void p(Vec4 pIn) {pSave = pIn;}
     104             :   void p(double pxIn, double pyIn, double pzIn, double eIn)
     105           0 :     {pSave.p(pxIn, pyIn, pzIn, eIn);}
     106             :   void px(double pxIn) {pSave.px(pxIn);}
     107             :   void py(double pyIn) {pSave.py(pyIn);}
     108           0 :   void pz(double pzIn) {pSave.pz(pzIn);}
     109           0 :   void e(double eIn) {pSave.e(eIn);}
     110           0 :   void m(double mIn) {mSave = mIn;}
     111           0 :   void scale(double scaleIn) {scaleSave = scaleIn;}
     112           0 :   void pol(double polIn) {polSave = polIn;}
     113           0 :   void vProd(Vec4 vProdIn) {vProdSave = vProdIn; hasVertexSave = true;}
     114             :   void vProd(double xProdIn, double yProdIn, double zProdIn, double tProdIn)
     115             :     {vProdSave.p(xProdIn, yProdIn, zProdIn, tProdIn); hasVertexSave = true;}
     116             :   void xProd(double xProdIn) {vProdSave.px(xProdIn); hasVertexSave = true;}
     117             :   void yProd(double yProdIn) {vProdSave.py(yProdIn); hasVertexSave = true;}
     118             :   void zProd(double zProdIn) {vProdSave.pz(zProdIn); hasVertexSave = true;}
     119             :   void tProd(double tProdIn) {vProdSave.e(tProdIn); hasVertexSave = true;}
     120           0 :   void tau(double tauIn) {tauSave = tauIn;}
     121             : 
     122             :   // Member functions for output.
     123           0 :   int    id()        const {return idSave;}
     124           0 :   int    status()    const {return statusSave;}
     125           0 :   int    mother1()   const {return mother1Save;}
     126           0 :   int    mother2()   const {return mother2Save;}
     127           0 :   int    daughter1() const {return daughter1Save;}
     128           0 :   int    daughter2() const {return daughter2Save;}
     129           0 :   int    col()       const {return colSave;}
     130           0 :   int    acol()      const {return acolSave;}
     131           0 :   Vec4   p()         const {return pSave;}
     132           0 :   double px()        const {return pSave.px();}
     133           0 :   double py()        const {return pSave.py();}
     134           0 :   double pz()        const {return pSave.pz();}
     135           0 :   double e()         const {return pSave.e();}
     136           0 :   double m()         const {return mSave;}
     137           0 :   double scale()     const {return scaleSave;}
     138           0 :   double pol()       const {return polSave;}
     139           0 :   bool   hasVertex() const {return hasVertexSave;}
     140           0 :   Vec4   vProd()     const {return vProdSave;}
     141           0 :   double xProd()     const {return vProdSave.px();}
     142           0 :   double yProd()     const {return vProdSave.py();}
     143           0 :   double zProd()     const {return vProdSave.pz();}
     144           0 :   double tProd()     const {return vProdSave.e();}
     145           0 :   double tau()       const {return tauSave;}
     146             : 
     147             :   // Member functions for output; derived int and bool quantities.
     148           0 :   int    idAbs()     const {return abs(idSave);}
     149           0 :   int    statusAbs() const {return abs(statusSave);}
     150           0 :   bool   isFinal()   const {return (statusSave > 0);}
     151           0 :   bool   isRescatteredIncoming() const {return
     152           0 :     (statusSave == -34 || statusSave == -45 ||
     153           0 :      statusSave == -46 || statusSave == -54);}
     154             : 
     155             :   // Member functions for output; derived double quantities.
     156           0 :   double m2()        const {return (mSave >= 0.) ?  mSave*mSave
     157           0 :                                                  : -mSave*mSave;}
     158           0 :   double mCalc()     const {return pSave.mCalc();}
     159             :   double m2Calc()    const {return pSave.m2Calc();}
     160           0 :   double eCalc()     const {return sqrt(abs(m2() + pSave.pAbs2()));}
     161           0 :   double pT()        const {return pSave.pT();}
     162           0 :   double pT2()       const {return pSave.pT2();}
     163           0 :   double mT()        const {double temp = m2() + pSave.pT2();
     164           0 :     return (temp >= 0.) ? sqrt(temp) : -sqrt(-temp);}
     165           0 :   double mT2()       const {return m2() + pSave.pT2();}
     166           0 :   double pAbs()      const {return pSave.pAbs();}
     167           0 :   double pAbs2()     const {return pSave.pAbs2();}
     168             :   double eT()        const {return pSave.eT();}
     169             :   double eT2()       const {return pSave.eT2();}
     170             :   double theta()     const {return pSave.theta();}
     171           0 :   double phi()       const {return pSave.phi();}
     172             :   double thetaXZ()   const {return pSave.thetaXZ();}
     173           0 :   double pPos()      const {return pSave.pPos();}
     174           0 :   double pNeg()      const {return pSave.pNeg();}
     175             :   double y()         const;
     176             :   double eta()       const;
     177           0 :   Vec4   vDec()      const {return (tauSave > 0. && mSave > 0.)
     178           0 :     ? vProdSave + tauSave * pSave / mSave : vProdSave;}
     179           0 :   double xDec()      const {return (tauSave > 0. && mSave > 0.)
     180           0 :     ? vProdSave.px() + tauSave * pSave.px() / mSave : vProdSave.px();}
     181           0 :   double yDec()      const {return (tauSave > 0. && mSave > 0.)
     182           0 :     ? vProdSave.py() + tauSave * pSave.py() / mSave : vProdSave.py();}
     183           0 :   double zDec()      const {return (tauSave > 0. && mSave > 0.)
     184           0 :     ? vProdSave.pz() + tauSave * pSave.pz() / mSave : vProdSave.pz();}
     185             :   double tDec()      const {return (tauSave > 0. && mSave > 0.)
     186             :     ? vProdSave.e()  + tauSave * pSave.e()  / mSave : vProdSave.e();}
     187             : 
     188             :   // Methods that can refer back to the event the particle belongs to.
     189             :   virtual int index() const;
     190             :   int iTopCopy()      const;
     191             :   int iBotCopy()      const;
     192             :   int iTopCopyId(bool simplify = false) const;
     193             :   int iBotCopyId(bool simplify = false) const;
     194             :   vector<int> motherList()   const;
     195             :   vector<int> daughterList() const;
     196             :   vector<int> sisterList(bool traceTopBot = false) const;
     197             :   bool isAncestor(int iAncestor) const;
     198             :   int statusHepMC()  const;
     199             :   bool isFinalPartonLevel() const;
     200             :   bool undoDecay();
     201             : 
     202             :   // Further output, based on a pointer to a ParticleDataEntry object.
     203             :   string name()      const {
     204             :     return (pdePtr != 0) ? pdePtr->name(idSave) : " ";}
     205             :   string nameWithStatus(int maxLen = 20) const;
     206             :   int    spinType()  const {
     207           0 :     return (pdePtr != 0) ? pdePtr->spinType() : 0;}
     208             :   int    chargeType() const {
     209           0 :     return (pdePtr != 0) ? pdePtr->chargeType(idSave) : 0;}
     210             :   double charge()    const {
     211           0 :     return (pdePtr != 0) ?  pdePtr->charge(idSave) : 0;}
     212             :   bool   isCharged() const {
     213             :     return (pdePtr != 0) ? (pdePtr->chargeType(idSave) != 0) : false;}
     214             :   bool   isNeutral() const {
     215           0 :     return (pdePtr != 0) ? (pdePtr->chargeType(idSave) == 0) : false;}
     216             :   int    colType()   const {
     217           0 :     return (pdePtr != 0) ? pdePtr->colType(idSave) : 0;}
     218             :   double m0()        const {
     219           0 :     return (pdePtr != 0) ? pdePtr->m0() : 0.;}
     220             :   double mWidth()    const {
     221           0 :     return (pdePtr != 0) ? pdePtr->mWidth() : 0.;}
     222             :   double mMin()      const {
     223             :     return (pdePtr != 0) ? pdePtr->mMin() : 0.;}
     224             :   double mMax()      const {
     225             :     return (pdePtr != 0) ? pdePtr->mMax() : 0.;}
     226             :   double mSel()      const {
     227             :     return (pdePtr != 0) ? pdePtr->mSel() : 0.;}
     228             :   double constituentMass() const {
     229           0 :     return (pdePtr != 0) ? pdePtr->constituentMass() : 0.;}
     230             :   double tau0()      const {
     231           0 :     return (pdePtr != 0) ? pdePtr->tau0() : 0.;}
     232             :   bool   mayDecay()  const {
     233           0 :     return (pdePtr != 0) ? pdePtr->mayDecay() : false;}
     234             :   bool   canDecay()  const {
     235           0 :     return (pdePtr != 0) ? pdePtr->canDecay() : false;}
     236             :   bool   doExternalDecay() const {
     237             :     return (pdePtr != 0) ? pdePtr->doExternalDecay() : false;}
     238             :   bool   isResonance() const {
     239           0 :     return (pdePtr != 0) ? pdePtr->isResonance() : false;}
     240             :   bool   isVisible() const {
     241           0 :     return (pdePtr != 0) ? pdePtr->isVisible() : false;}
     242             :   bool   isLepton()  const {
     243           0 :     return (pdePtr != 0) ? pdePtr->isLepton() : false;}
     244             :   bool   isQuark()   const {
     245           0 :     return (pdePtr != 0) ? pdePtr->isQuark() : false;}
     246             :   bool   isGluon()   const {
     247           0 :     return (pdePtr != 0) ? pdePtr->isGluon() : false;}
     248             :   bool   isDiquark()   const {
     249           0 :     return (pdePtr != 0) ? pdePtr->isDiquark() : false;}
     250             :   bool   isParton()   const {
     251           0 :     return (pdePtr != 0) ? pdePtr->isParton() : false;}
     252             :   bool   isHadron()  const {
     253           0 :     return (pdePtr != 0) ? pdePtr->isHadron() : false;}
     254           0 :   ParticleDataEntry& particleDataEntry() const {return *pdePtr;}
     255             : 
     256             :   // Member functions that perform operations.
     257             :   void rescale3(double fac) {pSave.rescale3(fac);}
     258           0 :   void rescale4(double fac) {pSave.rescale4(fac);}
     259           0 :   void rescale5(double fac) {pSave.rescale4(fac); mSave *= fac;}
     260           0 :   void rot(double thetaIn, double phiIn) {pSave.rot(thetaIn, phiIn);
     261           0 :     if (hasVertexSave) vProdSave.rot(thetaIn, phiIn);}
     262             :   void bst(double betaX, double betaY, double betaZ) {
     263           0 :     pSave.bst(betaX, betaY, betaZ);
     264           0 :     if (hasVertexSave) vProdSave.bst(betaX, betaY, betaZ);}
     265             :   void bst(double betaX, double betaY, double betaZ, double gamma) {
     266           0 :     pSave.bst(betaX, betaY, betaZ, gamma);
     267           0 :     if (hasVertexSave) vProdSave.bst(betaX, betaY, betaZ, gamma);}
     268           0 :   void bst(const Vec4& pBst) {pSave.bst(pBst);
     269           0 :     if (hasVertexSave) vProdSave.bst(pBst);}
     270           0 :   void bst(const Vec4& pBst, double mBst) {pSave.bst(pBst, mBst);
     271           0 :     if (hasVertexSave) vProdSave.bst(pBst, mBst);}
     272           0 :   void bstback(const Vec4& pBst) {pSave.bstback(pBst);
     273           0 :     if (hasVertexSave) vProdSave.bstback(pBst);}
     274             :   void bstback(const Vec4& pBst, double mBst) {pSave.bstback(pBst, mBst);
     275             :     if (hasVertexSave) vProdSave.bstback(pBst, mBst);}
     276           0 :   void rotbst(const RotBstMatrix& M) {pSave.rotbst(M);
     277           0 :     if (hasVertexSave) vProdSave.rotbst(M);}
     278             :   void offsetHistory( int minMother, int addMother, int minDaughter,
     279             :     int addDaughter);
     280             :   void offsetCol( int addCol);
     281             : 
     282             : protected:
     283             : 
     284             :   // Constants: could only be changed in the code itself.
     285             :   static const double TINY;
     286             : 
     287             :   // Properties of the current particle.
     288             :   int    idSave, statusSave, mother1Save, mother2Save, daughter1Save,
     289             :          daughter2Save, colSave, acolSave;
     290             :   Vec4   pSave;
     291             :   double mSave, scaleSave, polSave;
     292             :   bool   hasVertexSave;
     293             :   Vec4   vProdSave;
     294             :   double tauSave;
     295             : 
     296             :   // Pointer to properties of the particle species.
     297             :   // Should no be saved in a persistent copy of the event record.
     298             :   // The //! below is ROOT notation that this member should not be saved.
     299             :   // Event::restorePtrs() can be called to restore the missing information.
     300             :   ParticleDataEntry* pdePtr;  //!
     301             : 
     302             :   // Pointer to the whole event record to which the particle belongs (if any).
     303             :   // As above it should not be saved.
     304             :   Event*             evtPtr;  //!
     305             : 
     306             : };
     307             : 
     308             : // Invariant mass of a pair and its square.
     309             : // (Not part of class proper, but tightly linked.)
     310             : double m(const Particle&, const Particle&);
     311             : double m2(const Particle&, const Particle&);
     312             : 
     313             : //==========================================================================
     314             : 
     315             : // The junction class stores what kind of junction it is, the colour indices
     316             : // of the legs at the junction and as far out as legs have been traced,
     317             : // and the status codes assigned for fragmentation of each leg.
     318             : 
     319             : class Junction {
     320             : 
     321             : public:
     322             : 
     323             :   // Constructors.
     324           0 :   Junction() : remainsSave(true), kindSave(0) {
     325           0 :     for (int j = 0; j < 3; ++j) {
     326           0 :     colSave[j] = 0; endColSave[j] = 0; statusSave[j] = 0; } }
     327             :   Junction( int kindIn, int col0In, int col1In, int col2In)
     328           0 :     : remainsSave(true), kindSave(kindIn) {colSave[0] = col0In;
     329           0 :     colSave[1] = col1In; colSave[2] = col2In;
     330           0 :     for (int j = 0; j < 3; ++j) {
     331           0 :     endColSave[j] = colSave[j]; statusSave[j] = 0; } }
     332           0 :   Junction(const Junction& ju) : remainsSave(ju.remainsSave),
     333           0 :     kindSave(ju.kindSave) { for (int j = 0; j < 3; ++j) {
     334           0 :     colSave[j] = ju.colSave[j]; endColSave[j] = ju.endColSave[j];
     335           0 :     statusSave[j] = ju.statusSave[j]; } }
     336           0 :   Junction& operator=(const Junction& ju) {if (this != &ju) {
     337           0 :     remainsSave = ju.remainsSave; kindSave =  ju.kindSave;
     338           0 :     for (int j = 0; j < 3; ++j) { colSave[j] = ju.colSave[j];
     339           0 :     endColSave[j] = ju.endColSave[j]; statusSave[j] = ju.statusSave[j]; } }
     340           0 :     return *this; }
     341             : 
     342             :   // Set values.
     343           0 :   void remains(bool remainsIn) {remainsSave = remainsIn;}
     344           0 :   void col(int j, int colIn) {colSave[j] = colIn; endColSave[j] = colIn;}
     345           0 :   void cols(int j, int colIn, int endColIn) {colSave[j] = colIn;
     346           0 :     endColSave[j] = endColIn;}
     347           0 :   void endCol(int j, int endColIn) {endColSave[j] = endColIn;}
     348           0 :   void status(int j, int statusIn) {statusSave[j] = statusIn;}
     349             : 
     350             :   // Read out value.
     351           0 :   bool   remains()     const {return remainsSave;}
     352           0 :   int    kind()        const {return kindSave;}
     353           0 :   int    col(int j)    const {return colSave[j];}
     354           0 :   int    endCol(int j) const {return endColSave[j];}
     355           0 :   int    status(int j) const {return statusSave[j];}
     356             : 
     357             : private:
     358             : 
     359             :   // Kind, positions of the three ends and their status codes.
     360             :   bool remainsSave;
     361             :   int kindSave, colSave[3], endColSave[3], statusSave[3];
     362             : 
     363             : };
     364             : 
     365             : //==========================================================================
     366             : 
     367             : // The Event class holds all info on the generated event.
     368             : 
     369           0 : class Event {
     370             : 
     371             : public:
     372             : 
     373             :   // Constructors.
     374           0 :   Event(int capacity = 100) : startColTag(100), maxColTag(100),
     375           0 :     savedSize(0), savedJunctionSize(0), savedPartonLevelSize(0),
     376           0 :     scaleSave(0.), scaleSecondSave(0.),
     377           0 :     headerList("----------------------------------------"),
     378           0 :     particleDataPtr(0) { entry.reserve(capacity); }
     379             :   Event& operator=(const Event& oldEvent);
     380           0 :   Event(const Event& oldEvent) {*this = oldEvent;}
     381             : 
     382             :   // Initialize header for event listing, particle data table, and colour.
     383             :   void init( string headerIn = "", ParticleData* particleDataPtrIn = 0,
     384             :     int startColTagIn = 100) {
     385           0 :     headerList.replace(0, headerIn.length() + 2, headerIn + "  ");
     386           0 :      particleDataPtr = particleDataPtrIn; startColTag = startColTagIn;}
     387             : 
     388             :   // Clear event record.
     389           0 :   void clear() {entry.resize(0); maxColTag = startColTag;
     390           0 :     savedPartonLevelSize = 0; scaleSave = 0.; scaleSecondSave = 0.;
     391           0 :     clearJunctions();}
     392             : 
     393             :   // Clear event record, and set first particle empty.
     394           0 :   void reset() {clear(); append(90, -11, 0, 0, 0., 0., 0., 0., 0.);}
     395             : 
     396             :   // Overload index operator to access element of event record.
     397           0 :   Particle& operator[](int i) {return entry[i];}
     398           0 :   const Particle& operator[](int i) const {return entry[i];}
     399             : 
     400             :   // Implement standard references to elements in the particle array.
     401             :   Particle& front()   {return entry.front();}
     402             :   Particle& at(int i) {return entry.at(i);}
     403           0 :   Particle& back()    {return entry.back();}
     404             : 
     405             :   // Event record size.
     406           0 :   int size() const {return entry.size();}
     407             : 
     408             :   // Put a new particle at the end of the event record; return index.
     409             :   int append(Particle entryIn) {
     410           0 :     entry.push_back(entryIn); setEvtPtr();
     411           0 :     if (entryIn.col() > maxColTag) maxColTag = entryIn.col();
     412           0 :     if (entryIn.acol() > maxColTag) maxColTag = entryIn.acol();
     413           0 :     return entry.size() - 1;
     414             :   }
     415             :   int append(int id, int status, int mother1, int mother2, int daughter1,
     416             :     int daughter2, int col, int acol, double px, double py, double pz,
     417             :     double e, double m = 0., double scaleIn = 0., double polIn = 9.) {
     418           0 :     entry.push_back( Particle(id, status, mother1, mother2, daughter1,
     419           0 :     daughter2, col, acol, px, py, pz, e, m, scaleIn, polIn) ); setEvtPtr();
     420           0 :     if (col > maxColTag) maxColTag = col;
     421           0 :     if (acol > maxColTag) maxColTag = acol;
     422           0 :     return entry.size() - 1;
     423             :   }
     424             :   int append(int id, int status, int mother1, int mother2, int daughter1,
     425             :     int daughter2, int col, int acol, Vec4 p, double m = 0.,
     426             :     double scaleIn = 0., double polIn = 9.) {
     427           0 :     entry.push_back( Particle(id, status, mother1, mother2, daughter1,
     428           0 :     daughter2, col, acol, p, m, scaleIn, polIn) ); setEvtPtr();
     429           0 :     if (col > maxColTag) maxColTag = col;
     430           0 :     if (acol > maxColTag) maxColTag = acol;
     431           0 :     return entry.size() - 1;
     432             :   }
     433             : 
     434             :   // Brief versions of append: no mothers and no daughters.
     435             :   int append(int id, int status, int col, int acol, double px, double py,
     436             :     double pz, double e, double m = 0., double scaleIn = 0.,
     437           0 :     double polIn = 9.) { entry.push_back( Particle(id, status, 0, 0, 0, 0,
     438           0 :     col, acol, px, py, pz, e, m, scaleIn, polIn) ); setEvtPtr();
     439           0 :     if (col > maxColTag) maxColTag = col;
     440           0 :     if (acol > maxColTag) maxColTag = acol;
     441           0 :     return entry.size() - 1;
     442             :   }
     443             :   int append(int id, int status, int col, int acol, Vec4 p, double m = 0.,
     444             :     double scaleIn = 0., double polIn = 9.) {entry.push_back( Particle(id,
     445             :     status, 0, 0, 0, 0, col, acol, p, m, scaleIn, polIn) ); setEvtPtr();
     446             :     if (col > maxColTag) maxColTag = col;
     447             :     if (acol > maxColTag) maxColTag = acol;
     448             :     return entry.size() - 1;
     449             :   }
     450             : 
     451             :   // Set pointer to the event for a particle, by default latest one.
     452           0 :   void setEvtPtr(int iSet = -1) {if (iSet < 0) iSet = entry.size() - 1;
     453           0 :     entry[iSet].setEvtPtr( this);}
     454             : 
     455             :   // Add a copy of an existing particle at the end of the event record.
     456             :   int copy(int iCopy, int newStatus = 0);
     457             : 
     458             :   // List the particles in an event.
     459             :   void list(int precision = 3) const;
     460             :   void list(ostream& os, int precision = 3) const;
     461             :   void list(bool showScaleAndVertex, bool showMothersAndDaughters = false,
     462             :     int precision = 3) const;
     463             :   void list(bool showScaleAndVertex, bool showMothersAndDaughters,
     464             :     ostream& os, int precision = 3) const;
     465             : 
     466             :   // Remove last n entries.
     467           0 :   void popBack(int nRemove = 1) { if (nRemove ==1) entry.pop_back();
     468           0 :     else {int newSize = max( 0, size() - nRemove);
     469           0 :     entry.resize(newSize);} }
     470             : 
     471             :   // Remove entries from iFirst to iLast, including endpoints.
     472             :   void remove(int iFirst, int iLast) {
     473           0 :     if (iFirst < 0 || iLast >= int(entry.size()) || iLast < iFirst) return;
     474           0 :     entry.erase( entry.begin() + iFirst, entry.begin() + iLast + 1);
     475           0 :   }
     476             : 
     477             :   // Restore all ParticleDataEntry* pointers in the Particle vector.
     478             :   // Useful when a persistent copy of the event record is read back in.
     479             :   void restorePtrs() { for (int i = 0; i < size(); ++i) setEvtPtr(i); }
     480             : 
     481             :   // Save or restore the size of the event record (throwing at the end).
     482           0 :   void saveSize() {savedSize = entry.size();}
     483           0 :   void restoreSize() {entry.resize(savedSize);}
     484           0 :   int  savedSizeValue() {return savedSize;}
     485             : 
     486             :   // Initialize and access colour tag information.
     487           0 :   void initColTag(int colTag = 0) {maxColTag = max( colTag,startColTag);}
     488           0 :   int lastColTag() const {return maxColTag;}
     489           0 :   int nextColTag() {return ++maxColTag;}
     490             : 
     491             :   // Access scale for which event as a whole is defined.
     492           0 :   void scale( double scaleIn) {scaleSave = scaleIn;}
     493           0 :   double scale() const {return scaleSave;}
     494             : 
     495             :   // Need a second scale if two hard interactions in event.
     496           0 :   void scaleSecond( double scaleSecondIn) {scaleSecondSave = scaleSecondIn;}
     497           0 :   double scaleSecond() const {return scaleSecondSave;}
     498             : 
     499             :   // Find complete list of daughters.
     500             :   // Note: temporarily retained for CMS compatibility. Do not use!
     501             :   vector<int> daughterList(int i) const {return entry[i].daughterList();}
     502             : 
     503             :   // Member functions for rotations and boosts of an event.
     504             :   void rot(double theta, double phi)
     505             :     {for (int i = 0; i < size(); ++i) entry[i].rot(theta, phi);}
     506             :   void bst(double betaX, double betaY, double betaZ)
     507             :     {for (int i = 0; i < size(); ++i) entry[i].bst(betaX, betaY, betaZ);}
     508             :   void bst(double betaX, double betaY, double betaZ, double gamma)
     509           0 :     {for (int i = 0; i < size(); ++i) entry[i].bst(betaX, betaY, betaZ,
     510           0 :     gamma);}
     511             :   void bst(const Vec4& vec)
     512             :     {for (int i = 0; i < size(); ++i) entry[i].bst(vec);}
     513             :   void rotbst(const RotBstMatrix& M)
     514           0 :     {for (int i = 0; i < size(); ++i) entry[i].rotbst(M);}
     515             : 
     516             :   // Clear the list of junctions.
     517           0 :   void clearJunctions() {junction.resize(0);}
     518             : 
     519             :   // Add a junction to the list, study it or extra input.
     520             :   int appendJunction( int kind, int col0, int col1, int col2)
     521           0 :     { junction.push_back( Junction( kind, col0, col1, col2) );
     522           0 :     return junction.size() - 1;}
     523           0 :   int appendJunction(Junction junctionIn) {junction.push_back(junctionIn);
     524           0 :     return junction.size() - 1;}
     525           0 :   int sizeJunction() const {return junction.size();}
     526           0 :   bool remainsJunction(int i) const {return junction[i].remains();}
     527           0 :   void remainsJunction(int i, bool remainsIn) {junction[i].remains(remainsIn);}
     528           0 :   int kindJunction(int i) const {return junction[i].kind();}
     529           0 :   int colJunction( int i, int j) const {return junction[i].col(j);}
     530           0 :   void colJunction( int i, int j, int colIn) {junction[i].col(j, colIn);}
     531           0 :   int endColJunction( int i, int j) const {return junction[i].endCol(j);}
     532             :   void endColJunction( int i, int j, int endColIn)
     533           0 :     {junction[i].endCol(j, endColIn);}
     534           0 :   int statusJunction( int i, int j) const {return junction[i].status(j);}
     535             :   void statusJunction( int i, int j, int statusIn)
     536           0 :     {junction[i].status(j, statusIn);}
     537           0 :   Junction& getJunction(int i) {return junction[i];}
     538           0 :   const Junction& getJunction(int i) const {return junction[i];}
     539             :   void eraseJunction(int i);
     540             : 
     541             :   // Save or restore the size of the junction list (throwing at the end).
     542           0 :   void saveJunctionSize() {savedJunctionSize = junction.size();}
     543           0 :   void restoreJunctionSize() {junction.resize(savedJunctionSize);}
     544             : 
     545             :   // List any junctions in the event; for debug mainly.
     546             :   void listJunctions(ostream& os = cout) const;
     547             : 
     548             :   // Save event record size at Parton Level, i.e. before hadronization.
     549           0 :   void savePartonLevelSize() {savedPartonLevelSize = entry.size();}
     550             : 
     551             :   // Operator overloading allows to append one event to an existing one.
     552             :   // Warning: particles should be OK, but some other information unreliable.
     553             :   Event& operator+=(const Event& addEvent);
     554             : 
     555             : private:
     556             : 
     557             :   // The Particle class needs to access particle data.
     558             :   friend class Particle;
     559             : 
     560             :   // Constants: could only be changed in the code itself.
     561             :   static const int IPERLINE;
     562             : 
     563             :   // Initialization data, normally only set once.
     564             :   int startColTag;
     565             : 
     566             :   // The event: a vector containing all particles (entries).
     567             :   // The explicit use of Pythia8:: qualifier patches a limitation in ROOT.
     568             :   vector<Pythia8::Particle> entry;
     569             : 
     570             :   // The list of junctions.
     571             :   // The explicit use of Pythia8:: qualifier patches a limitation in ROOT.
     572             :   vector<Pythia8::Junction> junction;
     573             : 
     574             :   // The maximum colour tag of the event so far.
     575             :   int maxColTag;
     576             : 
     577             :   // Saved entry and junction list sizes, for simple restoration.
     578             :   int savedSize, savedJunctionSize, savedPartonLevelSize;
     579             : 
     580             :   // The scale of the event; linear quantity in GeV.
     581             :   double scaleSave, scaleSecondSave;
     582             : 
     583             :   // Header specification in event listing (at most 40 characters wide).
     584             :   string headerList;
     585             : 
     586             :   // Pointer to the particle data table.
     587             :   // The //! below is ROOT notation that this member should not be saved.
     588             :   ParticleData* particleDataPtr;  //!
     589             : 
     590             : };
     591             : 
     592             : //==========================================================================
     593             : 
     594             : } // end namespace Pythia8
     595             : 
     596             : #endif // end Pythia8_Event_H

Generated by: LCOV version 1.11