1 // StringFragmentation.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2008 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(StringFlav* flavSelPtrIn, StringPT* pTSelPtrIn,
39 StringZ* zSelPtrIn) {flavSelPtr = flavSelPtrIn;
40 pTSelPtr = pTSelPtrIn; zSelPtr = zSelPtrIn;}
42 // Set up initial endpoint values from input.
43 void setUp(bool fromPosIn, int iEndIn, int idOldIn, int iMaxIn,
44 double pxIn, double pyIn, double GammaIn, double xPosIn, double xNegIn);
46 // Fragment off one hadron from the string system, in flavour and pT.
49 // Fragment off one hadron from the string system, in momentum space,
50 // by taking steps either from positive or from negative end.
51 Vec4 kinematicsHadron(StringSystem& system);
53 // Update string end information after a hadron has been removed.
56 // Constants: could only be changed in the code itself.
57 static const double TINY, PT2SAME;
59 // Pointers to classes for flavour, pT and z generation.
60 StringFlav* flavSelPtr;
66 int iEnd, iMax, idHad, iPosOld, iNegOld, iPosNew, iNegNew;
67 double pxOld, pyOld, pxNew, pyNew, pxHad, pyHad, mHad, mT2Had, zHad,
68 GammaOld, GammaNew, xPosOld, xPosNew, xPosHad, xNegOld, xNegNew,
70 FlavContainer flavOld, flavNew;
75 //**************************************************************************
77 // The StringFragmentation class contains the top-level routines
78 // to fragment a colour singlet partonic system.
80 class StringFragmentation {
85 StringFragmentation() {}
87 // Initialize and save pointers.
88 void init(Info* infoPtrIn, StringFlav* flavSelPtrIn,
89 StringPT* pTSelPtrIn, StringZ* zSelPtrIn);
91 // Do the fragmentation: driver routine.
92 bool fragment( int iSub, ColConfig& colConfig, Event& event);
94 // Find the boost matrix to the rest frame of a junction.
95 RotBstMatrix junctionRestFrame(Vec4& p0, Vec4& p1, Vec4& p2);
99 // Constants: could only be changed in the code itself.
100 static const int NTRYFLAV, NTRYJOIN, NSTOPMASS, NTRYJNREST,
101 NTRYJNMATCH, NTRYJRFEQ;
102 static const double FACSTOPMASS, CLOSEDM2MAX, CLOSEDM2FRAC, EXPMAX,
103 MATCHPOSNEG, EJNWEIGHTMAX, CONVJNREST, M2MAXJRF,
106 // Pointer to various information on the generation.
109 // Pointers to classes for flavour, pT and z generation.
110 StringFlav* flavSelPtr;
114 // Initialization data, read from Settings.
115 double stopMass, stopNewFlav, stopSmear, eNormJunction,
116 eBothLeftJunction, eMaxLeftJunction, eMinLeftJunction, bLund;
119 bool hasJunction, isClosed;
121 double w2Rem, stopMassNow;
122 Vec4 pSum, pRem, pJunctionHadrons;
124 // List of partons in string system.
127 // Temporary event record for the produced particles.
130 // Information on the system of string regions.
131 StringSystem system, systemMin, systemMid;
133 // Information on the two current endpoints of the fragmenting system.
134 StringEnd posEnd, negEnd;
136 // Find region where to put first string break for closed gluon loop.
137 vector<int> findFirstRegion(vector<int>& iPartonIn, Event& event);
139 // Set flavours and momentum position for initial string endpoints.
140 void setStartEnds(int idPos, int idNeg, StringSystem systemNow);
142 // Check remaining energy-momentum whether it is OK to continue.
143 bool energyUsedUp(bool fromPos);
145 // Produce the final two partons to complete the system.
146 bool finalTwo(bool fromPos);
148 // Construct a special joining region for the final two hadrons.
149 StringRegion finalRegion();
151 // Store the hadrons in the normal event record, ordered from one end.
152 void store(Event& event);
154 // Fragment off two of the string legs in to a junction.
155 bool fragmentToJunction(Event& event);
159 //**************************************************************************
161 } // end namespace Pythia8
163 #endif // Pythia8_StringFragmentation_H