Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // FragmentationSystems.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 // This file contains auxiliary classes in the fragmentation process.
0007 // ColSinglet contains info on an individual singlet.
0008 // ColConfig describes the colour configuration of the whole event.
0009 // StringRegion keeps track on string momenta and directions.
0010 // StringSystem contains all the StringRegions of the colour singlet.
0011 // StringVertex contains information on space-time location of string breaks.
0012 
0013 #ifndef Pythia8_FragmentationSystems_H
0014 #define Pythia8_FragmentationSystems_H
0015 
0016 #include "Pythia8/Basics.h"
0017 #include "Pythia8/Event.h"
0018 #include "Pythia8/FragmentationFlavZpT.h"
0019 #include "Pythia8/Info.h"
0020 #include "Pythia8/ParticleData.h"
0021 #include "Pythia8/PythiaStdlib.h"
0022 #include "Pythia8/Settings.h"
0023 
0024 namespace Pythia8 {
0025 
0026 //==========================================================================
0027 
0028 // The ColSinglet class contains info on an individual singlet.
0029 // Only to be used inside ColConfig, so no private members.
0030 
0031 class ColSinglet {
0032 
0033 public:
0034 
0035   // Constructors.
0036   ColSinglet() : pSum(0., 0., 0., 0.), mass(0.), massExcess(0.),
0037     hasJunction(false), isClosed(false), isCollected(false) {}
0038   ColSinglet(vector<int>& iPartonIn, Vec4 pSumIn, double massIn,
0039     double massExcessIn, bool hasJunctionIn = false,
0040     bool isClosedIn = false, bool isCollectedIn = false)
0041     : iParton(iPartonIn), pSum(pSumIn), mass(massIn),
0042     massExcess(massExcessIn), hasJunction(hasJunctionIn),
0043     isClosed(isClosedIn), isCollected(isCollectedIn) {}
0044 
0045   // Size of iParton array.
0046   int size() const { return iParton.size();}
0047 
0048   // Stored quantities.
0049   vector<int> iParton;
0050   Vec4   pSum;
0051   double mass, massExcess;
0052   bool   hasJunction, isClosed, isCollected;
0053 
0054 };
0055 
0056 //==========================================================================
0057 
0058 // The ColConfig class describes the colour configuration of the whole event.
0059 
0060 class ColConfig {
0061 
0062 public:
0063 
0064   // Constructor.
0065   ColConfig() : loggerPtr(), flavSelPtr(), mJoin(), mJoinJunction(),
0066     mStringMin() {singlets.resize(0);}
0067 
0068   // Initialize and save pointers.
0069   void init(Info* infoPtrIn, StringFlav* flavSelPtrIn);
0070 
0071   // Number of colour singlets.
0072   int size() const {return singlets.size();}
0073 
0074   // Overload index operator to access separate colour singlets.
0075   ColSinglet& operator[](int iSub) {return singlets[iSub];}
0076   const ColSinglet& operator[](int iSub) const {return singlets[iSub];}
0077 
0078   // Clear contents.
0079   void clear() {singlets.resize(0);}
0080 
0081   // Insert a new colour singlet system in ascending mass order.
0082   // Calculate its properties. Join nearby partons.
0083   bool insert( vector<int>& iPartonIn, Event& event);
0084 
0085   // Insert a new qqbar colour singlet system in ascending mass order.
0086   // Calculate its properties.
0087   bool simpleInsert( vector<int>& iPartonIn, Event& event,
0088     bool fixOrder = false);
0089 
0090   // Erase a colour singlet system. (Rare operation.)
0091   void erase(int iSub) {singlets.erase(singlets.begin() + iSub);}
0092 
0093   // Collect all partons of singlet to be consecutively ordered.
0094   void collect(int iSub, Event& event, bool skipTrivial = true);
0095 
0096   // Find to which singlet system a particle belongs.
0097   int findSinglet(int i);
0098 
0099   // List all currently identified singlets.
0100   void list() const;
0101 
0102   // Rapidity range [y_min, y_max] of all string pieces in all singlets.
0103   // Only used when ClosePacking:doClosePacking is on.
0104   vector< vector< pair<double,double> > > rapPairs;
0105 
0106 private:
0107 
0108   // Constants: could only be changed in the code itself.
0109   static const double CONSTITUENTMASS;
0110 
0111   // Pointer to logger.
0112   Logger* loggerPtr;
0113 
0114   // Pointer to class for flavour generation.
0115   StringFlav* flavSelPtr;
0116 
0117   // Initialization data, to be read from Settings.
0118   double mJoin, mJoinJunction, mStringMin;
0119 
0120   // List of all separate colour singlets.
0121   vector<ColSinglet> singlets;
0122 
0123   // Join two legs of junction to a diquark for small invariant masses.
0124   bool joinJunction( vector<int>& iPartonIn, Event& event,
0125     double massExcessIn);
0126 
0127 };
0128 
0129 //==========================================================================
0130 
0131 // The StringRegion class contains the information related to
0132 // one string section in the evolution of a multiparton system.
0133 // Only to be used inside StringFragmentation and MiniStringFragmentation,
0134 // so no private members.
0135 
0136 class StringRegion {
0137 
0138 public:
0139 
0140   // Constructor.
0141   StringRegion() : isSetUp(false), isEmpty(true), w2(0.), xPosProj(0.),
0142     xNegProj(0.), pxProj(0.), pyProj(0.), colPos(0), colNeg(0) {}
0143 
0144   // Constants: could only be changed in the code itself.
0145   static const double MJOIN, TINY;
0146 
0147   // Data members.
0148   bool   isSetUp, isEmpty;
0149   Vec4   pPos, pNeg, eX, eY, pPosMass, pNegMass, massOffset;
0150   double w2, xPosProj, xNegProj, pxProj, pyProj;
0151   int    colPos, colNeg;
0152 
0153   // Calculate offset of the region from parton list. Special junction case.
0154   Vec4 gluonOffset(vector<int>& iSys, Event& event, int iPos, int iNeg);
0155   Vec4 gluonOffsetJRF(vector<int>& iSys, Event& event, int iPos, int iNeg,
0156     RotBstMatrix MtoJRF);
0157 
0158   // If massive case, the offset of the initial regions is calculated.
0159   bool massiveOffset(int iPos, int iNeg, int iMax, int id1, int id2,
0160     double mc, double mb);
0161 
0162   // Set up four-vectors for longitudinal and transverse directions.
0163   void setUp(Vec4 p1, Vec4 p2, int col1, int col2, bool isMassless = false);
0164 
0165   // Construct a four-momentum from (x+, x-, px, py).
0166   Vec4 pHad( double xPosIn, double xNegIn, double pxIn, double pyIn) const
0167     { return xPosIn * pPos + xNegIn * pNeg + pxIn * eX + pyIn * eY; }
0168 
0169   // Project a four-momentum onto (x+, x-, px, py). Read out projection.
0170   void project(Vec4 pIn);
0171   void project( double pxIn, double pyIn, double pzIn, double eIn)
0172     { project( Vec4( pxIn, pyIn, pzIn, eIn) ); }
0173   double xPos() const {return xPosProj;}
0174   double xNeg() const {return xNegProj;}
0175   double px() const {return pxProj;}
0176   double py() const {return pyProj;}
0177 
0178 };
0179 
0180 //==========================================================================
0181 
0182 // The StringSystem class contains the complete set of all string regions.
0183 // Only to be used inside StringFragmentation, so no private members.
0184 
0185 class StringSystem {
0186 
0187 public:
0188 
0189   // Constructor.
0190   StringSystem() : sizePartons(), sizeStrings(), sizeRegions(), indxReg(),
0191     iMax(), mJoin(), m2Join() {}
0192 
0193   // Set up system from parton list.
0194   void setUp(const vector<int>& iSys, const Event& event);
0195 
0196   // Calculate string region from (iPos, iNeg) pair.
0197   int iReg( int iPos, int iNeg) const
0198     {return (iPos * (indxReg - iPos)) / 2 + iNeg;}
0199 
0200   // Reference to string region specified by (iPos, iNeg) pair.
0201   StringRegion& region(int iPos, int iNeg) {return system[iReg(iPos, iNeg)];}
0202 
0203   // Reference to low string region specified either by iPos or iNeg.
0204   const StringRegion& regionLowPos(int iPos) const {
0205     return system[iReg(iPos, iMax - iPos)]; }
0206   const StringRegion& regionLowNeg(int iNeg) const {
0207     return system[iReg(iMax - iNeg, iNeg)]; }
0208 
0209   // Main content: a vector with all the string regions of the system.
0210   vector<StringRegion> system;
0211 
0212   // Other data members.
0213   int    sizePartons, sizeStrings, sizeRegions, indxReg, iMax;
0214   double mJoin, m2Join;
0215 
0216 };
0217 
0218 //==========================================================================
0219 
0220 // The StringVertex class contains the space-time vertex location information
0221 // stored during the fragmentation process. No private members.
0222 
0223 class StringVertex {
0224 
0225 public:
0226 
0227   // Constructors.
0228   StringVertex() : fromPos(false), iRegPos(0), iRegNeg(0),
0229     xRegPos(0.), xRegNeg(0.) { }
0230 
0231   StringVertex(bool fromPosIn, int iRegPosIn,
0232     int iRegNegIn, double xRegPosIn, double xRegNegIn)
0233     : fromPos(fromPosIn), iRegPos(iRegPosIn), iRegNeg(iRegNegIn),
0234     xRegPos(xRegPosIn), xRegNeg(xRegNegIn) { }
0235 
0236   StringVertex(const StringVertex& v): fromPos(v.fromPos),
0237     iRegPos(v.iRegPos), iRegNeg(v.iRegNeg),
0238     xRegPos(v.xRegPos), xRegNeg(v.xRegNeg) { }
0239 
0240   StringVertex& operator = (const StringVertex& v) {if (this != &v)
0241     {fromPos = v.fromPos; iRegPos = v.iRegPos; iRegNeg = v.iRegNeg;
0242     xRegPos = v.xRegPos; xRegNeg = v.xRegNeg;} return *this; }
0243 
0244   // Save values.
0245   void store(bool fromPosIn, int iRegPosIn, int iRegNegIn,
0246     double xRegPosIn, double xRegNegIn) {
0247     fromPos = fromPosIn; iRegPos = iRegPosIn; iRegNeg = iRegNegIn;
0248     xRegPos = xRegPosIn; xRegNeg = xRegNegIn; }
0249 
0250   // Variable members.
0251   bool fromPos;
0252   int iRegPos, iRegNeg;
0253   double xRegPos, xRegNeg;
0254 
0255 };
0256 
0257 //==========================================================================
0258 
0259 } // end namespace Pythia8
0260 
0261 #endif // Pythia8_FragmentationSystems_H