]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8170/include/StringFragmentation.h
end-of-line normalization
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8170 / include / StringFragmentation.h
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.
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( ParticleData* particleDataPtrIn, StringFlav* flavSelPtrIn, 
39     StringPT* pTSelPtrIn, StringZ* zSelPtrIn) {
40     particleDataPtr = particleDataPtrIn; flavSelPtr = flavSelPtrIn;
41     pTSelPtr = pTSelPtrIn; zSelPtr = zSelPtrIn;}
42    
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); 
46
47   // Fragment off one hadron from the string system, in flavour and pT.
48   void newHadron();
49
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);
53
54   // Update string end information after a hadron has been removed.
55   void update();
56
57   // Constants: could only be changed in the code itself.
58   static const double TINY, PT2SAME;
59
60   // Pointer to the particle data table.
61   ParticleData* particleDataPtr;
62
63   // Pointers to classes for flavour, pT and z generation.
64   StringFlav*   flavSelPtr;
65   StringPT*     pTSelPtr;
66   StringZ*      zSelPtr;
67  
68   // Data members.
69   bool   fromPos;
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,
73          xNegHad;
74   FlavContainer flavOld, flavNew;
75   Vec4   pHad, pSoFar;
76
77 };
78   
79 //==========================================================================
80
81 // The StringFragmentation class contains the top-level routines 
82 // to fragment a colour singlet partonic system.
83
84 class StringFragmentation {
85
86 public:
87
88   // Constructor. 
89   StringFragmentation() {}
90
91   // Initialize and save pointers.
92   void init(Info* infoPtrIn, Settings& settings, 
93     ParticleData* particleDataPtrIn, Rndm* rndmPtrIn, 
94     StringFlav* flavSelPtrIn, StringPT* pTSelPtrIn, StringZ* zSelPtrIn);
95
96   // Do the fragmentation: driver routine.
97   bool fragment( int iSub, ColConfig& colConfig, Event& event);
98
99   // Find the boost matrix to the rest frame of a junction.
100   RotBstMatrix junctionRestFrame(Vec4& p0, Vec4& p1, Vec4& p2);
101
102 private: 
103
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;
110
111   // Pointer to various information on the generation.
112   Info*         infoPtr;
113
114   // Pointer to the particle data table.
115   ParticleData* particleDataPtr;
116
117   // Pointer to the random number generator.
118   Rndm*         rndmPtr;
119
120   // Pointers to classes for flavour, pT and z generation.
121   StringFlav*   flavSelPtr;
122   StringPT*     pTSelPtr;
123   StringZ*      zSelPtr;
124
125   // Initialization data, read from Settings.
126   double stopMass, stopNewFlav, stopSmear, eNormJunction,
127          eBothLeftJunction, eMaxLeftJunction, eMinLeftJunction, 
128          mJoin, bLund;
129
130   // Data members.
131   bool   hasJunction, isClosed;
132   int    iPos, iNeg;
133   double w2Rem, stopMassNow;
134   Vec4   pSum, pRem, pJunctionHadrons;
135
136   // List of partons in string system.
137   vector<int> iParton;
138
139   // Temporary event record for the produced particles.
140   Event hadrons;
141
142   // Information on the system of string regions.
143   StringSystem system, systemMin, systemMid;
144
145   // Information on the two current endpoints of the fragmenting system.
146   StringEnd posEnd, negEnd; 
147
148   // Find region where to put first string break for closed gluon loop.
149   vector<int> findFirstRegion(vector<int>& iPartonIn, Event& event);
150
151   // Set flavours and momentum position for initial string endpoints. 
152   void setStartEnds(int idPos, int idNeg, StringSystem systemNow);
153
154   // Check remaining energy-momentum whether it is OK to continue.
155   bool energyUsedUp(bool fromPos);
156
157   // Produce the final two partons to complete the system.
158   bool finalTwo(bool fromPos);
159
160   // Construct a special joining region for the final two hadrons.
161   StringRegion finalRegion();
162
163   // Store the hadrons in the normal event record, ordered from one end.
164   void store(Event& event);
165
166   // Fragment off two of the string legs in to a junction. 
167   bool fragmentToJunction(Event& event);
168
169   // Join extra nearby partons when stuck.
170   int extraJoin(double facExtra, Event& event);
171
172 };  
173  
174 //==========================================================================
175
176 } // end namespace Pythia8
177
178 #endif // Pythia8_StringFragmentation_H