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