]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8145/include/StringFragmentation.h
Use Output directive instead of the old OutputFile and OUtputArchive. Save fileinfo...
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8145 / include / StringFragmentation.h
1 // StringFragmentation.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2010 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                       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, bLund;
128
129   // Data members.
130   bool   hasJunction, isClosed;
131   int    iPos, iNeg;
132   double w2Rem, stopMassNow;
133   Vec4   pSum, pRem, pJunctionHadrons;
134
135   // List of partons in string system.
136   vector<int> iParton;
137
138   // Temporary event record for the produced particles.
139   Event hadrons;
140
141   // Information on the system of string regions.
142   StringSystem system, systemMin, systemMid;
143
144   // Information on the two current endpoints of the fragmenting system.
145   StringEnd posEnd, negEnd; 
146
147   // Find region where to put first string break for closed gluon loop.
148   vector<int> findFirstRegion(vector<int>& iPartonIn, Event& event);
149
150   // Set flavours and momentum position for initial string endpoints. 
151   void setStartEnds(int idPos, int idNeg, StringSystem systemNow);
152
153   // Check remaining energy-momentum whether it is OK to continue.
154   bool energyUsedUp(bool fromPos);
155
156   // Produce the final two partons to complete the system.
157   bool finalTwo(bool fromPos);
158
159   // Construct a special joining region for the final two hadrons.
160   StringRegion finalRegion();
161
162   // Store the hadrons in the normal event record, ordered from one end.
163   void store(Event& event);
164
165   // Fragment off two of the string legs in to a junction. 
166   bool fragmentToJunction(Event& event);
167
168 };  
169  
170 //==========================================================================
171
172 } // end namespace Pythia8
173
174 #endif // Pythia8_StringFragmentation_H