]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8130/include/StringFragmentation.h
pythia8130 distributed with AliRoot
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8130 / include / StringFragmentation.h
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.
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 "Basics.h"
14 #include "Event.h"
15 #include "Info.h"
16 #include "FragmentationFlavZpT.h"
17 #include "FragmentationSystems.h"
18 #include "ParticleData.h"
19 #include "PythiaStdlib.h"
20 #include "Settings.h"
21
22 namespace Pythia8 {
23  
24 //**************************************************************************
25
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.
29
30 class StringEnd {
31
32 public:
33
34   // Constructor. 
35   StringEnd() {}
36
37   // Save pointers.
38   void init(StringFlav* flavSelPtrIn, StringPT* pTSelPtrIn, 
39     StringZ* zSelPtrIn) {flavSelPtr = flavSelPtrIn;
40     pTSelPtr = pTSelPtrIn; zSelPtr = zSelPtrIn;}
41    
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); 
45
46   // Fragment off one hadron from the string system, in flavour and pT.
47   void newHadron();
48
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);
52
53   // Update string end information after a hadron has been removed.
54   void update();
55
56   // Constants: could only be changed in the code itself.
57   static const double TINY, PT2SAME;
58
59   // Pointers to classes for flavour, pT and z generation.
60   StringFlav* flavSelPtr;
61   StringPT*   pTSelPtr;
62   StringZ*    zSelPtr;
63  
64   // Data members.
65   bool   fromPos;
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,
69          xNegHad;
70   FlavContainer flavOld, flavNew;
71   Vec4   pHad, pSoFar;
72
73 };
74   
75 //**************************************************************************
76
77 // The StringFragmentation class contains the top-level routines 
78 // to fragment a colour singlet partonic system.
79
80 class StringFragmentation {
81
82 public:
83
84   // Constructor. 
85   StringFragmentation() {}
86
87   // Initialize and save pointers.
88   void init(Info* infoPtrIn, StringFlav* flavSelPtrIn, 
89     StringPT* pTSelPtrIn, StringZ* zSelPtrIn);
90
91   // Do the fragmentation: driver routine.
92   bool fragment( int iSub, ColConfig& colConfig, Event& event);
93
94   // Find the boost matrix to the rest frame of a junction.
95   RotBstMatrix junctionRestFrame(Vec4& p0, Vec4& p1, Vec4& p2);
96
97 private: 
98
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, 
104                       CONVJRFEQ;
105
106   // Pointer to various information on the generation.
107   Info*       infoPtr;
108
109   // Pointers to classes for flavour, pT and z generation.
110   StringFlav* flavSelPtr;
111   StringPT*   pTSelPtr;
112   StringZ*    zSelPtr;
113
114   // Initialization data, read from Settings.
115   double stopMass, stopNewFlav, stopSmear, eNormJunction,
116          eBothLeftJunction, eMaxLeftJunction, eMinLeftJunction, bLund;
117
118   // Data members.
119   bool   hasJunction, isClosed;
120   int    iPos, iNeg;
121   double w2Rem, stopMassNow;
122   Vec4   pSum, pRem, pJunctionHadrons;
123
124   // List of partons in string system.
125   vector<int> iParton;
126
127   // Temporary event record for the produced particles.
128   Event hadrons;
129
130   // Information on the system of string regions.
131   StringSystem system, systemMin, systemMid;
132
133   // Information on the two current endpoints of the fragmenting system.
134   StringEnd posEnd, negEnd; 
135
136   // Find region where to put first string break for closed gluon loop.
137   vector<int> findFirstRegion(vector<int>& iPartonIn, Event& event);
138
139   // Set flavours and momentum position for initial string endpoints. 
140   void setStartEnds(int idPos, int idNeg, StringSystem systemNow);
141
142   // Check remaining energy-momentum whether it is OK to continue.
143   bool energyUsedUp(bool fromPos);
144
145   // Produce the final two partons to complete the system.
146   bool finalTwo(bool fromPos);
147
148   // Construct a special joining region for the final two hadrons.
149   StringRegion finalRegion();
150
151   // Store the hadrons in the normal event record, ordered from one end.
152   void store(Event& event);
153
154   // Fragment off two of the string legs in to a junction. 
155   bool fragmentToJunction(Event& event);
156
157 };  
158  
159 //**************************************************************************
160
161 } // end namespace Pythia8
162
163 #endif // Pythia8_StringFragmentation_H