StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StringFragmentation.h
1 // StringFragmentation.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2020 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // This file contains the classes for string fragmentation.
7 // StringEnd: keeps track of the fragmentation step.
8 // StringFragmentation: is the top-level class.
9 
10 #ifndef Pythia8_StringFragmentation_H
11 #define Pythia8_StringFragmentation_H
12 
13 #include "Pythia8/Basics.h"
14 #include "Pythia8/Event.h"
15 #include "Pythia8/Info.h"
16 #include "Pythia8/FragmentationFlavZpT.h"
17 #include "Pythia8/FragmentationSystems.h"
18 #include "Pythia8/ParticleData.h"
19 #include "Pythia8/PhysicsBase.h"
20 #include "Pythia8/PythiaStdlib.h"
21 #include "Pythia8/Ropewalk.h"
22 #include "Pythia8/Settings.h"
23 #include "Pythia8/UserHooks.h"
24 
25 namespace Pythia8 {
26 
27 //==========================================================================
28 
29 // The StringEnd class contains the information related to
30 // one of the current endpoints of the string system.
31 // Only to be used inside StringFragmentation, so no private members.
32 
33 class StringEnd {
34 
35 public:
36 
37  // Constructor.
38  StringEnd() : particleDataPtr(), flavSelPtr(), pTSelPtr(), zSelPtr(),
39  fromPos(), thermalModel(), mT2suppression(), iEnd(), iMax(), idHad(),
40  iPosOld(), iNegOld(), iPosNew(), iNegNew(), hadSoFar(), colOld(), colNew(),
41  pxOld(), pyOld(), pxNew(), pyNew(), pxHad(), pyHad(), mHad(), mT2Had(),
42  zHad(), GammaOld(), GammaNew(), xPosOld(), xPosNew(), xPosHad(), xNegOld(),
43  xNegNew(), xNegHad(), aLund(), bLund() {}
44 
45  // Save pointers.
46  void init( ParticleData* particleDataPtrIn, StringFlav* flavSelPtrIn,
47  StringPT* pTSelPtrIn, StringZ* zSelPtrIn, Settings& settings) {
48  particleDataPtr = particleDataPtrIn; flavSelPtr = flavSelPtrIn;
49  pTSelPtr = pTSelPtrIn; zSelPtr = zSelPtrIn;
50  bLund = zSelPtr->bAreaLund(); aLund = zSelPtr->aAreaLund();
51  thermalModel = settings.flag("StringPT:thermalModel");
52  mT2suppression = settings.flag("StringPT:mT2suppression"); }
53 
54  // Set up initial endpoint values from input.
55  void setUp(bool fromPosIn, int iEndIn, int idOldIn, int iMaxIn,
56  double pxIn, double pyIn, double GammaIn, double xPosIn,
57  double xNegIn, int colIn);
58 
59  // Fragment off one hadron from the string system, in flavour and pT.
60  void newHadron(double nNSP = 0.0);
61 
62  // Fragment off one hadron from the string system, in momentum space,
63  // by taking steps either from positive or from negative end.
64  Vec4 kinematicsHadron(StringSystem& system,
65  vector<StringVertex>& stringVertices, bool useInputZ = false,
66  double zHadIn = 0.);
67 
68  // Generate momentum for some possible next hadron, based on mean values
69  // to get an estimate for rapidity and pT.
70  Vec4 kinematicsHadronTmp(StringSystem system, Vec4 pRem, double phi,
71  double mult);
72 
73  // Update string end information after a hadron has been removed.
74  void update();
75 
76  // Constants: could only be changed in the code itself.
77  static const double TINY, PT2SAME, MEANMMIN, MEANM, MEANPT;
78 
79  // Pointer to the particle data table.
80  ParticleData* particleDataPtr;
81 
82  // Pointers to classes for flavour, pT and z generation.
83  StringFlav* flavSelPtr;
84  StringPT* pTSelPtr;
85  StringZ* zSelPtr;
86 
87  // Data members.
88  bool fromPos, thermalModel, mT2suppression;
89  int iEnd, iMax, idHad, iPosOld, iNegOld, iPosNew, iNegNew, hadSoFar,
90  colOld, colNew;
91  double pxOld, pyOld, pxNew, pyNew, pxHad, pyHad, mHad, mT2Had, zHad,
92  GammaOld, GammaNew, xPosOld, xPosNew, xPosHad, xNegOld, xNegNew,
93  xNegHad, aLund, bLund;
94  FlavContainer flavOld, flavNew;
95  Vec4 pHad, pSoFar;
96 
97 };
98 
99 //==========================================================================
100 
101 // The StringFragmentation class contains the top-level routines
102 // to fragment a colour singlet partonic system.
103 
104 class StringFragmentation : public PhysicsBase {
105 
106 public:
107 
108  // Constructor.
109  StringFragmentation() :
110  flavSelPtr(), pTSelPtr(), zSelPtr(), flavRopePtr(),
111  closePacking(), setVertices(), constantTau(), smearOn(),
112  traceColours(false), hadronVertex(), stopMass(), stopNewFlav(),
113  stopSmear(), eNormJunction(), eBothLeftJunction(), eMaxLeftJunction(),
114  eMinLeftJunction(), mJoin(), bLund(), pT20(), xySmear(), maxSmear(),
115  maxTau(), kappaVtx(), mc(), mb(), hasJunction(), isClosed(), iPos(),
116  iNeg(), w2Rem(), stopMassNow(), idDiquark(), legMin(), legMid() {}
117 
118  // Initialize and save pointers.
119  void init(StringFlav* flavSelPtrIn, StringPT* pTSelPtrIn, StringZ* zSelPtrIn,
120  FragModPtr fragModPtrIn = NULL);
121 
122  // Do the fragmentation: driver routine.
123  bool fragment( int iSub, ColConfig& colConfig, Event& event);
124 
125  // Find the boost matrix to the rest frame of a junction.
126  RotBstMatrix junctionRestFrame(Vec4& p0, Vec4& p1, Vec4& p2);
127 
128 private:
129 
130  // Constants: could only be changed in the code itself.
131  static const int NTRYFLAV, NTRYJOIN, NSTOPMASS, NTRYJNREST,
132  NTRYJNMATCH, NTRYJRFEQ, NTRYSMEAR;
133  static const double FACSTOPMASS, CLOSEDM2MAX, CLOSEDM2FRAC, EXPMAX,
134  MATCHPOSNEG, EJNWEIGHTMAX, CONVJNREST, M2MAXJRF,
135  M2MINJRF, EEXTRAJNMATCH, MDIQUARKMIN, CONVJRFEQ,
136  CHECKPOS;
137 
138  // Pointers to classes for flavour, pT and z generation.
139  StringFlav* flavSelPtr;
140  StringPT* pTSelPtr;
141  StringZ* zSelPtr;
142 
143  // Pointer to flavour-composition-changing ropes.
144  FragModPtr flavRopePtr;
145 
146  // Initialization data, read from Settings.
147  bool closePacking, setVertices, constantTau, smearOn,
148  traceColours;
149  int hadronVertex;
150  double stopMass, stopNewFlav, stopSmear, eNormJunction,
151  eBothLeftJunction, eMaxLeftJunction, eMinLeftJunction,
152  mJoin, bLund, pT20, xySmear, maxSmear, maxTau, kappaVtx, mc, mb;
153 
154  // Data members.
155  bool hasJunction, isClosed;
156  int iPos, iNeg;
157  double w2Rem, stopMassNow;
158  Vec4 pSum, pRem, pJunctionHadrons;
159 
160  // List of partons in string system.
161  vector<int> iParton, iPartonMinLeg, iPartonMidLeg, iPartonMax;
162 
163  // Vertex information from the fragmentation process.
164  vector<StringVertex> stringVertices, legMinVertices, legMidVertices;
165 
166  // Boost from/to rest frame of a junction to original frame.
167  RotBstMatrix MfromJRF, MtoJRF;
168 
169  // Information on diquark created at the junction.
170  int idDiquark;
171 
172  // Fictitious opposing partons in JRF: string ends for vertex location.
173  Vec4 pMinEnd, pMidEnd;
174 
175  // Temporary event record for the produced particles.
176  Event hadrons;
177 
178  // Information on the system of string regions.
179  StringSystem system, systemMin, systemMid;
180 
181  // Information on the two current endpoints of the fragmenting system.
182  StringEnd posEnd, negEnd;
183 
184  // Find region where to put first string break for closed gluon loop.
185  vector<int> findFirstRegion(int iSub, ColConfig& colConfig, Event& event);
186 
187  // Set flavours and momentum position for initial string endpoints.
188  void setStartEnds(int idPos, int idNeg, StringSystem systemNow,
189  int legNow = 3);
190 
191  // Check remaining energy-momentum whether it is OK to continue.
192  bool energyUsedUp(bool fromPos);
193 
194  // Produce the final two partons to complete the system.
195  bool finalTwo(bool fromPos, Event& event, bool usedPosJun, bool usedNegJun,
196  double nNSP);
197 
198  // Final region information.
199  Vec4 pPosFinalReg, pNegFinalReg, eXFinalReg, eYFinalReg;
200 
201  // Set hadron production points in space-time picture.
202  bool setHadronVertices(Event& event);
203 
204  // Construct a special joining region for the final two hadrons.
205  StringRegion finalRegion();
206 
207  // Store the hadrons in the normal event record, ordered from one end.
208  void store(Event& event);
209 
210  // Fragment off two of the string legs in to a junction.
211  bool fragmentToJunction(Event& event);
212 
213  // Initially considered legs from the junction.
214  int legMin, legMid;
215 
216  // Join extra nearby partons when stuck.
217  int extraJoin(double facExtra, Event& event);
218 
219  // Get the number of nearby strings given the energies.
220  double nearStringPieces(StringEnd end,
221  vector< vector< pair<double,double> > >& rapPairs);
222 
223 };
224 
225 //==========================================================================
226 
227 } // end namespace Pythia8
228 
229 #endif // Pythia8_StringFragmentation_H
Definition: AgUStep.h:26