PYTHIA  8.312
FragmentationSystems.h
1 // FragmentationSystems.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2024 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 auxiliary classes in the fragmentation process.
7 // ColSinglet contains info on an individual singlet.
8 // ColConfig describes the colour configuration of the whole event.
9 // StringRegion keeps track on string momenta and directions.
10 // StringSystem contains all the StringRegions of the colour singlet.
11 // StringVertex contains information on space-time location of string breaks.
12 
13 #ifndef Pythia8_FragmentationSystems_H
14 #define Pythia8_FragmentationSystems_H
15 
16 #include "Pythia8/Basics.h"
17 #include "Pythia8/Event.h"
18 #include "Pythia8/FragmentationFlavZpT.h"
19 #include "Pythia8/Info.h"
20 #include "Pythia8/ParticleData.h"
21 #include "Pythia8/PythiaStdlib.h"
22 #include "Pythia8/Settings.h"
23 
24 namespace Pythia8 {
25 
26 //==========================================================================
27 
28 // The ColSinglet class contains info on an individual singlet.
29 // Only to be used inside ColConfig, so no private members.
30 
31 class ColSinglet {
32 
33 public:
34 
35  // Constructors.
36  ColSinglet() : pSum(0., 0., 0., 0.), mass(0.), massExcess(0.),
37  hasJunction(false), isClosed(false), isCollected(false) {}
38  ColSinglet(vector<int>& iPartonIn, Vec4 pSumIn, double massIn,
39  double massExcessIn, bool hasJunctionIn = false,
40  bool isClosedIn = false, bool isCollectedIn = false)
41  : iParton(iPartonIn), pSum(pSumIn), mass(massIn),
42  massExcess(massExcessIn), hasJunction(hasJunctionIn),
43  isClosed(isClosedIn), isCollected(isCollectedIn) {}
44 
45  // Size of iParton array.
46  int size() const { return iParton.size();}
47 
48  // Stored quantities.
49  vector<int> iParton;
50  Vec4 pSum;
51  double mass, massExcess;
52  bool hasJunction, isClosed, isCollected;
53 
54 };
55 
56 //==========================================================================
57 
58 // The ColConfig class describes the colour configuration of the whole event.
59 
60 class ColConfig {
61 
62 public:
63 
64  // Constructor.
65  ColConfig() : loggerPtr(), flavSelPtr(), mJoin(), mJoinJunction(),
66  mStringMin() {singlets.resize(0);}
67 
68  // Initialize and save pointers.
69  void init(Info* infoPtrIn, StringFlav* flavSelPtrIn);
70 
71  // Number of colour singlets.
72  int size() const {return singlets.size();}
73 
74  // Overload index operator to access separate colour singlets.
75  ColSinglet& operator[](int iSub) {return singlets[iSub];}
76  const ColSinglet& operator[](int iSub) const {return singlets[iSub];}
77 
78  // Clear contents.
79  void clear() {singlets.resize(0);}
80 
81  // Insert a new colour singlet system in ascending mass order.
82  // Calculate its properties. Join nearby partons.
83  bool insert( vector<int>& iPartonIn, Event& event);
84 
85  // Insert a new qqbar colour singlet system in ascending mass order.
86  // Calculate its properties.
87  bool simpleInsert( vector<int>& iPartonIn, Event& event,
88  bool fixOrder = false);
89 
90  // Erase a colour singlet system. (Rare operation.)
91  void erase(int iSub) {singlets.erase(singlets.begin() + iSub);}
92 
93  // Collect all partons of singlet to be consecutively ordered.
94  void collect(int iSub, Event& event, bool skipTrivial = true);
95 
96  // Find to which singlet system a particle belongs.
97  int findSinglet(int i);
98 
99  // List all currently identified singlets.
100  void list() const;
101 
102  // Rapidity range [y_min, y_max] of all string pieces in all singlets.
103  // Only used when ClosePacking:doClosePacking is on.
104  vector< vector< pair<double,double> > > rapPairs;
105 
106 private:
107 
108  // Constants: could only be changed in the code itself.
109  static const double CONSTITUENTMASS;
110 
111  // Pointer to logger.
112  Logger* loggerPtr;
113 
114  // Pointer to class for flavour generation.
115  StringFlav* flavSelPtr;
116 
117  // Initialization data, to be read from Settings.
118  double mJoin, mJoinJunction, mStringMin;
119 
120  // List of all separate colour singlets.
121  vector<ColSinglet> singlets;
122 
123  // Join two legs of junction to a diquark for small invariant masses.
124  bool joinJunction( vector<int>& iPartonIn, Event& event,
125  double massExcessIn);
126 
127 };
128 
129 //==========================================================================
130 
131 // The StringRegion class contains the information related to
132 // one string section in the evolution of a multiparton system.
133 // Only to be used inside StringFragmentation and MiniStringFragmentation,
134 // so no private members.
135 
137 
138 public:
139 
140  // Constructor.
141  StringRegion() : isSetUp(false), isEmpty(true), w2(0.), xPosProj(0.),
142  xNegProj(0.), pxProj(0.), pyProj(0.), colPos(0), colNeg(0) {}
143 
144  // Constants: could only be changed in the code itself.
145  static const double MJOIN, TINY;
146 
147  // Data members.
148  bool isSetUp, isEmpty;
149  Vec4 pPos, pNeg, eX, eY, pPosMass, pNegMass, massOffset;
150  double w2, xPosProj, xNegProj, pxProj, pyProj;
151  int colPos, colNeg;
152 
153  // Calculate offset of the region from parton list. Special junction case.
154  Vec4 gluonOffset(vector<int>& iSys, Event& event, int iPos, int iNeg);
155  Vec4 gluonOffsetJRF(vector<int>& iSys, Event& event, int iPos, int iNeg,
156  RotBstMatrix MtoJRF);
157 
158  // If massive case, the offset of the initial regions is calculated.
159  bool massiveOffset(int iPos, int iNeg, int iMax, int id1, int id2,
160  double mc, double mb);
161 
162  // Set up four-vectors for longitudinal and transverse directions.
163  void setUp(Vec4 p1, Vec4 p2, int col1, int col2, bool isMassless = false);
164 
165  // Construct a four-momentum from (x+, x-, px, py).
166  Vec4 pHad( double xPosIn, double xNegIn, double pxIn, double pyIn) const
167  { return xPosIn * pPos + xNegIn * pNeg + pxIn * eX + pyIn * eY; }
168 
169  // Project a four-momentum onto (x+, x-, px, py). Read out projection.
170  void project(Vec4 pIn);
171  void project( double pxIn, double pyIn, double pzIn, double eIn)
172  { project( Vec4( pxIn, pyIn, pzIn, eIn) ); }
173  double xPos() const {return xPosProj;}
174  double xNeg() const {return xNegProj;}
175  double px() const {return pxProj;}
176  double py() const {return pyProj;}
177 
178 };
179 
180 //==========================================================================
181 
182 // The StringSystem class contains the complete set of all string regions.
183 // Only to be used inside StringFragmentation, so no private members.
184 
186 
187 public:
188 
189  // Constructor.
190  StringSystem() : sizePartons(), sizeStrings(), sizeRegions(), indxReg(),
191  iMax(), mJoin(), m2Join() {}
192 
193  // Set up system from parton list.
194  void setUp(const vector<int>& iSys, const Event& event);
195 
196  // Calculate string region from (iPos, iNeg) pair.
197  int iReg( int iPos, int iNeg) const
198  {return (iPos * (indxReg - iPos)) / 2 + iNeg;}
199 
200  // Reference to string region specified by (iPos, iNeg) pair.
201  StringRegion& region(int iPos, int iNeg) {return system[iReg(iPos, iNeg)];}
202 
203  // Reference to low string region specified either by iPos or iNeg.
204  const StringRegion& regionLowPos(int iPos) const {
205  return system[iReg(iPos, iMax - iPos)]; }
206  const StringRegion& regionLowNeg(int iNeg) const {
207  return system[iReg(iMax - iNeg, iNeg)]; }
208 
209  // Main content: a vector with all the string regions of the system.
210  vector<StringRegion> system;
211 
212  // Other data members.
213  int sizePartons, sizeStrings, sizeRegions, indxReg, iMax;
214  double mJoin, m2Join;
215 
216 };
217 
218 //==========================================================================
219 
220 // The StringVertex class contains the space-time vertex location information
221 // stored during the fragmentation process. No private members.
222 
224 
225 public:
226 
227  // Constructors.
228  StringVertex() : fromPos(false), iRegPos(0), iRegNeg(0),
229  xRegPos(0.), xRegNeg(0.) { }
230 
231  StringVertex(bool fromPosIn, int iRegPosIn,
232  int iRegNegIn, double xRegPosIn, double xRegNegIn)
233  : fromPos(fromPosIn), iRegPos(iRegPosIn), iRegNeg(iRegNegIn),
234  xRegPos(xRegPosIn), xRegNeg(xRegNegIn) { }
235 
236  StringVertex(const StringVertex& v): fromPos(v.fromPos),
237  iRegPos(v.iRegPos), iRegNeg(v.iRegNeg),
238  xRegPos(v.xRegPos), xRegNeg(v.xRegNeg) { }
239 
240  StringVertex& operator = (const StringVertex& v) {if (this != &v)
241  {fromPos = v.fromPos; iRegPos = v.iRegPos; iRegNeg = v.iRegNeg;
242  xRegPos = v.xRegPos; xRegNeg = v.xRegNeg;} return *this; }
243 
244  // Save values.
245  void store(bool fromPosIn, int iRegPosIn, int iRegNegIn,
246  double xRegPosIn, double xRegNegIn) {
247  fromPos = fromPosIn; iRegPos = iRegPosIn; iRegNeg = iRegNegIn;
248  xRegPos = xRegPosIn; xRegNeg = xRegNegIn; }
249 
250  // Variable members.
251  bool fromPos;
252  int iRegPos, iRegNeg;
253  double xRegPos, xRegNeg;
254 
255 };
256 
257 //==========================================================================
258 
259 } // end namespace Pythia8
260 
261 #endif // Pythia8_FragmentationSystems_H
Definition: FragmentationSystems.h:223
const StringRegion & regionLowPos(int iPos) const
Reference to low string region specified either by iPos or iNeg.
Definition: FragmentationSystems.h:204
Definition: Info.h:45
The Event class holds all info on the generated event.
Definition: Event.h:453
vector< vector< pair< double, double > > > rapPairs
Definition: FragmentationSystems.h:104
int size() const
Number of colour singlets.
Definition: FragmentationSystems.h:72
Definition: FragmentationSystems.h:185
StringRegion & region(int iPos, int iNeg)
Reference to string region specified by (iPos, iNeg) pair.
Definition: FragmentationSystems.h:201
ColSinglet()
Constructors.
Definition: FragmentationSystems.h:36
bool fromPos
Variable members.
Definition: FragmentationSystems.h:251
int size() const
Size of iParton array.
Definition: FragmentationSystems.h:46
Definition: FragmentationSystems.h:136
Definition: Logger.h:23
void clear()
Clear contents.
Definition: FragmentationSystems.h:79
bool isSetUp
Data members.
Definition: FragmentationSystems.h:148
Vec4 pHad(double xPosIn, double xNegIn, double pxIn, double pyIn) const
Construct a four-momentum from (x+, x-, px, py).
Definition: FragmentationSystems.h:166
int iReg(int iPos, int iNeg) const
Calculate string region from (iPos, iNeg) pair.
Definition: FragmentationSystems.h:197
ColSinglet & operator[](int iSub)
Overload index operator to access separate colour singlets.
Definition: FragmentationSystems.h:75
vector< int > iParton
Stored quantities.
Definition: FragmentationSystems.h:49
StringRegion()
Constructor.
Definition: FragmentationSystems.h:141
The ColConfig class describes the colour configuration of the whole event.
Definition: FragmentationSystems.h:60
void store(bool fromPosIn, int iRegPosIn, int iRegNegIn, double xRegPosIn, double xRegNegIn)
Save values.
Definition: FragmentationSystems.h:245
static const double TINY
Avoid division by zero.
Definition: FragmentationSystems.h:145
Definition: Basics.h:252
vector< StringRegion > system
Main content: a vector with all the string regions of the system.
Definition: FragmentationSystems.h:210
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
StringVertex()
Constructors.
Definition: FragmentationSystems.h:228
StringSystem()
Constructor.
Definition: FragmentationSystems.h:190
The StringFlav class is used to select quark and hadron flavours.
Definition: FragmentationFlavZpT.h:84
Definition: FragmentationSystems.h:31
int sizePartons
Other data members.
Definition: FragmentationSystems.h:213
ColConfig()
Constructor.
Definition: FragmentationSystems.h:65
Definition: Basics.h:32
void erase(int iSub)
Erase a colour singlet system. (Rare operation.)
Definition: FragmentationSystems.h:91