1 // FragmentationFlavZpT.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.
6 // This file contains helper classes for fragmentation.
7 // StringFlav is used to select quark and hadron flavours.
8 // StringPT is used to select transverse momenta.
9 // StringZ is used to sample the fragmentation function f(z).
11 #ifndef Pythia8_FragmentationFlavZpT_H
12 #define Pythia8_FragmentationFlavZpT_H
15 #include "ParticleData.h"
16 #include "PythiaStdlib.h"
22 //==========================================================================
24 // The FlavContainer class is a simple container for flavour,
25 // including the extra properties needed for popcorn baryon handling.
26 // id = current flavour.
27 // rank = current rank; 0 for endpoint flavour and then increase by 1.
28 // nPop = number of popcorn mesons yet to be produced (1 or 0).
29 // idPop = (absolute sign of) popcorn quark, shared between B and Bbar.
30 // idVtx = (absolute sign of) vertex (= non-shared) quark in diquark.
37 FlavContainer(int idIn = 0, int rankIn = 0, int nPopIn = 0,
38 int idPopIn = 0, int idVtxIn = 0) : id(idIn), rank(rankIn),
39 nPop(nPopIn), idPop(idPopIn), idVtx(idVtxIn) {}
41 // Overloaded equal operator.
42 FlavContainer& operator=(const FlavContainer& flav) { if (this != &flav) {
43 id = flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
44 idVtx = flav.idVtx; } return *this; }
47 FlavContainer& anti() {id = -id; return *this;}
49 // Read in a container into another, without/with id sign flip.
50 FlavContainer& copy(const FlavContainer& flav) { if (this != &flav) {
51 id = flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
52 idVtx = flav.idVtx; } return *this; }
53 FlavContainer& anti(const FlavContainer& flav) { if (this != &flav) {
54 id = -flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
55 idVtx = flav.idVtx; } return *this; }
58 int id, rank, nPop, idPop, idVtx;
62 //==========================================================================
64 // The StringFlav class is used to select quark and hadron flavours.
73 // Initialize data members.
74 void init(Settings& settings, Rndm* rndmPtrIn);
76 // Pick a light d, u or s quark according to fixed ratios.
77 int pickLightQ() { double rndmFlav = probQandS * rndmPtr->flat();
78 if (rndmFlav < 1.) return 1; if (rndmFlav < 2.) return 2; return 3; }
80 // Pick a new flavour (including diquarks) given an incoming one.
81 FlavContainer pick(FlavContainer& flavOld);
83 // Combine two flavours (including diquarks) to produce a hadron.
84 int combine(FlavContainer& flav1, FlavContainer& flav2);
86 // Assign popcorn quark inside an original (= rank 0) diquark.
87 void assignPopQ(FlavContainer& flav);
89 // Combine two quarks to produce a diquark.
90 int makeDiquark(int id1, int id2, int idHad = 0);
94 // Constants: could only be changed in the code itself.
95 static const int mesonMultipletCode[6];
96 static const double baryonCGOct[6], baryonCGDec[6];
98 // Initialization data, to be read from Settings.
99 bool suppressLeadingB;
100 double probQQtoQ, probStoUD, probSQtoQQ, probQQ1toQQ0, probQandQQ,
101 probQandS, probQandSinQQ, probQQ1corr, probQQ1corrInv, probQQ1norm,
102 mesonRate[4][6], mesonRateSum[4], mesonMix1[2][6], mesonMix2[2][6],
103 etaSup, etaPrimeSup, decupletSup, baryonCGSum[6], baryonCGMax[6],
104 popcornRate, popcornSpair, popcornSmeson, scbBM[3], popFrac,
105 popS[3], dWT[3][7], lightLeadingBSup, heavyLeadingBSup;
107 // Pointer to the random number generator.
112 //==========================================================================
114 // The StringZ class is used to sample the fragmentation function f(z).
123 // Initialize data members.
124 void init(Settings& settings, ParticleData& particleData, Rndm* rndmPtrIn);
126 // Fragmentation function: top-level to determine parameters.
127 double zFrag( int idOld, int idNew = 0, double mT2 = 1.);
131 // Constants: could only be changed in the code itself.
132 static const double CFROMUNITY, AFROMZERO, AFROMC, EXPMAX;
134 // Initialization data, to be read from Settings.
135 bool usePetersonC, usePetersonB, usePetersonH;
136 double mc2, mb2, aLund, bLund, aExtraDiquark, rFactC, rFactB, rFactH,
137 epsilonC, epsilonB, epsilonH;
139 // Fragmentation function: select z according to provided parameters.
140 double zLund( double a, double b, double c = 1.);
141 double zPeterson( double epsilon);
143 // Pointer to the random number generator.
148 //==========================================================================
150 // The StringPT class is used to select select transverse momenta.
159 // Initialize data members.
160 void init(Settings& settings, Rndm* rndmPtrIn);
162 // Return px and py as a pair in the same call.
163 pair<double, double> pxy();
167 // Initialization data, to be read from Settings.
168 double sigmaQ, enhancedFraction, enhancedWidth;
170 // Pointer to the random number generator.
175 //==========================================================================
177 } // end namespace Pythia8
179 #endif // Pythia8_FragmentationFlavZpT_H