1 // StringFragmentation.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2012 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.
6 // This file contains the classes for string fragmentation.
7 // StringEnd: keeps track of the fragmentation step.
8 // StringFragmentation: is the top-level class.
10 #ifndef Pythia8_StringFragmentation_H
11 #define Pythia8_StringFragmentation_H
16 #include "FragmentationFlavZpT.h"
17 #include "FragmentationSystems.h"
18 #include "ParticleData.h"
19 #include "PythiaStdlib.h"
24 //==========================================================================
26 // The StringEnd class contains the information related to
27 // one of the current endpoints of the string system.
28 // Only to be used inside StringFragmentation, so no private members.
38 void init( ParticleData* particleDataPtrIn, StringFlav* flavSelPtrIn,
39 StringPT* pTSelPtrIn, StringZ* zSelPtrIn) {
40 particleDataPtr = particleDataPtrIn; flavSelPtr = flavSelPtrIn;
41 pTSelPtr = pTSelPtrIn; zSelPtr = zSelPtrIn;}
43 // Set up initial endpoint values from input.
44 void setUp(bool fromPosIn, int iEndIn, int idOldIn, int iMaxIn,
45 double pxIn, double pyIn, double GammaIn, double xPosIn, double xNegIn);
47 // Fragment off one hadron from the string system, in flavour and pT.
50 // Fragment off one hadron from the string system, in momentum space,
51 // by taking steps either from positive or from negative end.
52 Vec4 kinematicsHadron(StringSystem& system);
54 // Update string end information after a hadron has been removed.
57 // Constants: could only be changed in the code itself.
58 static const double TINY, PT2SAME;
60 // Pointer to the particle data table.
61 ParticleData* particleDataPtr;
63 // Pointers to classes for flavour, pT and z generation.
64 StringFlav* flavSelPtr;
70 int iEnd, iMax, idHad, iPosOld, iNegOld, iPosNew, iNegNew;
71 double pxOld, pyOld, pxNew, pyNew, pxHad, pyHad, mHad, mT2Had, zHad,
72 GammaOld, GammaNew, xPosOld, xPosNew, xPosHad, xNegOld, xNegNew,
74 FlavContainer flavOld, flavNew;
79 //==========================================================================
81 // The StringFragmentation class contains the top-level routines
82 // to fragment a colour singlet partonic system.
84 class StringFragmentation {
89 StringFragmentation() {}
91 // Initialize and save pointers.
92 void init(Info* infoPtrIn, Settings& settings,
93 ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
94 StringFlav* flavSelPtrIn, StringPT* pTSelPtrIn, StringZ* zSelPtrIn);
96 // Do the fragmentation: driver routine.
97 bool fragment( int iSub, ColConfig& colConfig, Event& event);
99 // Find the boost matrix to the rest frame of a junction.
100 RotBstMatrix junctionRestFrame(Vec4& p0, Vec4& p1, Vec4& p2);
104 // Constants: could only be changed in the code itself.
105 static const int NTRYFLAV, NTRYJOIN, NSTOPMASS, NTRYJNREST,
106 NTRYJNMATCH, NTRYJRFEQ;
107 static const double FACSTOPMASS, CLOSEDM2MAX, CLOSEDM2FRAC, EXPMAX,
108 MATCHPOSNEG, EJNWEIGHTMAX, CONVJNREST, M2MAXJRF,
109 EEXTRAJNMATCH, MDIQUARKMIN, CONVJRFEQ;
111 // Pointer to various information on the generation.
114 // Pointer to the particle data table.
115 ParticleData* particleDataPtr;
117 // Pointer to the random number generator.
120 // Pointers to classes for flavour, pT and z generation.
121 StringFlav* flavSelPtr;
125 // Initialization data, read from Settings.
126 double stopMass, stopNewFlav, stopSmear, eNormJunction,
127 eBothLeftJunction, eMaxLeftJunction, eMinLeftJunction,
131 bool hasJunction, isClosed;
133 double w2Rem, stopMassNow;
134 Vec4 pSum, pRem, pJunctionHadrons;
136 // List of partons in string system.
139 // Temporary event record for the produced particles.
142 // Information on the system of string regions.
143 StringSystem system, systemMin, systemMid;
145 // Information on the two current endpoints of the fragmenting system.
146 StringEnd posEnd, negEnd;
148 // Find region where to put first string break for closed gluon loop.
149 vector<int> findFirstRegion(vector<int>& iPartonIn, Event& event);
151 // Set flavours and momentum position for initial string endpoints.
152 void setStartEnds(int idPos, int idNeg, StringSystem systemNow);
154 // Check remaining energy-momentum whether it is OK to continue.
155 bool energyUsedUp(bool fromPos);
157 // Produce the final two partons to complete the system.
158 bool finalTwo(bool fromPos);
160 // Construct a special joining region for the final two hadrons.
161 StringRegion finalRegion();
163 // Store the hadrons in the normal event record, ordered from one end.
164 void store(Event& event);
166 // Fragment off two of the string legs in to a junction.
167 bool fragmentToJunction(Event& event);
169 // Join extra nearby partons when stuck.
170 int extraJoin(double facExtra, Event& event);
174 //==========================================================================
176 } // end namespace Pythia8
178 #endif // Pythia8_StringFragmentation_H